diff -Naur Python-2.7-old/Makefile.pre.in Python-2.7-new/Makefile.pre.in --- Python-2.7-old/Makefile.pre.in 2010-04-11 17:10:46.000000000 -0700 +++ Python-2.7-new/Makefile.pre.in 2010-07-09 13:40:47.000000000 -0700 @@ -179,6 +179,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 @@ -212,6 +213,8 @@ # Parser PGEN= Parser/pgen$(EXE) +HOSTPGEN= $(PGEN) + POBJS= \ Parser/acceler.o \ Parser/grammar1.o \ @@ -404,8 +407,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 @@ -538,7 +541,7 @@ $(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) @@ -919,26 +922,26 @@ done; \ done $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt - 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): @@ -1042,8 +1045,10 @@ # Install the dynamically loadable modules # This goes into $(exec_prefix) -sharedinstall: sharedmods - $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \ +sharedinstall: sharedmods + 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-old/setup.py Python-2.7-new/setup.py --- Python-2.7-old/setup.py 2010-06-27 05:36:16.000000000 -0700 +++ Python-2.7-new/setup.py 2010-07-09 13:54:29.000000000 -0700 @@ -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: --- Python-2.7Orig/configure 2011-04-29 22:30:59.231331437 +1000 +++ Python-2.7/configure 2010-05-29 01:28:47.000000000 +1000 @@ -13517,7 +13517,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. */ @@ -13569,7 +13569,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