mirror of
https://github.com/novatiq/packages.git
synced 2026-04-24 21:14:40 +01:00
This adds the ability to patch setuptools (and pip), and adds 3 reproducibility patches from Debian[1]. (003-PKG-INFO-output-reproducible.patch addresses the issue identified in #9039.) The patching is not perfect, in that the patches are applied to setuptools and pip after they have been installed, since they are installed from wheels which are already "precompiled". Also, patching for the host install cannot be updated in place, for example if a patch is added or removed. [1]: https://sources.debian.org/patches/python-setuptools/40.8.0-1/ Signed-off-by: Jeffery To <jeffery.to@gmail.com>
337 lines
10 KiB
Makefile
337 lines
10 KiB
Makefile
#
|
|
# Copyright (C) 2006-2016 OpenWrt.org
|
|
#
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
# See /LICENSE for more information.
|
|
#
|
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
# For PYTHON_VERSION
|
|
include ../python-version.mk
|
|
|
|
PKG_NAME:=python
|
|
PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
|
|
PKG_RELEASE:=5
|
|
|
|
PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
|
|
PKG_SOURCE_URL:=https://www.python.org/ftp/python/$(PKG_VERSION)
|
|
PKG_HASH:=f222ef602647eecb6853681156d32de4450a2c39f4de93bd5b20235f2e660ed7
|
|
|
|
PKG_LICENSE:=Python/2.0
|
|
PKG_LICENSE_FILES:=LICENSE Doc/copyright.rst Doc/license.rst Modules/_ctypes/darwin/LICENSE Modules/_ctypes/libffi/LICENSE Modules/_ctypes/libffi_osx/LICENSE Modules/expat/COPYING
|
|
PKG_CPE_ID:=cpe:/a:python:python
|
|
|
|
PKG_MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>, Jeffery To <jeffery.to@gmail.com>
|
|
|
|
# This file provides the necsessary host build variables
|
|
include ../python-host.mk
|
|
|
|
# For PyPackage
|
|
include ../python-package.mk
|
|
|
|
PKG_FIXUP:=autoreconf
|
|
PKG_INSTALL:=1
|
|
PKG_BUILD_PARALLEL:=1
|
|
HOST_BUILD_PARALLEL:=1
|
|
|
|
PKG_BUILD_DIR:=$(BUILD_DIR)/Python-$(PKG_VERSION)
|
|
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/Python-$(PKG_VERSION)
|
|
|
|
PKG_CONFIG_DEPENDS:= \
|
|
CONFIG_PACKAGE_python-setuptools CONFIG_PACKAGE_python-pip \
|
|
CONFIG_PYTHON_BLUETOOTH_SUPPORT
|
|
|
|
PKG_BUILD_DEPENDS:=python/host
|
|
HOST_BUILD_DEPENDS:=bzip2/host expat/host
|
|
|
|
include $(INCLUDE_DIR)/host-build.mk
|
|
include $(INCLUDE_DIR)/package.mk
|
|
|
|
define Package/python/Default
|
|
SUBMENU:=Python
|
|
SECTION:=lang
|
|
CATEGORY:=Languages
|
|
TITLE:=Python $(PYTHON_VERSION) programming language
|
|
URL:=https://www.python.org/
|
|
endef
|
|
|
|
define Package/python/Default/description
|
|
Python is a dynamic object-oriented programming language that can be used
|
|
for many kinds of software development. It offers strong support for
|
|
integration with other languages and tools, comes with extensive standard
|
|
libraries, and can be learned in a few days. Many Python programmers
|
|
report substantial productivity gains and feel the language encourages
|
|
the development of higher quality, more maintainable code.
|
|
endef
|
|
|
|
define Package/python-base
|
|
$(call Package/python/Default)
|
|
TITLE:=Python $(PYTHON_VERSION) interpreter
|
|
DEPENDS:=+libpthread +zlib
|
|
endef
|
|
|
|
define Package/python-base/description
|
|
This package contains only the interpreter and the bare minimum
|
|
for the interpreter to start.
|
|
endef
|
|
|
|
define Package/python-light
|
|
$(call Package/python/Default)
|
|
TITLE:=Python $(PYTHON_VERSION) light installation
|
|
DEPENDS:=+python-base +libffi +libbz2 +PYTHON_BLUETOOTH_SUPPORT:bluez-libs
|
|
endef
|
|
|
|
define Package/python-light/config
|
|
source "$(SOURCE)/Config-python-light.in"
|
|
endef
|
|
|
|
define Package/python-light/description
|
|
This package is essentially the python-base package plus
|
|
a few of the rarely used (and big) libraries stripped out
|
|
into separate packages.
|
|
endef
|
|
|
|
PYTHON_LIB_FILES_DEL:=
|
|
PYTHON_PACKAGES:=
|
|
PYTHON_PACKAGES_DEPENDS:=
|
|
define PyBasePackage
|
|
PYTHON_PACKAGES+=$(1)
|
|
ifeq ($(3),)
|
|
PYTHON_PACKAGES_DEPENDS+=$(1)
|
|
endif
|
|
PYTHON_LIB_FILES_DEL+=$(2)
|
|
define PyPackage/$(1)/filespec
|
|
ifneq ($(2),)
|
|
$(subst $(space),$(newline),$(foreach lib_file,$(2),+|$(lib_file)))
|
|
-|/usr/lib/python$(PYTHON_VERSION)/*/test
|
|
-|/usr/lib/python$(PYTHON_VERSION)/*/tests
|
|
endif
|
|
endef
|
|
PyPackage/$(1)/install?=:
|
|
endef
|
|
|
|
include ./files/python-package-*.mk
|
|
|
|
define Package/python
|
|
$(call Package/python/Default)
|
|
DEPENDS:=+python-light $(foreach package,$(PYTHON_PACKAGES_DEPENDS),+$(package))
|
|
endef
|
|
|
|
define Package/python/description
|
|
This package contains the (almost) full Python install.
|
|
It's python-light + all other packages.
|
|
endef
|
|
|
|
MAKE_FLAGS+=\
|
|
CROSS_COMPILE=yes \
|
|
LD="$(TARGET_CC)" \
|
|
PGEN=pgen2
|
|
|
|
EXTRA_CFLAGS+= \
|
|
-DNDEBUG -fno-inline
|
|
EXTRA_LDFLAGS+= \
|
|
-L$(PKG_BUILD_DIR)
|
|
|
|
ENABLE_IPV6:=
|
|
ifeq ($(CONFIG_IPV6),y)
|
|
ENABLE_IPV6 += --enable-ipv6
|
|
endif
|
|
|
|
PYTHON_FOR_BUILD:= \
|
|
_PYTHON_PROJECT_BASE=$(PKG_BUILD_DIR) \
|
|
_PYTHON_HOST_PLATFORM=linux2 \
|
|
PYTHONPATH="$(PKG_BUILD_DIR)/Lib:$(PKG_BUILD_DIR)/build/lib.linux2-$(PYTHON_VERSION)" \
|
|
_PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata \
|
|
$(HOST_PYTHON_BIN)
|
|
|
|
DISABLE_BLUETOOTH:= \
|
|
ac_cv_header_bluetooth_bluetooth_h=no \
|
|
ac_cv_header_bluetooth_h=no
|
|
|
|
CONFIGURE_ARGS+= \
|
|
--sysconfdir=/etc \
|
|
--enable-shared \
|
|
--without-cxx-main \
|
|
--with-threads \
|
|
--with-system-ffi \
|
|
--with-ensurepip=no \
|
|
--without-pymalloc \
|
|
$(if $(CONFIG_PYTHON_BLUETOOTH_SUPPORT),,$(DISABLE_BLUETOOTH)) \
|
|
PYTHON_FOR_BUILD="$(PYTHON_FOR_BUILD)" \
|
|
$(ENABLE_IPV6) \
|
|
CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \
|
|
OPT="$(TARGET_CFLAGS)"
|
|
|
|
define Build/Prepare
|
|
$(call Build/Prepare/Default)
|
|
$(CP) ./files/config.site $(PKG_BUILD_DIR)/config.site
|
|
endef
|
|
|
|
ifdef CONFIG_PACKAGE_python-setuptools
|
|
define Build/Compile/python-setuptools
|
|
$(STAGING_DIR_HOSTPKG)/bin/pip install \
|
|
--ignore-installed \
|
|
--root=$(PKG_BUILD_DIR)/install-setuptools --prefix=. \
|
|
$(PKG_BUILD_DIR)/Lib/ensurepip/_bundled/setuptools-$(PYTHON_SETUPTOOLS_VERSION)-py2.py3-none-any.whl
|
|
$(call PatchDir,$(PKG_BUILD_DIR)/install-setuptools/lib/python$(PYTHON_VERSION)/site-packages,./patches-setuptools,)
|
|
endef
|
|
endif # CONFIG_PACKAGE_python-setuptools
|
|
|
|
ifdef CONFIG_PACKAGE_python-pip
|
|
define Build/Compile/python-pip
|
|
$(STAGING_DIR_HOSTPKG)/bin/pip install \
|
|
--ignore-installed \
|
|
--root=$(PKG_BUILD_DIR)/install-pip --prefix=. \
|
|
$(PKG_BUILD_DIR)/Lib/ensurepip/_bundled/pip-$(PYTHON_PIP_VERSION)-py2.py3-none-any.whl
|
|
$(call PatchDir,$(PKG_BUILD_DIR)/install-pip/lib/python$(PYTHON_VERSION)/site-packages,./patches-pip,)
|
|
endef
|
|
endif # CONFIG_PACKAGE_python-pip
|
|
|
|
define Build/Compile
|
|
$(call Build/Compile/Default)
|
|
# Use host pip to install python-setuptools
|
|
$(call Build/Compile/python-setuptools)
|
|
$(call Build/Compile/python-pip)
|
|
endef
|
|
|
|
define Build/InstallDev
|
|
$(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib $(1)/usr/lib/pkgconfig
|
|
$(INSTALL_DIR) $(1)/usr/bin
|
|
$(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)-openwrt
|
|
$(CP) \
|
|
$(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \
|
|
$(1)/usr/include/
|
|
$(CP) \
|
|
$(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION) \
|
|
$(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* \
|
|
$(1)/usr/lib/
|
|
$(CP) \
|
|
$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/python*.pc \
|
|
$(1)/usr/lib/pkgconfig
|
|
$(INSTALL_BIN) \
|
|
./files/python-config.in \
|
|
$(1)/usr/bin/python$(PYTHON_VERSION)-config
|
|
$(SED) \
|
|
's|@EXENAME@|$(HOST_PYTHON_DIR)/bin/python$(PYTHON_VERSION)|' \
|
|
$(1)/usr/bin/python$(PYTHON_VERSION)-config
|
|
$(CP) \
|
|
$(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/_sysconfigdata.py \
|
|
$(1)/usr/lib/python$(PYTHON_VERSION)-openwrt/_sysconfigdatatarget.py
|
|
endef
|
|
|
|
PYTHON_BASE_LIB_FILES:= \
|
|
/usr/lib/python$(PYTHON_VERSION)/_abcoll.py \
|
|
/usr/lib/python$(PYTHON_VERSION)/_sysconfigdata.py \
|
|
/usr/lib/python$(PYTHON_VERSION)/_weakrefset.py \
|
|
/usr/lib/python$(PYTHON_VERSION)/abc.py \
|
|
/usr/lib/python$(PYTHON_VERSION)/copy_reg.py \
|
|
/usr/lib/python$(PYTHON_VERSION)/genericpath.py \
|
|
/usr/lib/python$(PYTHON_VERSION)/linecache.py \
|
|
/usr/lib/python$(PYTHON_VERSION)/posixpath.py \
|
|
/usr/lib/python$(PYTHON_VERSION)/os.py \
|
|
/usr/lib/python$(PYTHON_VERSION)/re.py \
|
|
/usr/lib/python$(PYTHON_VERSION)/site.py \
|
|
/usr/lib/python$(PYTHON_VERSION)/sre_compile.py \
|
|
/usr/lib/python$(PYTHON_VERSION)/sre_constants.py \
|
|
/usr/lib/python$(PYTHON_VERSION)/sre_parse.py \
|
|
/usr/lib/python$(PYTHON_VERSION)/sysconfig.py \
|
|
/usr/lib/python$(PYTHON_VERSION)/stat.py \
|
|
/usr/lib/python$(PYTHON_VERSION)/traceback.py \
|
|
/usr/lib/python$(PYTHON_VERSION)/types.py \
|
|
/usr/lib/python$(PYTHON_VERSION)/UserDict.py \
|
|
/usr/lib/python$(PYTHON_VERSION)/warnings.py
|
|
|
|
PYTHON_LIB_FILES_DEL+=$(PYTHON_BASE_LIB_FILES)
|
|
|
|
define PyPackage/python-base/filespec
|
|
+|/usr/bin/python$(PYTHON_VERSION)
|
|
$(subst $(space),$(newline),$(foreach lib_file,$(PYTHON_BASE_LIB_FILES),+|$(lib_file)))
|
|
endef
|
|
|
|
define PyPackage/python-light/filespec
|
|
+|/usr/lib/python$(PYTHON_VERSION)
|
|
-|/usr/lib/python$(PYTHON_VERSION)/distutils/cygwinccompiler.py
|
|
-|/usr/lib/python$(PYTHON_VERSION)/distutils/command/wininst*
|
|
-|/usr/lib/python$(PYTHON_VERSION)/ensurepip
|
|
-|/usr/lib/python$(PYTHON_VERSION)/idlelib
|
|
-|/usr/lib/python$(PYTHON_VERSION)/lib-tk
|
|
-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_testcapi.so
|
|
-|/usr/lib/python$(PYTHON_VERSION)/pdb.doc
|
|
-|/usr/lib/python$(PYTHON_VERSION)/test
|
|
-|/usr/lib/python$(PYTHON_VERSION)/webbrowser.py
|
|
-|/usr/lib/python$(PYTHON_VERSION)/*/test
|
|
-|/usr/lib/python$(PYTHON_VERSION)/*/tests
|
|
-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/readline.so
|
|
$(subst $(space),$(newline),$(foreach lib_file,$(PYTHON_LIB_FILES_DEL),-|$(lib_file)))
|
|
endef
|
|
|
|
define PyPackage/python-base/install
|
|
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib
|
|
$(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python
|
|
$(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python2
|
|
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* $(1)/usr/lib/
|
|
endef
|
|
|
|
PyPackage/python-light/install:=:
|
|
PyPackage/python/install:=:
|
|
|
|
define PyPackage/python/filespec
|
|
-|$(PYTHON_PKG_DIR)
|
|
endef
|
|
|
|
HOST_LDFLAGS += \
|
|
$$$$(pkg-config --static --libs libcrypto libssl) -Wl$(comma)-rpath=$(STAGING_DIR_HOSTPKG)/lib
|
|
|
|
ifeq ($(HOST_OS),Linux)
|
|
HOST_LDFLAGS += \
|
|
-Wl,--no-as-needed -lrt
|
|
endif
|
|
|
|
HOST_CONFIGURE_ARGS+= \
|
|
--without-cxx-main \
|
|
--without-pymalloc \
|
|
--with-threads \
|
|
--prefix=$(HOST_PYTHON_DIR) \
|
|
--exec-prefix=$(HOST_PYTHON_DIR) \
|
|
--with-system-expat=$(STAGING_DIR_HOSTPKG) \
|
|
--with-ensurepip=install \
|
|
CONFIG_SITE=
|
|
|
|
define Host/Compile
|
|
$(call Host/Compile/Default,python Parser/pgen sharedmods)
|
|
endef
|
|
|
|
define Host/Install
|
|
$(MAKE) -C $(HOST_BUILD_DIR) install
|
|
$(INSTALL_DIR) $(HOST_PYTHON_DIR)/bin/
|
|
$(INSTALL_BIN) $(HOST_BUILD_DIR)/Parser/pgen $(HOST_PYTHON_DIR)/bin/pgen2
|
|
ifeq ($(wildcard $(HOST_PYTHON_PKG_DIR)/.setuptools-patched),)
|
|
$(call HostPatchDir,$(HOST_PYTHON_PKG_DIR),./patches-setuptools,)
|
|
touch $(HOST_PYTHON_PKG_DIR)/.setuptools-patched
|
|
endif
|
|
ifeq ($(wildcard $(HOST_PYTHON_PKG_DIR)/.pip-patched),)
|
|
$(call HostPatchDir,$(HOST_PYTHON_PKG_DIR),./patches-pip,)
|
|
touch $(HOST_PYTHON_PKG_DIR)/.pip-patched
|
|
endif
|
|
endef
|
|
|
|
$(eval $(call HostBuild))
|
|
|
|
$(foreach package, $(PYTHON_PACKAGES), \
|
|
$(eval $(call PyPackage,$(package))) \
|
|
$(eval $(call BuildPackage,$(package))) \
|
|
$(eval $(call BuildPackage,$(package)-src)) \
|
|
)
|
|
|
|
$(eval $(call PyPackage,python-base))
|
|
$(eval $(call PyPackage,python-light))
|
|
$(eval $(call PyPackage,python))
|
|
|
|
$(eval $(call BuildPackage,python-base))
|
|
$(eval $(call BuildPackage,python-light))
|
|
$(eval $(call BuildPackage,python))
|
|
|
|
$(eval $(call BuildPackage,python-base-src))
|
|
$(eval $(call BuildPackage,python-light-src))
|