From a1fe8c48aae5058bbcd18c03194858700c249ef5 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Thu, 16 Oct 2014 08:46:32 +0300 Subject: python3: reduce bloat by removing *.pyo and *.pyc files Seems that if you add a package folder this would also include the compiled python3 files which increases fw size. Signed-off-by: Alexandru Ardelean --- lang/python3/files/python3-package.mk | 1 + 1 file changed, 1 insertion(+) (limited to 'lang/python3/files/python3-package.mk') diff --git a/lang/python3/files/python3-package.mk b/lang/python3/files/python3-package.mk index e85b64819..090d84601 100644 --- a/lang/python3/files/python3-package.mk +++ b/lang/python3/files/python3-package.mk @@ -32,6 +32,7 @@ define Py3Package $(call shexport,Py3Package/$(1)/filespec) define Package/$(1)/install + find $(PKG_INSTALL_DIR) -name "*\.pyc" -o -name "*\.pyo" | xargs rm -f @$(SH_FUNC) getvar $$(call shvar,Py3Package/$(1)/filespec) | ( \ IFS='|'; \ while read fop fspec fperm; do \ -- cgit From 885fe99cd29ea6b056e816ff78dd750b0e7dde8b Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Thu, 16 Oct 2014 16:15:56 +0300 Subject: python3: enforce the existence of files in the filespecs Seems that this allows some goofs, because some files silently do not get copied and the build succeeds, even though it shouldn't. Signed-off-by: Alexandru Ardelean --- lang/python3/files/python3-package.mk | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lang/python3/files/python3-package.mk') diff --git a/lang/python3/files/python3-package.mk b/lang/python3/files/python3-package.mk index 090d84601..7808d9ecd 100644 --- a/lang/python3/files/python3-package.mk +++ b/lang/python3/files/python3-package.mk @@ -37,6 +37,10 @@ define Py3Package IFS='|'; \ while read fop fspec fperm; do \ if [ "$$$$$$$$fop" = "+" ]; then \ + if [ ! -e "$(PKG_INSTALL_DIR)$$$$$$$$fspec" ]; then \ + echo "File not found '$(PKG_INSTALL_DIR)$$$$$$$$fspec'"; \ + exit 1; \ + fi; \ dpath=`dirname "$$$$$$$$fspec"`; \ if [ -n "$$$$$$$$fperm" ]; then \ dperm="-m$$$$$$$$fperm"; \ -- cgit From f729ba98c5ba44523202e4bfe98c863830dd818c Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Sun, 19 Oct 2014 00:45:59 +0300 Subject: python3: export CC + CCSHARED env vars to cross-compile Python C extensions properly Signed-off-by: Alexandru Ardelean --- lang/python3/files/python3-package.mk | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lang/python3/files/python3-package.mk') diff --git a/lang/python3/files/python3-package.mk b/lang/python3/files/python3-package.mk index 7808d9ecd..d5028d002 100644 --- a/lang/python3/files/python3-package.mk +++ b/lang/python3/files/python3-package.mk @@ -72,6 +72,8 @@ endef define Build/Compile/Py3Mod $(call HostPython3, \ cd $(PKG_BUILD_DIR)/$(strip $(1)); \ + CC="$(TARGET_CC)" \ + CCSHARED="$(TARGET_CC) $(FPIC)" \ CFLAGS="$(TARGET_CFLAGS)" \ CPPFLAGS="$(TARGET_CPPFLAGS)" \ LDFLAGS="$(TARGET_LDFLAGS)" \ -- cgit From 3edeed3f4dc93b545f18f7b78c554d655fca51f1 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Sun, 19 Oct 2014 10:03:44 +0300 Subject: python3: add PYTHON3_INC_DIR var to CPPFLAGS The target's PYTHON3_INC_DIR should take precedence over the host's include dir when cross-compiling. Signed-off-by: Alexandru Ardelean --- lang/python3/files/python3-package.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lang/python3/files/python3-package.mk') diff --git a/lang/python3/files/python3-package.mk b/lang/python3/files/python3-package.mk index d5028d002..ef5fbd6d7 100644 --- a/lang/python3/files/python3-package.mk +++ b/lang/python3/files/python3-package.mk @@ -75,7 +75,7 @@ define Build/Compile/Py3Mod CC="$(TARGET_CC)" \ CCSHARED="$(TARGET_CC) $(FPIC)" \ CFLAGS="$(TARGET_CFLAGS)" \ - CPPFLAGS="$(TARGET_CPPFLAGS)" \ + CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PYTHON3_INC_DIR)" \ LDFLAGS="$(TARGET_LDFLAGS)" \ $(3) \ , \ -- cgit From cc6423d57ab4a34dc18aa7420cc8203e65bd097d Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Sun, 19 Oct 2014 10:21:03 +0300 Subject: python3: add LD and LDSHARED env vars to Build/Compile/Py3Mod Tells the host Python to use the target's linker. Signed-off-by: Alexandru Ardelean --- lang/python3/files/python3-package.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lang/python3/files/python3-package.mk') diff --git a/lang/python3/files/python3-package.mk b/lang/python3/files/python3-package.mk index ef5fbd6d7..f29cd7f07 100644 --- a/lang/python3/files/python3-package.mk +++ b/lang/python3/files/python3-package.mk @@ -74,9 +74,11 @@ define Build/Compile/Py3Mod cd $(PKG_BUILD_DIR)/$(strip $(1)); \ CC="$(TARGET_CC)" \ CCSHARED="$(TARGET_CC) $(FPIC)" \ + LD="$(TARGET_CC)" \ + LDSHARED="$(TARGET_CC) -shared" \ CFLAGS="$(TARGET_CFLAGS)" \ CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PYTHON3_INC_DIR)" \ - LDFLAGS="$(TARGET_LDFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS) -lpython$(PYTHON3_VERSION)" \ $(3) \ , \ ./setup.py $(2) \ -- cgit From 056e565ab646f991ad7b3a9dd95f63ad50248f3b Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Sun, 19 Oct 2014 21:17:33 +0300 Subject: python3: add _PYTHON_HOST_PLATFORM env var when cross-compiling C extensions This mostly helps to avoid confusion when modules are cross-compiled. Otherwise build folders are named with the host's platform name. Signed-off-by: Alexandru Ardelean --- lang/python3/files/python3-package.mk | 1 + 1 file changed, 1 insertion(+) (limited to 'lang/python3/files/python3-package.mk') diff --git a/lang/python3/files/python3-package.mk b/lang/python3/files/python3-package.mk index f29cd7f07..e2e71d3e0 100644 --- a/lang/python3/files/python3-package.mk +++ b/lang/python3/files/python3-package.mk @@ -79,6 +79,7 @@ define Build/Compile/Py3Mod CFLAGS="$(TARGET_CFLAGS)" \ CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PYTHON3_INC_DIR)" \ LDFLAGS="$(TARGET_LDFLAGS) -lpython$(PYTHON3_VERSION)" \ + _PYTHON_HOST_PLATFORM="linux-$(ARCH)" \ $(3) \ , \ ./setup.py $(2) \ -- cgit