NON-WORKING python with an older version of the MinGW patch.
[fedora-mingw.git] / python / mingw32-python-2.5.2-cross.patch-20081006
diff --git a/python/mingw32-python-2.5.2-cross.patch-20081006 b/python/mingw32-python-2.5.2-cross.patch-20081006
new file mode 100644 (file)
index 0000000..e389235
--- /dev/null
@@ -0,0 +1,2135 @@
+diff -urN Python-2.5.2.orig/configure.in Python-2.5.2.mingw32/configure.in
+--- Python-2.5.2.orig/configure.in     2008-10-06 14:54:18.000000000 +0100
++++ Python-2.5.2.mingw32/configure.in  2008-10-06 18:31:53.000000000 +0100
+@@ -9,6 +9,11 @@
+ AC_CONFIG_SRCDIR([Include/object.h])
+ AC_CONFIG_HEADER(pyconfig.h)
++# find compiler while respecting --host setting
++AC_CANONICAL_HOST()
++AC_CHECK_TOOLS(CC,gcc cc)
++AC_CHECK_TOOLS(CXX,g++ c++)
++
+ dnl This is for stuff that absolutely must end up in pyconfig.h.
+ dnl Please use pyport.h instead, if possible.
+ AH_TOP([
+@@ -163,8 +168,8 @@
+ # Set name for machine-dependent library files
+ AC_SUBST(MACHDEP)
+ AC_MSG_CHECKING(MACHDEP)
+-if test -z "$MACHDEP"
+-then
++if test -z "$MACHDEP"; then
++    if test "$cross_compiling" = "no"; then
+       ac_sys_system=`uname -s`
+       if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64" \
+       -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
+@@ -172,6 +177,23 @@
+       else
+               ac_sys_release=`uname -r`
+       fi
++    else
++      m=`$CC -dumpmachine`
++      changequote(<<, >>)#dnl
++      ac_sys_system=`expr "$m" : "[^-]*-\([^-]*\)"`
++      changequote([, ])#dnl
++
++
++      case $ac_sys_system in
++      cygwin*) ac_sys_system=`echo $ac_sys_system | sed s/cygwin/CYGWIN/g `;;
++      darwin*) ac_sys_system=`echo $ac_sys_system | sed s/darwin/Darwin/g `;;
++      freebsd*) ac_sys_system=`echo $ac_sys_system | sed s/freebsd/FreeBSD/g `;;
++      linux*) ac_sys_system=`echo $ac_sys_system | sed s/linux/Linux/g `;;
++      esac
++      
++
++    fi
++    
+       ac_md_system=`echo $ac_sys_system |
+                          tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
+       ac_md_release=`echo $ac_sys_release |
+@@ -424,8 +446,8 @@
+ if test -z "$CXX"
+ then
+         case "$CC" in
+-        gcc)    AC_PATH_PROG(CXX, [g++], [g++], [notfound]) ;;
+-        cc)     AC_PATH_PROG(CXX, [c++], [c++], [notfound]) ;;
++        gcc)    AC_CHECK_TOOL(CXX, [g++], [notfound]) ;;
++        cc)     AC_CHECK_TOOL(CXX, [c++], [notfound]) ;;
+         esac
+       if test "$CXX" = "notfound"
+       then
+@@ -434,7 +456,7 @@
+ fi
+ if test -z "$CXX"
+ then
+-      AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
++      AC_CHECK_TOOLS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
+       if test "$CXX" = "notfound"
+       then
+               CXX=""
+@@ -462,34 +484,6 @@
+ esac
+ AC_EXEEXT
+-AC_MSG_CHECKING(for --with-suffix)
+-AC_ARG_WITH(suffix,
+-            AC_HELP_STRING(--with-suffix=.exe, set executable suffix),
+-[
+-      case $withval in
+-      no)     EXEEXT=;;
+-      yes)    EXEEXT=.exe;;
+-      *)      EXEEXT=$withval;;
+-      esac])
+-AC_MSG_RESULT($EXEEXT)
+-
+-# Test whether we're running on a non-case-sensitive system, in which
+-# case we give a warning if no ext is given
+-AC_SUBST(BUILDEXEEXT)
+-AC_MSG_CHECKING(for case-insensitive build directory)
+-if test ! -d CaseSensitiveTestDir; then
+-mkdir CaseSensitiveTestDir
+-fi
+-
+-if test -d casesensitivetestdir
+-then
+-    AC_MSG_RESULT(yes)
+-    BUILDEXEEXT=.exe
+-else
+-      AC_MSG_RESULT(no)
+-      BUILDEXEEXT=$EXEEXT
+-fi
+-rmdir CaseSensitiveTestDir
+ case $MACHDEP in
+ bsdos*)
+@@ -686,9 +680,9 @@
+ AC_MSG_RESULT($LDLIBRARY)
+-AC_PROG_RANLIB
+-AC_SUBST(AR)
+-AC_CHECK_PROGS(AR, ar aal, ar)
++# find tools while respecting --host setting
++AC_CHECK_TOOL(RANLIB,ranlib)
++AC_CHECK_TOOLS(AR,ar aal,ar)
+ AC_SUBST(SVNVERSION)
+ AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
+@@ -810,7 +804,7 @@
+      AC_TRY_RUN([int main() { return 0; }],
+      ac_cv_no_strict_aliasing_ok=yes,
+      ac_cv_no_strict_aliasing_ok=no,
+-     ac_cv_no_strict_aliasing_ok=no)
++     ac_cv_no_strict_aliasing_ok=yes)
+      CC="$ac_save_cc"
+     AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
+     if test $ac_cv_no_strict_aliasing_ok = yes
+@@ -3369,27 +3363,15 @@
+   AC_MSG_RESULT(no)
+ )
+-AC_MSG_CHECKING(for /dev/ptmx)
+-
+-if test -r /dev/ptmx
+-then
+-  AC_MSG_RESULT(yes)
+-  AC_DEFINE(HAVE_DEV_PTMX, 1,
+-  [Define if we have /dev/ptmx.])
+-else
+-  AC_MSG_RESULT(no)
+-fi
+-
+-AC_MSG_CHECKING(for /dev/ptc)
+-
+-if test -r /dev/ptc
+-then
+-  AC_MSG_RESULT(yes)
+-  AC_DEFINE(HAVE_DEV_PTC, 1,
+-  [Define if we have /dev/ptc.])
+-else
+-  AC_MSG_RESULT(no)
+-fi
++AC_CHECK_FILE(/dev/ptmx,
++       [AC_DEFINE(HAVE_DEV_PTMX, 1,
++          [Define if we have /dev/ptmx.])],
++       [])
++ 
++AC_CHECK_FILE(/dev/ptc,
++       [AC_DEFINE(HAVE_DEV_PTC, 1,
++          [Define if we have /dev/ptc.])],
++       [])
+ case $MACHDEP in
+ darwin)       
+@@ -3411,7 +3393,8 @@
+ AC_MSG_CHECKING(for %zd printf() format support)
+-AC_TRY_RUN([#include <stdio.h>
++AC_CACHE_VAL(ac_cv_printf_zd_format,
++      AC_TRY_RUN([#include <stdio.h>
+ #include <stddef.h>
+ #include <string.h>
+@@ -3447,7 +3430,7 @@
+ }],
+ [AC_MSG_RESULT(yes)
+  AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])],
+- AC_MSG_RESULT(no))
++ AC_MSG_RESULT(no)))
+ AC_CHECK_TYPE(socklen_t,,
+   AC_DEFINE(socklen_t,int,
+@@ -3477,10 +3460,76 @@
+ done
+ AC_MSG_RESULT(done)
++# Cross compiling
++AC_SUBST(cross_compiling)
++
++if test "$cross_compiling" = "yes"; then
++    AC_MSG_CHECKING(cc for build)
++    CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
++else
++    CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
++fi   
++     
++if test "$cross_compiling" = "yes"; then
++   AC_MSG_RESULT($CC_FOR_BUILD)
++fi
++
++AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler (default: cc)])
++      
++if test "$cross_compiling" = "yes"; then
++    AC_MSG_CHECKING(python for build)
++    PYTHON_FOR_BUILD="${PYTHON_FOR_BUILD-python}"
++    PYTHON_FOR_BUILD=`which $PYTHON_FOR_BUILD`
++else
++    PYTHON_FOR_BUILD='./$(BUILDPYTHON)'
++fi   
++
++if test "$cross_compiling" = "yes"; then
++    AC_MSG_RESULT($PYTHON_FOR_BUILD)
++fi
++AC_ARG_VAR(PYTHON_FOR_BUILD,[build system python (default: python)])
++AC_SUBST(PYTHON_FOR_BUILD)
++
++if test "$cross_compiling" = "yes"; then
++    CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-}
++    CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD- -I.}
++    CROSS_COMMENT=#
++    LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-}
++    O_FOR_BUILD=x
++    RUNSHARED="MACHDEP=$ac_sys_system SRCDIR=$srcdir SO=${SO}"
++
++    # Extra flags for MinGW host.
++    case "$host" in
++        *-*-mingw*)
++          CFLAGSFORSHARED="-I`pwd`/PC $CFLAGSFORSHARED"
++          CFLAGS_FOR_BUILD="-I`pwd`/PC $CFLAGS_FOR_BUILD"
++          CPPFLAGS_FOR_BUILD="-I`pwd`/PC $CPPFLAGS_FOR_BUILD" ;;
++    esac
++else
++    CROSS_COMMENT=
++    O_FOR_BUILD=o
++fi
++AC_SUBST(CFLAGS_FOR_BUILD)
++AC_SUBST(CPPFLAGS_FOR_BUILD)
++AC_SUBST(CROSS_COMMENT)
++AC_SUBST(LDFLAGS_FOR_BUILD)
++AC_SUBST(O_FOR_BUILD)
++
+ # generate output files
+ AC_CONFIG_FILES(Makefile.pre Modules/Setup.config)
+ AC_OUTPUT
++if test "$cross_compiling" = "yes"; then
++    case "$host" in
++        *-*-mingw*)
++          # Never use the generated pyconfig.h, always use the
++          # one in the PC/ subdirectory.
++          rm -f pyconfig.h pyconfig.h-t
++          echo '#include "PC/pyconfig.h"' > pyconfig.h-t
++          mv pyconfig.h-t pyconfig.h
++    esac
++fi
++
+ echo "creating Modules/Setup"
+ if test ! -f Modules/Setup
+ then
+diff -urN Python-2.5.2.orig/Include/pyport.h Python-2.5.2.mingw32/Include/pyport.h
+--- Python-2.5.2.orig/Include/pyport.h 2008-02-14 11:26:18.000000000 +0000
++++ Python-2.5.2.mingw32/Include/pyport.h      2008-10-06 15:07:45.000000000 +0100
+@@ -752,6 +752,7 @@
+ #define LONG_BIT (8 * SIZEOF_LONG)
+ #endif
++#ifndef __MINGW32__
+ #if LONG_BIT != 8 * SIZEOF_LONG
+ /* 04-Oct-2000 LONG_BIT is apparently (mis)defined as 64 on some recent
+  * 32-bit platforms using gcc.  We try to catch that here at compile-time
+@@ -760,6 +761,7 @@
+  */
+ #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
+ #endif
++#endif
+ #ifdef __cplusplus
+ }
+diff -urN Python-2.5.2.orig/Lib/distutils/command/build_ext.py Python-2.5.2.mingw32/Lib/distutils/command/build_ext.py
+--- Python-2.5.2.orig/Lib/distutils/command/build_ext.py       2007-04-24 16:27:25.000000000 +0100
++++ Python-2.5.2.mingw32/Lib/distutils/command/build_ext.py    2008-10-06 14:55:15.000000000 +0100
+@@ -624,6 +624,8 @@
+             ext_path[len(ext_path) - 1] = ext_path[len(ext_path) - 1][:8]
+         # extensions in debug_mode are named 'module_d.pyd' under windows
+         so_ext = get_config_var('SO')
++        if os.environ.get('CROSS_COMPILING') == 'yes':
++            so_ext = os.environ.get('SO')
+         if os.name == 'nt' and self.debug:
+             return apply(os.path.join, ext_path) + '_d' + so_ext
+         return apply(os.path.join, ext_path) + so_ext
+@@ -705,6 +707,8 @@
+             return ext.libraries
+         else:
++            if os.environ.get('CROSS_COMPILING') == 'yes':
++                return []
+             from distutils import sysconfig
+             if sysconfig.get_config_var('Py_ENABLE_SHARED'):
+                 template = "python%d.%d"
+diff -urN Python-2.5.2.orig/Lib/plat-linux/regen Python-2.5.2.mingw32/Lib/plat-linux/regen
+--- Python-2.5.2.orig/Lib/plat-linux/regen     1970-01-01 01:00:00.000000000 +0100
++++ Python-2.5.2.mingw32/Lib/plat-linux/regen  2008-10-06 14:55:15.000000000 +0100
+@@ -0,0 +1,3 @@
++#! /bin/sh
++set -v
++python$EXE ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h
+diff -urN Python-2.5.2.orig/Makefile.pre.in Python-2.5.2.mingw32/Makefile.pre.in
+--- Python-2.5.2.orig/Makefile.pre.in  2008-10-06 14:54:19.000000000 +0100
++++ Python-2.5.2.mingw32/Makefile.pre.in       2008-10-06 18:31:47.000000000 +0100
+@@ -27,6 +27,7 @@
+ VERSION=      @VERSION@
+ srcdir=               @srcdir@
+ VPATH=                @srcdir@
++export srcdir
+ CC=           @CC@
+ CXX=          @CXX@
+@@ -72,6 +73,15 @@
+ # C flags used for building the interpreter object files
+ PY_CFLAGS=    $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
++# For cross compile: build compiler options
++CC_FOR_BUILD= @CC_FOR_BUILD@
++CROSS_COMPILING=      @cross_compiling@
++EXEEXT                =       @EXEEXT@
++O_FOR_BUILD=  @O_FOR_BUILD@
++
++CFLAGS_FOR_BUILD=     @CFLAGS_FOR_BUILD@
++CPPFLAGS_FOR_BUILD=   @CPPFLAGS_FOR_BUILD@ -I$(srcdir)/Include
++LDFLAGS_FOR_BUILD=    @LDFLAGS_FOR_BUILD@
+ # Machine-dependent subdirectories
+ MACHDEP=      @MACHDEP@
+@@ -108,7 +118,6 @@
+ # Executable suffix (.exe on Windows and Mac OS X)
+ EXE=          @EXEEXT@
+-BUILDEXE=     @BUILDEXEEXT@
+ # Short name and location for Mac OS X Python framework
+ UNIVERSALSDK=@UNIVERSALSDK@
+@@ -172,7 +181,8 @@
+ UNICODE_OBJS=   @UNICODE_OBJS@
+ PYTHON=               python$(EXE)
+-BUILDPYTHON=  python$(BUILDEXE)
++BUILDPYTHON=  python$(EXE)
++PYTHON_FOR_BUILD=     @PYTHON_FOR_BUILD@
+ # === Definitions added by makesetup ===
+@@ -198,7 +208,7 @@
+ ##########################################################################
+ # Parser
+-PGEN=         Parser/pgen$(EXE)
++PGEN_FOR_BUILD=       Parser/pgen$(EXEEXT)
+ POBJS=                \
+               Parser/acceler.o \
+@@ -215,14 +225,27 @@
+ PARSER_OBJS=  $(POBJS) Parser/myreadline.o Parser/tokenizer.o
+-PGOBJS=               \
+-              Objects/obmalloc.o \
+-              Python/mysnprintf.o \
+-              Parser/tokenizer_pgen.o \
+-              Parser/printgrammar.o \
+-              Parser/pgenmain.o
++POBJS_FOR_BUILD=              \
++              Parser/acceler.$(O_FOR_BUILD) \
++              Parser/grammar1.$(O_FOR_BUILD) \
++              Parser/listnode.$(O_FOR_BUILD) \
++              Parser/node.$(O_FOR_BUILD) \
++              Parser/parser.$(O_FOR_BUILD) \
++              Parser/parsetok.$(O_FOR_BUILD) \
++              Parser/bitset.$(O_FOR_BUILD) \
++              Parser/metagrammar.$(O_FOR_BUILD) \
++              Parser/firstsets.$(O_FOR_BUILD) \
++              Parser/grammar.$(O_FOR_BUILD) \
++              Parser/pgen.$(O_FOR_BUILD)
++
++PGOBJS_FOR_BUILD=             \
++              Objects/obmalloc.$(O_FOR_BUILD) \
++              Python/mysnprintf.$(O_FOR_BUILD) \
++              Parser/tokenizer_pgen.$(O_FOR_BUILD) \
++              Parser/printgrammar.$(O_FOR_BUILD) \
++              Parser/pgenmain.$(O_FOR_BUILD)
+-PGENOBJS=     $(PGENMAIN) $(POBJS) $(PGOBJS)
++PGENOBJS=     $(POBJS_FOR_BUILD) $(PGOBJS_FOR_BUILD)
+ ##########################################################################
+ # AST
+@@ -341,15 +364,18 @@
+                       Modules/python.o \
+                       $(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
+-
++platform: $(PYTHON_FOR_BUILD)
++      $(RUNSHARED) $(PYTHON_FOR_BUILD) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
+ # Build the shared modules
+-sharedmods: $(BUILDPYTHON)
++sharedmods: $(PYTHON_FOR_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*) $(RUNSHARED) CROSS_COMPILING=$(CROSS_COMPILING) CC='$(CC)' \
++            CFLAGS='$(CFLAGS) $(CPPFLAGS)' \
++            LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py -q build;; \
++      *) $(RUNSHARED) CROSS_COMPILING=$(CROSS_COMPILING) CC='$(CC)' \
++            CFLAGS='$(CFLAGS) $(CPPFLAGS)' \
++            LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py build;; \
+       esac
+ # Build static library
+@@ -472,12 +498,12 @@
+       $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
+-$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
++$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN_FOR_BUILD) $(GRAMMAR_INPUT)
+               -@ mkdir Include
+-              -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
++              -$(PGEN_FOR_BUILD) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
+-$(PGEN):      $(PGENOBJS)
+-              $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
++$(PGEN_FOR_BUILD):    $(PGENOBJS)
++              $(CC_FOR_BUILD) $(OPT) $(LDFLAGS_FOR_BUILD) $(PGENOBJS) $(LIBS) -o $(PGEN_FOR_BUILD)
+ Parser/grammar.o:     $(srcdir)/Parser/grammar.c \
+                               $(srcdir)/Include/token.h \
+@@ -504,6 +530,14 @@
+                               $(srcdir)/Objects/unicodetype_db.h
+ ############################################################################
++# Cross compile rules
++
++# .x is a native object file during cross-compile. 
++.SUFFIXES: .x 
++.c.x:
++      $(CC_FOR_BUILD) -c $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -o $@ $<
++
++############################################################################
+ # Header files
+ PYTHON_HEADERS= \
+@@ -576,7 +610,7 @@
+ TESTOPTS=     -l $(EXTRATESTOPTS)
+ TESTPROG=     $(srcdir)/Lib/test/regrtest.py
+-TESTPYTHON=   $(RUNSHARED) ./$(BUILDPYTHON) -E -tt
++TESTPYTHON=   $(RUNSHARED) $(PYTHON_FOR_BUILD) -E -tt
+ test:         all platform
+               -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
+               -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
+@@ -597,7 +631,7 @@
+               -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
+               -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
+               $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
+-              $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E -tt $(TESTPROG) $(TESTOPTS) -uall
++              $(RUNSHARED) /usr/libexec/oah/translate $(PYTHON_FOR_BUILD) -E -tt $(TESTPROG) $(TESTOPTS) -uall
+ # Like testall, but with a single pass only
+@@ -725,7 +759,7 @@
+               distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
+               setuptools setuptools/command setuptools/tests setuptools.egg-info \
+               curses $(MACHDEPS)
+-libinstall:   $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR)
++libinstall: $(srcdir)/Lib/$(PLATDIR) $(PYTHON_FOR_BUILD)
+       @for i in $(SCRIPTDIR) $(LIBDEST); \
+       do \
+               if test ! -d $(DESTDIR)$$i; then \
+@@ -782,19 +816,19 @@
+       done
+       $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
+       PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
+-              ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
++              $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
+               -d $(LIBDEST) -f \
+               -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
+       PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+-              ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
++              $(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
+               -d $(LIBDEST) -f \
+               -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
+       -PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
+-              ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
++              $(PYTHON_FOR_BUILD) -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 \
++              $(PYTHON_FOR_BUILD) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
+               -d $(LIBDEST)/site-packages -f \
+               -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+@@ -805,7 +839,7 @@
+       export PATH; PATH="`pwd`:$$PATH"; \
+       export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
+       export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
+-      export EXE; EXE="$(BUILDEXE)"; \
++      export EXE; EXE="$(EXEEXT)"; \
+       cd $(srcdir)/Lib/$(PLATDIR); ./regen
+ # Install the include files
+@@ -894,8 +928,9 @@
+ # Install the dynamically loadable modules
+ # This goes into $(exec_prefix)
+ sharedinstall:
+-      $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
+-              --prefix=$(prefix) \
++      CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILING='$(CROSS_COMPILING)' \
++              $(RUNSHARED) $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py install \
++              --prefix=$(prefix) \
+               --install-scripts=$(BINDIR) \
+               --install-platlib=$(DESTSHARED) \
+               --root=/$(DESTDIR)
+@@ -967,8 +1002,8 @@
+ # This installs a few of the useful scripts in Tools/scripts
+ scriptsinstall:
+-      SRCDIR=$(srcdir) $(RUNSHARED) \
+-      ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
++      $(RUNSHARED) \
++      $(PYTHON_FOR_BUILD) $(srcdir)/Tools/scripts/setup.py install \
+       --prefix=$(prefix) \
+       --install-scripts=$(BINDIR) \
+       --root=/$(DESTDIR)
+@@ -1029,11 +1064,12 @@
+       find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
+ clobber: clean
+-      -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
++      -rm -f $(BUILDPYTHON) $(PGEN_FOR_BUILD) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
+               tags TAGS \
+               config.cache config.log pyconfig.h Modules/config.c
+       -rm -rf build platform
+       -rm -rf $(PYTHONFRAMEWORKDIR)
++      -rm -rf buildpython
+ # Make things extra clean, before making a distribution:
+ # remove all generated files, even Makefile[.pre]
+diff -urN Python-2.5.2.orig/Makefile.pre.in~ Python-2.5.2.mingw32/Makefile.pre.in~
+--- Python-2.5.2.orig/Makefile.pre.in~ 1970-01-01 01:00:00.000000000 +0100
++++ Python-2.5.2.mingw32/Makefile.pre.in~      2008-10-06 14:55:15.000000000 +0100
+@@ -0,0 +1,1135 @@
++# Top-level Makefile for Python
++#
++# As distributed, this file is called Makefile.pre.in; it is processed
++# into the real Makefile by running the script ./configure, which
++# replaces things like @spam@ with values appropriate for your system.
++# This means that if you edit Makefile, your changes get lost the next
++# time you run the configure script.  Ideally, you can do:
++#
++#     ./configure
++#     make
++#     make test
++#     make install
++#
++# If you have a previous version of Python installed that you don't
++# want to overwrite, you can use "make altinstall" instead of "make
++# install".  Refer to the "Installing" section in the README file for
++# additional details.
++#
++# See also the section "Build instructions" in the README file.
++
++# === Variables set by makesetup ===
++
++MODOBJS=        _MODOBJS_
++MODLIBS=        _MODLIBS_
++
++# === Variables set by configure
++VERSION=      @VERSION@
++srcdir=               @srcdir@
++VPATH=                @srcdir@
++export srcdir
++
++CC=           @CC@
++CXX=          @CXX@
++MAINCC=               @MAINCC@
++LINKCC=               @LINKCC@
++AR=           @AR@
++RANLIB=               @RANLIB@
++SVNVERSION=   @SVNVERSION@
++
++# Shell used by make (some versions default to the login shell, which is bad)
++SHELL=                /bin/sh
++
++# Use this to make a link between python$(VERSION) and python in $(BINDIR)
++LN=           @LN@
++
++# Portable install script (configure doesn't always guess right)
++INSTALL=      @INSTALL@
++INSTALL_PROGRAM=@INSTALL_PROGRAM@
++INSTALL_SCRIPT= @INSTALL_SCRIPT@
++INSTALL_DATA= @INSTALL_DATA@
++# Shared libraries must be installed with executable mode on some systems;
++# rather than figuring out exactly which, we always give them executable mode.
++# Also, making them read-only seems to be a good idea...
++INSTALL_SHARED= ${INSTALL} -m 555
++
++MAKESETUP=      $(srcdir)/Modules/makesetup
++
++# Compiler options
++OPT=          @OPT@
++BASECFLAGS=   @BASECFLAGS@
++CFLAGS=               $(BASECFLAGS) $(OPT) $(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
++CPPFLAGS=     -I. -IInclude -I$(srcdir)/Include @CPPFLAGS@
++LDFLAGS=      @LDFLAGS@
++LDLAST=               @LDLAST@
++SGI_ABI=      @SGI_ABI@
++CCSHARED=     @CCSHARED@
++LINKFORSHARED=        @LINKFORSHARED@
++# Extra C flags added for building the interpreter object files.
++CFLAGSFORSHARED=@CFLAGSFORSHARED@
++# C flags used for building the interpreter object files
++PY_CFLAGS=    $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
++
++# For cross compile: build compiler options
++CC_FOR_BUILD= @CC_FOR_BUILD@
++CROSS_COMPILING=      @cross_compiling@
++EXEEXT_FOR_BUILD=     @EXEEXT_FOR_BUILD@
++O_FOR_BUILD=  @O_FOR_BUILD@
++
++CFLAGS_FOR_BUILD=     @CFLAGS_FOR_BUILD@
++CPPFLAGS_FOR_BUILD=   @CPPFLAGS_FOR_BUILD@ -I$(srcdir)/Include
++LDFLAGS_FOR_BUILD=    @LDFLAGS_FOR_BUILD@
++LIBS_FOR_BUILD=       @LIBS_FOR_BUILD@
++
++# Machine-dependent subdirectories
++MACHDEP=      @MACHDEP@
++
++# Install prefix for architecture-independent files
++prefix=               @prefix@
++
++# Install prefix for architecture-dependent files
++exec_prefix=  @exec_prefix@
++
++# Install prefix for data files
++datarootdir=    @datarootdir@
++
++# Expanded directories
++BINDIR=               $(exec_prefix)/bin
++LIBDIR=               $(exec_prefix)/lib64
++MANDIR=               @mandir@
++INCLUDEDIR=   @includedir@
++CONFINCLUDEDIR=       $(exec_prefix)/include
++SCRIPTDIR=    $(prefix)/lib64
++
++# Detailed destination directories
++BINLIBDEST=   $(LIBDIR)/python$(VERSION)
++LIBDEST=      $(SCRIPTDIR)/python$(VERSION)
++INCLUDEPY=    $(INCLUDEDIR)/python$(VERSION)
++CONFINCLUDEPY=        $(CONFINCLUDEDIR)/python$(VERSION)
++LIBP=         $(LIBDIR)/python$(VERSION)
++
++# Symbols used for using shared libraries
++SO=           @SO@
++LDSHARED=     @LDSHARED@
++BLDSHARED=    @BLDSHARED@
++DESTSHARED=   $(BINLIBDEST)/lib-dynload
++
++# Executable suffix (.exe on Windows and Mac OS X)
++EXE=          @EXEEXT@
++BUILDEXE=     @BUILDEXEEXT@
++
++# Short name and location for Mac OS X Python framework
++UNIVERSALSDK=@UNIVERSALSDK@
++PYTHONFRAMEWORK=      @PYTHONFRAMEWORK@
++PYTHONFRAMEWORKDIR=   @PYTHONFRAMEWORKDIR@
++PYTHONFRAMEWORKPREFIX=        @PYTHONFRAMEWORKPREFIX@
++PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
++# Deployment target selected during configure, to be checked
++# by distutils. The export statement is needed to ensure that the
++# deployment target is active during build.
++MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
++@EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
++
++# Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
++OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
++
++# Environment to run shared python without installed libraries
++RUNSHARED=       @RUNSHARED@
++
++# Modes for directories, executables and data files created by the
++# install process.  Default to user-only-writable for all file types.
++DIRMODE=      755
++EXEMODE=      755
++FILEMODE=     644
++
++# configure script arguments
++CONFIG_ARGS=  @CONFIG_ARGS@
++
++
++# Subdirectories with code
++SRCDIRS=      @SRCDIRS@
++
++# Other subdirectories
++SUBDIRSTOO=   Include Lib Misc Demo
++
++# Files and directories to be distributed
++CONFIGFILES=  configure configure.in acconfig.h pyconfig.h.in Makefile.pre.in
++DISTFILES=    README ChangeLog $(CONFIGFILES)
++DISTDIRS=     $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
++DIST=         $(DISTFILES) $(DISTDIRS)
++
++
++LIBRARY=      @LIBRARY@
++LDLIBRARY=      @LDLIBRARY@
++BLDLIBRARY=     @BLDLIBRARY@
++DLLLIBRARY=   @DLLLIBRARY@
++LDLIBRARYDIR=   @LDLIBRARYDIR@
++INSTSONAME=   @INSTSONAME@
++
++
++LIBS=         @LIBS@
++LIBM=         @LIBM@
++LIBC=         @LIBC@
++SYSLIBS=      $(LIBM) $(LIBC)
++SHLIBS=               @SHLIBS@
++
++THREADOBJ=    @THREADOBJ@
++DLINCLDIR=    @DLINCLDIR@
++DYNLOADFILE=  @DYNLOADFILE@
++MACHDEP_OBJS= @MACHDEP_OBJS@
++UNICODE_OBJS=   @UNICODE_OBJS@
++
++PYTHON=               python$(EXE)
++BUILDPYTHON=  python$(EXE)
++PYTHON_FOR_BUILD=     @PYTHON_FOR_BUILD@
++
++# === Definitions added by makesetup ===
++
++
++##########################################################################
++# Modules
++MODULE_OBJS=  \
++              Modules/config.o \
++              Modules/getpath.o \
++              Modules/main.o \
++              Modules/gcmodule.o
++
++# Used of signalmodule.o is not available
++SIGNAL_OBJS=  @SIGNAL_OBJS@
++
++
++##########################################################################
++# Grammar
++GRAMMAR_H=    $(srcdir)/Include/graminit.h
++GRAMMAR_C=    $(srcdir)/Python/graminit.c
++GRAMMAR_INPUT=        $(srcdir)/Grammar/Grammar
++
++
++##########################################################################
++# Parser
++PGEN_FOR_BUILD=       Parser/pgen$(EXEEXT_FOR_BUILD)
++
++POBJS=                \
++              Parser/acceler.o \
++              Parser/grammar1.o \
++              Parser/listnode.o \
++              Parser/node.o \
++              Parser/parser.o \
++              Parser/parsetok.o \
++              Parser/bitset.o \
++              Parser/metagrammar.o \
++              Parser/firstsets.o \
++              Parser/grammar.o \
++              Parser/pgen.o
++
++PARSER_OBJS=  $(POBJS) Parser/myreadline.o Parser/tokenizer.o
++
++POBJS_FOR_BUILD=              \
++              Parser/acceler.$(O_FOR_BUILD) \
++              Parser/grammar1.$(O_FOR_BUILD) \
++              Parser/listnode.$(O_FOR_BUILD) \
++              Parser/node.$(O_FOR_BUILD) \
++              Parser/parser.$(O_FOR_BUILD) \
++              Parser/parsetok.$(O_FOR_BUILD) \
++              Parser/bitset.$(O_FOR_BUILD) \
++              Parser/metagrammar.$(O_FOR_BUILD) \
++              Parser/firstsets.$(O_FOR_BUILD) \
++              Parser/grammar.$(O_FOR_BUILD) \
++              Parser/pgen.$(O_FOR_BUILD)
++
++PGOBJS_FOR_BUILD=             \
++              Objects/obmalloc.$(O_FOR_BUILD) \
++              Python/mysnprintf.$(O_FOR_BUILD) \
++              Parser/tokenizer_pgen.$(O_FOR_BUILD) \
++              Parser/printgrammar.$(O_FOR_BUILD) \
++              Parser/pgenmain.$(O_FOR_BUILD)
++
++PGENOBJS=     $(POBJS_FOR_BUILD) $(PGOBJS_FOR_BUILD)
++
++##########################################################################
++# AST
++AST_H_DIR=    $(srcdir)/Include
++AST_H=                $(AST_H_DIR)/Python-ast.h
++AST_C_DIR=    $(srcdir)/Python
++AST_C=                $(AST_C_DIR)/Python-ast.c
++AST_ASDL=     $(srcdir)/Parser/Python.asdl
++
++ASDLGEN_FILES=        $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
++# XXX Note that a build now requires Python exist before the build starts
++ASDLGEN=      $(srcdir)/Parser/asdl_c.py
++
++##########################################################################
++# Python
++PYTHON_OBJS=  \
++              Python/Python-ast.o \
++              Python/asdl.o \
++              Python/ast.o \
++              Python/bltinmodule.o \
++              Python/ceval.o \
++              Python/compile.o \
++              Python/codecs.o \
++              Python/errors.o \
++              Python/frozen.o \
++              Python/frozenmain.o \
++              Python/future.o \
++              Python/getargs.o \
++              Python/getcompiler.o \
++              Python/getcopyright.o \
++              Python/getmtime.o \
++              Python/getplatform.o \
++              Python/getversion.o \
++              Python/graminit.o \
++              Python/import.o \
++              Python/importdl.o \
++              Python/marshal.o \
++              Python/modsupport.o \
++              Python/mystrtoul.o \
++              Python/mysnprintf.o \
++              Python/pyarena.o \
++              Python/pyfpe.o \
++              Python/pystate.o \
++              Python/pythonrun.o \
++              Python/structmember.o \
++              Python/symtable.o \
++              Python/sysmodule.o \
++              Python/traceback.o \
++              Python/getopt.o \
++              Python/pystrtod.o \
++              Python/$(DYNLOADFILE) \
++              $(MACHDEP_OBJS) \
++              $(THREADOBJ)
++
++
++##########################################################################
++# Objects
++OBJECT_OBJS=  \
++              Objects/abstract.o \
++              Objects/boolobject.o \
++              Objects/bufferobject.o \
++              Objects/cellobject.o \
++              Objects/classobject.o \
++              Objects/cobject.o \
++              Objects/codeobject.o \
++              Objects/complexobject.o \
++              Objects/descrobject.o \
++              Objects/enumobject.o \
++              Objects/exceptions.o \
++              Objects/genobject.o \
++              Objects/fileobject.o \
++              Objects/floatobject.o \
++              Objects/frameobject.o \
++              Objects/funcobject.o \
++              Objects/intobject.o \
++              Objects/iterobject.o \
++              Objects/listobject.o \
++              Objects/longobject.o \
++              Objects/dictobject.o \
++              Objects/methodobject.o \
++              Objects/moduleobject.o \
++              Objects/object.o \
++              Objects/obmalloc.o \
++              Objects/rangeobject.o \
++                Objects/setobject.o \
++              Objects/sliceobject.o \
++              Objects/stringobject.o \
++              Objects/structseq.o \
++              Objects/tupleobject.o \
++              Objects/typeobject.o \
++              Objects/weakrefobject.o \
++              $(UNICODE_OBJS)
++
++
++##########################################################################
++# objects that get linked into the Python library
++LIBRARY_OBJS= \
++              Modules/_typesmodule.o \
++              Modules/getbuildinfo.o \
++              $(PARSER_OBJS) \
++              $(OBJECT_OBJS) \
++              $(PYTHON_OBJS) \
++              $(MODULE_OBJS) \
++              $(SIGNAL_OBJS) \
++              $(MODOBJS)
++
++#########################################################################
++# Rules
++
++# Default target
++all:          $(BUILDPYTHON) oldsharedmods sharedmods
++
++# Build the interpreter
++$(BUILDPYTHON):       Modules/python.o $(LIBRARY) $(LDLIBRARY)
++              $(LINKCC) $(CFLAGS) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
++                      Modules/python.o \
++                      $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
++
++platform: $(PYTHON_FOR_BUILD)
++      $(RUNSHARED) $(PYTHON_FOR_BUILD) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
++
++# Build the shared modules
++sharedmods: $(PYTHON_FOR_BUILD)
++      case $$MAKEFLAGS in \
++      *-s*) $(RUNSHARED) CROSS_COMPILING=$(CROSS_COMPILING) CC='$(CC)' \
++            CFLAGS='$(CFLAGS) $(CPPFLAGS)' \
++            LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py -q build;; \
++      *) $(RUNSHARED) CROSS_COMPILING=$(CROSS_COMPILING) CC='$(CC)' \
++            CFLAGS='$(CFLAGS) $(CPPFLAGS)' \
++            LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py build;; \
++      esac
++
++# Build static library
++# avoid long command lines, same as LIBRARY_OBJS
++$(LIBRARY): $(LIBRARY_OBJS)
++      -rm -f $@
++      $(AR) cr $@ Modules/getbuildinfo.o
++      $(AR) cr $@ Modules/_typesmodule.o
++      $(AR) cr $@ $(PARSER_OBJS)
++      $(AR) cr $@ $(OBJECT_OBJS)
++      $(AR) cr $@ $(PYTHON_OBJS)
++      $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
++      $(AR) cr $@ $(MODOBJS)
++      $(RANLIB) $@
++
++libpython$(VERSION).so: $(LIBRARY_OBJS)
++      if test $(INSTSONAME) != $(LDLIBRARY); then \
++              $(LDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
++              $(LN) -f $(INSTSONAME) $@; \
++      else\
++              $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
++      fi
++
++libpython$(VERSION).sl: $(LIBRARY_OBJS)
++      $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM)
++
++# This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
++# minimal framework (not including the Lib directory and such) in the current
++# directory.
++RESSRCDIR=$(srcdir)/Mac/Resources/framework
++$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
++              $(LIBRARY) \
++              $(RESSRCDIR)/Info.plist \
++                $(RESSRCDIR)/version.plist \
++                $(RESSRCDIR)/English.lproj/InfoPlist.strings
++      $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
++      if test "${UNIVERSALSDK}"; then \
++              $(CC) -o $(LDLIBRARY) -arch i386 -arch ppc -dynamiclib \
++                      -isysroot "${UNIVERSALSDK}" \
++                      -all_load $(LIBRARY) -Wl,-single_module \
++                      -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/Python \
++                      -compatibility_version $(VERSION) \
++                      -current_version $(VERSION); \
++        else \
++              /usr/bin/libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
++                      @LIBTOOL_CRUFT@ ;\
++      fi
++      $(INSTALL) -d -m $(DIRMODE)  \
++              $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
++      $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
++              $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
++      $(INSTALL_DATA) $(RESSRCDIR)/version.plist \
++              $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/version.plist
++      $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
++              $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj/InfoPlist.strings
++      $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
++      $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
++      $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
++      $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
++
++# This rule builds the Cygwin Python DLL and import library if configured
++# for a shared core library; otherwise, this rule is a noop.
++$(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
++      if test -n "$(DLLLIBRARY)"; then \
++              $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
++                      $(LIBS) $(MODLIBS) $(SYSLIBS); \
++      else true; \
++      fi
++
++
++oldsharedmods: $(SHAREDMODS)
++
++
++Makefile Modules/config.c: Makefile.pre \
++                              $(srcdir)/Modules/config.c.in \
++                              $(MAKESETUP) \
++                              Modules/Setup.config \
++                              Modules/Setup \
++                              Modules/Setup.local
++      $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
++                              -s Modules \
++                              Modules/Setup.config \
++                              Modules/Setup.local \
++                              Modules/Setup
++      @mv config.c Modules
++      @echo "The Makefile was updated, you may need to re-run make."
++
++
++Modules/Setup: $(srcdir)/Modules/Setup.dist
++      @if test -f Modules/Setup; then \
++              echo "-----------------------------------------------"; \
++              echo "Modules/Setup.dist is newer than Modules/Setup;"; \
++              echo "check to make sure you have all the updates you"; \
++              echo "need in your Modules/Setup file."; \
++              echo "Usually, copying Setup.dist to Setup will work."; \
++              echo "-----------------------------------------------"; \
++      fi
++
++############################################################################
++# Special rules for object files
++
++Modules/getbuildinfo.o: $(PARSER_OBJS) \
++              $(OBJECT_OBJS) \
++              $(PYTHON_OBJS) \
++              $(MODULE_OBJS) \
++              $(SIGNAL_OBJS) \
++              $(MODOBJS) \
++              $(srcdir)/Modules/getbuildinfo.c
++      $(CC) -c $(PY_CFLAGS) -DSVNVERSION=\"`LC_ALL=C $(SVNVERSION)`\" -o $@ $(srcdir)/Modules/getbuildinfo.c
++
++Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
++      $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
++              -DPREFIX='"$(prefix)"' \
++              -DEXEC_PREFIX='"$(exec_prefix)"' \
++              -DVERSION='"$(VERSION)"' \
++              -DVPATH='"$(VPATH)"' \
++              -o $@ $(srcdir)/Modules/getpath.c
++
++Modules/python.o: $(srcdir)/Modules/python.c
++      $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
++
++
++$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN_FOR_BUILD) $(GRAMMAR_INPUT)
++              -@ mkdir Include
++              -$(PGEN_FOR_BUILD) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
++
++$(PGEN_FOR_BUILD):    $(PGENOBJS)
++              $(CC_FOR_BUILD) $(OPT) $(LDFLAGS_FOR_BUILD) $(PGENOBJS) $(LIBS_FOR_BUILD) -o $(PGEN_FOR_BUILD)
++
++Parser/grammar.o:     $(srcdir)/Parser/grammar.c \
++                              $(srcdir)/Include/token.h \
++                              $(srcdir)/Include/grammar.h
++Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
++
++Parser/tokenizer_pgen.o:      $(srcdir)/Parser/tokenizer.c
++
++$(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
++      $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
++
++$(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
++      $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
++
++Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H)
++
++Python/getplatform.o: $(srcdir)/Python/getplatform.c
++              $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
++
++Python/importdl.o: $(srcdir)/Python/importdl.c
++              $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
++
++Objects/unicodectype.o:       $(srcdir)/Objects/unicodectype.c \
++                              $(srcdir)/Objects/unicodetype_db.h
++
++############################################################################
++# Cross compile rules
++
++# .x is a native object file during cross-compile. 
++.SUFFIXES: .x 
++.c.x:
++      $(CC_FOR_BUILD) -c $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -o $@ $<
++
++############################################################################
++# Header files
++
++PYTHON_HEADERS= \
++              Include/Python.h \
++              Include/Python-ast.h \
++              Include/asdl.h \
++              Include/abstract.h \
++              Include/boolobject.h \
++              Include/bufferobject.h \
++              Include/ceval.h \
++              Include/classobject.h \
++              Include/cobject.h \
++              Include/code.h \
++              Include/codecs.h \
++              Include/compile.h \
++              Include/complexobject.h \
++              Include/descrobject.h \
++              Include/dictobject.h \
++              Include/enumobject.h \
++              Include/genobject.h \
++              Include/fileobject.h \
++              Include/floatobject.h \
++              Include/funcobject.h \
++              Include/import.h \
++              Include/intobject.h \
++              Include/intrcheck.h \
++              Include/iterobject.h \
++              Include/listobject.h \
++              Include/longobject.h \
++              Include/methodobject.h \
++              Include/modsupport.h \
++              Include/moduleobject.h \
++              Include/object.h \
++              Include/objimpl.h \
++              Include/patchlevel.h \
++              Include/pyarena.h \
++              Include/pydebug.h \
++              Include/pyerrors.h \
++              Include/pyfpe.h \
++              Include/pymem.h \
++              Include/pyport.h \
++              Include/pystate.h \
++              Include/pythonrun.h \
++              Include/rangeobject.h \
++                Include/setobject.h \
++              Include/sliceobject.h \
++              Include/stringobject.h \
++              Include/structseq.h \
++              Include/structmember.h \
++              Include/symtable.h \
++              Include/sysmodule.h \
++              Include/traceback.h \
++              Include/tupleobject.h \
++              Include/unicodeobject.h \
++              Include/weakrefobject.h \
++              pyconfig.h
++
++$(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
++
++
++######################################################################
++
++# Test the interpreter (twice, once without .pyc files, once with)
++# In the past, we've had problems where bugs in the marshalling or
++# elsewhere caused bytecode read from .pyc files to behave differently
++# than bytecode generated directly from a .py source file.  Sometimes
++# the bytecode read from a .pyc file had the bug, somtimes the directly
++# generated bytecode.  This is sometimes a very shy bug needing a lot of
++# sample data.
++
++TESTOPTS=     -l $(EXTRATESTOPTS)
++TESTPROG=     $(srcdir)/Lib/test/regrtest.py
++TESTPYTHON=   $(RUNSHARED) $(PYTHON_FOR_BUILD) -E -tt
++test:         all platform
++              -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
++              -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
++              $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
++
++testall:      all platform
++              -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
++              -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
++              $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
++
++#  Run the unitests for both architectures in a Universal build on OSX
++#  Must be run on an Intel box.
++testuniversal:        all platform
++              if [ `arch` != 'i386' ];then \
++                      echo "This can only be used on OSX/i386" ;\
++                      exit 1 ;\
++              fi
++              -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
++              -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
++              $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
++              $(RUNSHARED) /usr/libexec/oah/translate $(PYTHON_FOR_BUILD) -E -tt $(TESTPROG) $(TESTOPTS) -uall
++
++
++# Like testall, but with a single pass only
++# run an optional script to include some information about the build environment
++buildbottest: all platform
++              -@if which pybuildbot.identify >/dev/null 2>&1; then \
++                      pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
++              fi
++              $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw
++
++QUICKTESTOPTS=        $(TESTOPTS) -x test_thread test_signal test_strftime \
++              test_unicodedata test_re test_sre test_select test_poll \
++              test_linuxaudiodev test_struct test_sunaudiodev test_zlib
++quicktest:    all platform
++              -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
++              -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
++              $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
++
++MEMTESTOPTS=    $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
++              test_longexp
++memtest:      all platform
++              -rm -f $(srcdir)/Lib/test/*.py[co]
++              -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
++              $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
++
++# Install everything
++install:      @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
++
++# Install almost everything without disturbing previous versions
++altinstall:   @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
++                sharedinstall oldsharedinstall @FRAMEWORKALTINSTALLLAST@
++
++# Install shared libraries enabled by Setup
++DESTDIRS=     $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
++
++oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
++              @for i in X $(SHAREDMODS); do \
++                if test $$i != X; then \
++                  echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
++                  $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
++                fi; \
++              done
++
++$(DESTSHARED):
++              @for i in $(DESTDIRS); \
++              do \
++                      if test ! -d $(DESTDIR)$$i; then \
++                              echo "Creating directory $$i"; \
++                              $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
++                      else    true; \
++                      fi; \
++              done
++
++
++# Install the interpreter (by creating a hard link to python$(VERSION))
++bininstall:   altbininstall
++      -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
++      then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
++      else true; \
++      fi
++      (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
++      -rm -f $(DESTDIR)$(BINDIR)/python-config
++      (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python-config)
++
++# Install the interpreter with $(VERSION) affixed
++# This goes into $(exec_prefix)
++altbininstall:        $(BUILDPYTHON)
++      @for i in $(BINDIR) $(LIBDIR); \
++      do \
++              if test ! -d $(DESTDIR)$$i; then \
++                      echo "Creating directory $$i"; \
++                      $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
++              else    true; \
++              fi; \
++      done
++      $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
++      if test -f libpython$(VERSION)$(SO); then \
++              if test "$(SO)" = .dll; then \
++                      $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(BINDIR); \
++              else \
++                      $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
++                      if test libpython$(VERSION)$(SO) != $(INSTSONAME); then \
++                              (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) libpython$(VERSION)$(SO)); \
++                      fi \
++              fi; \
++      else    true; \
++      fi
++
++# Install the manual page
++maninstall:
++      @for i in $(MANDIR) $(MANDIR)/man1; \
++      do \
++              if test ! -d $(DESTDIR)$$i; then \
++                      echo "Creating directory $$i"; \
++                      $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
++              else    true; \
++              fi; \
++      done
++      $(INSTALL_DATA) $(srcdir)/Misc/python.man \
++              $(DESTDIR)$(MANDIR)/man1/python.1
++
++# Install the library
++PLATDIR=      plat-$(MACHDEP)
++EXTRAPLATDIR= @EXTRAPLATDIR@
++EXTRAMACHDEPPATH=@EXTRAMACHDEPPATH@
++MACHDEPS=     $(PLATDIR) $(EXTRAPLATDIR)
++XMLLIBSUBDIRS=  xml xml/dom xml/etree xml/parsers xml/sax
++PLATMACDIRS= plat-mac plat-mac/Carbon plat-mac/lib-scriptpackages \
++      plat-mac/lib-scriptpackages/_builtinSuites \
++      plat-mac/lib-scriptpackages/CodeWarrior \
++      plat-mac/lib-scriptpackages/Explorer \
++      plat-mac/lib-scriptpackages/Finder \
++      plat-mac/lib-scriptpackages/Netscape \
++      plat-mac/lib-scriptpackages/StdSuites \
++      plat-mac/lib-scriptpackages/SystemEvents \
++      plat-mac/lib-scriptpackages/Terminal 
++PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages
++LIBSUBDIRS=   lib-tk site-packages test test/output test/data \
++              test/decimaltestdata \
++              encodings compiler hotshot \
++              email email/mime email/test email/test/data \
++              sqlite3 sqlite3/test \
++              logging bsddb bsddb/test csv wsgiref \
++              ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
++              distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
++              setuptools setuptools/command setuptools/tests setuptools.egg-info \
++              curses $(MACHDEPS)
++libinstall: $(srcdir)/Lib/$(PLATDIR) $(PYTHON_FOR_BUILD)
++      @for i in $(SCRIPTDIR) $(LIBDEST); \
++      do \
++              if test ! -d $(DESTDIR)$$i; then \
++                      echo "Creating directory $$i"; \
++                      $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
++              else    true; \
++              fi; \
++      done
++      @for d in $(LIBSUBDIRS); \
++      do \
++              a=$(srcdir)/Lib/$$d; \
++              if test ! -d $$a; then continue; else true; fi; \
++              b=$(LIBDEST)/$$d; \
++              if test ! -d $(DESTDIR)$$b; then \
++                      echo "Creating directory $$b"; \
++                      $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
++              else    true; \
++              fi; \
++      done
++      @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
++      do \
++              if test -x $$i; then \
++                      $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
++                      echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
++              else \
++                      $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
++                      echo $(INSTALL_DATA) $$i $(LIBDEST); \
++              fi; \
++      done
++      @for d in $(LIBSUBDIRS); \
++      do \
++              a=$(srcdir)/Lib/$$d; \
++              if test ! -d $$a; then continue; else true; fi; \
++              if test `ls $$a | wc -l` -lt 1; then continue; fi; \
++              b=$(LIBDEST)/$$d; \
++              for i in $$a/*; \
++              do \
++                      case $$i in \
++                      *CVS) ;; \
++                      *.py[co]) ;; \
++                      *.orig) ;; \
++                      *~) ;; \
++                      *) \
++                              if test -d $$i; then continue; fi; \
++                              if test -x $$i; then \
++                                  echo $(INSTALL_SCRIPT) $$i $$b; \
++                                  $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
++                              else \
++                                  echo $(INSTALL_DATA) $$i $$b; \
++                                  $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
++                              fi;; \
++                      esac; \
++              done; \
++      done
++      $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
++      PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
++              $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
++              -d $(LIBDEST) -f \
++              -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
++      PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
++              $(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
++              -d $(LIBDEST) -f \
++              -x 'bad_coding|badsyntax|site-packages' $(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
++
++# Create the PLATDIR source directory, if one wasn't distributed..
++$(srcdir)/Lib/$(PLATDIR):
++      mkdir $(srcdir)/Lib/$(PLATDIR)
++      cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
++      export PATH; PATH="`pwd`:$$PATH"; \
++      export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
++      export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
++      export EXE; EXE="$(BUILDEXE)"; \
++      cd $(srcdir)/Lib/$(PLATDIR); ./regen
++
++# Install the include files
++INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
++inclinstall:
++      @for i in $(INCLDIRSTOMAKE); \
++      do \
++              if test ! -d $(DESTDIR)$$i; then \
++                      echo "Creating directory $$i"; \
++                      $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
++              else    true; \
++              fi; \
++      done
++      @for i in $(srcdir)/Include/*.h; \
++      do \
++              echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
++              $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
++      done
++      $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
++
++# Install the library and miscellaneous stuff needed for extending/embedding
++# This goes into $(exec_prefix)
++LIBPL=                $(LIBP)/config
++libainstall:  all
++      @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
++      do \
++              if test ! -d $(DESTDIR)$$i; then \
++                      echo "Creating directory $$i"; \
++                      $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
++              else    true; \
++              fi; \
++      done
++      @if test -d $(LIBRARY); then :; else \
++              if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
++                      if test "$(SO)" = .dll; then \
++                              $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
++                      else \
++                              $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
++                              $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
++                      fi; \
++              else \
++                      echo Skip install of $(LIBRARY) - use make frameworkinstall; \
++              fi; \
++      fi
++      $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
++      $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
++      $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
++      $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
++      $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
++      $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
++      $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
++      $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
++      $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
++      # Substitution happens here, as the completely-expanded BINDIR
++      # is not available in configure
++      sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
++      $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
++      rm python-config
++      @if [ -s Modules/python.exp -a \
++              "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
++              echo; echo "Installing support files for building shared extension modules on AIX:"; \
++              $(INSTALL_DATA) Modules/python.exp              \
++                              $(DESTDIR)$(LIBPL)/python.exp;          \
++              echo; echo "$(LIBPL)/python.exp";               \
++              $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix  \
++                              $(DESTDIR)$(LIBPL)/makexp_aix;          \
++              echo "$(LIBPL)/makexp_aix";                     \
++              $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix   \
++                              $(DESTDIR)$(LIBPL)/ld_so_aix;           \
++              echo "$(LIBPL)/ld_so_aix";                      \
++              echo; echo "See Misc/AIX-NOTES for details.";   \
++      else true; \
++      fi
++      @case "$(MACHDEP)" in beos*) \
++              echo; echo "Installing support files for building shared extension modules on BeOS:"; \
++              $(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README;      \
++              echo; echo "$(LIBPL)/README";                   \
++              $(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \
++              echo "$(LIBPL)/ar_beos";                        \
++              $(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \
++              echo "$(LIBPL)/ld_so_beos";                     \
++              echo; echo "See Misc/BeOS-NOTES for details.";  \
++              ;; \
++      esac
++
++# Install the dynamically loadable modules
++# This goes into $(exec_prefix)
++sharedinstall:
++      CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILING='$(CROSS_COMPILING)' \
++              $(RUNSHARED) $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py install \
++              --prefix=$(prefix) \
++              --install-scripts=$(BINDIR) \
++              --install-platlib=$(DESTSHARED) \
++              --root=/$(DESTDIR)
++
++# Here are a couple of targets for MacOSX again, to install a full
++# framework-based Python. frameworkinstall installs everything, the
++# subtargets install specific parts. Much of the actual work is offloaded to
++# the Makefile in Mac
++#
++#
++# This target is here for backward compatiblity, previous versions of Python
++# hadn't integrated framework installation in the normal install process.
++frameworkinstall: install
++
++# On install, we re-make the framework
++# structure in the install location, /Library/Frameworks/ or the argument to
++# --enable-framework. If --enable-framework has been specified then we have
++# automatically set prefix to the location deep down in the framework, so we
++# only have to cater for the structural bits of the framework.
++
++frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
++
++frameworkinstallstructure:    $(LDLIBRARY)
++      @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
++              echo Not configured with --enable-framework; \
++              exit 1; \
++      else true; \
++      fi
++      @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
++              if test ! -d $(DESTDIR)$$i; then \
++                      echo "Creating directory $(DESTDIR)$$i"; \
++                      $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
++              else    true; \
++              fi; \
++      done
++      $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
++      $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(DESTDIR)$(prefix)/Resources/Info.plist
++      $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(DESTDIR)$(prefix)/Resources/version.plist
++      $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
++              $(DESTDIR)$(prefix)/Resources/English.lproj/InfoPlist.strings
++      $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
++      $(LN) -fsn Versions/Current/Python $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Python
++      $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
++      $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
++      $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
++
++# This installs Mac/Lib into the framework
++# Install a number of symlinks to keep software that expects a normal unix
++# install (which includes python-config) happy.
++frameworkinstallmaclib:
++      ln -fs "../../../Python" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a"
++      cd Mac && $(MAKE) installmacsubtree DESTDIR="$(DESTDIR)"
++
++# This installs the IDE, the Launcher and other apps into /Applications
++frameworkinstallapps:
++      cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
++
++# This install the unix python and pythonw tools in /usr/local/bin
++frameworkinstallunixtools:
++      cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
++
++frameworkaltinstallunixtools:
++      cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
++
++# This installs the Demos and Tools into the applications directory.
++# It is not part of a normal frameworkinstall
++frameworkinstallextras:
++      cd Mac && Make installextras DESTDIR="$(DESTDIR)"
++
++# This installs a few of the useful scripts in Tools/scripts
++scriptsinstall:
++      $(RUNSHARED) \
++      $(PYTHON_FOR_BUILD) $(srcdir)/Tools/scripts/setup.py install \
++      --prefix=$(prefix) \
++      --install-scripts=$(BINDIR) \
++      --root=/$(DESTDIR)
++
++# Build the toplevel Makefile
++Makefile.pre: Makefile.pre.in config.status
++      CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
++      $(MAKE) -f Makefile.pre Makefile
++
++# Run the configure script.
++config.status:        $(srcdir)/configure
++      $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
++
++.PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
++
++# Some make's put the object file in the current directory
++.c.o:
++      $(CC) -c $(PY_CFLAGS) -o $@ $<
++
++# Run reindent on the library
++reindent:
++      ./python$(EXEEXT) $(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
++recheck:
++      $(SHELL) config.status --recheck
++      $(SHELL) config.status
++
++# Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
++autoconf:
++      (cd $(srcdir); autoconf)
++      (cd $(srcdir); autoheader)
++
++# Create a tags file for vi
++tags::
++      cd $(srcdir); \
++      ctags -w -t Include/*.h; \
++      for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
++      done; \
++      sort -o tags tags
++
++# Create a tags file for GNU Emacs
++TAGS::
++      cd $(srcdir); \
++      etags Include/*.h; \
++      for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
++
++# Sanitation targets -- clean leaves libraries, executables and tags
++# files, which clobber removes those as well
++pycremoval:
++      find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
++
++clean: pycremoval
++      find . -name '*.o' -exec rm -f {} ';'
++      find . -name '*.s[ol]' -exec rm -f {} ';'
++      find $(srcdir)/build -name 'fficonfig.h' -exec rm -f {} ';' || true
++      find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
++
++clobber: clean
++      -rm -f $(BUILDPYTHON) $(PGEN_FOR_BUILD) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
++              tags TAGS \
++              config.cache config.log pyconfig.h Modules/config.c
++      -rm -rf build platform
++      -rm -rf $(PYTHONFRAMEWORKDIR)
++      -rm -rf buildpython
++
++# Make things extra clean, before making a distribution:
++# remove all generated files, even Makefile[.pre]
++# Keep configure and Python-ast.[ch], it's possible they can't be generated
++distclean: clobber
++      -rm -f core Makefile Makefile.pre config.status \
++              Modules/Setup Modules/Setup.local Modules/Setup.config
++      find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
++                         -o -name '[@,#]*' -o -name '*.old' \
++                         -o -name '*.orig' -o -name '*.rej' \
++                         -o -name '*.bak' ')' \
++                         -exec rm -f {} ';'
++
++# Check for smelly exported symbols (not starting with Py/_Py)
++smelly: all
++      nm -p $(LIBRARY) | \
++              sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
++
++# Find files with funny names
++funny:
++      find $(DISTDIRS) -type d \
++              -o -name '*.[chs]' \
++              -o -name '*.py' \
++              -o -name '*.doc' \
++              -o -name '*.sty' \
++              -o -name '*.bib' \
++              -o -name '*.dat' \
++              -o -name '*.el' \
++              -o -name '*.fd' \
++              -o -name '*.in' \
++              -o -name '*.tex' \
++              -o -name '*,[vpt]' \
++              -o -name 'Setup' \
++              -o -name 'Setup.*' \
++              -o -name README \
++              -o -name Makefile \
++              -o -name ChangeLog \
++              -o -name Repository \
++              -o -name Root \
++              -o -name Entries \
++              -o -name Tag \
++              -o -name tags \
++              -o -name TAGS \
++              -o -name .cvsignore \
++              -o -name MANIFEST \
++              -o -print
++
++# Dependencies
++
++Python/thread.o: @THREADHEADERS@
++
++# Declare targets that aren't real files
++.PHONY: all sharedmods oldsharedmods test quicktest memtest
++.PHONY: install altinstall oldsharedinstall bininstall altbininstall
++.PHONY: maninstall libinstall inclinstall libainstall sharedinstall
++.PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
++.PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
++.PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean 
++.PHONY: smelly funny
++
++# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
+diff -urN Python-2.5.2.orig/Modules/gdbmmodule.c Python-2.5.2.mingw32/Modules/gdbmmodule.c
+--- Python-2.5.2.orig/Modules/gdbmmodule.c     2006-05-29 22:04:52.000000000 +0100
++++ Python-2.5.2.mingw32/Modules/gdbmmodule.c  2008-10-06 17:32:07.000000000 +0100
+@@ -11,7 +11,7 @@
+ #include <fcntl.h>
+ #include "gdbm.h"
+-#if defined(WIN32) && !defined(__CYGWIN__)
++#if defined(WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
+ #include "gdbmerrno.h"
+ extern const char * gdbm_strerror(gdbm_error);
+ #endif
+diff -urN Python-2.5.2.orig/Modules/posixmodule.c Python-2.5.2.mingw32/Modules/posixmodule.c
+--- Python-2.5.2.orig/Modules/posixmodule.c    2008-10-06 14:54:19.000000000 +0100
++++ Python-2.5.2.mingw32/Modules/posixmodule.c 2008-10-06 16:44:25.000000000 +0100
+@@ -130,6 +130,16 @@
+ #define HAVE_CWAIT    1
+ #define HAVE_FSYNC    1
+ #define fsync _commit
++#ifdef __MINGW32__    /* MinGW compiler */
++#define HAVE_GETCWD     1
++#define HAVE_SPAWNV   1
++#define HAVE_EXECV      1
++#define HAVE_PIPE       1
++#define HAVE_POPEN      1
++#define HAVE_SYSTEM   1
++#define HAVE_CWAIT    1
++#define HAVE_FSYNC    1
++#define fsync _commit
+ #else
+ #if defined(PYOS_OS2) && defined(PYCC_GCC) || defined(__VMS)
+ /* Everything needed is defined in PC/os2emx/pyconfig.h or vms/pyconfig.h */
+@@ -156,6 +166,7 @@
+ #define HAVE_WAIT       1
+ #define HAVE_TTYNAME  1
+ #endif  /* PYOS_OS2 && PYCC_GCC && __VMS */
++#endif  /* __MINGW32__ */
+ #endif  /* _MSC_VER */
+ #endif  /* __BORLANDC__ */
+ #endif  /* ! __WATCOMC__ || __QNX__ */
+@@ -173,7 +184,7 @@
+ #if defined(PYCC_VACPP)
+ extern int mkdir(char *);
+ #else
+-#if ( defined(__WATCOMC__) || defined(_MSC_VER) ) && !defined(__QNX__)
++#if ( defined(__WATCOMC__) || defined(_MSC_VER) || defined(__MINGW32__) ) && !defined(__QNX__)
+ extern int mkdir(const char *);
+ #else
+ extern int mkdir(const char *, mode_t);
+@@ -189,9 +200,13 @@
+ #ifdef __BORLANDC__
+ extern int chmod(const char *, int);
+ #else
++#ifndef __MINGW32__
+ extern int chmod(const char *, mode_t);
+ #endif
++#endif
++#ifndef __MINGW32__
+ extern int chown(const char *, uid_t, gid_t);
++#endif
+ extern char *getcwd(char *, int);
+ extern char *strerror(int);
+ extern int link(const char *, const char *);
+@@ -252,7 +267,7 @@
+ #endif
+ #endif
+-#ifdef _MSC_VER
++#if defined(_MSC_VER) || defined(__MINGW32__)
+ #ifdef HAVE_DIRECT_H
+ #include <direct.h>
+ #endif
+@@ -345,7 +360,7 @@
+ */
+ #include <crt_externs.h>
+ static char **environ;
+-#elif !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) )
++#elif !defined(_MSC_VER) && !defined(__MINGW32__) && ( !defined(__WATCOMC__) || defined(__QNX__) )
+ extern char **environ;
+ #endif /* !_MSC_VER */
+@@ -2328,7 +2343,7 @@
+                             Py_FileSystemDefaultEncoding, &path, &mode))
+               return NULL;
+       Py_BEGIN_ALLOW_THREADS
+-#if ( defined(__WATCOMC__) || defined(PYCC_VACPP) ) && !defined(__QNX__)
++#if ( defined(__MINGW32__) || defined(__WATCOMC__) || defined(PYCC_VACPP) ) && !defined(__QNX__)
+       res = mkdir(path);
+ #else
+       res = mkdir(path, mode);
+@@ -7972,7 +7987,7 @@
+ }
+ #endif
+-#ifdef MS_WINDOWS
++#if defined(MS_WINDOWS) && !defined(__MINGW32__)
+ PyDoc_STRVAR(win32_urandom__doc__,
+ "urandom(n) -> str\n\n\
+@@ -8371,9 +8386,9 @@
+ #ifdef HAVE_GETLOADAVG
+       {"getloadavg",  posix_getloadavg, METH_NOARGS, posix_getloadavg__doc__},
+ #endif
+- #ifdef MS_WINDOWS
++#if defined(MS_WINDOWS) && !defined(__MINGW32__)
+       {"urandom", win32_urandom, METH_VARARGS, win32_urandom__doc__},
+- #endif
++#endif
+  #ifdef __VMS
+       {"urandom", vms_urandom, METH_VARARGS, vms_urandom__doc__},
+  #endif
+@@ -8653,7 +8668,7 @@
+ }
+-#if (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__)) && !defined(__QNX__)
++#if (defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__) || defined(__BORLANDC__)) && !defined(__QNX__)
+ #define INITFUNC initnt
+ #define MODNAME "nt"
+diff -urN Python-2.5.2.orig/Modules/Setup.dist Python-2.5.2.mingw32/Modules/Setup.dist
+--- Python-2.5.2.orig/Modules/Setup.dist       2008-10-06 14:54:19.000000000 +0100
++++ Python-2.5.2.mingw32/Modules/Setup.dist    2008-10-06 17:38:27.000000000 +0100
+@@ -111,7 +111,7 @@
+ posix posixmodule.c           # posix (UNIX) system calls
+ errno errnomodule.c           # posix (UNIX) errno values
+-pwd pwdmodule.c                       # this is needed to find out the user's home dir
++#pwd pwdmodule.c                      # this is needed to find out the user's home dir
+                               # if $HOME is not set
+ _sre _sre.c                   # Fredrik Lundh's new regular expressions
+ _codecs _codecsmodule.c               # access to the builtin codecs and codec registry
+@@ -159,7 +159,7 @@
+ # it, depending on your system -- see the GNU readline instructions.
+ # It's okay for this to be a shared library, too.
+-readline readline.c -lreadline -lncursesw
++readline readline.c -lreadline
+ # Modules that should always be present (non UNIX dependent):
+@@ -187,9 +187,9 @@
+ # (If you have a really backward UNIX, select and socket may not be
+ # supported...)
+-fcntl fcntlmodule.c   # fcntl(2) and ioctl(2)
+-spwd spwdmodule.c             # spwd(3) 
+-grp grpmodule.c               # grp(3)
++#fcntl fcntlmodule.c  # fcntl(2) and ioctl(2)
++#spwd spwdmodule.c            # spwd(3) 
++#grp grpmodule.c              # grp(3)
+ select selectmodule.c # select(2); not on ancient System V
+ # Memory-mapped files (also works on Win32).
+@@ -219,9 +219,9 @@
+ # Some more UNIX dependent modules -- off by default, since these
+ # are not supported by all UNIX systems:
+-nis nismodule.c -lnsl # Sun yellow pages -- not everywhere
+-termios termios.c     # Steen Lumholt's termios module
+-resource resource.c   # Jeremy Hylton's rlimit interface
++#nis nismodule.c -lnsl        # Sun yellow pages -- not everywhere
++#termios termios.c    # Steen Lumholt's termios module
++#resource resource.c  # Jeremy Hylton's rlimit interface
+ # Multimedia modules -- off by default.
+@@ -293,12 +293,12 @@
+ # A Linux specific module -- off by default; this may also work on 
+ # some *BSDs.
+-linuxaudiodev linuxaudiodev.c
++#linuxaudiodev linuxaudiodev.c
+ # George Neville-Neil's timing module:
+-timing timingmodule.c
++#timing timingmodule.c
+ # The _tkinter module.
+@@ -313,7 +313,7 @@
+ # every system.
+ # *** Always uncomment this (leave the leading underscore in!):
+-_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
++#_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
+ # *** Uncomment and edit to reflect where your Tcl/Tk libraries are:
+ #     -L/usr/local/lib \
+ # *** Uncomment and edit to reflect where your Tcl/Tk headers are:
+@@ -323,7 +323,7 @@
+ # *** Or uncomment this for Solaris:
+ #     -I/usr/openwin/include \
+ # *** Uncomment and edit for Tix extension only:
+-      -DWITH_TIX -ltix \
++#     -DWITH_TIX -ltix \
+ # *** Uncomment and edit for BLT extension only:
+ #     -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \
+ # *** Uncomment and edit for PIL (TkImaging) extension only:
+@@ -332,7 +332,7 @@
+ # *** Uncomment and edit for TOGL extension only:
+ #     -DWITH_TOGL togl.c \
+ # *** Uncomment and edit to reflect your Tcl/Tk versions:
+-      -ltk -ltcl \
++#     -ltk -ltcl \
+ # *** Uncomment and edit to reflect where your X11 libraries are:
+ #     -L/usr/X11R6/lib \
+ # *** Or uncomment this for Solaris:
+@@ -342,7 +342,7 @@
+ # *** Uncomment for AIX:
+ #     -lld \
+ # *** Always uncomment this; X11 libraries to link with:
+-      -lX11
++#     -lX11
+ # Lance Ellinghaus's syslog module
+ #syslog syslogmodule.c                # syslog daemon interface
+@@ -354,9 +354,11 @@
+ #
+ # First, look at Setup.config; configure may have set this for you.
+-_curses _cursesmodule.c -lncursesw
++# XXX Should be possible to make this work with pdcurses.
++
++#_curses _cursesmodule.c -lncursesw
+ # Wrapper for the panel library that's part of ncurses and SYSV curses.
+-_curses_panel _curses_panel.c -lpanel -lncursesw 
++#_curses_panel _curses_panel.c -lpanel -lncursesw 
+ # Generic (SunOS / SVR4) dynamic loading module.
+@@ -364,7 +366,7 @@
+ # it is a highly experimental and dangerous device for calling
+ # *arbitrary* C functions in *arbitrary* shared libraries:
+-dl dlmodule.c
++#dl dlmodule.c
+ # Modules that provide persistent dictionary-like semantics.  You will
+@@ -402,10 +404,10 @@
+ #
+ # Edit the variables DB and DBLIBVERto point to the db top directory
+ # and the subdirectory of PORT where you built it.
+-DBLIBVER=4.7
+-DBINC=/usr/include/db4
+-DBLIB=/usr/lib64
+-_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER)
++#DBLIBVER=4.7
++#DBINC=/usr/include/db4
++#DBLIB=/usr/lib64
++#_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER)
+ # Historical Berkeley DB 1.85
+ #
+@@ -464,7 +466,7 @@
+ # More information on Expat can be found at www.libexpat.org.
+ #
+ #EXPAT_DIR=/usr/local/src/expat-1.95.2
+-pyexpat pyexpat.c -DHAVE_EXPAT_H -lexpat
++#pyexpat pyexpat.c -DHAVE_EXPAT_H -lexpat
+ # Hye-Shik Chang's CJKCodecs
+diff -urN Python-2.5.2.orig/Python/pythonrun.c Python-2.5.2.mingw32/Python/pythonrun.c
+--- Python-2.5.2.orig/Python/pythonrun.c       2007-05-02 17:02:48.000000000 +0100
++++ Python-2.5.2.mingw32/Python/pythonrun.c    2008-10-06 15:59:16.000000000 +0100
+@@ -1669,6 +1669,8 @@
+ int
+ PyOS_CheckStack(void)
+ {
++/* MinGW (gcc) defines _MSC_VER but doesn't have this exception stuff. */
++#ifndef __MINGW32__
+       __try {
+               /* alloca throws a stack overflow exception if there's
+                  not enough space left on the stack */
+@@ -1678,6 +1680,9 @@
+               /* just ignore all errors */
+       }
+       return 1;
++#else
++      return 0;
++#endif
+ }
+ #endif /* WIN32 && _MSC_VER */
+diff -urN Python-2.5.2.orig/README Python-2.5.2.mingw32/README
+--- Python-2.5.2.orig/README   2008-02-21 11:53:40.000000000 +0000
++++ Python-2.5.2.mingw32/README        2008-10-06 14:55:15.000000000 +0100
+@@ -1189,6 +1189,57 @@
+ do this.
++Cross Compiling
++---------------
++
++Python can be cross compiled by supplying different --build and --host
++parameters to configure.  Python is compiled on the "build" system and
++executed on the "host" system.  Cross compiling python requires a
++native Python on the build host, and a natively compiled tool `Pgen'.
++
++Before cross compiling, the correct version of Python must be compiled
++and installed on the build host.  The configure script will use `cc'
++and `python', or environment variables PYTHON_FOR_BUILD, eg:
++
++
++  PYTHON_FOR_BUILD=python2.5
++
++  # set these values according to your cross-compiler setup
++  PATH="$HOME/cross-target/freebsd-x86/usr/cross/bin:$PATH"
++
++  # headers & libraries for target system
++  CROSS_ROOT=$HOME/cross-target/freebsd-x86/
++
++  # supply all settings not correctly detected by configure.
++  # This can also be put a config.cache file
++  ac_cv_file__dev_ptmx=no
++  # .... insert more relevant settings
++  
++  export CROSS_ROOT PATH PYTHON_FOR_BUILD \
++       ac_cv_file__dev_ptmx  
++  
++  configure --host=i686-freebsd4 --with-system-ffi
++  make 
++
++   
++Cross compiling has been tested under linux. Your mileage may vary for
++other platforms.
++
++A few reminders on using configure to cross compile:
++- Cross compile tools must be in PATH,
++- Cross compile tools must be prefixed with the host type
++  (ie i586-mingw32-gcc, powerpc-darwin8-ranlib, ...),
++- CC, CXX, AR, and RANLIB must be undefined when running configure,
++  they will be auto-detected.
++- Autoconf must be stopped from autodetecting definitions for the
++  build machine.  This is easiest done by creating a config.cache
++  that overrides ac_cv_* variables appropriately.
++
++If you need a cross compiler, Debian ships several several (eg: avr,
++m68hc1x, mingw32), while dpkg-cross easily creates others.  Otherwise,
++check out Dan Kegel's crosstool: http://www.kegel.com/crosstool .
++
++
+ Miscellaneous issues
+ ====================
+diff -urN Python-2.5.2.orig/setup.py Python-2.5.2.mingw32/setup.py
+--- Python-2.5.2.orig/setup.py 2008-10-06 14:54:19.000000000 +0100
++++ Python-2.5.2.mingw32/setup.py      2008-10-06 17:40:57.000000000 +0100
+@@ -17,6 +17,15 @@
+ # This global variable is used to hold the list of modules to be disabled.
+ disabled_module_list = []
++import os
++
++if os.environ.get('CROSS_COMPILING') == 'yes':
++    sysconfig.get_config_vars()
++    sysconfig._config_vars.update (os.environ)
++else:
++    sysconfig.get_config_vars()
++    sysconfig._config_vars['srcdir'] = os.environ['srcdir']
++    
+ 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'
+@@ -203,6 +212,8 @@
+             self.announce('WARNING: skipping import check for Cygwin-based "%s"'
+                 % ext.name)
+             return
++        if os.environ.get('CROSS_COMPILING') == 'yes':
++            return
+         ext_filename = os.path.join(
+             self.build_lib,
+             self.get_ext_filename(self.get_ext_fullname(ext.name)))
+@@ -236,11 +247,15 @@
+                           level=3)
+     def get_platform(self):
+-        # Get value of sys.platform
+-        for platform in ['cygwin', 'beos', 'darwin', 'atheos', 'osf1']:
+-            if sys.platform.startswith(platform):
++        # Get value of target's sys.platform
++        p = sys.platform
++        if os.environ.get('CROSS_COMPILING') == 'yes':
++            p = os.environ.get('MACHDEP').lower()
++
++        for platform in ['cygwin', 'mingw', 'beos', 'darwin', 'atheos', 'osf1']:
++            if p.startswith(platform):
+                 return platform
+-        return sys.platform
++        return p
+     def detect_modules(self):
+         # Ensure that /usr/local is always used
+@@ -294,11 +309,15 @@
+         # 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.
+-        lib_dirs = self.compiler.library_dirs + [
+-            '/lib64', '/usr/lib64',
+-            '/lib', '/usr/lib',
+-            ]
+-        inc_dirs = self.compiler.include_dirs + ['/usr/include']
++        lib_dirs = []
++        inc_dirs = []
++        if os.environ.get('CROSS_COMPILING') != 'yes':
++            lib_dirs = self.compiler.library_dirs + [
++                '/lib64', '/usr/lib64',
++                '/lib', '/usr/lib',
++                ]
++            inc_dirs = self.compiler.include_dirs + ['/usr/include']
++            
+         exts = []
+         config_h = sysconfig.get_config_h_filename()
+@@ -643,6 +662,9 @@
+             db_inc_paths.append('/pkg/db-3.%d/include' % x)
+             db_inc_paths.append('/opt/db-3.%d/include' % x)
++        if os.environ.get('CROSS_COMPILING') == 'yes':
++            db_inc_paths = []
++
+         # Add some common subdirectories for Sleepycat DB to the list,
+         # based on the standard include directories. This way DB3/4 gets
+         # picked up when it is installed in a non-standard prefix and
+@@ -771,6 +793,9 @@
+         MIN_SQLITE_VERSION = ".".join([str(x)
+                                     for x in MIN_SQLITE_VERSION_NUMBER])
++        if os.environ.get('CROSS_COMPILING') == 'yes':
++            sqlite_inc_paths = []
++
+         # Scan the default include directories before the SQLite specific
+         # ones. This allows one to override the copy of sqlite on OSX,
+         # where /usr/include contains an old version of sqlite.
+@@ -857,6 +882,8 @@
+         # the more recent berkeleydb's db.h file first in the include path
+         # when attempting to compile and it will fail.
+         f = "/usr/include/db.h"
++      if os.environ.get('CROSS_COMPILING') == 'yes':
++              f = ''
+         if os.path.exists(f) and not db_incs:
+             data = open(f).read()
+             m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)