| Extensions should be installed to the targets libdir. This is important if e.g. host |
| has a 64bit /usr/lib64, but the target is 32bit and has $ROOT/usr/lib. Make sure we |
| respect the target's lib structure by getting the libdir name from Makefile. |
| |
| --- a/Lib/distutils/command/build_ext.py |
| +++ b/Lib/distutils/command/build_ext.py |
| @@ -234,7 +234,8 @@ class build_ext(Command): |
| if (sysconfig.get_config_var('Py_ENABLE_SHARED')): |
| if not sysconfig.python_build: |
| # building third party extensions |
| - self.library_dirs.append(sysconfig.get_config_var('LIBDIR')) |
| + sysroot = os.getenv('SYSROOT', '') |
| + self.library_dirs.append(sysroot + sysconfig.get_config_var('LIBDIR')) |
| else: |
| # building python standard extensions |
| self.library_dirs.append('.') |
| --- a/Lib/distutils/command/install.py |
| +++ b/Lib/distutils/command/install.py |
| @@ -312,6 +312,8 @@ class install(Command): |
| # everything else. |
| self.config_vars['base'] = self.install_base |
| self.config_vars['platbase'] = self.install_platbase |
| + if not self.user and self.home is None: |
| + self.config_vars['libdirname'] = self.install_libdirname |
| |
| if DEBUG: |
| from pprint import pprint |
| @@ -427,6 +429,10 @@ class install(Command): |
| |
| self.install_base = self.prefix |
| self.install_platbase = self.exec_prefix |
| + self.install_libdirname = os.path.basename(get_config_vars('LIBDIR')[0]) |
| + if self.install_libdirname is None: |
| + self.install_libdirname = '@@GENTOO_LIBDIR@@' |
| + |
| self.select_scheme("unix_prefix") |
| |
| def finalize_other(self): |