python: refresh patches
[openwrt/svn-archive/archive.git] / lang / python / patches / 000-cross-compile.patch
index 4072738dd1535cb5f3f7885fb228e5ff3680d9a9..dc2e1669777c426fd747a7ca8fa6c801b96f6db8 100644 (file)
-diff -uN Python-2.4.3.orig/Makefile.pre.in Python-2.4.3.cc/Makefile.pre.in
---- Python-2.4.3.orig/Makefile.pre.in  2006-03-13 07:08:41.000000000 -0600
-+++ Python-2.4.3.cc/Makefile.pre.in    2006-10-13 14:47:12.000000000 -0500
-@@ -162,6 +162,7 @@
+---
+ Makefile.pre.in |   25 +++++++++++++------------
+ 1 file changed, 13 insertions(+), 12 deletions(-)
+
+--- Python-2.6.4.orig/Makefile.pre.in
++++ Python-2.6.4/Makefile.pre.in
+@@ -175,6 +175,7 @@ UNICODE_OBJS=   @UNICODE_OBJS@
  
  PYTHON=               python$(EXE)
  BUILDPYTHON=  python$(BUILDEXE)
-+HOSTPYTHON=   ./$(BUILDPYTHON)
++HOSTPYTHON=   $(BUILDPYTHON)
  
- # === Definitions added by makesetup ===
-@@ -189,6 +190,8 @@
+ # 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
+@@ -205,7 +206,7 @@ GRAMMAR_INPUT=     $(srcdir)/Grammar/Grammar
+ ##########################################################################
  # Parser
  PGEN=         Parser/pgen$(EXE)
-+HOSTPGEN=  $(PGEN)
-+
+-
++HOSTPGEN=     $(PGEN)$(EXE)
  POBJS=                \
                Parser/acceler.o \
                Parser/grammar1.o \
-@@ -320,8 +323,8 @@
+@@ -370,7 +371,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"
+@@ -388,14 +389,14 @@ $(BUILDPYTHON):  Modules/python.o $(LIBRA
+                       $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
+ platform: $(BUILDPYTHON)
+-      $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
++      $(RUNSHARED) $(HOSTPYTHON) -E -c 'import sys ; from distutils.util 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;; \
+       @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*) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
-+      *) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
++      *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
++      *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
        esac
  
- # buildno should really depend on something like LIBRARY_SRC
-@@ -442,8 +445,7 @@
+ # Build static library
+@@ -517,7 +518,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)
+@@ -676,7 +677,7 @@ $(LIBRARY_OBJS) $(MODOBJS) Modules/pytho
  
-@@ -723,19 +725,19 @@
-       done
-       $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
-       PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
--              ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
-+              $(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
-               -d $(LIBDEST) -f \
-               -x 'badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
-       PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
--              ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
-+              $(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
-               -d $(LIBDEST) -f \
-               -x 'badsyntax|site-packages' $(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
-@@ -830,7 +832,8 @@
+ TESTOPTS=     -l $(EXTRATESTOPTS)
+ TESTPROG=     $(srcdir)/Lib/test/regrtest.py
+-TESTPYTHON=   $(RUNSHARED) ./$(BUILDPYTHON) -E -tt
++TESTPYTHON=   $(RUNSHARED) $(HOSTPYTHON) -E -tt
+ test:         all platform
+               -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
+               -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
+@@ -1001,7 +1002,7 @@ libainstall:     all
  # Install the dynamically loadable modules
  # This goes into $(exec_prefix)
  sharedinstall:
 -      $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
-+      CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILE='$(CROSS_COMPILE)' \
-+      $(HOSTPYTHON) -E $(srcdir)/setup.py install \
++      $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \
                --prefix=$(prefix) \
                --install-scripts=$(BINDIR) \
                --install-platlib=$(DESTSHARED) \
-diff -uN Python-2.4.3.orig/setup.py Python-2.4.3.cc/setup.py
---- Python-2.4.3.orig/setup.py 2006-03-23 13:07:46.000000000 -0600
-+++ Python-2.4.3.cc/setup.py   2006-10-13 15:36:01.000000000 -0500
-@@ -205,26 +205,30 @@
-         try:
-             imp.load_dynamic(ext.name, ext_filename)
-         except ImportError, why:
--            self.announce('*** WARNING: renaming "%s" since importing it'
--                          ' failed: %s' % (ext.name, why), level=3)
--            assert not self.inplace
--            basename, tail = os.path.splitext(ext_filename)
--            newname = basename + "_failed" + tail
--            if os.path.exists(newname):
--                os.remove(newname)
--            os.rename(ext_filename, newname)
--
--            # XXX -- This relies on a Vile HACK in
--            # distutils.command.build_ext.build_extension().  The
--            # _built_objects attribute is stored there strictly for
--            # use here.
--            # If there is a failure, _built_objects may not be there,
--            # so catch the AttributeError and move on.
--            try:
--                for filename in self._built_objects:
--                    os.remove(filename)
--            except AttributeError:
--                self.announce('unable to remove files (ignored)')
-+            if os.environ.get('CROSS_COMPILE') != "yes":
-+                self.announce('*** WARNING: renaming "%s" since importing it'
-+                              ' failed: %s' % (ext.name, why), level=3)
-+                assert not self.inplace
-+                basename, tail = os.path.splitext(ext_filename)
-+                newname = basename + "_failed" + tail
-+                if os.path.exists(newname):
-+                    os.remove(newname)
-+                os.rename(ext_filename, newname)
-+
-+                # XXX -- This relies on a Vile HACK in
-+                # distutils.command.build_ext.build_extension().  The
-+                # _built_objects attribute is stored there strictly for
-+                # use here.
-+                # If there is a failure, _built_objects may not be there,
-+                # so catch the AttributeError and move on.
-+                try:
-+                    for filename in self._built_objects:
-+                        os.remove(filename)
-+                except AttributeError:
-+                    self.announce('unable to remove files (ignored)')
-+            else:
-+                self.announce('WARNING: "%s" failed importing, but we leave it because we are cross-compiling' % ext.name)
-+
-         except:
-             exc_type, why, tb = sys.exc_info()
-             self.announce('*** WARNING: importing extension "%s" '
+@@ -1039,7 +1040,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
+@@ -1081,7 +1082,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)
+@@ -1103,7 +1104,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
+@@ -1200,7 +1201,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