# # thanks to David R Bacon for this patch # # http://biscuit.user.cis.ksu.edu/~dbacon/python23-xcompile.patch.bz2 # # it's based on Klaus Reimer patch # http://www.ailis.de/~k/patches/ # --- Python-2.3/Makefile.pre.in 2003-07-13 05:10:42.000000000 -0500 +++ Python-2.3-patched/Makefile.pre.in 2003-09-03 22:24:26.000000000 -0500 @@ -159,6 +159,7 @@ PYTHON= python$(EXE) BUILDPYTHON= python$(BUILDEXE) +HOSTPYTHON= ./$(BUILDPYTHON) # === Definitions added by makesetup === @@ -186,6 +187,8 @@ # Parser PGEN= Parser/pgen$(EXE) +HOSTPGEN= $(PGEN) + POBJS= \ Parser/acceler.o \ Parser/grammar1.o \ @@ -314,8 +317,8 @@ # Build the shared modules sharedmods: $(BUILDPYTHON) case $$MAKEFLAGS in \ - *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' DESTDIR='$(DESTDIR)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \ - *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' DESTDIR='$(DESTDIR)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \ + *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' DESTDIR='$(DESTDIR)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \ + *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' DESTDIR='$(DESTDIR)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \ esac # buildno should really depend on something like LIBRARY_SRC @@ -432,7 +435,7 @@ $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT) - -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) + -$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) $(PGEN): $(PGENOBJS) $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN) @@ -702,19 +705,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 @@ -809,7 +812,9 @@ # Install the dynamically loadable modules # This goes into $(exec_prefix) sharedinstall: - $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \ + LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ + CROSS_COMPILE='$(CROSS_COMPILE)' \ + $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \ --prefix=$(prefix) \ --install-scripts=$(BINDIR) \ --install-platlib=$(DESTSHARED) \ --- Python-2.3/setup.py 2003-07-10 07:48:39.000000000 -0500 +++ Python-2.3-patched/setup.py 2003-09-03 22:29:42.000000000 -0500 @@ -206,26 +206,29 @@ 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('stuff and things') except: exc_type, why, tb = sys.exc_info() self.announce('*** WARNING: importing extension "%s" '