From 714b1247b70b8b2c185aa30ae914fd90de826f41 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Thu, 16 Oct 2014 08:46:32 +0300 Subject: [PATCH 1/7] python: reduce bloat by removing *.pyo and *.pyc files Seems that if you add a package folder this would also include the compiled python files which increases fw size. Signed-off-by: Alexandru Ardelean --- lang/python/files/python-package.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/lang/python/files/python-package.mk b/lang/python/files/python-package.mk index 0196beeb6..6ac6051fa 100644 --- a/lang/python/files/python-package.mk +++ b/lang/python/files/python-package.mk @@ -32,6 +32,7 @@ define PyPackage $(call shexport,PyPackage/$(1)/filespec) define Package/$(1)/install + find $(PKG_INSTALL_DIR) -name "*\.pyc" -o -name "*\.pyo" | xargs rm -f @$(SH_FUNC) getvar $$(call shvar,PyPackage/$(1)/filespec) | ( \ IFS='|'; \ while read fop fspec fperm; do \ From 09c02844e497998dde3850fe231a3cc2d42f8125 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Thu, 16 Oct 2014 16:15:56 +0300 Subject: [PATCH 2/7] python: 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/python/files/python-package.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lang/python/files/python-package.mk b/lang/python/files/python-package.mk index 6ac6051fa..dc30494fe 100644 --- a/lang/python/files/python-package.mk +++ b/lang/python/files/python-package.mk @@ -37,6 +37,10 @@ define PyPackage 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"; \ From aafbac886eb7ebcad876c1a49c8e085b059727e6 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Fri, 17 Oct 2014 16:34:12 +0300 Subject: [PATCH 3/7] python: patch setup.py so that it does not include system include dirs Seems that the Python C extensions were being (or at least trying to be) build using '/usr/include' as the first include folder. Seems this issue was already fixed on MacOS X and now we've extended it for our case. Signed-off-by: Alexandru Ardelean --- ...not-add-include-dirs-when-cross-compiling.patch | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lang/python/patches/120-do-not-add-include-dirs-when-cross-compiling.patch diff --git a/lang/python/patches/120-do-not-add-include-dirs-when-cross-compiling.patch b/lang/python/patches/120-do-not-add-include-dirs-when-cross-compiling.patch new file mode 100644 index 000000000..fb2fe8a77 --- /dev/null +++ b/lang/python/patches/120-do-not-add-include-dirs-when-cross-compiling.patch @@ -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 From 8122954aff030b1048b6149168aca812ef5f51ee Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Fri, 17 Oct 2014 16:39:25 +0300 Subject: [PATCH 4/7] python: add ac_cv_buggy_getaddrinfo=no to config.site file Required when IPv6 support gets enabled. Signed-off-by: Alexandru Ardelean --- lang/python/files/config.site | 1 + 1 file changed, 1 insertion(+) diff --git a/lang/python/files/config.site b/lang/python/files/config.site index 8f7a3f981..cfa56b89b 100644 --- a/lang/python/files/config.site +++ b/lang/python/files/config.site @@ -8,4 +8,5 @@ ac_cv_file__dev_ptmx=yes ac_cv_file__dev_ptc=no +ac_cv_buggy_getaddrinfo=no From d05c846e69c75ab661b1e1c83b0e1df0a4b99639 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Fri, 17 Oct 2014 17:04:26 +0300 Subject: [PATCH 5/7] python: add patch to disable package compiles/tests during cross-builts Signed-off-by: Alexandru Ardelean --- .../130-do-not-run-distutils-tests.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 lang/python/patches/130-do-not-run-distutils-tests.patch diff --git a/lang/python/patches/130-do-not-run-distutils-tests.patch b/lang/python/patches/130-do-not-run-distutils-tests.patch new file mode 100644 index 000000000..4fdd2bb4b --- /dev/null +++ b/lang/python/patches/130-do-not-run-distutils-tests.patch @@ -0,0 +1,37 @@ +diff --git a/Makefile.pre.in b/Makefile.pre.in +index bcd83bf..c4dcc6d 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1005,32 +1005,6 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c + done; \ + done + $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt +- if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \ +- $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \ +- $(DESTDIR)$(LIBDEST)/distutils/tests ; \ +- fi +- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ +- -d $(LIBDEST) -f \ +- -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ +- $(DESTDIR)$(LIBDEST) +- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- $(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ +- -d $(LIBDEST) -f \ +- -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ +- $(DESTDIR)$(LIBDEST) +- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- $(PYTHON_FOR_BUILD) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ +- -d $(LIBDEST)/site-packages -f \ +- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages +- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- $(PYTHON_FOR_BUILD) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ +- -d $(LIBDEST)/site-packages -f \ +- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages +- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- $(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 + + # Create the PLATDIR source directory, if one wasn't distributed.. + $(srcdir)/Lib/$(PLATDIR): From 15111b3ccfab71c2a97c446a817e93eb22e3845f Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Fri, 17 Oct 2014 17:05:24 +0300 Subject: [PATCH 6/7] python: _md5 + _sha libs are now grouped under _hashlibs Signed-off-by: Alexandru Ardelean --- lang/python/Makefile | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lang/python/Makefile b/lang/python/Makefile index 58b11a196..ba1162a42 100644 --- a/lang/python/Makefile +++ b/lang/python/Makefile @@ -239,14 +239,11 @@ define PyPackage/python-full/filespec -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/grp.so -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/itertools.so -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/math.so --|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_md5.so +-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_hashlib.so -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/operator.so -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_random.so -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/readline.so -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/select.so --|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_sha.so --|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_sha256.so --|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_sha512.so -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_socket.so -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/strop.so -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_struct.so @@ -328,13 +325,10 @@ define PyPackage/python/filespec +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/grp.so +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/itertools.so +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/math.so -+|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_md5.so ++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_hashlib.so +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/operator.so +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_random.so +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/select.so -+|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_sha.so -+|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_sha256.so -+|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_sha512.so +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_socket.so +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/strop.so +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_struct.so From 6862f1d8e637f68ec22d64acf20a459a107d8421 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Fri, 17 Oct 2014 17:08:27 +0300 Subject: [PATCH 7/7] python: add libopenssl and libcrypto as package deps Signed-off-by: Alexandru Ardelean --- lang/python/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/python/Makefile b/lang/python/Makefile index ba1162a42..9e6282f08 100644 --- a/lang/python/Makefile +++ b/lang/python/Makefile @@ -53,7 +53,7 @@ endef define Package/python $(call Package/python/Default) - DEPENDS:=+libpthread +zlib +libffi + DEPENDS:=+libpthread +zlib +libffi +libopenssl +libcrypto endef define Package/python/description