diff -Naur Python-2.7.3/configure Python-2.7.3.patch/configure --- Python-2.7.3/configure 2012-04-10 01:07:36.000000000 +0200 +++ Python-2.7.3.patch/configure 2012-04-16 14:27:58.161470960 +0200 @@ -13697,7 +13697,7 @@ $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : - ac_cv_have_long_long_format=no + ac_cv_have_long_long_format="cross -- assuming yes" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -13749,7 +13749,7 @@ $as_echo "$ac_cv_have_long_long_format" >&6; } fi -if test "$ac_cv_have_long_long_format" = yes +if test "$ac_cv_have_long_long_format" != no then $as_echo "#define PY_FORMAT_LONG_LONG \"ll\"" >>confdefs.h diff -Naur Python-2.7.3/Makefile.pre.in Python-2.7.3.patch/Makefile.pre.in --- Python-2.7.3/Makefile.pre.in 2012-04-10 01:07:33.000000000 +0200 +++ Python-2.7.3.patch/Makefile.pre.in 2012-04-16 14:30:27.753099115 +0200 @@ -182,6 +182,7 @@ 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 @@ -215,6 +216,8 @@ # Parser PGEN= Parser/pgen$(EXE) +HOSTPGEN= $(PGEN) + POBJS= \ Parser/acceler.o \ Parser/grammar1.o \ @@ -408,8 +411,8 @@ # 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;; \ + *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \ + *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \ esac # Build static library @@ -543,7 +546,7 @@ $(GRAMMAR_H) $(GRAMMAR_C): Parser/pgen.stamp Parser/pgen.stamp: $(PGEN) $(GRAMMAR_INPUT) -@$(INSTALL) -d Include - $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) + $(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) -touch Parser/pgen.stamp $(PGEN): $(PGENOBJS) @@ -938,26 +941,26 @@ $(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) - 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()" # Create the PLATDIR source directory, if one wasn't distributed.. $(srcdir)/Lib/$(PLATDIR): @@ -1062,7 +1065,9 @@ # Install the dynamically loadable modules # This goes into $(exec_prefix) sharedinstall: sharedmods - $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \ + CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ + $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \ + --skip-build \ --prefix=$(prefix) \ --install-scripts=$(BINDIR) \ --install-platlib=$(DESTSHARED) \ diff -Naur Python-2.7.3/setup.py Python-2.7.3.patch/setup.py --- Python-2.7.3/setup.py 2012-04-10 01:07:36.000000000 +0200 +++ Python-2.7.3.patch/setup.py 2012-04-16 14:27:58.164471010 +0200 @@ -23,6 +23,10 @@ # This global variable is used to hold the list of modules to be disabled. disabled_module_list = [] +# _ctypes fails to cross-compile due to the libffi configure script. +#if os.environ.has_key('PYTHONXCPREFIX'): +# disabled_module_list.append('_ctypes') + def add_dir_to_list(dirlist, dir): """Add the directory 'dir' to the list 'dirlist' (at the front) if 1) 'dir' is not already in 'dirlist' @@ -278,6 +282,14 @@ (ext.name, sys.exc_info()[1])) self.failed.append(ext.name) return + + # Inport check will not work when cross-compiling. + if os.environ.has_key('PYTHONXCPREFIX'): + self.announce( + 'WARNING: skipping inport check for cross-compiled: "%s"' % + ext.name) + return + # Workaround for Mac OS X: The Carbon-based modules cannot be # reliably imported into a command-line Python if 'Carbon' in ext.extra_link_args: