Submitted By: Joe Ciccone <jciccone@linuxfromscratch.org>
Date: 2006-08-21
Initial Package Version: 2.4.3
Origin: Jim Gifford and Joe Ciccone
Description: Makes changes so we can fix the lib directories
             for multilib builds with the following sed.

sed -i -e "s:@@MULTILIB_DIR@@:lib64:g" \
        Lib/distutils/command/install.py \
        Lib/distutils/sysconfig.py \
        Lib/site.py \
        Makefile.pre.in \
        Modules/Setup.dist \
        Modules/getpath.c \
        setup.py

diff -Naur Python-2.4.3.orig/Lib/distutils/command/install.py Python-2.4.3/Lib/distutils/command/install.py
--- Python-2.4.3.orig/Lib/distutils/command/install.py	2006-08-21 00:42:10.000000000 -0400
+++ Python-2.4.3/Lib/distutils/command/install.py	2006-08-21 00:43:33.000000000 -0400
@@ -39,14 +39,14 @@
 INSTALL_SCHEMES = {
     'unix_prefix': {
         'purelib': '$base/lib/python$py_version_short/site-packages',
-        'platlib': '$platbase/lib/python$py_version_short/site-packages',
+        'platlib': '$platbase/@@MULTILIB_DIR@@/python$py_version_short/site-packages',
         'headers': '$base/include/python$py_version_short/$dist_name',
         'scripts': '$base/bin',
         'data'   : '$base',
         },
     'unix_home': {
         'purelib': '$base/lib/python',
-        'platlib': '$base/lib/python',
+        'platlib': '$base/@@MULTILIB_DIR@@/python',
         'headers': '$base/include/python/$dist_name',
         'scripts': '$base/bin',
         'data'   : '$base',
diff -Naur Python-2.4.3.orig/Lib/distutils/sysconfig.py Python-2.4.3/Lib/distutils/sysconfig.py
--- Python-2.4.3.orig/Lib/distutils/sysconfig.py	2006-08-21 00:42:10.000000000 -0400
+++ Python-2.4.3/Lib/distutils/sysconfig.py	2006-08-21 00:43:33.000000000 -0400
@@ -99,8 +99,12 @@
         prefix = plat_specific and EXEC_PREFIX or PREFIX
 
     if os.name == "posix":
+        if plat_specific or standard_lib:
+            lib = "@@MULTILIB_DIR@@"
+        else:
+            lib = "lib"
         libpython = os.path.join(prefix,
-                                 "lib", "python" + get_python_version())
+                                 "@@MULTILIB_DIR@@", "python" + get_python_version())
         if standard_lib:
             return libpython
         else:
diff -Naur Python-2.4.3.orig/Lib/site.py Python-2.4.3/Lib/site.py
--- Python-2.4.3.orig/Lib/site.py	2006-08-21 00:42:10.000000000 -0400
+++ Python-2.4.3/Lib/site.py	2006-08-21 00:43:33.000000000 -0400
@@ -179,9 +179,14 @@
                 sitedirs = [os.path.join(prefix, "Lib", "site-packages")]
             elif os.sep == '/':
                 sitedirs = [os.path.join(prefix,
+                                         "@@MULTILIB_DIR@@",
+                                         "python" + sys.version[:3],
+                                         "site-packages"),
+                            os.path.join(prefix,
                                          "lib",
                                          "python" + sys.version[:3],
                                          "site-packages"),
+                                                       os.path.join(prefix, "@@MULTILIB_DIR@@", "site-python"),
                             os.path.join(prefix, "lib", "site-python")]
             else:
                 sitedirs = [prefix, os.path.join(prefix, "lib", "site-packages")]
diff -Naur Python-2.4.3.orig/Makefile.pre.in Python-2.4.3/Makefile.pre.in
--- Python-2.4.3.orig/Makefile.pre.in	2006-08-21 00:42:11.000000000 -0400
+++ Python-2.4.3/Makefile.pre.in	2006-08-21 00:43:33.000000000 -0400
@@ -79,11 +79,11 @@
 
 # Expanded directories
 BINDIR=		$(exec_prefix)/bin
-LIBDIR=		$(exec_prefix)/lib
+LIBDIR=		$(exec_prefix)/@@MULTILIB_DIR@@
 MANDIR=		@mandir@
 INCLUDEDIR=	@includedir@
 CONFINCLUDEDIR=	$(exec_prefix)/include
-SCRIPTDIR=	$(prefix)/lib
+SCRIPTDIR=	$(prefix)/@@MULTILIB_DIR@@
 
 # Detailed destination directories
 BINLIBDEST=	$(LIBDIR)/python$(VERSION)
diff -Naur Python-2.4.3.orig/Modules/Setup.dist Python-2.4.3/Modules/Setup.dist
--- Python-2.4.3.orig/Modules/Setup.dist	2006-08-21 00:42:10.000000000 -0400
+++ Python-2.4.3/Modules/Setup.dist	2006-08-21 00:46:35.000000000 -0400
@@ -330,7 +330,7 @@
 # *** Uncomment and edit to reflect your Tcl/Tk versions:
 #	-ltk8.2 -ltcl8.2 \
 # *** Uncomment and edit to reflect where your X11 libraries are:
-#	-L/usr/X11R6/lib \
+# 	-L/usr/X11R6/@@MULTILIB_DIR@@ \
 # *** Or uncomment this for Solaris:
 #	-L/usr/openwin/lib \
 # *** Uncomment these for TOGL extension only:
@@ -401,7 +401,7 @@
 #DB=/usr/local/BerkeleyDB.4.0
 #DBLIBVER=4.0
 #DBINC=$(DB)/include
-#DBLIB=$(DB)/lib
+DBLIB=$(DB)/@@MULTILIB_DIR@@
 #_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER)
 
 # Historical Berkeley DB 1.85
@@ -447,7 +447,7 @@
 # Andrew Kuchling's zlib module.
 # This require zlib 1.1.3 (or later).
 # See http://www.gzip.org/zlib/
-#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
+zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/@@MULTILIB_DIR@@ -lz
 
 # Interface to the Expat XML parser
 #
diff -Naur Python-2.4.3.orig/Modules/getpath.c Python-2.4.3/Modules/getpath.c
--- Python-2.4.3.orig/Modules/getpath.c	2006-08-21 00:42:10.000000000 -0400
+++ Python-2.4.3/Modules/getpath.c	2006-08-21 00:43:33.000000000 -0400
@@ -112,8 +112,8 @@
 #endif
 
 #ifndef PYTHONPATH
-#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
-              EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
+#define PYTHONPATH PREFIX "/@@MULTILIB_DIR@@/python" VERSION ":" \
+              EXEC_PREFIX "/@@MULTILIB_DIR@@/python" VERSION "/lib-dynload"
 #endif
 
 #ifndef LANDMARK
@@ -124,7 +124,7 @@
 static char exec_prefix[MAXPATHLEN+1];
 static char progpath[MAXPATHLEN+1];
 static char *module_search_path = NULL;
-static char lib_python[] = "lib/python" VERSION;
+static char lib_python[] = "@@MULTILIB_DIR@@/python" VERSION;
 
 static void
 reduce(char *dir)
@@ -519,7 +519,7 @@
     }
     else
         strncpy(zip_path, PREFIX, MAXPATHLEN);
-    joinpath(zip_path, "lib/python00.zip");
+    joinpath(zip_path, "@@MULTILIB_DIR@@/python00.zip");
     bufsz = strlen(zip_path);	/* Replace "00" with version */
     zip_path[bufsz - 6] = VERSION[0];
     zip_path[bufsz - 5] = VERSION[2];
@@ -529,7 +529,7 @@
             fprintf(stderr,
                 "Could not find platform dependent libraries <exec_prefix>\n");
         strncpy(exec_prefix, EXEC_PREFIX, MAXPATHLEN);
-        joinpath(exec_prefix, "lib/lib-dynload");
+        joinpath(exec_prefix, "@@MULTILIB_DIR@@/lib-dynload");
     }
     /* If we found EXEC_PREFIX do *not* reduce it!  (Yet.) */
 
diff -Naur Python-2.4.3.orig/setup.py Python-2.4.3/setup.py
--- Python-2.4.3.orig/setup.py	2006-08-21 00:42:09.000000000 -0400
+++ Python-2.4.3/setup.py	2006-08-21 00:43:33.000000000 -0400
@@ -240,7 +240,7 @@
 
     def detect_modules(self):
         # Ensure that /usr/local is always used
-        add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
+        add_dir_to_list(self.compiler.library_dirs, '/usr/local/@@MULTILIB_DIR@@')
         add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
 
         # Add paths to popular package managers on OS X/darwin
@@ -267,7 +267,7 @@
         # if a file is found in one of those directories, it can
         # be assumed that no additional -I,-L directives are needed.
         lib_dirs = self.compiler.library_dirs + [
-            '/lib64', '/usr/lib64',
+            '/@@MULTILIB_DIR@@', '/usr/@@MULTILIB_DIR@@',
             '/lib', '/usr/lib',
             ]
         inc_dirs = self.compiler.include_dirs + ['/usr/include']
@@ -433,11 +433,11 @@
             elif self.compiler.find_library_file(lib_dirs, 'curses'):
                 readline_libs.append('curses')
             elif self.compiler.find_library_file(lib_dirs +
-                                               ['/usr/lib/termcap'],
+                                               ['/usr/@@MULTILIB_DIR@@/termcap'],
                                                'termcap'):
                 readline_libs.append('termcap')
             exts.append( Extension('readline', ['readline.c'],
-                                   library_dirs=['/usr/lib/termcap'],
+                                   library_dirs=['/usr/@@MULTILIB_DIR@@/termcap'],
                                    libraries=readline_libs) )
         if platform not in ['mac']:
             # crypt module.
@@ -466,8 +466,8 @@
             if krb5_h:
                 ssl_incs += krb5_h
         ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
-                                     ['/usr/local/ssl/lib',
-                                      '/usr/contrib/ssl/lib/'
+                                     ['/usr/local/ssl/@@MULTILIB_DIR@@',
+                                      '/usr/contrib/ssl/@@MULTILIB_DIR@@/'
                                      ] )
 
         if (ssl_incs is not None and
@@ -565,9 +565,9 @@
 
                 # check lib directories parallel to the location of the header
                 db_dirs_to_check = [
-                    os.path.join(db_incdir, '..', 'lib64'),
+                    os.path.join(db_incdir, '..', '@@MULTILIB_DIR@@'),
                     os.path.join(db_incdir, '..', 'lib'),
-                    os.path.join(db_incdir, '..', '..', 'lib64'),
+                    os.path.join(db_incdir, '..', '..', '@@MULTILIB_DIR@@'),
                     os.path.join(db_incdir, '..', '..', 'lib'),
                 ]
                 db_dirs_to_check = filter(os.path.isdir, db_dirs_to_check)
@@ -1031,15 +1031,15 @@
             added_lib_dirs.append('/usr/openwin/lib')
         elif os.path.exists('/usr/X11R6/include'):
             include_dirs.append('/usr/X11R6/include')
-            added_lib_dirs.append('/usr/X11R6/lib64')
+            added_lib_dirs.append('/usr/X11R6/@@MULTILIB_DIR@@')
             added_lib_dirs.append('/usr/X11R6/lib')
         elif os.path.exists('/usr/X11R5/include'):
             include_dirs.append('/usr/X11R5/include')
-            added_lib_dirs.append('/usr/X11R5/lib')
+            added_lib_dirs.append('/usr/X11R5/@@MULTILIB_DIR@@')
         else:
             # Assume default location for X11
             include_dirs.append('/usr/X11/include')
-            added_lib_dirs.append('/usr/X11/lib')
+            added_lib_dirs.append('/usr/X11/@@MULTILIB_DIR@@')
 
         # If Cygwin, then verify that X is installed before proceeding
         if platform == 'cygwin':
