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.

411 lines
13 KiB

python3: bump to version 3.10.0 Manually re-applied: 008-distutils-use-python-sysroot.patch 016-adjust-config-paths.patch Drop patch: 003-do-not-run-distutils-tests.patch There is now a configure option '--disable-test-modules' And seems we left the '_ctypes_test' around for quite some time. Dropped now. Refs: https://bugs.python.org/issue27640 https://bugs.python.org/issue43282 Drop patch: 013-getbuildinfo-date-time-source-date-epoch.patch Python build honors SOURCE_DATE_EPOCH pretty well now. Drop setuptools patches. Setuptools should be reproducible with Python 3.6+ according to a mention here: https://github.com/pypa/setuptools/pull/1690#issuecomment-536517456 It's time to let upstream fix Setuptools reproduce-ability. Drop patch: 010-do-not-add-rt-lib-dirs-when-cross-compiling.patch I can't seem to fully remember why it's there. And it seem to build fine without it. Drop patch: 015-abort-on-failed-modules.patch Python build supports a similar PYTHONSTRICTEXTENSIONBUILD=1 env-var option. Add patch: 026-openssl-feature-flags.patch We need to keep this in our tree for a while. See: https://bugs.python.org/issue45627 Backport patch: 027-bpo-43158-Use-configure-values-for-building-_uuid-ex.patch Link: https://github.com/python/cpython/pull/29353 Fixes the build for uuid C module. Add patch: 028-host-python-support-ssl-with-libressl.patch We need the _ssl module working on the host-side with LibreSSL for pip to work to download from https://pypi.org Refs: https://github.com/openwrt/openwrt/pull/4749 Add patch: 029-disable-deprecation-warning.patch Fixes apparmor build. The warning causes a configure error. Refreshed the rest of patches. Some old build-flags were removed. They don't seem to be necessary anymore. Split python3-uuid from python3-light. To better manage the libuuid library (if needed). Also, fixing the uuid C module build. Seems this was failing, and was falling back to using hashlib. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
3 years ago
python3: bump to version 3.10.0 Manually re-applied: 008-distutils-use-python-sysroot.patch 016-adjust-config-paths.patch Drop patch: 003-do-not-run-distutils-tests.patch There is now a configure option '--disable-test-modules' And seems we left the '_ctypes_test' around for quite some time. Dropped now. Refs: https://bugs.python.org/issue27640 https://bugs.python.org/issue43282 Drop patch: 013-getbuildinfo-date-time-source-date-epoch.patch Python build honors SOURCE_DATE_EPOCH pretty well now. Drop setuptools patches. Setuptools should be reproducible with Python 3.6+ according to a mention here: https://github.com/pypa/setuptools/pull/1690#issuecomment-536517456 It's time to let upstream fix Setuptools reproduce-ability. Drop patch: 010-do-not-add-rt-lib-dirs-when-cross-compiling.patch I can't seem to fully remember why it's there. And it seem to build fine without it. Drop patch: 015-abort-on-failed-modules.patch Python build supports a similar PYTHONSTRICTEXTENSIONBUILD=1 env-var option. Add patch: 026-openssl-feature-flags.patch We need to keep this in our tree for a while. See: https://bugs.python.org/issue45627 Backport patch: 027-bpo-43158-Use-configure-values-for-building-_uuid-ex.patch Link: https://github.com/python/cpython/pull/29353 Fixes the build for uuid C module. Add patch: 028-host-python-support-ssl-with-libressl.patch We need the _ssl module working on the host-side with LibreSSL for pip to work to download from https://pypi.org Refs: https://github.com/openwrt/openwrt/pull/4749 Add patch: 029-disable-deprecation-warning.patch Fixes apparmor build. The warning causes a configure error. Refreshed the rest of patches. Some old build-flags were removed. They don't seem to be necessary anymore. Split python3-uuid from python3-light. To better manage the libuuid library (if needed). Also, fixing the uuid C module build. Seems this was failing, and was falling back to using hashlib. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
3 years ago
python3: bump to version 3.10.0 Manually re-applied: 008-distutils-use-python-sysroot.patch 016-adjust-config-paths.patch Drop patch: 003-do-not-run-distutils-tests.patch There is now a configure option '--disable-test-modules' And seems we left the '_ctypes_test' around for quite some time. Dropped now. Refs: https://bugs.python.org/issue27640 https://bugs.python.org/issue43282 Drop patch: 013-getbuildinfo-date-time-source-date-epoch.patch Python build honors SOURCE_DATE_EPOCH pretty well now. Drop setuptools patches. Setuptools should be reproducible with Python 3.6+ according to a mention here: https://github.com/pypa/setuptools/pull/1690#issuecomment-536517456 It's time to let upstream fix Setuptools reproduce-ability. Drop patch: 010-do-not-add-rt-lib-dirs-when-cross-compiling.patch I can't seem to fully remember why it's there. And it seem to build fine without it. Drop patch: 015-abort-on-failed-modules.patch Python build supports a similar PYTHONSTRICTEXTENSIONBUILD=1 env-var option. Add patch: 026-openssl-feature-flags.patch We need to keep this in our tree for a while. See: https://bugs.python.org/issue45627 Backport patch: 027-bpo-43158-Use-configure-values-for-building-_uuid-ex.patch Link: https://github.com/python/cpython/pull/29353 Fixes the build for uuid C module. Add patch: 028-host-python-support-ssl-with-libressl.patch We need the _ssl module working on the host-side with LibreSSL for pip to work to download from https://pypi.org Refs: https://github.com/openwrt/openwrt/pull/4749 Add patch: 029-disable-deprecation-warning.patch Fixes apparmor build. The warning causes a configure error. Refreshed the rest of patches. Some old build-flags were removed. They don't seem to be necessary anymore. Split python3-uuid from python3-light. To better manage the libuuid library (if needed). Also, fixing the uuid C module build. Seems this was failing, and was falling back to using hashlib. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
3 years ago
python3: bump to version 3.10.0 Manually re-applied: 008-distutils-use-python-sysroot.patch 016-adjust-config-paths.patch Drop patch: 003-do-not-run-distutils-tests.patch There is now a configure option '--disable-test-modules' And seems we left the '_ctypes_test' around for quite some time. Dropped now. Refs: https://bugs.python.org/issue27640 https://bugs.python.org/issue43282 Drop patch: 013-getbuildinfo-date-time-source-date-epoch.patch Python build honors SOURCE_DATE_EPOCH pretty well now. Drop setuptools patches. Setuptools should be reproducible with Python 3.6+ according to a mention here: https://github.com/pypa/setuptools/pull/1690#issuecomment-536517456 It's time to let upstream fix Setuptools reproduce-ability. Drop patch: 010-do-not-add-rt-lib-dirs-when-cross-compiling.patch I can't seem to fully remember why it's there. And it seem to build fine without it. Drop patch: 015-abort-on-failed-modules.patch Python build supports a similar PYTHONSTRICTEXTENSIONBUILD=1 env-var option. Add patch: 026-openssl-feature-flags.patch We need to keep this in our tree for a while. See: https://bugs.python.org/issue45627 Backport patch: 027-bpo-43158-Use-configure-values-for-building-_uuid-ex.patch Link: https://github.com/python/cpython/pull/29353 Fixes the build for uuid C module. Add patch: 028-host-python-support-ssl-with-libressl.patch We need the _ssl module working on the host-side with LibreSSL for pip to work to download from https://pypi.org Refs: https://github.com/openwrt/openwrt/pull/4749 Add patch: 029-disable-deprecation-warning.patch Fixes apparmor build. The warning causes a configure error. Refreshed the rest of patches. Some old build-flags were removed. They don't seem to be necessary anymore. Split python3-uuid from python3-light. To better manage the libuuid library (if needed). Also, fixing the uuid C module build. Seems this was failing, and was falling back to using hashlib. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
3 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
python3: bump to version 3.10.0 Manually re-applied: 008-distutils-use-python-sysroot.patch 016-adjust-config-paths.patch Drop patch: 003-do-not-run-distutils-tests.patch There is now a configure option '--disable-test-modules' And seems we left the '_ctypes_test' around for quite some time. Dropped now. Refs: https://bugs.python.org/issue27640 https://bugs.python.org/issue43282 Drop patch: 013-getbuildinfo-date-time-source-date-epoch.patch Python build honors SOURCE_DATE_EPOCH pretty well now. Drop setuptools patches. Setuptools should be reproducible with Python 3.6+ according to a mention here: https://github.com/pypa/setuptools/pull/1690#issuecomment-536517456 It's time to let upstream fix Setuptools reproduce-ability. Drop patch: 010-do-not-add-rt-lib-dirs-when-cross-compiling.patch I can't seem to fully remember why it's there. And it seem to build fine without it. Drop patch: 015-abort-on-failed-modules.patch Python build supports a similar PYTHONSTRICTEXTENSIONBUILD=1 env-var option. Add patch: 026-openssl-feature-flags.patch We need to keep this in our tree for a while. See: https://bugs.python.org/issue45627 Backport patch: 027-bpo-43158-Use-configure-values-for-building-_uuid-ex.patch Link: https://github.com/python/cpython/pull/29353 Fixes the build for uuid C module. Add patch: 028-host-python-support-ssl-with-libressl.patch We need the _ssl module working on the host-side with LibreSSL for pip to work to download from https://pypi.org Refs: https://github.com/openwrt/openwrt/pull/4749 Add patch: 029-disable-deprecation-warning.patch Fixes apparmor build. The warning causes a configure error. Refreshed the rest of patches. Some old build-flags were removed. They don't seem to be necessary anymore. Split python3-uuid from python3-light. To better manage the libuuid library (if needed). Also, fixing the uuid C module build. Seems this was failing, and was falling back to using hashlib. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
3 years ago
python3: bump to version 3.10.0 Manually re-applied: 008-distutils-use-python-sysroot.patch 016-adjust-config-paths.patch Drop patch: 003-do-not-run-distutils-tests.patch There is now a configure option '--disable-test-modules' And seems we left the '_ctypes_test' around for quite some time. Dropped now. Refs: https://bugs.python.org/issue27640 https://bugs.python.org/issue43282 Drop patch: 013-getbuildinfo-date-time-source-date-epoch.patch Python build honors SOURCE_DATE_EPOCH pretty well now. Drop setuptools patches. Setuptools should be reproducible with Python 3.6+ according to a mention here: https://github.com/pypa/setuptools/pull/1690#issuecomment-536517456 It's time to let upstream fix Setuptools reproduce-ability. Drop patch: 010-do-not-add-rt-lib-dirs-when-cross-compiling.patch I can't seem to fully remember why it's there. And it seem to build fine without it. Drop patch: 015-abort-on-failed-modules.patch Python build supports a similar PYTHONSTRICTEXTENSIONBUILD=1 env-var option. Add patch: 026-openssl-feature-flags.patch We need to keep this in our tree for a while. See: https://bugs.python.org/issue45627 Backport patch: 027-bpo-43158-Use-configure-values-for-building-_uuid-ex.patch Link: https://github.com/python/cpython/pull/29353 Fixes the build for uuid C module. Add patch: 028-host-python-support-ssl-with-libressl.patch We need the _ssl module working on the host-side with LibreSSL for pip to work to download from https://pypi.org Refs: https://github.com/openwrt/openwrt/pull/4749 Add patch: 029-disable-deprecation-warning.patch Fixes apparmor build. The warning causes a configure error. Refreshed the rest of patches. Some old build-flags were removed. They don't seem to be necessary anymore. Split python3-uuid from python3-light. To better manage the libuuid library (if needed). Also, fixing the uuid C module build. Seems this was failing, and was falling back to using hashlib. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
3 years ago
python3: bump to version 3.10.0 Manually re-applied: 008-distutils-use-python-sysroot.patch 016-adjust-config-paths.patch Drop patch: 003-do-not-run-distutils-tests.patch There is now a configure option '--disable-test-modules' And seems we left the '_ctypes_test' around for quite some time. Dropped now. Refs: https://bugs.python.org/issue27640 https://bugs.python.org/issue43282 Drop patch: 013-getbuildinfo-date-time-source-date-epoch.patch Python build honors SOURCE_DATE_EPOCH pretty well now. Drop setuptools patches. Setuptools should be reproducible with Python 3.6+ according to a mention here: https://github.com/pypa/setuptools/pull/1690#issuecomment-536517456 It's time to let upstream fix Setuptools reproduce-ability. Drop patch: 010-do-not-add-rt-lib-dirs-when-cross-compiling.patch I can't seem to fully remember why it's there. And it seem to build fine without it. Drop patch: 015-abort-on-failed-modules.patch Python build supports a similar PYTHONSTRICTEXTENSIONBUILD=1 env-var option. Add patch: 026-openssl-feature-flags.patch We need to keep this in our tree for a while. See: https://bugs.python.org/issue45627 Backport patch: 027-bpo-43158-Use-configure-values-for-building-_uuid-ex.patch Link: https://github.com/python/cpython/pull/29353 Fixes the build for uuid C module. Add patch: 028-host-python-support-ssl-with-libressl.patch We need the _ssl module working on the host-side with LibreSSL for pip to work to download from https://pypi.org Refs: https://github.com/openwrt/openwrt/pull/4749 Add patch: 029-disable-deprecation-warning.patch Fixes apparmor build. The warning causes a configure error. Refreshed the rest of patches. Some old build-flags were removed. They don't seem to be necessary anymore. Split python3-uuid from python3-light. To better manage the libuuid library (if needed). Also, fixing the uuid C module build. Seems this was failing, and was falling back to using hashlib. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
3 years ago
python3: bump to version 3.10.0 Manually re-applied: 008-distutils-use-python-sysroot.patch 016-adjust-config-paths.patch Drop patch: 003-do-not-run-distutils-tests.patch There is now a configure option '--disable-test-modules' And seems we left the '_ctypes_test' around for quite some time. Dropped now. Refs: https://bugs.python.org/issue27640 https://bugs.python.org/issue43282 Drop patch: 013-getbuildinfo-date-time-source-date-epoch.patch Python build honors SOURCE_DATE_EPOCH pretty well now. Drop setuptools patches. Setuptools should be reproducible with Python 3.6+ according to a mention here: https://github.com/pypa/setuptools/pull/1690#issuecomment-536517456 It's time to let upstream fix Setuptools reproduce-ability. Drop patch: 010-do-not-add-rt-lib-dirs-when-cross-compiling.patch I can't seem to fully remember why it's there. And it seem to build fine without it. Drop patch: 015-abort-on-failed-modules.patch Python build supports a similar PYTHONSTRICTEXTENSIONBUILD=1 env-var option. Add patch: 026-openssl-feature-flags.patch We need to keep this in our tree for a while. See: https://bugs.python.org/issue45627 Backport patch: 027-bpo-43158-Use-configure-values-for-building-_uuid-ex.patch Link: https://github.com/python/cpython/pull/29353 Fixes the build for uuid C module. Add patch: 028-host-python-support-ssl-with-libressl.patch We need the _ssl module working on the host-side with LibreSSL for pip to work to download from https://pypi.org Refs: https://github.com/openwrt/openwrt/pull/4749 Add patch: 029-disable-deprecation-warning.patch Fixes apparmor build. The warning causes a configure error. Refreshed the rest of patches. Some old build-flags were removed. They don't seem to be necessary anymore. Split python3-uuid from python3-light. To better manage the libuuid library (if needed). Also, fixing the uuid C module build. Seems this was failing, and was falling back to using hashlib. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
3 years ago
  1. #
  2. # Copyright (C) 2006-2016 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. # The file included below defines PYTHON3_VERSION
  9. include ../python3-version.mk
  10. PKG_NAME:=python3
  11. PKG_RELEASE:=1
  12. PKG_VERSION:=$(PYTHON3_VERSION).$(PYTHON3_VERSION_MICRO)
  13. PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
  14. PKG_SOURCE_URL:=https://www.python.org/ftp/python/$(PKG_VERSION)
  15. # FIXME: if updating, get rid of [1] & [2] asap
  16. PKG_HASH:=a7f1265b6e1a5de1ec5c3ec7019ab53413469934758311e9d240c46e5ae6e177
  17. PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
  18. PKG_LICENSE:=PSF-2.0
  19. PKG_LICENSE_FILES:=LICENSE Doc/copyright.rst Doc/license.rst Modules/_ctypes/darwin/LICENSE Modules/_ctypes/libffi_osx/LICENSE Modules/expat/COPYING
  20. PKG_CPE_ID:=cpe:/a:python:python
  21. # This file provides the necsessary host build variables
  22. include ../python3-host.mk
  23. # For Py3Package
  24. PYTHON3_PKG_BUILD:=0
  25. include ../python3-package.mk
  26. PKG_FIXUP:=autoreconf
  27. PKG_INSTALL:=1
  28. PKG_BUILD_PARALLEL:=1
  29. HOST_BUILD_PARALLEL:=1
  30. PKG_BUILD_DIR:=$(BUILD_DIR)/Python-$(PKG_VERSION)
  31. HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/Python-$(PKG_VERSION)
  32. PKG_CONFIG_DEPENDS:= \
  33. CONFIG_PACKAGE_python3-pkg-resources \
  34. CONFIG_PACKAGE_python3-setuptools CONFIG_PACKAGE_python3-pip
  35. PKG_BUILD_DEPENDS:=bluez python3/host
  36. HOST_BUILD_DEPENDS:=bzip2/host libffi/host
  37. include $(INCLUDE_DIR)/host-build.mk
  38. include $(INCLUDE_DIR)/package.mk
  39. define Package/python3/Default
  40. SUBMENU:=Python
  41. SECTION:=lang
  42. CATEGORY:=Languages
  43. TITLE:=Python $(PYTHON3_VERSION) programming language
  44. URL:=https://www.python.org/
  45. endef
  46. define Package/python3/Default/description
  47. Python is a dynamic object-oriented programming language that can be used
  48. for many kinds of software development. It offers strong support for
  49. integration with other languages and tools, comes with extensive standard
  50. libraries, and can be learned in a few days. Many Python programmers
  51. report substantial productivity gains and feel the language encourages
  52. the development of higher quality, more maintainable code.
  53. endef
  54. define Package/libpython3
  55. $(call Package/python3/Default)
  56. TITLE:=Python $(PYTHON3_VERSION) core library
  57. DEPENDS:=+libpthread +zlib
  58. ABI_VERSION:=$(PYTHON3_VERSION)
  59. endef
  60. define Package/libpython3/description
  61. This package contains only core Python library.
  62. endef
  63. define Package/python3-base
  64. $(call Package/python3/Default)
  65. TITLE:=Python $(PYTHON3_VERSION) interpreter
  66. DEPENDS:=+libpthread +zlib +libpython3
  67. endef
  68. define Package/python3-base/description
  69. This package contains only the interpreter and the bare minimum
  70. for the interpreter to start.
  71. endef
  72. define Package/python3-light
  73. $(call Package/python3/Default)
  74. TITLE:=Python $(PYTHON3_VERSION) light installation
  75. DEPENDS:=+python3-base +libffi +libbz2
  76. endef
  77. define Package/python3-light/config
  78. source "$(SOURCE)/Config-python3-light.in"
  79. endef
  80. define Package/python3-light/description
  81. This package is essentially the python3-base package plus
  82. a few of the rarely used (and big) libraries stripped out
  83. into separate packages.
  84. endef
  85. PYTHON3_LIB_FILES_DEL:=
  86. PYTHON3_PACKAGES:=
  87. PYTHON3_SO_SUFFIX:=cpython-$(PYTHON3_VERSION_MAJOR)$(PYTHON3_VERSION_MINOR).so
  88. PYTHON3_PACKAGES_DEPENDS:=
  89. define Py3BasePackage
  90. PYTHON3_PACKAGES+=$(1)
  91. ifeq ($(3),)
  92. PYTHON3_PACKAGES_DEPENDS+=$(1)
  93. endif
  94. PYTHON3_LIB_FILES_DEL+=$(2)
  95. define Py3Package/$(1)/filespec
  96. ifneq ($(2),)
  97. $(subst $(space),$(newline),$(foreach lib_file,$(2),+|$(lib_file)))
  98. -|/usr/lib/python$(PYTHON3_VERSION)/*/test
  99. -|/usr/lib/python$(PYTHON3_VERSION)/*/tests
  100. endif
  101. endef
  102. Py3Package/$(1)/install?=:
  103. endef
  104. include ./files/python3-package-*.mk
  105. define Package/python3
  106. $(call Package/python3/Default)
  107. DEPENDS:=+python3-light $(foreach package,$(PYTHON3_PACKAGES_DEPENDS),+$(package))
  108. endef
  109. define Package/python3/description
  110. This package contains the (almost) full Python install.
  111. It's python3-light + all other packages.
  112. endef
  113. EXTRA_LDFLAGS+= \
  114. -L$(PKG_BUILD_DIR) \
  115. -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib
  116. # Workaround for hardfloat mips
  117. # https://bugs.python.org/issue46265
  118. ifneq ($(findstring mips,$(CONFIG_ARCH)),)
  119. ifeq ($(CONFIG_HAS_FPU),y)
  120. CONFIGURE_VARS += \
  121. ax_cv_check_cflags___fno_semantic_interposition=no
  122. endif
  123. endif
  124. MAKE_VARS += \
  125. PYTHONSTRICTEXTENSIONBUILD=1
  126. CONFIGURE_ARGS+= \
  127. --enable-optimizations \
  128. --enable-shared \
  129. --with-system-ffi \
  130. --without-cxx-main \
  131. --without-ensurepip \
  132. --without-pymalloc \
  133. --disable-test-modules \
  134. $(if $(CONFIG_IPV6),--enable-ipv6) \
  135. $(if $(findstring mips,$(CONFIG_ARCH)),,--with-lto) \
  136. CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \
  137. OPT="$(TARGET_CFLAGS)"
  138. define Build/Prepare
  139. $(call Build/Prepare/Default)
  140. $(CP) ./files/config.site $(PKG_BUILD_DIR)/config.site
  141. endef
  142. ifdef CONFIG_PACKAGE_python3-setuptools
  143. PYTHON3_SETUPTOOLS_BUILD:=1
  144. endif
  145. ifdef CONFIG_PACKAGE_python3-pkg-resources
  146. PYTHON3_SETUPTOOLS_BUILD:=1
  147. endif
  148. ifeq ($(PYTHON3_SETUPTOOLS_BUILD),1)
  149. define Build/Compile/python3-setuptools
  150. $(HOST_PYTHON3_PIP) \
  151. --disable-pip-version-check \
  152. --cache-dir "$(DL_DIR)/pip-cache" \
  153. install \
  154. --ignore-installed \
  155. --root=$(PKG_BUILD_DIR)/install-setuptools \
  156. --prefix=/usr \
  157. $(PKG_BUILD_DIR)/Lib/ensurepip/_bundled/setuptools-$(PYTHON3_SETUPTOOLS_VERSION)-py3-none-any.whl
  158. $(call PatchDir,$(PKG_BUILD_DIR)/install-setuptools/usr/lib/python$(PYTHON3_VERSION)/site-packages,./patches-setuptools,)
  159. endef
  160. else
  161. define Build/Compile/python3-setuptools
  162. ls $(PKG_BUILD_DIR)/Lib/ensurepip/_bundled/setuptools-$(PYTHON3_SETUPTOOLS_VERSION)-py3-none-any.whl
  163. endef
  164. endif # CONFIG_PACKAGE_python3-setuptools
  165. ifdef CONFIG_PACKAGE_python3-pip
  166. define Build/Compile/python3-pip
  167. $(HOST_PYTHON3_PIP) \
  168. --disable-pip-version-check \
  169. --cache-dir "$(DL_DIR)/pip-cache" \
  170. install \
  171. --ignore-installed \
  172. --root=$(PKG_BUILD_DIR)/install-pip \
  173. --prefix=/usr \
  174. $(PKG_BUILD_DIR)/Lib/ensurepip/_bundled/pip-$(PYTHON3_PIP_VERSION)-py3-none-any.whl
  175. # FIXME: [1] get rid of this asap; 'patch' doesn't like Windows endings, and this file is full of them...
  176. # I actually tried this in a number of ways and the only way to fix this is to implement
  177. # a poor-man's dos2unix using sed.
  178. # The issue is with the pip package; it seems that it throws in some Windows line-endings
  179. # and 'patch' won't handle them. So, we do a "dos2unix" and then patch.
  180. # We can get rid of this once this is solved upstream and in pip:
  181. # https://github.com/pypa/pep517/pull/130
  182. sed 's/\r//' -i $(PKG_BUILD_DIR)/install-pip/usr/lib/python$(PYTHON3_VERSION)/site-packages/pip/_vendor/pep517/in_process/__init__.py
  183. $(call PatchDir,$(PKG_BUILD_DIR)/install-pip/usr/lib/python$(PYTHON3_VERSION)/site-packages,./patches-pip,)
  184. endef
  185. else
  186. define Build/Compile/python3-pip
  187. ls $(PKG_BUILD_DIR)/Lib/ensurepip/_bundled/pip-$(PYTHON3_PIP_VERSION)-py3-none-any.whl
  188. endef
  189. endif # CONFIG_PACKAGE_python3-pip
  190. define Build/Compile
  191. $(call Build/Compile/Default)
  192. # Use host pip to install python-setuptools
  193. $(call Build/Compile/python3-setuptools)
  194. $(call Build/Compile/python3-pip)
  195. endef
  196. define Build/InstallDev
  197. $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib $(1)/usr/lib/pkgconfig
  198. $(INSTALL_DIR) $(2)/bin
  199. $(CP) \
  200. $(PKG_INSTALL_DIR)/usr/include/python$(PYTHON3_VERSION) \
  201. $(1)/usr/include/
  202. $(CP) \
  203. $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON3_VERSION) \
  204. $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON3_VERSION).so* \
  205. $(1)/usr/lib/
  206. grep \
  207. '^_PYTHON_HOST_PLATFORM=' \
  208. $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON3_VERSION)/config-$(PYTHON3_VERSION)/Makefile > \
  209. $(1)/usr/lib/python$(PYTHON3_VERSION)/config-$(PYTHON3_VERSION)/Makefile-vars
  210. $(CP) \
  211. $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/python*.pc \
  212. $(1)/usr/lib/pkgconfig
  213. $(INSTALL_BIN) \
  214. $(PKG_INSTALL_DIR)/usr/bin/python$(PYTHON3_VERSION)-config \
  215. $(2)/bin/
  216. $(SED) \
  217. 's|^prefix_real=.*$$$$|prefix_real="$(PYTHON3_DIR)"|' \
  218. $(2)/bin/python$(PYTHON3_VERSION)-config
  219. endef
  220. PYTHON3_BASE_LIB_FILES:= \
  221. /usr/lib/python$(PYTHON3_VERSION)/encodings \
  222. /usr/lib/python$(PYTHON3_VERSION)/_collections_abc.py \
  223. /usr/lib/python$(PYTHON3_VERSION)/_sitebuiltins.py \
  224. /usr/lib/python$(PYTHON3_VERSION)/_sysconfigdata.py \
  225. /usr/lib/python$(PYTHON3_VERSION)/_weakrefset.py \
  226. /usr/lib/python$(PYTHON3_VERSION)/abc.py \
  227. /usr/lib/python$(PYTHON3_VERSION)/codecs.py \
  228. /usr/lib/python$(PYTHON3_VERSION)/genericpath.py \
  229. /usr/lib/python$(PYTHON3_VERSION)/io.py \
  230. /usr/lib/python$(PYTHON3_VERSION)/os.py \
  231. /usr/lib/python$(PYTHON3_VERSION)/posixpath.py \
  232. /usr/lib/python$(PYTHON3_VERSION)/site.py \
  233. /usr/lib/python$(PYTHON3_VERSION)/sysconfig.py \
  234. /usr/lib/python$(PYTHON3_VERSION)/stat.py
  235. PYTHON3_LIB_FILES_DEL+=$(PYTHON3_BASE_LIB_FILES)
  236. define Py3Package/python3-base/filespec
  237. +|/usr/bin/python$(PYTHON3_VERSION)
  238. $(subst $(space),$(newline),$(foreach lib_file,$(PYTHON3_BASE_LIB_FILES),+|$(lib_file)))
  239. endef
  240. define Py3Package/python3-light/filespec
  241. +|/usr/lib/python$(PYTHON3_VERSION)
  242. -|/usr/lib/python$(PYTHON3_VERSION)/distutils/cygwinccompiler.py
  243. -|/usr/lib/python$(PYTHON3_VERSION)/distutils/command/wininst*
  244. -|/usr/lib/python$(PYTHON3_VERSION)/ensurepip
  245. -|/usr/lib/python$(PYTHON3_VERSION)/idlelib
  246. -|/usr/lib/python$(PYTHON3_VERSION)/tkinter
  247. -|/usr/lib/python$(PYTHON3_VERSION)/turtledemo
  248. -|/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_test*.so
  249. -|/usr/lib/python$(PYTHON3_VERSION)/pdb.doc
  250. -|/usr/lib/python$(PYTHON3_VERSION)/test
  251. -|/usr/lib/python$(PYTHON3_VERSION)/webbrowser.py
  252. -|/usr/lib/python$(PYTHON3_VERSION)/*/test
  253. -|/usr/lib/python$(PYTHON3_VERSION)/*/tests
  254. -|/usr/lib/python$(PYTHON3_VERSION)/_osx_support.py
  255. $(subst $(space),$(newline),$(foreach lib_file,$(PYTHON3_LIB_FILES_DEL),-|$(lib_file)))
  256. endef
  257. define Package/libpython3/install
  258. # Adding the lib-dynload folder (even just empty) suppresses 2 warnings when starting Python
  259. $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/
  260. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON3_VERSION).so* $(1)/usr/lib/
  261. endef
  262. define Py3Package/python3-base/install
  263. $(INSTALL_DIR) $(1)/usr/bin
  264. $(LN) python$(PYTHON3_VERSION) $(1)/usr/bin/python3
  265. $(LN) python$(PYTHON3_VERSION) $(1)/usr/bin/python
  266. # This depends on being called before filespec is processed
  267. $(SED) 's|$(TARGET_AR)|ar|g;s|$(TARGET_CROSS)readelf|readelf|g;s|$(TARGET_CC)|gcc|g;s|$(TARGET_CXX)|g++|g' \
  268. $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON3_VERSION)/_sysconfigdata.py
  269. endef
  270. Py3Package/python3-light/install:=:
  271. Py3Package/python3/install:=:
  272. define Py3Package/python3/filespec
  273. -|$(PYTHON3_PKG_DIR)
  274. endef
  275. HOST_LDFLAGS += \
  276. -Wl$(comma)-rpath$(comma)$(STAGING_DIR_HOSTPKG)/lib
  277. ifeq ($(HOST_OS),Linux)
  278. HOST_LDFLAGS += \
  279. -Wl,--no-as-needed -lrt
  280. endif
  281. # Would be nice to be able to do this, but hosts are very fiddly
  282. # HOST_MAKE_VARS += \
  283. # PYTHONSTRICTEXTENSIONBUILD=1
  284. ifeq ($(HOST_OS),Darwin)
  285. HOST_CONFIGURE_VARS += \
  286. ac_cv_header_libintl_h=no
  287. HOST_MAKE_VARS += \
  288. USE_PYTHON_CONFIG_PY=1
  289. endif
  290. # FIXME: remove when removing patch '028-host-python-support-ssl-with-libressl.patch'
  291. HOST_CFLAGS += \
  292. -DOPENWRT_HOST_BUILD
  293. HOST_CONFIGURE_ARGS+= \
  294. --enable-optimizations \
  295. --with-ensurepip=upgrade \
  296. --with-system-expat=$(STAGING_DIR_HOSTPKG) \
  297. --with-ssl-default-suites=openssl \
  298. --without-cxx-main \
  299. --without-pymalloc \
  300. --disable-test-modules \
  301. CONFIG_SITE=
  302. define Host/Configure
  303. $(SED) 's/^ENABLE_USER_SITE = None$$$$/ENABLE_USER_SITE = False/' $(HOST_BUILD_DIR)/Lib/site.py
  304. $(call Host/Configure/Default)
  305. endef
  306. define Host/Compile
  307. $(call Host/Compile/Default,python)
  308. $(call Host/Compile/Default,sharedmods)
  309. endef
  310. define Host/Install
  311. $(if $(wildcard $(HOST_PYTHON3_PKG_DIR)/.setuptools_installed_$(PYTHON3_SETUPTOOLS_VERSION)-$(PYTHON3_SETUPTOOLS_PKG_RELEASE)),,
  312. rm -rf \
  313. $(HOST_PYTHON3_PKG_DIR)/pkg_resources \
  314. $(HOST_PYTHON3_PKG_DIR)/setuptools \
  315. $(HOST_PYTHON3_PKG_DIR)/setuptools-* \
  316. $(HOST_PYTHON3_PKG_DIR)/.setuptools-patched* \
  317. $(HOST_PYTHON3_PKG_DIR)/.setuptools_installed_*
  318. )
  319. $(if $(wildcard $(HOST_PYTHON3_PKG_DIR)/.pip_installed_$(PYTHON3_PIP_VERSION)-$(PYTHON3_PIP_PKG_RELEASE)),,
  320. rm -rf \
  321. $(HOST_PYTHON3_PKG_DIR)/pip \
  322. $(HOST_PYTHON3_PKG_DIR)/pip-* \
  323. $(HOST_PYTHON3_PKG_DIR)/.pip-patched* \
  324. $(HOST_PYTHON3_PKG_DIR)/.pip_installed_*
  325. )
  326. $(call Host/Install/Default)
  327. $(if $(wildcard $(HOST_PYTHON3_PKG_DIR)/.setuptools_installed_$(PYTHON3_SETUPTOOLS_VERSION)-$(PYTHON3_SETUPTOOLS_PKG_RELEASE)),,
  328. $(call HostPatchDir,$(HOST_PYTHON3_PKG_DIR),./patches-setuptools,)
  329. touch $(HOST_PYTHON3_PKG_DIR)/.setuptools_installed_$(PYTHON3_SETUPTOOLS_VERSION)-$(PYTHON3_SETUPTOOLS_PKG_RELEASE)
  330. )
  331. $(if $(wildcard $(HOST_PYTHON3_PKG_DIR)/.pip_installed_$(PYTHON3_PIP_VERSION)-$(PYTHON3_PIP_PKG_RELEASE)),,
  332. # FIXME: [2] get rid of this asap; same as [1]
  333. sed 's/\r//' -i $(HOST_PYTHON3_PKG_DIR)/pip/_vendor/pep517/in_process/__init__.py
  334. $(call HostPatchDir,$(HOST_PYTHON3_PKG_DIR),./patches-pip,)
  335. touch $(HOST_PYTHON3_PKG_DIR)/.pip_installed_$(PYTHON3_PIP_VERSION)-$(PYTHON3_PIP_PKG_RELEASE)
  336. )
  337. endef
  338. $(eval $(call HostBuild))
  339. $(foreach package, $(PYTHON3_PACKAGES), \
  340. $(eval $(call Py3Package,$(package))) \
  341. $(eval $(call BuildPackage,$(package))) \
  342. $(eval $(call BuildPackage,$(package)-src)) \
  343. )
  344. $(eval $(call BuildPackage,libpython3))
  345. $(eval $(call Py3Package,python3-base))
  346. $(eval $(call Py3Package,python3-light))
  347. $(eval $(call Py3Package,python3))
  348. $(eval $(call BuildPackage,python3-base))
  349. $(eval $(call BuildPackage,python3-light))
  350. $(eval $(call BuildPackage,python3))
  351. $(eval $(call BuildPackage,python3-base-src))
  352. $(eval $(call BuildPackage,python3-light-src))