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>
5 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>
5 years ago
  1. --- a/Lib/distutils/sysconfig.py
  2. +++ b/Lib/distutils/sysconfig.py
  3. @@ -445,6 +445,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. @@ -344,6 +344,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. @@ -1460,7 +1460,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. @@ -1618,7 +1618,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. @@ -2951,7 +2951,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. @@ -15213,7 +15213,7 @@ else
  50. fi
  51. -if test x$PLATFORM_TRIPLET = x; then
  52. +if true ; then
  53. LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}"
  54. else
  55. LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
  56. --- a/configure.ac
  57. +++ b/configure.ac
  58. @@ -75,7 +75,7 @@ if test "$cross_compiling" = yes; then
  59. AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])
  60. fi
  61. AC_MSG_RESULT($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_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) '$interp
  63. + 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
  64. fi
  65. elif test "$cross_compiling" = maybe; then
  66. AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])
  67. @@ -4688,7 +4688,7 @@ fi
  68. dnl define LIBPL after ABIFLAGS and LDVERSION is defined.
  69. AC_SUBST(PY_ENABLE_SHARED)
  70. -if test x$PLATFORM_TRIPLET = x; then
  71. +if true ; then
  72. LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}"
  73. else
  74. LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"