You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
3.8 KiB

python3: Use default _PYTHON_HOST_PLATFORM This lets the Python build process set _PYTHON_HOST_PLATFORM instead of forcing an explicit value. Also: * Save the target _PYTHON_HOST_PLATFORM value during Build/InstallDev for use when building target Python packages (in python3-package.mk). * Use the (mostly) default PYTHON_FOR_BUILD value, instead patch configure to remove the platform triplet from the sysconfigdata file name. * Remove the "CROSS_COMPILE=yes" make variable (there is no indication that this variable is necessary). * Force host pip to build packages from source instead of downloading binary wheels. Previously, host pip can download universal (platform-independent) wheels but not platform-specific wheels, because of the custom _PYTHON_HOST_PLATFORM value. (Packages that do not have universal wheels would be compiled from source.) With a correct _PYTHON_HOST_PLATFORM, host pip can install platform-specific wheels as well. However, the pre-built shared object (.so) files in these wheels will have the host's platform triplet in their file names. When target Python packages are built (using the target's _PYTHON_HOST_PLATFORM), Python will not use these shared object files. By forcing host pip to build packages from source, the built shared object files will not have the platform triplet in their file names. (Host Python has been patched to remove the platform triplet from file names.) This allows these packages to be used when building target Python packages. (The net effect of this complete change is that platform-dependent packages will continue to be compiled from source, while platform-independent packages will now also be compiled from source.) Signed-off-by: Jeffery To <jeffery.to@gmail.com>
4 years ago
python3: Use default _PYTHON_HOST_PLATFORM This lets the Python build process set _PYTHON_HOST_PLATFORM instead of forcing an explicit value. Also: * Save the target _PYTHON_HOST_PLATFORM value during Build/InstallDev for use when building target Python packages (in python3-package.mk). * Use the (mostly) default PYTHON_FOR_BUILD value, instead patch configure to remove the platform triplet from the sysconfigdata file name. * Remove the "CROSS_COMPILE=yes" make variable (there is no indication that this variable is necessary). * Force host pip to build packages from source instead of downloading binary wheels. Previously, host pip can download universal (platform-independent) wheels but not platform-specific wheels, because of the custom _PYTHON_HOST_PLATFORM value. (Packages that do not have universal wheels would be compiled from source.) With a correct _PYTHON_HOST_PLATFORM, host pip can install platform-specific wheels as well. However, the pre-built shared object (.so) files in these wheels will have the host's platform triplet in their file names. When target Python packages are built (using the target's _PYTHON_HOST_PLATFORM), Python will not use these shared object files. By forcing host pip to build packages from source, the built shared object files will not have the platform triplet in their file names. (Host Python has been patched to remove the platform triplet from file names.) This allows these packages to be used when building target Python packages. (The net effect of this complete change is that platform-dependent packages will continue to be compiled from source, while platform-independent packages will now also be compiled from source.) Signed-off-by: Jeffery To <jeffery.to@gmail.com>
4 years ago
  1. --- a/Lib/distutils/sysconfig.py
  2. +++ b/Lib/distutils/sysconfig.py
  3. @@ -451,6 +451,7 @@ def _init_posix():
  4. platform=sys.platform,
  5. multiarch=getattr(sys.implementation, '_multiarch', ''),
  6. ))
  7. + name = '_sysconfigdata'
  8. _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
  9. build_time_vars = _temp.build_time_vars
  10. global _config_vars
  11. --- a/Lib/sysconfig.py
  12. +++ b/Lib/sysconfig.py
  13. @@ -342,6 +342,7 @@ def get_makefile_filename():
  14. def _get_sysconfigdata_name():
  15. + return '_sysconfigdata'
  16. return os.environ.get('_PYTHON_SYSCONFIGDATA_NAME',
  17. '_sysconfigdata_{abi}_{platform}_{multiarch}'.format(
  18. abi=sys.abiflags,
  19. --- a/Makefile.pre.in
  20. +++ b/Makefile.pre.in
  21. @@ -1534,7 +1534,7 @@ libinstall: build_all $(srcdir)/Modules/
  22. esac; \
  23. done; \
  24. done
  25. - $(INSTALL_DATA) `cat pybuilddir.txt`/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py \
  26. + $(INSTALL_DATA) `cat pybuilddir.txt`/_sysconfigdata*.py \
  27. $(DESTDIR)$(LIBDEST); \
  28. $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
  29. ifeq (@COMPILE_ALL_TESTS@,yes)
  30. @@ -1692,7 +1692,7 @@ sharedinstall: sharedmods
  31. --install-scripts=$(BINDIR) \
  32. --install-platlib=$(DESTSHARED) \
  33. --root=$(DESTDIR)/
  34. - -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py
  35. + -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata*.py
  36. -rm -r $(DESTDIR)$(DESTSHARED)/__pycache__
  37. # Here are a couple of targets for MacOSX again, to install a full
  38. --- a/configure
  39. +++ b/configure
  40. @@ -2977,7 +2977,7 @@ $as_echo_n "checking for python interpre
  41. fi
  42. { $as_echo "$as_me:${as_lineno-$LINENO}: result: $interp" >&5
  43. $as_echo "$interp" >&6; }
  44. - PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) '$interp
  45. + PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata '$interp
  46. fi
  47. elif test "$cross_compiling" = maybe; then
  48. as_fn_error $? "Cross compiling required --host=HOST-TUPLE and --build=ARCH" "$LINENO" 5
  49. @@ -15441,7 +15441,7 @@ fi
  50. -if test x$PLATFORM_TRIPLET = x; then
  51. +if true ; then
  52. LIBPL='$(prefix)'"/${PLATLIBDIR}/python${VERSION}/config-${LDVERSION}"
  53. else
  54. LIBPL='$(prefix)'"/${PLATLIBDIR}/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
  55. --- a/configure.ac
  56. +++ b/configure.ac
  57. @@ -75,7 +75,7 @@ if test "$cross_compiling" = yes; then
  58. AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])
  59. fi
  60. AC_MSG_RESULT($interp)
  61. - PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) '$interp
  62. + PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata '$interp
  63. fi
  64. elif test "$cross_compiling" = maybe; then
  65. AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])
  66. @@ -4833,7 +4833,7 @@ fi],
  67. dnl define LIBPL after ABIFLAGS and LDVERSION is defined.
  68. AC_SUBST(PY_ENABLE_SHARED)
  69. -if test x$PLATFORM_TRIPLET = x; then
  70. +if true ; then
  71. LIBPL='$(prefix)'"/${PLATLIBDIR}/python${VERSION}/config-${LDVERSION}"
  72. else
  73. LIBPL='$(prefix)'"/${PLATLIBDIR}/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"