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.

400 lines
12 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. PKG_HASH:=8437efd5b106ef0a75aabfbf23d880625120a73a86a22ade4d2e2e68d7b74486
  16. PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
  17. PKG_LICENSE:=PSF-2.0
  18. PKG_LICENSE_FILES:=LICENSE Doc/copyright.rst Doc/license.rst Modules/_ctypes/darwin/LICENSE Modules/_ctypes/libffi_osx/LICENSE Modules/expat/COPYING
  19. PKG_CPE_ID:=cpe:/a:python:python
  20. # This file provides the necsessary host build variables
  21. include ../python3-host.mk
  22. # For Py3Package
  23. PYTHON3_PKG_BUILD:=0
  24. include ../python3-package.mk
  25. PKG_FIXUP:=autoreconf
  26. PKG_INSTALL:=1
  27. PKG_BUILD_PARALLEL:=1
  28. HOST_BUILD_PARALLEL:=1
  29. PKG_BUILD_DIR:=$(BUILD_DIR)/Python-$(PKG_VERSION)
  30. HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/Python-$(PKG_VERSION)
  31. PKG_CONFIG_DEPENDS:= \
  32. CONFIG_PACKAGE_python3-pkg-resources \
  33. CONFIG_PACKAGE_python3-setuptools CONFIG_PACKAGE_python3-pip
  34. PKG_BUILD_DEPENDS:=bluez python3/host
  35. HOST_BUILD_DEPENDS:=bzip2/host libffi/host
  36. include $(INCLUDE_DIR)/host-build.mk
  37. include $(INCLUDE_DIR)/package.mk
  38. define Package/python3/Default
  39. SUBMENU:=Python
  40. SECTION:=lang
  41. CATEGORY:=Languages
  42. TITLE:=Python $(PYTHON3_VERSION) programming language
  43. URL:=https://www.python.org/
  44. endef
  45. define Package/python3/Default/description
  46. Python is a dynamic object-oriented programming language that can be used
  47. for many kinds of software development. It offers strong support for
  48. integration with other languages and tools, comes with extensive standard
  49. libraries, and can be learned in a few days. Many Python programmers
  50. report substantial productivity gains and feel the language encourages
  51. the development of higher quality, more maintainable code.
  52. endef
  53. define Package/libpython3
  54. $(call Package/python3/Default)
  55. TITLE:=Python $(PYTHON3_VERSION) core library
  56. DEPENDS:=+libpthread +zlib
  57. ABI_VERSION:=$(PYTHON3_VERSION)
  58. endef
  59. define Package/libpython3/description
  60. This package contains only core Python library.
  61. endef
  62. define Package/python3-base
  63. $(call Package/python3/Default)
  64. TITLE:=Python $(PYTHON3_VERSION) interpreter
  65. DEPENDS:=+libpthread +zlib +libpython3
  66. endef
  67. define Package/python3-base/description
  68. This package contains only the interpreter and the bare minimum
  69. for the interpreter to start.
  70. endef
  71. define Package/python3-light
  72. $(call Package/python3/Default)
  73. TITLE:=Python $(PYTHON3_VERSION) light installation
  74. DEPENDS:=+python3-base +libffi +libbz2
  75. endef
  76. define Package/python3-light/config
  77. source "$(SOURCE)/Config-python3-light.in"
  78. endef
  79. define Package/python3-light/description
  80. This package is essentially the python3-base package plus
  81. a few of the rarely used (and big) libraries stripped out
  82. into separate packages.
  83. endef
  84. PYTHON3_LIB_FILES_DEL:=
  85. PYTHON3_PACKAGES:=
  86. PYTHON3_SO_SUFFIX:=cpython-$(PYTHON3_VERSION_MAJOR)$(PYTHON3_VERSION_MINOR).so
  87. PYTHON3_PACKAGES_DEPENDS:=
  88. define Py3BasePackage
  89. PYTHON3_PACKAGES+=$(1)
  90. ifeq ($(3),)
  91. PYTHON3_PACKAGES_DEPENDS+=$(1)
  92. endif
  93. PYTHON3_LIB_FILES_DEL+=$(2)
  94. define Py3Package/$(1)/filespec
  95. ifneq ($(2),)
  96. $(subst $(space),$(newline),$(foreach lib_file,$(2),+|$(lib_file)))
  97. -|/usr/lib/python$(PYTHON3_VERSION)/*/test
  98. -|/usr/lib/python$(PYTHON3_VERSION)/*/tests
  99. endif
  100. endef
  101. Py3Package/$(1)/install?=:
  102. endef
  103. include ./files/python3-package-*.mk
  104. define Package/python3
  105. $(call Package/python3/Default)
  106. DEPENDS:=+python3-light $(foreach package,$(PYTHON3_PACKAGES_DEPENDS),+$(package))
  107. endef
  108. define Package/python3/description
  109. This package contains the (almost) full Python install.
  110. It's python3-light + all other packages.
  111. endef
  112. EXTRA_LDFLAGS+= \
  113. -L$(PKG_BUILD_DIR) \
  114. -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib
  115. # Workaround for hardfloat mips
  116. # https://bugs.python.org/issue46265
  117. ifneq ($(findstring mips,$(CONFIG_ARCH)),)
  118. ifeq ($(CONFIG_HAS_FPU),y)
  119. CONFIGURE_VARS += \
  120. ax_cv_check_cflags___fno_semantic_interposition=no
  121. endif
  122. endif
  123. MAKE_VARS += \
  124. PYTHONSTRICTEXTENSIONBUILD=1
  125. CONFIGURE_ARGS+= \
  126. --enable-optimizations \
  127. --enable-shared \
  128. --with-system-ffi \
  129. --without-cxx-main \
  130. --without-ensurepip \
  131. --without-pymalloc \
  132. --disable-test-modules \
  133. $(if $(CONFIG_IPV6),--enable-ipv6) \
  134. $(if $(findstring mips,$(CONFIG_ARCH)),,--with-lto) \
  135. CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \
  136. OPT="$(TARGET_CFLAGS)"
  137. define Build/Prepare
  138. $(call Build/Prepare/Default)
  139. $(CP) ./files/config.site $(PKG_BUILD_DIR)/config.site
  140. endef
  141. ifdef CONFIG_PACKAGE_python3-setuptools
  142. PYTHON3_SETUPTOOLS_BUILD:=1
  143. endif
  144. ifdef CONFIG_PACKAGE_python3-pkg-resources
  145. PYTHON3_SETUPTOOLS_BUILD:=1
  146. endif
  147. ifeq ($(PYTHON3_SETUPTOOLS_BUILD),1)
  148. define Build/Compile/python3-setuptools
  149. $(HOST_PYTHON3_PIP) \
  150. --disable-pip-version-check \
  151. --cache-dir "$(DL_DIR)/pip-cache" \
  152. install \
  153. --ignore-installed \
  154. --root=$(PKG_BUILD_DIR)/install-setuptools \
  155. --prefix=/usr \
  156. $(PKG_BUILD_DIR)/Lib/ensurepip/_bundled/setuptools-$(PYTHON3_SETUPTOOLS_VERSION)-py3-none-any.whl
  157. $(call PatchDir,$(PKG_BUILD_DIR)/install-setuptools/usr/lib/python$(PYTHON3_VERSION)/site-packages,./patches-setuptools,)
  158. endef
  159. else
  160. define Build/Compile/python3-setuptools
  161. ls $(PKG_BUILD_DIR)/Lib/ensurepip/_bundled/setuptools-$(PYTHON3_SETUPTOOLS_VERSION)-py3-none-any.whl
  162. endef
  163. endif # CONFIG_PACKAGE_python3-setuptools
  164. ifdef CONFIG_PACKAGE_python3-pip
  165. define Build/Compile/python3-pip
  166. $(HOST_PYTHON3_PIP) \
  167. --disable-pip-version-check \
  168. --cache-dir "$(DL_DIR)/pip-cache" \
  169. install \
  170. --ignore-installed \
  171. --root=$(PKG_BUILD_DIR)/install-pip \
  172. --prefix=/usr \
  173. $(PKG_BUILD_DIR)/Lib/ensurepip/_bundled/pip-$(PYTHON3_PIP_VERSION)-py3-none-any.whl
  174. $(call PatchDir,$(PKG_BUILD_DIR)/install-pip/usr/lib/python$(PYTHON3_VERSION)/site-packages,./patches-pip,)
  175. endef
  176. else
  177. define Build/Compile/python3-pip
  178. ls $(PKG_BUILD_DIR)/Lib/ensurepip/_bundled/pip-$(PYTHON3_PIP_VERSION)-py3-none-any.whl
  179. endef
  180. endif # CONFIG_PACKAGE_python3-pip
  181. define Build/Compile
  182. $(call Build/Compile/Default)
  183. # Use host pip to install python-setuptools
  184. $(call Build/Compile/python3-setuptools)
  185. $(call Build/Compile/python3-pip)
  186. endef
  187. define Build/InstallDev
  188. $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib $(1)/usr/lib/pkgconfig
  189. $(INSTALL_DIR) $(2)/bin
  190. $(CP) \
  191. $(PKG_INSTALL_DIR)/usr/include/python$(PYTHON3_VERSION) \
  192. $(1)/usr/include/
  193. $(CP) \
  194. $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON3_VERSION) \
  195. $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON3_VERSION).so* \
  196. $(1)/usr/lib/
  197. grep \
  198. '^_PYTHON_HOST_PLATFORM=' \
  199. $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON3_VERSION)/config-$(PYTHON3_VERSION)/Makefile > \
  200. $(1)/usr/lib/python$(PYTHON3_VERSION)/config-$(PYTHON3_VERSION)/Makefile-vars
  201. $(CP) \
  202. $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/python*.pc \
  203. $(1)/usr/lib/pkgconfig
  204. $(INSTALL_BIN) \
  205. $(PKG_INSTALL_DIR)/usr/bin/python$(PYTHON3_VERSION)-config \
  206. $(2)/bin/
  207. $(SED) \
  208. 's|^prefix_real=.*$$$$|prefix_real="$(PYTHON3_DIR)"|' \
  209. $(2)/bin/python$(PYTHON3_VERSION)-config
  210. endef
  211. PYTHON3_BASE_LIB_FILES:= \
  212. /usr/lib/python$(PYTHON3_VERSION)/encodings \
  213. /usr/lib/python$(PYTHON3_VERSION)/_collections_abc.py \
  214. /usr/lib/python$(PYTHON3_VERSION)/_sitebuiltins.py \
  215. /usr/lib/python$(PYTHON3_VERSION)/_sysconfigdata.py \
  216. /usr/lib/python$(PYTHON3_VERSION)/_weakrefset.py \
  217. /usr/lib/python$(PYTHON3_VERSION)/abc.py \
  218. /usr/lib/python$(PYTHON3_VERSION)/codecs.py \
  219. /usr/lib/python$(PYTHON3_VERSION)/genericpath.py \
  220. /usr/lib/python$(PYTHON3_VERSION)/io.py \
  221. /usr/lib/python$(PYTHON3_VERSION)/os.py \
  222. /usr/lib/python$(PYTHON3_VERSION)/posixpath.py \
  223. /usr/lib/python$(PYTHON3_VERSION)/site.py \
  224. /usr/lib/python$(PYTHON3_VERSION)/sysconfig.py \
  225. /usr/lib/python$(PYTHON3_VERSION)/stat.py
  226. PYTHON3_LIB_FILES_DEL+=$(PYTHON3_BASE_LIB_FILES)
  227. define Py3Package/python3-base/filespec
  228. +|/usr/bin/python$(PYTHON3_VERSION)
  229. $(subst $(space),$(newline),$(foreach lib_file,$(PYTHON3_BASE_LIB_FILES),+|$(lib_file)))
  230. endef
  231. define Py3Package/python3-light/filespec
  232. +|/usr/lib/python$(PYTHON3_VERSION)
  233. -|/usr/lib/python$(PYTHON3_VERSION)/distutils/cygwinccompiler.py
  234. -|/usr/lib/python$(PYTHON3_VERSION)/distutils/command/wininst*
  235. -|/usr/lib/python$(PYTHON3_VERSION)/ensurepip
  236. -|/usr/lib/python$(PYTHON3_VERSION)/idlelib
  237. -|/usr/lib/python$(PYTHON3_VERSION)/tkinter
  238. -|/usr/lib/python$(PYTHON3_VERSION)/turtledemo
  239. -|/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_test*.so
  240. -|/usr/lib/python$(PYTHON3_VERSION)/pdb.doc
  241. -|/usr/lib/python$(PYTHON3_VERSION)/test
  242. -|/usr/lib/python$(PYTHON3_VERSION)/webbrowser.py
  243. -|/usr/lib/python$(PYTHON3_VERSION)/*/test
  244. -|/usr/lib/python$(PYTHON3_VERSION)/*/tests
  245. -|/usr/lib/python$(PYTHON3_VERSION)/_osx_support.py
  246. $(subst $(space),$(newline),$(foreach lib_file,$(PYTHON3_LIB_FILES_DEL),-|$(lib_file)))
  247. endef
  248. define Package/libpython3/install
  249. # Adding the lib-dynload folder (even just empty) suppresses 2 warnings when starting Python
  250. $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/
  251. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON3_VERSION).so* $(1)/usr/lib/
  252. endef
  253. define Py3Package/python3-base/install
  254. $(INSTALL_DIR) $(1)/usr/bin
  255. $(LN) python$(PYTHON3_VERSION) $(1)/usr/bin/python3
  256. $(LN) python$(PYTHON3_VERSION) $(1)/usr/bin/python
  257. # This depends on being called before filespec is processed
  258. $(SED) 's|$(TARGET_AR)|ar|g;s|$(TARGET_CROSS)readelf|readelf|g;s|$(TARGET_CC)|gcc|g;s|$(TARGET_CXX)|g++|g' \
  259. $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON3_VERSION)/_sysconfigdata.py
  260. endef
  261. Py3Package/python3-light/install:=:
  262. Py3Package/python3/install:=:
  263. define Py3Package/python3/filespec
  264. -|$(PYTHON3_PKG_DIR)
  265. endef
  266. HOST_LDFLAGS += \
  267. -Wl$(comma)-rpath$(comma)$(STAGING_DIR_HOSTPKG)/lib
  268. ifeq ($(HOST_OS),Linux)
  269. HOST_LDFLAGS += \
  270. -Wl,--no-as-needed -lrt
  271. endif
  272. # Would be nice to be able to do this, but hosts are very fiddly
  273. # HOST_MAKE_VARS += \
  274. # PYTHONSTRICTEXTENSIONBUILD=1
  275. ifeq ($(HOST_OS),Darwin)
  276. HOST_CONFIGURE_VARS += \
  277. ac_cv_header_libintl_h=no
  278. HOST_MAKE_VARS += \
  279. USE_PYTHON_CONFIG_PY=1
  280. endif
  281. # FIXME: remove when removing patch '028-host-python-support-ssl-with-libressl.patch'
  282. HOST_CFLAGS += \
  283. -DOPENWRT_HOST_BUILD
  284. HOST_CONFIGURE_ARGS+= \
  285. --enable-optimizations \
  286. --with-ensurepip=upgrade \
  287. --with-system-expat=$(STAGING_DIR_HOSTPKG) \
  288. --with-ssl-default-suites=openssl \
  289. --without-cxx-main \
  290. --without-pymalloc \
  291. --disable-test-modules \
  292. CONFIG_SITE=
  293. define Host/Configure
  294. $(SED) 's/^ENABLE_USER_SITE = None$$$$/ENABLE_USER_SITE = False/' $(HOST_BUILD_DIR)/Lib/site.py
  295. $(call Host/Configure/Default)
  296. endef
  297. define Host/Compile
  298. $(call Host/Compile/Default,python)
  299. $(call Host/Compile/Default,sharedmods)
  300. endef
  301. define Host/Install
  302. $(if $(wildcard $(HOST_PYTHON3_PKG_DIR)/.setuptools_installed_$(PYTHON3_SETUPTOOLS_VERSION)-$(PYTHON3_SETUPTOOLS_PKG_RELEASE)),,
  303. rm -rf \
  304. $(HOST_PYTHON3_PKG_DIR)/pkg_resources \
  305. $(HOST_PYTHON3_PKG_DIR)/setuptools \
  306. $(HOST_PYTHON3_PKG_DIR)/setuptools-* \
  307. $(HOST_PYTHON3_PKG_DIR)/.setuptools-patched* \
  308. $(HOST_PYTHON3_PKG_DIR)/.setuptools_installed_*
  309. )
  310. $(if $(wildcard $(HOST_PYTHON3_PKG_DIR)/.pip_installed_$(PYTHON3_PIP_VERSION)-$(PYTHON3_PIP_PKG_RELEASE)),,
  311. rm -rf \
  312. $(HOST_PYTHON3_PKG_DIR)/pip \
  313. $(HOST_PYTHON3_PKG_DIR)/pip-* \
  314. $(HOST_PYTHON3_PKG_DIR)/.pip-patched* \
  315. $(HOST_PYTHON3_PKG_DIR)/.pip_installed_*
  316. )
  317. $(call Host/Install/Default)
  318. $(if $(wildcard $(HOST_PYTHON3_PKG_DIR)/.setuptools_installed_$(PYTHON3_SETUPTOOLS_VERSION)-$(PYTHON3_SETUPTOOLS_PKG_RELEASE)),,
  319. $(call HostPatchDir,$(HOST_PYTHON3_PKG_DIR),./patches-setuptools,)
  320. touch $(HOST_PYTHON3_PKG_DIR)/.setuptools_installed_$(PYTHON3_SETUPTOOLS_VERSION)-$(PYTHON3_SETUPTOOLS_PKG_RELEASE)
  321. )
  322. $(if $(wildcard $(HOST_PYTHON3_PKG_DIR)/.pip_installed_$(PYTHON3_PIP_VERSION)-$(PYTHON3_PIP_PKG_RELEASE)),,
  323. $(call HostPatchDir,$(HOST_PYTHON3_PKG_DIR),./patches-pip,)
  324. touch $(HOST_PYTHON3_PKG_DIR)/.pip_installed_$(PYTHON3_PIP_VERSION)-$(PYTHON3_PIP_PKG_RELEASE)
  325. )
  326. endef
  327. $(eval $(call HostBuild))
  328. $(foreach package, $(PYTHON3_PACKAGES), \
  329. $(eval $(call Py3Package,$(package))) \
  330. $(eval $(call BuildPackage,$(package))) \
  331. $(eval $(call BuildPackage,$(package)-src)) \
  332. )
  333. $(eval $(call BuildPackage,libpython3))
  334. $(eval $(call Py3Package,python3-base))
  335. $(eval $(call Py3Package,python3-light))
  336. $(eval $(call Py3Package,python3))
  337. $(eval $(call BuildPackage,python3-base))
  338. $(eval $(call BuildPackage,python3-light))
  339. $(eval $(call BuildPackage,python3))
  340. $(eval $(call BuildPackage,python3-base-src))
  341. $(eval $(call BuildPackage,python3-light-src))