Sat Oct 1 03:11:15 2011 UTC ()
Debian (and therefore Ubuntu) have taken to hiding some libraries
awkwardly, leading to Python 2.6 failing to build.

Python 2.7 builds ok, because it has been taught to deal with this.
This patch retro-fits the 2.7 code into 2.6, and allows 2.6 to build on
Ubuntu 11.04.

Ok'd by wiz@


(dsainty)
diff -r1.37 -r1.38 pkgsrc/lang/python26/distinfo
diff -r1.15 -r1.16 pkgsrc/lang/python26/patches/patch-am

cvs diff -r1.37 -r1.38 pkgsrc/lang/python26/Attic/distinfo (expand / switch to context diff)
--- pkgsrc/lang/python26/Attic/distinfo 2011/09/30 08:34:26 1.37
+++ pkgsrc/lang/python26/Attic/distinfo 2011/10/01 03:11:15 1.38
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.37 2011/09/30 08:34:26 yyamano Exp $
+$NetBSD: distinfo,v 1.38 2011/10/01 03:11:15 dsainty Exp $
 
 SHA1 (Python-2.6.7.tar.bz2) = 5d35eb746e85fb3deaff8518448137c9b9fb6daa
 RMD160 (Python-2.6.7.tar.bz2) = 513e84a7cb76ca876e3803bb03ed558bd0378063
@@ -14,7 +14,7 @@
 SHA1 (patch-ae) = a6d578b5f12eb42fbbcc11791576d2686a4807d9
 SHA1 (patch-ah) = 501d220b41e578402f3400fe88e582aa2408a147
 SHA1 (patch-al) = e18800d53de022e4c24055f7d03b69af2837b089
-SHA1 (patch-am) = 60c108d05a16c531ee6cf99e5c7ad9a5f27c5f01
+SHA1 (patch-am) = aebb81db4aa38c3c1ef57ed4e25422685c362db2
 SHA1 (patch-an) = 17b4e17b3b562c29a050e9bb20447084ce82b8ab
 SHA1 (patch-ao) = 8c6a156b0f0c2a6d319658477fff348e6a0c3603
 SHA1 (patch-ap) = d23a869a449ab9dc166cfa149913b20c9acad9cb

cvs diff -r1.15 -r1.16 pkgsrc/lang/python26/patches/Attic/patch-am (expand / switch to context diff)
--- pkgsrc/lang/python26/patches/Attic/patch-am 2010/09/16 13:24:47 1.15
+++ pkgsrc/lang/python26/patches/Attic/patch-am 2011/10/01 03:11:15 1.16
@@ -1,4 +1,4 @@
-$NetBSD: patch-am,v 1.15 2010/09/16 13:24:47 obache Exp $
+$NetBSD: patch-am,v 1.16 2011/10/01 03:11:15 dsainty Exp $
 
 Disabled modules for normal build:
 bsddb
@@ -19,9 +19,12 @@
 
 Build the 1.85 compat module all the time against the BDB version of choice.
 
---- setup.py.orig	2010-07-17 12:31:09.000000000 +0000
-+++ setup.py
-@@ -18,7 +18,7 @@ from distutils.command.install_lib impor
+Add in Debian multiarch support (retrofitted from Python 2.7.2) to
+support building the "nis" and "crypt" modules.
+
+--- setup.py	2010-07-18 00:31:09.000000000 +1200
++++ setup.py	2011-09-23 01:51:17.757519638 +1200
+@@ -18,7 +18,7 @@
  from distutils.spawn import find_executable
  
  # This global variable is used to hold the list of modules to be disabled.
@@ -30,9 +33,32 @@
  
  def add_dir_to_list(dirlist, dir):
      """Add the directory 'dir' to the list 'dirlist' (at the front) if
-@@ -355,9 +355,15 @@ class PyBuildExt(build_ext):
+@@ -354,10 +354,40 @@
+                 return platform
          return sys.platform
  
++    def add_multiarch_paths(self):
++        # Debian/Ubuntu multiarch support.
++        # https://wiki.ubuntu.com/MultiarchSpec
++        if not find_executable('dpkg-architecture'):
++            return
++        tmpfile = os.path.join(self.build_temp, 'multiarch')
++        if not os.path.exists(self.build_temp):
++            os.makedirs(self.build_temp)
++        ret = os.system(
++            'dpkg-architecture -qDEB_HOST_MULTIARCH > %s 2> /dev/null' %
++            tmpfile)
++        try:
++            if ret >> 8 == 0:
++                with open(tmpfile) as fp:
++                    multiarch_path_component = fp.readline().strip()
++                add_dir_to_list(self.compiler.library_dirs,
++                                '/usr/lib/' + multiarch_path_component)
++                add_dir_to_list(self.compiler.include_dirs,
++                                '/usr/include/' + multiarch_path_component)
++        finally:
++            os.unlink(tmpfile)
++
      def detect_modules(self):
 -        # Ensure that /usr/local is always used
 -        add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
@@ -46,10 +72,12 @@
 +                self.compiler.library_dirs.insert(0, libdir)
 +            if incdir not in self.compiler.include_dirs:
 +                self.compiler.include_dirs.insert(0, incdir)
++
++        self.add_multiarch_paths()
  
          # Add paths specified in the environment variables LDFLAGS and
          # CPPFLAGS for header and library files.
-@@ -703,9 +709,7 @@ class PyBuildExt(build_ext):
+@@ -703,9 +733,7 @@
              if krb5_h:
                  ssl_incs += krb5_h
          ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
@@ -60,7 +88,7 @@
  
          if (ssl_incs is not None and
              ssl_libs is not None):
-@@ -815,172 +819,6 @@ class PyBuildExt(build_ext):
+@@ -815,172 +843,6 @@
              else:
                  raise ValueError("unknown major BerkeleyDB version", major)
  
@@ -233,7 +261,7 @@
          # The sqlite interface
          sqlite_setup_debug = False   # verbose debug prints from this script?
  
-@@ -1094,31 +932,12 @@ class PyBuildExt(build_ext):
+@@ -1094,31 +956,12 @@
          # we do not build this one.  Otherwise this build will pick up
          # the more recent berkeleydb's db.h file first in the include path
          # when attempting to compile and it will fail.
@@ -270,7 +298,7 @@
  
          # The standard Unix dbm module:
          if platform not in ['cygwin']:
-@@ -1131,7 +950,7 @@ class PyBuildExt(build_ext):
+@@ -1131,7 +974,7 @@
                  exts.append( Extension('dbm', ['dbmmodule.c'],
                                         define_macros=[('HAVE_NDBM_H',None)],
                                         libraries = ndbm_libs ) )
@@ -279,7 +307,7 @@
                  gdbm_libs = ['gdbm']
                  if self.compiler.find_library_file(lib_dirs, 'gdbm_compat'):
                      gdbm_libs.append('gdbm_compat')
-@@ -1147,14 +966,11 @@ class PyBuildExt(build_ext):
+@@ -1147,14 +990,11 @@
                          libraries = gdbm_libs ) )
                  else:
                      missing.append('dbm')
@@ -296,7 +324,7 @@
              else:
                  missing.append('dbm')
  
-@@ -1408,6 +1224,14 @@ class PyBuildExt(build_ext):
+@@ -1408,6 +1248,14 @@
                  )
              libraries = []
  
@@ -311,7 +339,7 @@
          else:                                   # Linux and other unices
              macros = dict(
                  HAVE_SEM_OPEN=1,
-@@ -2026,9 +1850,9 @@ def main():
+@@ -2026,9 +1874,9 @@
            ext_modules=[Extension('_struct', ['_struct.c'])],
  
            # Scripts to install