mirror of
https://github.com/openwrt/packages.git
synced 2026-04-18 04:12:14 +00:00
python packages: move all things python under lang/python
I admit this may be be a bit aggressive, but the lang folder is getting cluttered/filled up with Python, PHP, Perl, Ruby, etc. packages. Makes sense to try to group them into per-lang folders. I took the Pythons. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
This commit is contained in:
319
lang/python/python/Makefile
Normal file
319
lang/python/python/Makefile
Normal file
@@ -0,0 +1,319 @@
|
||||
#
|
||||
# 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 ./files/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_MD5SUM:=53b43534153bb2a0363f08bae8b9d990
|
||||
PKG_HASH:=35d543986882f78261f97787fd3e06274bfa6df29fac9b4a94f73930ff98f731
|
||||
|
||||
PKG_LICENSE:=PSF
|
||||
PKG_LICENSE_FILES:=LICENSE Modules/_ctypes/libffi_msvc/LICENSE Modules/_ctypes/darwin/LICENSE Modules/_ctypes/libffi/LICENSE Modules/_ctypes/libffi_osx/LICENSE Tools/pybench/LICENSE
|
||||
|
||||
# This file provides the necsessary host build variables
|
||||
include ./files/python-host.mk
|
||||
|
||||
# For PyPackage
|
||||
include ./files/python-package.mk
|
||||
|
||||
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_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/
|
||||
MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
|
||||
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-pip-conf
|
||||
$(call Package/python/Default)
|
||||
TITLE:=Configuration file for pip/pip3
|
||||
URL:=https://pip.pypa.io
|
||||
endef
|
||||
|
||||
define Package/python-pip-conf/description
|
||||
Configuration file for pip/pip3
|
||||
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
|
||||
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
|
||||
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)
|
||||
|
||||
CONFIGURE_ARGS+= \
|
||||
--sysconfdir=/etc \
|
||||
--enable-shared \
|
||||
--without-cxx-main \
|
||||
--with-threads \
|
||||
--with-system-ffi \
|
||||
--with-ensurepip=no \
|
||||
--without-pymalloc \
|
||||
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-*.whl
|
||||
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-*.whl
|
||||
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) $(STAGING_DIR)/mk/
|
||||
$(INSTALL_DIR) $(1)/usr/include/ $(1)/usr/lib/ $(1)/usr/lib/pkgconfig
|
||||
$(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/
|
||||
$(INSTALL_DATA) \
|
||||
./files/python-package.mk \
|
||||
./files/python-host.mk \
|
||||
./files/python-version.mk \
|
||||
./files/python-package-install.sh \
|
||||
$(STAGING_DIR)/mk/
|
||||
$(CP) \
|
||||
$(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \
|
||||
$(1)/usr/include/
|
||||
$(CP) \
|
||||
$(HOST_PYTHON_LIB_DIR) \
|
||||
$(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* \
|
||||
$(1)/usr/lib/
|
||||
$(CP) \
|
||||
$(HOST_PYTHON_DIR)/lib/pkgconfig/python.pc \
|
||||
$(HOST_PYTHON_DIR)/lib/pkgconfig/python2.pc \
|
||||
$(HOST_PYTHON_DIR)/lib/pkgconfig/python-$(PYTHON_VERSION).pc \
|
||||
$(1)/usr/lib/pkgconfig
|
||||
$(CP) \
|
||||
$(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config \
|
||||
$(1)/usr/lib/python$(PYTHON_VERSION)/
|
||||
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
|
||||
|
||||
define PyPackage/python/filespec
|
||||
-|$(PYTHON_PKG_DIR)
|
||||
endef
|
||||
|
||||
define Package/python-pip-conf/install
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(CP) ./files/pip.conf $(1)/etc
|
||||
endef
|
||||
|
||||
HOST_LDFLAGS += \
|
||||
$$$$(pkg-config --static --libs libcrypto libssl)
|
||||
|
||||
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-system-ffi=no \
|
||||
--with-ensurepip=install \
|
||||
CONFIG_SITE=
|
||||
|
||||
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
|
||||
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-pip-conf))
|
||||
|
||||
$(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))
|
||||
$(eval $(call BuildPackage,python-src))
|
||||
12
lang/python/python/files/config.site
Normal file
12
lang/python/python/files/config.site
Normal file
@@ -0,0 +1,12 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Copyright (C) 2007-2014 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
ac_cv_file__dev_ptmx=yes
|
||||
ac_cv_file__dev_ptc=no
|
||||
ac_cv_buggy_getaddrinfo=no
|
||||
|
||||
3
lang/python/python/files/pip.conf
Normal file
3
lang/python/python/files/pip.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
[global]
|
||||
cache-dir=/tmp/.cache
|
||||
log-file=/tmp/pip-log.txt
|
||||
81
lang/python/python/files/python-host.mk
Normal file
81
lang/python/python/files/python-host.mk
Normal file
@@ -0,0 +1,81 @@
|
||||
#
|
||||
# Copyright (C) 2015-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
ifneq ($(__python_host_mk_inc),1)
|
||||
__python_host_mk_inc=1
|
||||
|
||||
# For PYTHON_VERSION
|
||||
$(call include_mk, python-version.mk)
|
||||
|
||||
HOST_PYTHON_DIR:=$(STAGING_DIR_HOSTPKG)
|
||||
HOST_PYTHON_INC_DIR:=$(HOST_PYTHON_DIR)/include/python$(PYTHON_VERSION)
|
||||
HOST_PYTHON_LIB_DIR:=$(HOST_PYTHON_DIR)/lib/python$(PYTHON_VERSION)
|
||||
|
||||
HOST_PYTHON_PKG_DIR:=$(HOST_PYTHON_DIR)/lib/python$(PYTHON_VERSION)/site-packages
|
||||
|
||||
HOST_PYTHON_BIN:=$(HOST_PYTHON_DIR)/bin/python$(PYTHON_VERSION)
|
||||
|
||||
HOST_PYTHONPATH:=$(HOST_PYTHON_LIB_DIR):$(HOST_PYTHON_PKG_DIR)
|
||||
|
||||
define HostPython
|
||||
if [ "$(strip $(3))" == "HOST" ]; then \
|
||||
export PYTHONPATH="$(HOST_PYTHONPATH)"; \
|
||||
export PYTHONDONTWRITEBYTECODE=0; \
|
||||
else \
|
||||
export PYTHONPATH="$(PYTHONPATH)"; \
|
||||
export PYTHONDONTWRITEBYTECODE=1; \
|
||||
export _python_sysroot="$(STAGING_DIR)"; \
|
||||
export _python_prefix="/usr"; \
|
||||
export _python_exec_prefix="/usr"; \
|
||||
fi; \
|
||||
export PYTHONOPTIMIZE=""; \
|
||||
$(1) \
|
||||
$(HOST_PYTHON_BIN) $(2);
|
||||
endef
|
||||
|
||||
# $(1) => commands to execute before running pythons script
|
||||
# $(2) => python script and its arguments
|
||||
# $(3) => additional variables
|
||||
define Build/Compile/HostPyRunHost
|
||||
$(call HostPython, \
|
||||
$(if $(1),$(1);) \
|
||||
CC="$(HOSTCC)" \
|
||||
CCSHARED="$(HOSTCC) $(HOST_FPIC)" \
|
||||
CXX="$(HOSTCXX)" \
|
||||
LD="$(HOSTCC)" \
|
||||
LDSHARED="$(HOSTCC) -shared" \
|
||||
CFLAGS="$(HOST_CFLAGS)" \
|
||||
CPPFLAGS="$(HOST_CPPFLAGS) -I$(HOST_PYTHON_INC_DIR)" \
|
||||
LDFLAGS="$(HOST_LDFLAGS) -lpython$(PYTHON_VERSION) -Wl$(comma)-rpath=$(STAGING_DIR_HOSTPKG)/lib" \
|
||||
_PYTHON_HOST_PLATFORM=linux2 \
|
||||
$(3) \
|
||||
, \
|
||||
$(2) \
|
||||
, \
|
||||
HOST \
|
||||
)
|
||||
endef
|
||||
|
||||
|
||||
# $(1) => build subdir
|
||||
# $(2) => additional arguments to setup.py
|
||||
# $(3) => additional variables
|
||||
define Build/Compile/HostPyMod
|
||||
$(call Build/Compile/HostPyRunHost, \
|
||||
cd $(HOST_BUILD_DIR)/$(strip $(1)), \
|
||||
./setup.py $(2), \
|
||||
$(3))
|
||||
endef
|
||||
|
||||
define HostPy/Compile/Default
|
||||
$(call Build/Compile/HostPyMod,,\
|
||||
install --root="$(STAGING_DIR_HOSTPKG)" --prefix="" \
|
||||
--single-version-externally-managed \
|
||||
)
|
||||
endef
|
||||
|
||||
endif # __python_host_mk_inc
|
||||
23
lang/python/python/files/python-package-codecs.mk
Normal file
23
lang/python/python/files/python-package-codecs.mk
Normal file
@@ -0,0 +1,23 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Package/python-codecs
|
||||
$(call Package/python/Default)
|
||||
TITLE:=Python $(PYTHON_VERSION) codecs + unicode support
|
||||
DEPENDS:=+python-light
|
||||
endef
|
||||
|
||||
$(eval $(call PyBasePackage,python-codecs, \
|
||||
/usr/lib/python$(PYTHON_VERSION)/encodings \
|
||||
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_codecs_cn.so \
|
||||
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_codecs_hk.so \
|
||||
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_codecs_iso2022.so \
|
||||
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_codecs_jp.so \
|
||||
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_codecs_kr.so \
|
||||
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_codecs_tw.so \
|
||||
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/unicodedata.so \
|
||||
))
|
||||
16
lang/python/python/files/python-package-compiler.mk
Normal file
16
lang/python/python/files/python-package-compiler.mk
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Package/python-compiler
|
||||
$(call Package/python/Default)
|
||||
TITLE:=Python $(PYTHON_VERSION) compiler module
|
||||
DEPENDS:=+python-light
|
||||
endef
|
||||
|
||||
$(eval $(call PyBasePackage,python-compiler, \
|
||||
/usr/lib/python$(PYTHON_VERSION)/compiler \
|
||||
))
|
||||
18
lang/python/python/files/python-package-ctypes.mk
Normal file
18
lang/python/python/files/python-package-ctypes.mk
Normal file
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Package/python-ctypes
|
||||
$(call Package/python/Default)
|
||||
TITLE:=Python $(PYTHON_VERSION) ctypes module
|
||||
DEPENDS:=+python-light
|
||||
endef
|
||||
|
||||
$(eval $(call PyBasePackage,python-ctypes, \
|
||||
/usr/lib/python$(PYTHON_VERSION)/ctypes \
|
||||
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_ctypes.so \
|
||||
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_ctypes_test.so \
|
||||
))
|
||||
18
lang/python/python/files/python-package-db.mk
Normal file
18
lang/python/python/files/python-package-db.mk
Normal file
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Package/python-db
|
||||
$(call Package/python/Default)
|
||||
TITLE:=Python $(PYTHON_VERSION) db module
|
||||
DEPENDS:=+python-light +libdb47
|
||||
endef
|
||||
|
||||
$(eval $(call PyBasePackage,python-db, \
|
||||
/usr/lib/python$(PYTHON_VERSION)/bsddb \
|
||||
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_bsddb.so \
|
||||
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/dbm.so \
|
||||
))
|
||||
16
lang/python/python/files/python-package-decimal.mk
Normal file
16
lang/python/python/files/python-package-decimal.mk
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Package/python-decimal
|
||||
$(call Package/python/Default)
|
||||
TITLE:=Python $(PYTHON_VERSION) decimal module
|
||||
DEPENDS:=+python-light
|
||||
endef
|
||||
|
||||
$(eval $(call PyBasePackage,python-decimal, \
|
||||
/usr/lib/python$(PYTHON_VERSION)/decimal.py \
|
||||
))
|
||||
27
lang/python/python/files/python-package-dev.mk
Normal file
27
lang/python/python/files/python-package-dev.mk
Normal file
@@ -0,0 +1,27 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Package/python-dev
|
||||
$(call Package/python/Default)
|
||||
TITLE:=Python $(PYTHON_VERSION) development files
|
||||
DEPENDS:=+python +python-lib2to3
|
||||
endef
|
||||
|
||||
define PyPackage/python-dev/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/python*config $(1)/usr/bin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config/libpython$(PYTHON_VERSION).a $(1)/usr/lib
|
||||
endef
|
||||
|
||||
$(eval $(call PyBasePackage,python-dev, \
|
||||
/usr/lib/python$(PYTHON_VERSION)/config \
|
||||
/usr/include/python$(PYTHON_VERSION) \
|
||||
/usr/lib/pkgconfig \
|
||||
, \
|
||||
DO_NOT_ADD_TO_PACKAGE_DEPENDS \
|
||||
))
|
||||
|
||||
16
lang/python/python/files/python-package-distutils.mk
Normal file
16
lang/python/python/files/python-package-distutils.mk
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Package/python-distutils
|
||||
$(call Package/python/Default)
|
||||
TITLE:=Python $(PYTHON_VERSION) distutils
|
||||
DEPENDS:=+python-light
|
||||
endef
|
||||
|
||||
$(eval $(call PyBasePackage,python-distutils, \
|
||||
/usr/lib/python$(PYTHON_VERSION)/distutils \
|
||||
))
|
||||
16
lang/python/python/files/python-package-email.mk
Normal file
16
lang/python/python/files/python-package-email.mk
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Package/python-email
|
||||
$(call Package/python/Default)
|
||||
TITLE:=Python $(PYTHON_VERSION) email module
|
||||
DEPENDS:=+python-light
|
||||
endef
|
||||
|
||||
$(eval $(call PyBasePackage,python-email, \
|
||||
/usr/lib/python$(PYTHON_VERSION)/email \
|
||||
))
|
||||
16
lang/python/python/files/python-package-gdbm.mk
Normal file
16
lang/python/python/files/python-package-gdbm.mk
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Package/python-gdbm
|
||||
$(call Package/python/Default)
|
||||
TITLE:=Python $(PYTHON_VERSION) gdbm module
|
||||
DEPENDS:=+python-light +libgdbm
|
||||
endef
|
||||
|
||||
$(eval $(call PyBasePackage,python-gdbm, \
|
||||
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/gdbm.so \
|
||||
))
|
||||
70
lang/python/python/files/python-package-install.sh
Normal file
70
lang/python/python/files/python-package-install.sh
Normal file
@@ -0,0 +1,70 @@
|
||||
#!/bin/sh
|
||||
|
||||
process_filespec() {
|
||||
local src_dir="$1"
|
||||
local dst_dir="$2"
|
||||
local filespec="$3"
|
||||
echo "$filespec" | (
|
||||
IFS='|'
|
||||
while read fop fspec fperm; do
|
||||
local fop=`echo "$fop" | tr -d ' \t\n'`
|
||||
if [ "$fop" = "+" ]; then
|
||||
if [ ! -e "${src_dir}${fspec}" ]; then
|
||||
echo "File not found '${src_dir}${fspec}'"
|
||||
exit 1
|
||||
fi
|
||||
dpath=`dirname "$fspec"`
|
||||
if [ -z "$fperm" ]; then
|
||||
dperm=`stat -c "%a" ${src_dir}${dpath}`
|
||||
fi
|
||||
mkdir -p -m$dperm ${dst_dir}${dpath}
|
||||
echo "copying: '$fspec'"
|
||||
cp -fpR ${src_dir}${fspec} ${dst_dir}${dpath}/
|
||||
if [ -n "$fperm" ]; then
|
||||
chmod -R $fperm ${dst_dir}${fspec}
|
||||
fi
|
||||
elif [ "$fop" = "-" ]; then
|
||||
echo "removing: '$fspec'"
|
||||
rm -fR ${dst_dir}${fspec}
|
||||
elif [ "$fop" = "=" ]; then
|
||||
echo "setting permissions: '$fperm' on '$fspec'"
|
||||
chmod -R $fperm ${dst_dir}${fspec}
|
||||
fi
|
||||
done
|
||||
)
|
||||
}
|
||||
|
||||
src_dir="$1"
|
||||
dst_dir="$2"
|
||||
python="$3"
|
||||
mode="$4"
|
||||
filespec="$5"
|
||||
|
||||
process_filespec "$src_dir" "$dst_dir" "$filespec" || {
|
||||
echo "process filespec error-ed"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "$mode" == "sources" ] ; then
|
||||
# Copy only python source files
|
||||
find $dst_dir -not -name "*\.py" | xargs rm -f
|
||||
# Delete empty folders (if the case)
|
||||
find $dst_dir/usr -type d | xargs rmdir &> /dev/null
|
||||
rmdir $dst_dir/usr &> /dev/null
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# XXX [So that you won't goof as I did]
|
||||
# Note: Yes, I tried to use the -O & -OO flags here.
|
||||
# However the generated byte-codes were not portable.
|
||||
# So, we just stuck to un-optimized byte-codes,
|
||||
# which is still way better/faster than running
|
||||
# Python sources all the time.
|
||||
$python -m compileall -d '/' $dst_dir || {
|
||||
echo "python -m compileall err-ed"
|
||||
exit 1
|
||||
}
|
||||
# Delete source files and pyc [ un-optimized bytecode files ]
|
||||
# We may want to make this optimization thing configurable later, but not sure atm
|
||||
find $dst_dir -name "*\.py" | xargs rm -f
|
||||
|
||||
18
lang/python/python/files/python-package-lib2to3.mk
Normal file
18
lang/python/python/files/python-package-lib2to3.mk
Normal file
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Package/python-lib2to3
|
||||
$(call Package/python/Default)
|
||||
TITLE:=Python $(PYTHON_VERSION) lib2to3 module
|
||||
DEPENDS:=+python
|
||||
endef
|
||||
|
||||
$(eval $(call PyBasePackage,python-lib2to3, \
|
||||
/usr/lib/python$(PYTHON_VERSION)/lib2to3 \
|
||||
, \
|
||||
DO_NOT_ADD_TO_PACKAGE_DEPENDS \
|
||||
))
|
||||
16
lang/python/python/files/python-package-logging.mk
Normal file
16
lang/python/python/files/python-package-logging.mk
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Package/python-logging
|
||||
$(call Package/python/Default)
|
||||
TITLE:=Python $(PYTHON_VERSION) logging module
|
||||
DEPENDS:=+python-light
|
||||
endef
|
||||
|
||||
$(eval $(call PyBasePackage,python-logging, \
|
||||
/usr/lib/python$(PYTHON_VERSION)/logging \
|
||||
))
|
||||
17
lang/python/python/files/python-package-multiprocessing.mk
Normal file
17
lang/python/python/files/python-package-multiprocessing.mk
Normal file
@@ -0,0 +1,17 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Package/python-multiprocessing
|
||||
$(call Package/python/Default)
|
||||
TITLE:=Python $(PYTHON_VERSION) multiprocessing
|
||||
DEPENDS:=+python-light
|
||||
endef
|
||||
|
||||
$(eval $(call PyBasePackage,python-multiprocessing, \
|
||||
/usr/lib/python$(PYTHON_VERSION)/multiprocessing \
|
||||
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_multiprocessing.so \
|
||||
))
|
||||
18
lang/python/python/files/python-package-ncurses.mk
Normal file
18
lang/python/python/files/python-package-ncurses.mk
Normal file
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Package/python-ncurses
|
||||
$(call Package/python/Default)
|
||||
TITLE:=Python $(PYTHON_VERSION) ncurses module
|
||||
DEPENDS:=+python-light +libncurses
|
||||
endef
|
||||
|
||||
$(eval $(call PyBasePackage,python-ncurses, \
|
||||
/usr/lib/python$(PYTHON_VERSION)/curses \
|
||||
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_curses.so \
|
||||
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_curses_panel.so \
|
||||
))
|
||||
17
lang/python/python/files/python-package-openssl.mk
Normal file
17
lang/python/python/files/python-package-openssl.mk
Normal file
@@ -0,0 +1,17 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Package/python-openssl
|
||||
$(call Package/python/Default)
|
||||
TITLE:=Python $(PYTHON_VERSION) SSL module
|
||||
DEPENDS:=+python-light +libopenssl
|
||||
endef
|
||||
|
||||
$(eval $(call PyBasePackage,python-openssl, \
|
||||
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_hashlib.so \
|
||||
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_ssl.so \
|
||||
))
|
||||
28
lang/python/python/files/python-package-pip.mk
Normal file
28
lang/python/python/files/python-package-pip.mk
Normal file
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# Copyright (C) 2017 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Package/python-pip
|
||||
$(call Package/python/Default)
|
||||
TITLE:=Python $(PYTHON_VERSION) pip module
|
||||
VERSION:=$(PYTHON_PIP_VERSION)
|
||||
DEPENDS:=+python +python-setuptools +python-pip-conf
|
||||
endef
|
||||
|
||||
define PyPackage/python-pip/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/python$(PYTHON_VERSION)/site-packages
|
||||
# Adjust shebang to proper python location on target
|
||||
sed "1s/.*/#\!\/usr\/bin\/python$(PYTHON_VERSION)/" -i $(PKG_BUILD_DIR)/install-pip/bin/*
|
||||
$(CP) $(PKG_BUILD_DIR)/install-pip/bin/* $(1)/usr/bin
|
||||
$(CP) \
|
||||
$(PKG_BUILD_DIR)/install-pip/lib/python$(PYTHON_VERSION)/site-packages/pip \
|
||||
$(1)/usr/lib/python$(PYTHON_VERSION)/site-packages/
|
||||
endef
|
||||
|
||||
$(eval $(call PyBasePackage,python-pip, \
|
||||
, \
|
||||
DO_NOT_ADD_TO_PACKAGE_DEPENDS \
|
||||
))
|
||||
18
lang/python/python/files/python-package-pydoc.mk
Normal file
18
lang/python/python/files/python-package-pydoc.mk
Normal file
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Package/python-pydoc
|
||||
$(call Package/python/Default)
|
||||
TITLE:=Python $(PYTHON_VERSION) pydoc module
|
||||
DEPENDS:=+python-light
|
||||
endef
|
||||
|
||||
$(eval $(call PyBasePackage,python-pydoc, \
|
||||
/usr/lib/python$(PYTHON_VERSION)/doctest.py \
|
||||
/usr/lib/python$(PYTHON_VERSION)/pydoc.py \
|
||||
/usr/lib/python$(PYTHON_VERSION)/pydoc_data \
|
||||
))
|
||||
30
lang/python/python/files/python-package-setuptools.mk
Normal file
30
lang/python/python/files/python-package-setuptools.mk
Normal file
@@ -0,0 +1,30 @@
|
||||
#
|
||||
# Copyright (C) 2017 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Package/python-setuptools
|
||||
$(call Package/python/Default)
|
||||
TITLE:=Python $(PYTHON_VERSION) setuptools module
|
||||
VERSION:=$(PYTHON_SETUPTOOLS_VERSION)
|
||||
DEPENDS:=+python
|
||||
endef
|
||||
|
||||
define PyPackage/python-setuptools/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/python$(PYTHON_VERSION)/site-packages
|
||||
# Adjust shebang to proper python location on target
|
||||
sed "1s/.*/#\!\/usr\/bin\/python$(PYTHON_VERSION)/" -i $(PKG_BUILD_DIR)/install-setuptools/bin/*
|
||||
$(CP) $(PKG_BUILD_DIR)/install-setuptools/bin/* $(1)/usr/bin
|
||||
$(CP) \
|
||||
$(PKG_BUILD_DIR)/install-setuptools/lib/python$(PYTHON_VERSION)/site-packages/pkg_resources \
|
||||
$(PKG_BUILD_DIR)/install-setuptools/lib/python$(PYTHON_VERSION)/site-packages/setuptools \
|
||||
$(PKG_BUILD_DIR)/install-setuptools/lib/python$(PYTHON_VERSION)/site-packages/easy_install.py \
|
||||
$(1)/usr/lib/python$(PYTHON_VERSION)/site-packages
|
||||
endef
|
||||
|
||||
$(eval $(call PyBasePackage,python-setuptools, \
|
||||
, \
|
||||
DO_NOT_ADD_TO_PACKAGE_DEPENDS \
|
||||
))
|
||||
17
lang/python/python/files/python-package-sqlite3.mk
Normal file
17
lang/python/python/files/python-package-sqlite3.mk
Normal file
@@ -0,0 +1,17 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Package/python-sqlite3
|
||||
$(call Package/python/Default)
|
||||
TITLE:=Python $(PYTHON_VERSION) sqlite3 module
|
||||
DEPENDS:=+python-light +libsqlite3
|
||||
endef
|
||||
|
||||
$(eval $(call PyBasePackage,python-sqlite3, \
|
||||
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_sqlite3.so \
|
||||
/usr/lib/python$(PYTHON_VERSION)/sqlite3 \
|
||||
))
|
||||
16
lang/python/python/files/python-package-unittest.mk
Normal file
16
lang/python/python/files/python-package-unittest.mk
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Package/python-unittest
|
||||
$(call Package/python/Default)
|
||||
TITLE:=Python $(PYTHON_VERSION) unittest module
|
||||
DEPENDS:=+python-light
|
||||
endef
|
||||
|
||||
$(eval $(call PyBasePackage,python-unittest, \
|
||||
/usr/lib/python$(PYTHON_VERSION)/unittest \
|
||||
))
|
||||
20
lang/python/python/files/python-package-xml.mk
Normal file
20
lang/python/python/files/python-package-xml.mk
Normal file
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Package/python-xml
|
||||
$(call Package/python/Default)
|
||||
TITLE:=Python $(PYTHON_VERSION) xml libs
|
||||
DEPENDS:=+python-light +libexpat
|
||||
endef
|
||||
|
||||
$(eval $(call PyBasePackage,python-xml, \
|
||||
/usr/lib/python$(PYTHON_VERSION)/xml \
|
||||
/usr/lib/python$(PYTHON_VERSION)/xmllib.py \
|
||||
/usr/lib/python$(PYTHON_VERSION)/xmlrpclib.py \
|
||||
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_elementtree.so \
|
||||
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/pyexpat.so \
|
||||
))
|
||||
137
lang/python/python/files/python-package.mk
Normal file
137
lang/python/python/files/python-package.mk
Normal file
@@ -0,0 +1,137 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
$(call include_mk, python-version.mk)
|
||||
|
||||
PYTHON_DIR:=$(STAGING_DIR)/usr
|
||||
PYTHON_BIN_DIR:=$(PYTHON_DIR)/bin
|
||||
PYTHON_INC_DIR:=$(PYTHON_DIR)/include/python$(PYTHON_VERSION)
|
||||
PYTHON_LIB_DIR:=$(PYTHON_DIR)/lib/python$(PYTHON_VERSION)
|
||||
|
||||
PYTHON_PKG_DIR:=/usr/lib/python$(PYTHON_VERSION)/site-packages
|
||||
|
||||
PYTHON:=python$(PYTHON_VERSION)
|
||||
|
||||
PYTHONPATH:=$(PYTHON_LIB_DIR):$(STAGING_DIR)/$(PYTHON_PKG_DIR):$(PKG_INSTALL_DIR)/$(PYTHON_PKG_DIR)
|
||||
|
||||
# These configure args are needed in detection of path to Python header files
|
||||
# using autotools.
|
||||
CONFIGURE_ARGS += \
|
||||
_python_sysroot="$(STAGING_DIR)" \
|
||||
_python_prefix="/usr" \
|
||||
_python_exec_prefix="/usr"
|
||||
|
||||
PKG_USE_MIPS16:=0
|
||||
# This is required in addition to PKG_USE_MIPS16:=0 because otherwise MIPS16
|
||||
# flags are inherited from the Python base package (via sysconfig module)
|
||||
ifdef CONFIG_USE_MIPS16
|
||||
TARGET_CFLAGS += -mno-mips16 -mno-interlink-mips16
|
||||
endif
|
||||
|
||||
define PyPackage
|
||||
|
||||
define Package/$(1)-src
|
||||
$(call Package/$(1))
|
||||
TITLE+= (sources)
|
||||
DEPENDS:=$$$$(foreach dep,$$$$(filter +python-%,$$$$(DEPENDS)),$$$$(dep)-src)
|
||||
endef
|
||||
|
||||
define Package/$(1)-src/description
|
||||
$(call Package/$(1)/description).
|
||||
(Contains the Python sources for this package).
|
||||
endef
|
||||
|
||||
# Add default PyPackage filespec none defined
|
||||
ifndef PyPackage/$(1)/filespec
|
||||
define PyPackage/$(1)/filespec
|
||||
+|$(PYTHON_PKG_DIR)
|
||||
endef
|
||||
endif
|
||||
|
||||
ifndef PyPackage/$(1)/install
|
||||
define PyPackage/$(1)/install
|
||||
if [ -d $(PKG_INSTALL_DIR)/usr/bin ]; then \
|
||||
$(INSTALL_DIR) $$(1)/usr/bin ; \
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/* $$(1)/usr/bin/ ; \
|
||||
fi
|
||||
endef
|
||||
endif
|
||||
|
||||
$(call shexport,PyPackage/$(1)/filespec)
|
||||
|
||||
define Package/$(1)/install
|
||||
$(call PyPackage/$(1)/install,$$(1))
|
||||
find $(PKG_INSTALL_DIR) -name "*\.exe" | xargs rm -f
|
||||
if [ -e files/python-package-install.sh ] ; then \
|
||||
$(SHELL) files/python-package-install.sh \
|
||||
"$(PKG_INSTALL_DIR)" "$$(1)" \
|
||||
"$(HOST_PYTHON_BIN)" "$$(2)" \
|
||||
"$$$$$$$$$$(call shvar,PyPackage/$(1)/filespec)" ; \
|
||||
elif [ -e $(STAGING_DIR)/mk/python-package-install.sh ] ; then \
|
||||
$(SHELL) $(STAGING_DIR)/mk/python-package-install.sh \
|
||||
"$(PKG_INSTALL_DIR)" "$$(1)" \
|
||||
"$(HOST_PYTHON_BIN)" "$$(2)" \
|
||||
"$$$$$$$$$$(call shvar,PyPackage/$(1)/filespec)" ; \
|
||||
else \
|
||||
echo "No 'python-package-install.sh' script found" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
endef
|
||||
|
||||
define Package/$(1)-src/install
|
||||
$$(call Package/$(1)/install,$$(1),sources)
|
||||
endef
|
||||
endef
|
||||
|
||||
$(call include_mk, python-host.mk)
|
||||
|
||||
# $(1) => commands to execute before running pythons script
|
||||
# $(2) => python script and its arguments
|
||||
# $(3) => additional variables
|
||||
define Build/Compile/HostPyRunTarget
|
||||
$(call HostPython, \
|
||||
$(if $(1),$(1);) \
|
||||
CC="$(TARGET_CC)" \
|
||||
CCSHARED="$(TARGET_CC) $(FPIC)" \
|
||||
CXX="$(TARGET_CXX)" \
|
||||
LD="$(TARGET_CC)" \
|
||||
LDSHARED="$(TARGET_CC) -shared" \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PYTHON_INC_DIR)" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS) -lpython$(PYTHON_VERSION)" \
|
||||
_PYTHON_HOST_PLATFORM=linux2 \
|
||||
__PYVENV_LAUNCHER__="/usr/bin/$(PYTHON)" \
|
||||
$(3) \
|
||||
, \
|
||||
$(2) \
|
||||
)
|
||||
endef
|
||||
|
||||
# $(1) => build subdir
|
||||
# $(2) => additional arguments to setup.py
|
||||
# $(3) => additional variables
|
||||
define Build/Compile/PyMod
|
||||
$(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON_PKG_DIR)
|
||||
$(call Build/Compile/HostPyRunTarget, \
|
||||
cd $(PKG_BUILD_DIR)/$(strip $(1)), \
|
||||
./setup.py $(2), \
|
||||
$(3))
|
||||
find $(PKG_INSTALL_DIR) -name "*\.exe" | xargs rm -f
|
||||
endef
|
||||
|
||||
define PyBuild/Compile/Default
|
||||
$(call Build/Compile/PyMod,, \
|
||||
install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \
|
||||
--single-version-externally-managed \
|
||||
)
|
||||
endef
|
||||
|
||||
ifeq ($(BUILD_VARIANT),python)
|
||||
define Build/Compile
|
||||
$(call PyBuild/Compile/Default)
|
||||
endef
|
||||
endif # python
|
||||
13
lang/python/python/files/python-version.mk
Normal file
13
lang/python/python/files/python-version.mk
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# Copyright (C) 2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
PYTHON_VERSION:=2.7
|
||||
PYTHON_VERSION_MICRO:=13
|
||||
|
||||
PYTHON_SETUPTOOLS_VERSION:=28.8.0
|
||||
PYTHON_PIP_VERSION:=9.0.1
|
||||
|
||||
25
lang/python/python/patches/001-enable-zlib.patch
Normal file
25
lang/python/python/patches/001-enable-zlib.patch
Normal file
@@ -0,0 +1,25 @@
|
||||
From 6eeab87bc852481e599325549c854b701bf2e39f Mon Sep 17 00:00:00 2001
|
||||
From: Alexandru Ardelean <aa@ocedo.com>
|
||||
Date: Thu, 25 Sep 2014 18:18:29 +0300
|
||||
Subject: [PATCH] enable zlib
|
||||
|
||||
---
|
||||
Modules/Setup.dist | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Modules/Setup.dist b/Modules/Setup.dist
|
||||
index 01fb85f..01ac492 100644
|
||||
--- a/Modules/Setup.dist
|
||||
+++ b/Modules/Setup.dist
|
||||
@@ -358,7 +358,7 @@ _symtable symtablemodule.c
|
||||
# Andrew Kuchling's zlib module.
|
||||
# This require zlib 1.1.3 (or later).
|
||||
# See http://www.gzip.org/zlib/
|
||||
-#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
|
||||
+zlib zlibmodule.c -lz
|
||||
|
||||
# Interface to the Expat XML parser
|
||||
#
|
||||
--
|
||||
1.8.4.5
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
diff --git a/setup.py b/setup.py
|
||||
index cbdeaf3..5154412 100644
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -480,7 +480,8 @@ class PyBuildExt(build_ext):
|
||||
add_dir_to_list(dir_list, directory)
|
||||
|
||||
if os.path.normpath(sys.prefix) != '/usr' \
|
||||
- and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
|
||||
+ and not sysconfig.get_config_var('PYTHONFRAMEWORK') \
|
||||
+ and not cross_compiling:
|
||||
# OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
|
||||
# (PYTHONFRAMEWORK is set) to avoid # linking problems when
|
||||
# building a framework with different architectures than
|
||||
@@ -0,0 +1,20 @@
|
||||
diff --git a/Makefile.pre.in b/Makefile.pre.in
|
||||
index 7f4ec2f..e270bf2 100644
|
||||
--- a/Makefile.pre.in
|
||||
+++ b/Makefile.pre.in
|
||||
@@ -1038,6 +1038,7 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
|
||||
done; \
|
||||
done
|
||||
$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
|
||||
+ifeq (@COMPILE_ALL_TESTS@,yes)
|
||||
if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \
|
||||
$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
|
||||
$(DESTDIR)$(LIBDEST)/distutils/tests ; \
|
||||
@@ -1064,6 +1065,7 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
|
||||
$(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
|
||||
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
||||
$(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
|
||||
+endif
|
||||
|
||||
# Create the PLATDIR source directory, if one wasn't distributed..
|
||||
$(srcdir)/Lib/$(PLATDIR):
|
||||
@@ -0,0 +1,22 @@
|
||||
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
|
||||
index 748a63b..cb6e291 100644
|
||||
--- a/Python/pythonrun.c
|
||||
+++ b/Python/pythonrun.c
|
||||
@@ -79,7 +79,7 @@ int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */
|
||||
int Py_InspectFlag; /* Needed to determine whether to exit at SystemExit */
|
||||
int Py_NoSiteFlag; /* Suppress 'import site' */
|
||||
int Py_BytesWarningFlag; /* Warn on str(bytes) and str(buffer) */
|
||||
-int Py_DontWriteBytecodeFlag; /* Suppress writing bytecode files (*.py[co]) */
|
||||
+int Py_DontWriteBytecodeFlag = 1; /* Suppress writing bytecode files (*.py[co]) */
|
||||
int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c: deprecated */
|
||||
int Py_FrozenFlag; /* Needed by getpath.c */
|
||||
int Py_UnicodeFlag = 0; /* Needed by compile.c */
|
||||
@@ -174,7 +174,7 @@ Py_InitializeEx(int install_sigs)
|
||||
if ((p = Py_GETENV("PYTHONOPTIMIZE")) && *p != '\0')
|
||||
Py_OptimizeFlag = add_flag(Py_OptimizeFlag, p);
|
||||
if ((p = Py_GETENV("PYTHONDONTWRITEBYTECODE")) && *p != '\0')
|
||||
- Py_DontWriteBytecodeFlag = add_flag(Py_DontWriteBytecodeFlag, p);
|
||||
+ Py_DontWriteBytecodeFlag = atoi(p);
|
||||
/* The variable is only tested for existence here; _PyRandom_Init will
|
||||
check its value further. */
|
||||
if ((p = Py_GETENV("PYTHONHASHSEED")) && *p != '\0')
|
||||
@@ -0,0 +1,14 @@
|
||||
diff --git a/setup.py b/setup.py
|
||||
index 1d1ae72..511aed5 100644
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -444,7 +444,8 @@ class PyBuildExt(build_ext):
|
||||
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
|
||||
if cross_compiling:
|
||||
self.add_gcc_paths()
|
||||
- self.add_multiarch_paths()
|
||||
+ else:
|
||||
+ self.add_multiarch_paths()
|
||||
|
||||
# Add paths specified in the environment variables LDFLAGS and
|
||||
# CPPFLAGS for header and library files.
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/Lib/distutils/command/build_scripts.py
|
||||
+++ b/Lib/distutils/command/build_scripts.py
|
||||
@@ -89,6 +89,7 @@ class build_scripts (Command):
|
||||
adjust = 1
|
||||
post_interp = match.group(1) or ''
|
||||
|
||||
+ adjust = 0
|
||||
if adjust:
|
||||
log.info("copying and adjusting %s -> %s", script,
|
||||
self.build_dir)
|
||||
@@ -0,0 +1,54 @@
|
||||
Adjust library/header paths for cross-compilation
|
||||
|
||||
When cross-compiling third-party extensions, the get_python_inc() or
|
||||
get_python_lib() can be called, to return the path to headers or
|
||||
libraries. However, they use the sys.prefix of the host Python, which
|
||||
returns incorrect paths when cross-compiling (paths pointing to host
|
||||
headers and libraries).
|
||||
|
||||
In order to fix this, we introduce the _python_sysroot, _python_prefix
|
||||
and _python_exec_prefix variables, that allow to override these
|
||||
values, and get correct header/library paths when cross-compiling
|
||||
third-party Python modules.
|
||||
|
||||
The _python_sysroot variable is also used to prefix the LIBDIR value
|
||||
taken from the sysconfigdata module.
|
||||
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
|
||||
Index: b/Lib/distutils/sysconfig.py
|
||||
===================================================================
|
||||
--- a/Lib/distutils/sysconfig.py
|
||||
+++ b/Lib/distutils/sysconfig.py
|
||||
@@ -19,8 +19,13 @@
|
||||
from distutils.errors import DistutilsPlatformError
|
||||
|
||||
# These are needed in a couple of spots, so just compute them once.
|
||||
-PREFIX = os.path.normpath(sys.prefix)
|
||||
-EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
|
||||
+if "_python_sysroot" in os.environ:
|
||||
+ _sysroot=os.environ.get('_python_sysroot')
|
||||
+ PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_prefix'))
|
||||
+ EXEC_PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_exec_prefix'))
|
||||
+else:
|
||||
+ PREFIX = os.path.normpath(sys.prefix)
|
||||
+ EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
|
||||
|
||||
# Path to the base directory of the project. On Windows the binary may
|
||||
# live in project/PCBuild9. If we're dealing with an x64 Windows build,
|
||||
Index: b/Lib/distutils/command/build_ext.py
|
||||
===================================================================
|
||||
--- a/Lib/distutils/command/build_ext.py
|
||||
+++ b/Lib/distutils/command/build_ext.py
|
||||
@@ -237,7 +237,10 @@
|
||||
if (sysconfig.get_config_var('Py_ENABLE_SHARED')):
|
||||
if not sysconfig.python_build:
|
||||
# building third party extensions
|
||||
- self.library_dirs.append(sysconfig.get_config_var('LIBDIR'))
|
||||
+ libdir = sysconfig.get_config_var('LIBDIR')
|
||||
+ if "_python_sysroot" in os.environ:
|
||||
+ libdir = os.environ.get("_python_sysroot") + libdir
|
||||
+ self.library_dirs.append(libdir)
|
||||
else:
|
||||
# building python standard extensions
|
||||
self.library_dirs.append('.')
|
||||
@@ -0,0 +1,34 @@
|
||||
diff --git a/setup.py b/setup.py
|
||||
index 7868b7b..10ec68f 100644
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -1067,6 +1067,7 @@ class PyBuildExt(build_ext):
|
||||
if db_setup_debug: print "db lib: ", dblib, "not found"
|
||||
|
||||
except db_found:
|
||||
+ rt_dblib_dir = None if cross_compiling else dblib_dir
|
||||
if db_setup_debug:
|
||||
print "bsddb using BerkeleyDB lib:", db_ver, dblib
|
||||
print "bsddb lib dir:", dblib_dir, " inc dir:", db_incdir
|
||||
@@ -1081,7 +1082,7 @@ class PyBuildExt(build_ext):
|
||||
exts.append(Extension('_bsddb', ['_bsddb.c'],
|
||||
depends = ['bsddb.h'],
|
||||
library_dirs=dblib_dir,
|
||||
- runtime_library_dirs=dblib_dir,
|
||||
+ runtime_library_dirs=rt_dblib_dir,
|
||||
include_dirs=db_incs,
|
||||
libraries=dblibs))
|
||||
else:
|
||||
@@ -1292,10 +1293,11 @@ class PyBuildExt(build_ext):
|
||||
break
|
||||
elif cand == "bdb":
|
||||
if db_incs is not None:
|
||||
+ rt_dblib_dir = None if cross_compiling else dblib_dir
|
||||
print "building dbm using bdb"
|
||||
dbmext = Extension('dbm', ['dbmmodule.c'],
|
||||
library_dirs=dblib_dir,
|
||||
- runtime_library_dirs=dblib_dir,
|
||||
+ runtime_library_dirs=rt_dblib_dir,
|
||||
include_dirs=db_incs,
|
||||
define_macros=[
|
||||
('HAVE_BERKDB_H', None),
|
||||
@@ -0,0 +1,15 @@
|
||||
diff --git a/setup.py b/setup.py
|
||||
index 7868b7b..544fa7e 100644
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -452,8 +452,9 @@ class PyBuildExt(build_ext):
|
||||
# directly since an inconsistently reproducible issue comes up where
|
||||
# the environment variable is not set even though the value were passed
|
||||
# into configure and stored in the Makefile (issue found on OS X 10.3).
|
||||
+ rt_lib_dirs = [] if cross_compiling else self.compiler.runtime_library_dirs
|
||||
for env_var, arg_name, dir_list in (
|
||||
- ('LDFLAGS', '-R', self.compiler.runtime_library_dirs),
|
||||
+ ('LDFLAGS', '-R', rt_lib_dirs),
|
||||
('LDFLAGS', '-L', self.compiler.library_dirs),
|
||||
('CPPFLAGS', '-I', self.compiler.include_dirs)):
|
||||
env_val = sysconfig.get_config_var(env_var)
|
||||
@@ -0,0 +1,12 @@
|
||||
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
|
||||
index e478a57..eb297b4 100644
|
||||
--- a/Modules/_cursesmodule.c
|
||||
+++ b/Modules/_cursesmodule.c
|
||||
@@ -117,7 +117,6 @@ char *PyCursesVersion = "2.2";
|
||||
#defines many common symbols (such as "lines") which breaks the
|
||||
curses module in other ways. So the code will just specify
|
||||
explicit prototypes here. */
|
||||
-extern int setupterm(char *,int,int *);
|
||||
#ifdef __sgi
|
||||
#include <term.h>
|
||||
#endif
|
||||
Reference in New Issue
Block a user