From 1e8a2130a5b5ce6697956379e17bdeee435286ae Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Tue, 29 Oct 2013 09:17:25 +0100 Subject: update python2 and use new host infrastructure --- package/python2/patches/patch-Makefile_pre_in | 198 ++++++-------------------- 1 file changed, 40 insertions(+), 158 deletions(-) (limited to 'package/python2/patches/patch-Makefile_pre_in') diff --git a/package/python2/patches/patch-Makefile_pre_in b/package/python2/patches/patch-Makefile_pre_in index f18bd9a72..e4f59f0ba 100644 --- a/package/python2/patches/patch-Makefile_pre_in +++ b/package/python2/patches/patch-Makefile_pre_in @@ -1,166 +1,48 @@ -diff -Nur Python-2.7.1.orig/Makefile.pre.in Python-2.7.1/Makefile.pre.in ---- Python-2.7.1.orig/Makefile.pre.in 2010-10-14 13:37:30.000000000 +0200 -+++ Python-2.7.1/Makefile.pre.in 2013-07-11 11:56:32.128103200 +0200 -@@ -59,7 +59,7 @@ MAKESETUP= $(srcdir)/Modules/makese - # Compiler options - OPT= @OPT@ - BASECFLAGS= @BASECFLAGS@ --CFLAGS= $(BASECFLAGS) @CFLAGS@ $(OPT) $(EXTRA_CFLAGS) -+CFLAGS= $(BASECFLAGS) @CFLAGS@ $(EXTRA_CFLAGS) - # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to - # be able to build extension modules using the directories specified in the - # environment variables -@@ -179,6 +179,7 @@ UNICODE_OBJS= @UNICODE_OBJS@ - - PYTHON= python$(EXE) - BUILDPYTHON= python$(BUILDEXE) -+HOSTPYTHON?= $(BUILDPYTHON) - - # The task to run while instrument when building the profile-opt target - PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck -@@ -211,6 +212,7 @@ LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@ +--- Python-2.7.5.orig/Makefile.pre.in 2013-05-12 05:32:49.000000000 +0200 ++++ Python-2.7.5/Makefile.pre.in 2013-10-29 08:12:25.000000000 +0100 +@@ -227,6 +227,7 @@ LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@ ########################################################################## # Parser PGEN= Parser/pgen$(EXE) -+HOSTPGEN?= $(PGEN)$(EXE) - - POBJS= \ - Parser/acceler.o \ -@@ -380,7 +382,7 @@ build_all_generate_profile: - $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov" - - run_profile_task: -- ./$(BUILDPYTHON) $(PROFILE_TASK) -+ $(HOSTPYTHON) $(PROFILE_TASK) - - build_all_use_profile: - $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use" -@@ -398,14 +400,13 @@ $(BUILDPYTHON): Modules/python.o $(LIBRA - $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) - - platform: $(BUILDPYTHON) -- $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from sysconfig import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform -+ $(RUNSHARED) $(HOSTPYTHON) -E -c 'import sys ; from sysconfig import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform - - - # Build the shared modules - sharedmods: $(BUILDPYTHON) - @case $$MAKEFLAGS in \ -- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \ -- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \ -+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \ - esac - - # Build static library -@@ -538,7 +539,7 @@ Modules/python.o: $(srcdir)/Modules/pyth - - $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT) - -@$(INSTALL) -d Include -- -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) -+ -$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) - - $(PGEN): $(PGENOBJS) - $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN) -@@ -702,7 +703,7 @@ $(LIBRARY_OBJS) $(MODOBJS) Modules/pytho - - TESTOPTS= -l $(EXTRATESTOPTS) - TESTPROG= $(srcdir)/Lib/test/regrtest.py --TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -Wd -3 -E -tt $(TESTPYTHONOPTS) -+TESTPYTHON= $(RUNSHARED) $(HOSTPYTHON) -Wd -3 -E -tt $(TESTPYTHONOPTS) - test: all platform - -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f - -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -@@ -725,7 +726,7 @@ testuniversal: all platform - -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f - -$(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS) - $(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS) -- $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E -tt $(TESTPROG) -uall $(TESTOPTS) -+ $(RUNSHARED) /usr/libexec/oah/translate $(HOSTPYTHON) -E -tt $(TESTPROG) -uall $(TESTOPTS) - - - # Like testall, but with a single pass only -@@ -920,26 +921,26 @@ libinstall: build_all $(srcdir)/Lib/$(PL - done; \ - done - $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt ++HOSTPGEN?= Parser/pgen$(EXE) + + PSRCS= \ + Parser/acceler.c \ +@@ -593,7 +594,7 @@ Modules/pwdmodule.o: $(srcdir)/Modules/p + $(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS) + @$(MKDIR_P) Include + $(MAKE) $(PGEN) +- $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) ++ $(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) + $(GRAMMAR_C): $(GRAMMAR_H) $(GRAMMAR_INPUT) $(PGENSRCS) + $(MAKE) $(GRAMMAR_H) + touch $(GRAMMAR_C) +@@ -1000,28 +1001,6 @@ libinstall: build_all $(srcdir)/Lib/$(PL + $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \ + $(DESTDIR)$(LIBDEST)/distutils/tests ; \ + fi - PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -- ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ -+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -+ $(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ - -d $(LIBDEST) -f \ - -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ - $(DESTDIR)$(LIBDEST) +- $(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) \ -- ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ -+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -+ $(HOSTPYTHON) -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) \ -- ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ -+ $(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ - -d $(LIBDEST)/site-packages -f \ - -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages - -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -- ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ -+ $(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ - -d $(LIBDEST)/site-packages -f \ - -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages - -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -- ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()" -+ $(HOSTPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()" +- $(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): -@@ -1044,11 +1045,12 @@ libainstall: all python-config - # Install the dynamically loadable modules - # This goes into $(exec_prefix) - sharedinstall: sharedmods -- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \ -+ CROSS_COMPILE='$(CROSS_COMPILE)' \ -+ $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \ - --prefix=$(prefix) \ - --install-scripts=$(BINDIR) \ - --install-platlib=$(DESTSHARED) \ -- --root=/$(DESTDIR) -+ --root=$(DESTDIR) - - # Here are a couple of targets for MacOSX again, to install a full - # framework-based Python. frameworkinstall installs everything, the -@@ -1082,7 +1084,7 @@ frameworkinstallstructure: $(LDLIBRARY) - fi; \ - done - $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers -- sed 's/%VERSION%/'"`$(RUNSHARED) ./$(BUILDPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist -+ sed 's/%VERSION%/'"`$(RUNSHARED) $(HOSTPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist - $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current - $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK) - $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers -@@ -1117,7 +1119,7 @@ frameworkinstallextras: - # This installs a few of the useful scripts in Tools/scripts - scriptsinstall: - SRCDIR=$(srcdir) $(RUNSHARED) \ -- ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \ -+ $(HOSTPYTHON) $(srcdir)/Tools/scripts/setup.py install \ - --prefix=$(prefix) \ - --install-scripts=$(BINDIR) \ - --root=/$(DESTDIR) -@@ -1139,7 +1141,7 @@ config.status: $(srcdir)/configure - - # Run reindent on the library - reindent: -- ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib -+ $(HOSTPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib - - # Rerun configure with the same options as it was run last time, - # provided the config.status script exists -@@ -1242,7 +1244,7 @@ funny: - - # Perform some verification checks on any modified files. - patchcheck: -- $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py -+ $(RUNSHARED) $(HOSTPYTHON) $(srcdir)/Tools/scripts/patchcheck.py - - # Dependencies - -- cgit v1.2.3 From 1a3f7151d55fd0eb4508bfbd65d70bd9d3cf6399 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 30 Oct 2013 15:44:51 +0100 Subject: fix python cross-compile, when a python host binary is available --- package/python2/Makefile | 7 ++--- package/python2/patches/patch-Makefile_pre_in | 2 +- package/python2/patches/patch-setup_py | 38 ++++++++++++++++++++++++--- package/python3/Makefile | 2 +- 4 files changed, 40 insertions(+), 9 deletions(-) (limited to 'package/python2/patches/patch-Makefile_pre_in') diff --git a/package/python2/Makefile b/package/python2/Makefile index fdf39f45f..c0678a528 100644 --- a/package/python2/Makefile +++ b/package/python2/Makefile @@ -5,11 +5,11 @@ include ${TOPDIR}/rules.mk PKG_NAME:= python2 PKG_VERSION:= 2.7.5 -PKG_RELEASE:= 1 +PKG_RELEASE:= 2 PKG_MD5SUM:= b4f01a1d0ba0b46b05c73b2ac909b1df PKG_DESCR:= Python scripting language (Version 2) PKG_SECTION:= lang -PKG_BUILDDEP:= libffi python2-host +PKG_BUILDDEP:= libffi python2-host autotool PKG_DEPENDS:= libpthread libffi libgcc PKG_URL:= http://www.python.org/ PKG_SITES:= http://www.python.org/ftp/python/${PKG_VERSION}/ @@ -84,6 +84,7 @@ $(eval $(call PKG_mod_template,PYTHON2_MOD_NCURSES,_curses)) $(eval $(call PKG_mod_template,PYTHON2_MOD_SSL,_ssl)) $(eval $(call PKG_mod_template,PYTHON2_MOD_READLINE,readline)) +AUTOTOOL_STYLE:= autoreconf MAKE_ENV+= HOSTPGEN=$(STAGING_HOST_DIR)/usr/bin/pgen CONFIGURE_ENV+= ac_cv_have_long_long_format=yes \ ac_cv_file__dev_ptmx=yes \ @@ -118,7 +119,7 @@ python2-install: ${INSTALL_MODS_y} ${INSTALL_MODS_m} ${CP} ${WRKINST}/usr/lib/python2.7/* ${IDIR_PYTHON2}/usr/lib/python2.7 ${CP} ${WRKINST}/usr/include/python2.7/pyconfig.h \ ${IDIR_PYTHON2}/usr/include/python2.7 - for i in zlib bz2 _curses _ssl gdbm _sqlite pyexpat readline; do \ + @-for i in zlib bz2 _curses _ssl gdbm _sqlite pyexpat readline; do \ rm ${IDIR_PYTHON2}/usr/lib/python2.7/lib-dynload/$${i}*so; \ done diff --git a/package/python2/patches/patch-Makefile_pre_in b/package/python2/patches/patch-Makefile_pre_in index e4f59f0ba..8c6aba5c2 100644 --- a/package/python2/patches/patch-Makefile_pre_in +++ b/package/python2/patches/patch-Makefile_pre_in @@ -1,5 +1,5 @@ --- Python-2.7.5.orig/Makefile.pre.in 2013-05-12 05:32:49.000000000 +0200 -+++ Python-2.7.5/Makefile.pre.in 2013-10-29 08:12:25.000000000 +0100 ++++ Python-2.7.5/Makefile.pre.in 2013-10-30 14:10:07.000000000 +0100 @@ -227,6 +227,7 @@ LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@ ########################################################################## # Parser diff --git a/package/python2/patches/patch-setup_py b/package/python2/patches/patch-setup_py index f8f2fa1c0..0cb811de9 100644 --- a/package/python2/patches/patch-setup_py +++ b/package/python2/patches/patch-setup_py @@ -1,5 +1,5 @@ --- Python-2.7.5.orig/setup.py 2013-05-12 05:32:54.000000000 +0200 -+++ Python-2.7.5/setup.py 2013-10-29 07:33:37.000000000 +0100 ++++ Python-2.7.5/setup.py 2013-10-30 14:18:23.000000000 +0100 @@ -74,7 +74,7 @@ def find_file(filename, std_dirs, paths) 'paths' is a list of additional locations to check; if the file is found in one of them, the resulting list will contain the directory. @@ -54,7 +54,23 @@ if os.path.join(sysroot, p[1:]) == dirname: return [ p ] -@@ -437,10 +437,12 @@ class PyBuildExt(build_ext): +@@ -162,6 +162,7 @@ class PyBuildExt(build_ext): + + def build_extensions(self): + ++ self.compiler.library_dirs = [] + # Detect which modules should be compiled + missing = self.detect_modules() + +@@ -281,6 +282,7 @@ class PyBuildExt(build_ext): + + def build_extension(self, ext): + ++ + if ext.name == '_ctypes': + if not self.configure_ctypes(ext): + return +@@ -437,10 +439,12 @@ class PyBuildExt(build_ext): def detect_modules(self): # Ensure that /usr/local is always used @@ -70,7 +86,7 @@ # Add paths specified in the environment variables LDFLAGS and # CPPFLAGS for header and library files. -@@ -477,7 +479,8 @@ class PyBuildExt(build_ext): +@@ -477,7 +481,8 @@ class PyBuildExt(build_ext): add_dir_to_list(dir_list, directory) if os.path.normpath(sys.prefix) != '/usr' \ @@ -80,7 +96,21 @@ # 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 -@@ -530,7 +533,7 @@ class PyBuildExt(build_ext): +@@ -495,8 +500,13 @@ class PyBuildExt(build_ext): + # lib_dirs and inc_dirs are used to search for files; + # if a file is found in one of those directories, it can + # be assumed that no additional -I,-L directives are needed. ++ if cross_compiling: ++ add_dir_to_list(self.compiler.library_dirs, ++ sysconfig.get_config_var('srcdir')) ++ + inc_dirs = self.compiler.include_dirs[:] + lib_dirs = self.compiler.library_dirs[:] ++ + if not cross_compiling: + for d in ( + '/usr/include', +@@ -530,7 +540,7 @@ class PyBuildExt(build_ext): if host_platform == 'hp-ux11': lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32'] diff --git a/package/python3/Makefile b/package/python3/Makefile index c18423290..40659bff4 100644 --- a/package/python3/Makefile +++ b/package/python3/Makefile @@ -115,7 +115,7 @@ python3-install: ${INSTALL_MODS_y} ${INSTALL_MODS_m} ${CP} ${WRKINST}/usr/lib/python3.3/* ${IDIR_PYTHON3}/usr/lib/python3.3 ${CP} ${WRKINST}/usr/include/python3.3m/pyconfig.h \ ${IDIR_PYTHON3}/usr/include/python3.3m - for i in zlib _bz2 _curses _ssl _gdbm _sqlite pyexpat readline; do \ + @-for i in zlib _bz2 _curses _ssl _gdbm _sqlite pyexpat readline; do \ rm ${IDIR_PYTHON3}/usr/lib/python3.3/lib-dynload/$${i}*so; \ done -- cgit v1.2.3