Include correct BRs for autoreconf step.
[fedora-mingw.git] / python / mingw32-python-2.5.2-cross.patch-20081006
1 diff -urN Python-2.5.2.orig/configure.in Python-2.5.2.mingw32/configure.in
2 --- Python-2.5.2.orig/configure.in      2008-10-06 14:54:18.000000000 +0100
3 +++ Python-2.5.2.mingw32/configure.in   2008-10-06 18:31:53.000000000 +0100
4 @@ -9,6 +9,11 @@
5  AC_CONFIG_SRCDIR([Include/object.h])
6  AC_CONFIG_HEADER(pyconfig.h)
7  
8 +# find compiler while respecting --host setting
9 +AC_CANONICAL_HOST()
10 +AC_CHECK_TOOLS(CC,gcc cc)
11 +AC_CHECK_TOOLS(CXX,g++ c++)
12 +
13  dnl This is for stuff that absolutely must end up in pyconfig.h.
14  dnl Please use pyport.h instead, if possible.
15  AH_TOP([
16 @@ -163,8 +168,8 @@
17  # Set name for machine-dependent library files
18  AC_SUBST(MACHDEP)
19  AC_MSG_CHECKING(MACHDEP)
20 -if test -z "$MACHDEP"
21 -then
22 +if test -z "$MACHDEP"; then
23 +    if test "$cross_compiling" = "no"; then
24         ac_sys_system=`uname -s`
25         if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64" \
26         -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
27 @@ -172,6 +177,23 @@
28         else
29                 ac_sys_release=`uname -r`
30         fi
31 +    else
32 +       m=`$CC -dumpmachine`
33 +       changequote(<<, >>)#dnl
34 +       ac_sys_system=`expr "$m" : "[^-]*-\([^-]*\)"`
35 +       changequote([, ])#dnl
36 +
37 +
38 +       case $ac_sys_system in
39 +       cygwin*) ac_sys_system=`echo $ac_sys_system | sed s/cygwin/CYGWIN/g `;;
40 +       darwin*) ac_sys_system=`echo $ac_sys_system | sed s/darwin/Darwin/g `;;
41 +       freebsd*) ac_sys_system=`echo $ac_sys_system | sed s/freebsd/FreeBSD/g `;;
42 +       linux*) ac_sys_system=`echo $ac_sys_system | sed s/linux/Linux/g `;;
43 +       esac
44 +       
45 +
46 +    fi
47 +    
48         ac_md_system=`echo $ac_sys_system |
49                            tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
50         ac_md_release=`echo $ac_sys_release |
51 @@ -424,8 +446,8 @@
52  if test -z "$CXX"
53  then
54          case "$CC" in
55 -        gcc)    AC_PATH_PROG(CXX, [g++], [g++], [notfound]) ;;
56 -        cc)     AC_PATH_PROG(CXX, [c++], [c++], [notfound]) ;;
57 +        gcc)    AC_CHECK_TOOL(CXX, [g++], [notfound]) ;;
58 +        cc)     AC_CHECK_TOOL(CXX, [c++], [notfound]) ;;
59          esac
60         if test "$CXX" = "notfound"
61         then
62 @@ -434,7 +456,7 @@
63  fi
64  if test -z "$CXX"
65  then
66 -       AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
67 +       AC_CHECK_TOOLS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
68         if test "$CXX" = "notfound"
69         then
70                 CXX=""
71 @@ -462,34 +484,6 @@
72  esac
73  
74  AC_EXEEXT
75 -AC_MSG_CHECKING(for --with-suffix)
76 -AC_ARG_WITH(suffix,
77 -            AC_HELP_STRING(--with-suffix=.exe, set executable suffix),
78 -[
79 -       case $withval in
80 -       no)     EXEEXT=;;
81 -       yes)    EXEEXT=.exe;;
82 -       *)      EXEEXT=$withval;;
83 -       esac])
84 -AC_MSG_RESULT($EXEEXT)
85 -
86 -# Test whether we're running on a non-case-sensitive system, in which
87 -# case we give a warning if no ext is given
88 -AC_SUBST(BUILDEXEEXT)
89 -AC_MSG_CHECKING(for case-insensitive build directory)
90 -if test ! -d CaseSensitiveTestDir; then
91 -mkdir CaseSensitiveTestDir
92 -fi
93 -
94 -if test -d casesensitivetestdir
95 -then
96 -    AC_MSG_RESULT(yes)
97 -    BUILDEXEEXT=.exe
98 -else
99 -       AC_MSG_RESULT(no)
100 -       BUILDEXEEXT=$EXEEXT
101 -fi
102 -rmdir CaseSensitiveTestDir
103  
104  case $MACHDEP in
105  bsdos*)
106 @@ -686,9 +680,9 @@
107  
108  AC_MSG_RESULT($LDLIBRARY)
109  
110 -AC_PROG_RANLIB
111 -AC_SUBST(AR)
112 -AC_CHECK_PROGS(AR, ar aal, ar)
113 +# find tools while respecting --host setting
114 +AC_CHECK_TOOL(RANLIB,ranlib)
115 +AC_CHECK_TOOLS(AR,ar aal,ar)
116  
117  AC_SUBST(SVNVERSION)
118  AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
119 @@ -810,7 +804,7 @@
120       AC_TRY_RUN([int main() { return 0; }],
121       ac_cv_no_strict_aliasing_ok=yes,
122       ac_cv_no_strict_aliasing_ok=no,
123 -     ac_cv_no_strict_aliasing_ok=no)
124 +     ac_cv_no_strict_aliasing_ok=yes)
125       CC="$ac_save_cc"
126      AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
127      if test $ac_cv_no_strict_aliasing_ok = yes
128 @@ -3369,27 +3363,15 @@
129    AC_MSG_RESULT(no)
130  )
131  
132 -AC_MSG_CHECKING(for /dev/ptmx)
133 -
134 -if test -r /dev/ptmx
135 -then
136 -  AC_MSG_RESULT(yes)
137 -  AC_DEFINE(HAVE_DEV_PTMX, 1,
138 -  [Define if we have /dev/ptmx.])
139 -else
140 -  AC_MSG_RESULT(no)
141 -fi
142 -
143 -AC_MSG_CHECKING(for /dev/ptc)
144 -
145 -if test -r /dev/ptc
146 -then
147 -  AC_MSG_RESULT(yes)
148 -  AC_DEFINE(HAVE_DEV_PTC, 1,
149 -  [Define if we have /dev/ptc.])
150 -else
151 -  AC_MSG_RESULT(no)
152 -fi
153 +AC_CHECK_FILE(/dev/ptmx,
154 +       [AC_DEFINE(HAVE_DEV_PTMX, 1,
155 +          [Define if we have /dev/ptmx.])],
156 +       [])
157
158 +AC_CHECK_FILE(/dev/ptc,
159 +       [AC_DEFINE(HAVE_DEV_PTC, 1,
160 +          [Define if we have /dev/ptc.])],
161 +       [])
162  
163  case $MACHDEP in
164  darwin)        
165 @@ -3411,7 +3393,8 @@
166  
167  
168  AC_MSG_CHECKING(for %zd printf() format support)
169 -AC_TRY_RUN([#include <stdio.h>
170 +AC_CACHE_VAL(ac_cv_printf_zd_format,
171 +       AC_TRY_RUN([#include <stdio.h>
172  #include <stddef.h>
173  #include <string.h>
174  
175 @@ -3447,7 +3430,7 @@
176  }],
177  [AC_MSG_RESULT(yes)
178   AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])],
179 - AC_MSG_RESULT(no))
180 + AC_MSG_RESULT(no)))
181  
182  AC_CHECK_TYPE(socklen_t,,
183    AC_DEFINE(socklen_t,int,
184 @@ -3477,10 +3460,76 @@
185  done
186  AC_MSG_RESULT(done)
187  
188 +# Cross compiling
189 +AC_SUBST(cross_compiling)
190 +
191 +if test "$cross_compiling" = "yes"; then
192 +    AC_MSG_CHECKING(cc for build)
193 +    CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
194 +else
195 +    CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
196 +fi   
197 +     
198 +if test "$cross_compiling" = "yes"; then
199 +   AC_MSG_RESULT($CC_FOR_BUILD)
200 +fi
201 +
202 +AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler (default: cc)])
203 +       
204 +if test "$cross_compiling" = "yes"; then
205 +    AC_MSG_CHECKING(python for build)
206 +    PYTHON_FOR_BUILD="${PYTHON_FOR_BUILD-python}"
207 +    PYTHON_FOR_BUILD=`which $PYTHON_FOR_BUILD`
208 +else
209 +    PYTHON_FOR_BUILD='./$(BUILDPYTHON)'
210 +fi   
211 +
212 +if test "$cross_compiling" = "yes"; then
213 +    AC_MSG_RESULT($PYTHON_FOR_BUILD)
214 +fi
215 +AC_ARG_VAR(PYTHON_FOR_BUILD,[build system python (default: python)])
216 +AC_SUBST(PYTHON_FOR_BUILD)
217 +
218 +if test "$cross_compiling" = "yes"; then
219 +    CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-}
220 +    CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD- -I.}
221 +    CROSS_COMMENT=#
222 +    LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-}
223 +    O_FOR_BUILD=x
224 +    RUNSHARED="MACHDEP=$ac_sys_system SRCDIR=$srcdir SO=${SO}"
225 +
226 +    # Extra flags for MinGW host.
227 +    case "$host" in
228 +        *-*-mingw*)
229 +           CFLAGSFORSHARED="-I`pwd`/PC $CFLAGSFORSHARED"
230 +           CFLAGS_FOR_BUILD="-I`pwd`/PC $CFLAGS_FOR_BUILD"
231 +           CPPFLAGS_FOR_BUILD="-I`pwd`/PC $CPPFLAGS_FOR_BUILD" ;;
232 +    esac
233 +else
234 +    CROSS_COMMENT=
235 +    O_FOR_BUILD=o
236 +fi
237 +AC_SUBST(CFLAGS_FOR_BUILD)
238 +AC_SUBST(CPPFLAGS_FOR_BUILD)
239 +AC_SUBST(CROSS_COMMENT)
240 +AC_SUBST(LDFLAGS_FOR_BUILD)
241 +AC_SUBST(O_FOR_BUILD)
242 +
243  # generate output files
244  AC_CONFIG_FILES(Makefile.pre Modules/Setup.config)
245  AC_OUTPUT
246  
247 +if test "$cross_compiling" = "yes"; then
248 +    case "$host" in
249 +        *-*-mingw*)
250 +           # Never use the generated pyconfig.h, always use the
251 +           # one in the PC/ subdirectory.
252 +           rm -f pyconfig.h pyconfig.h-t
253 +           echo '#include "PC/pyconfig.h"' > pyconfig.h-t
254 +           mv pyconfig.h-t pyconfig.h
255 +    esac
256 +fi
257 +
258  echo "creating Modules/Setup"
259  if test ! -f Modules/Setup
260  then
261 diff -urN Python-2.5.2.orig/Include/pyport.h Python-2.5.2.mingw32/Include/pyport.h
262 --- Python-2.5.2.orig/Include/pyport.h  2008-02-14 11:26:18.000000000 +0000
263 +++ Python-2.5.2.mingw32/Include/pyport.h       2008-10-06 15:07:45.000000000 +0100
264 @@ -752,6 +752,7 @@
265  #define LONG_BIT (8 * SIZEOF_LONG)
266  #endif
267  
268 +#ifndef __MINGW32__
269  #if LONG_BIT != 8 * SIZEOF_LONG
270  /* 04-Oct-2000 LONG_BIT is apparently (mis)defined as 64 on some recent
271   * 32-bit platforms using gcc.  We try to catch that here at compile-time
272 @@ -760,6 +761,7 @@
273   */
274  #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
275  #endif
276 +#endif
277  
278  #ifdef __cplusplus
279  }
280 diff -urN Python-2.5.2.orig/Lib/distutils/command/build_ext.py Python-2.5.2.mingw32/Lib/distutils/command/build_ext.py
281 --- Python-2.5.2.orig/Lib/distutils/command/build_ext.py        2007-04-24 16:27:25.000000000 +0100
282 +++ Python-2.5.2.mingw32/Lib/distutils/command/build_ext.py     2008-10-06 14:55:15.000000000 +0100
283 @@ -624,6 +624,8 @@
284              ext_path[len(ext_path) - 1] = ext_path[len(ext_path) - 1][:8]
285          # extensions in debug_mode are named 'module_d.pyd' under windows
286          so_ext = get_config_var('SO')
287 +        if os.environ.get('CROSS_COMPILING') == 'yes':
288 +            so_ext = os.environ.get('SO')
289          if os.name == 'nt' and self.debug:
290              return apply(os.path.join, ext_path) + '_d' + so_ext
291          return apply(os.path.join, ext_path) + so_ext
292 @@ -705,6 +707,8 @@
293              return ext.libraries
294  
295          else:
296 +            if os.environ.get('CROSS_COMPILING') == 'yes':
297 +                return []
298              from distutils import sysconfig
299              if sysconfig.get_config_var('Py_ENABLE_SHARED'):
300                  template = "python%d.%d"
301 diff -urN Python-2.5.2.orig/Lib/plat-linux/regen Python-2.5.2.mingw32/Lib/plat-linux/regen
302 --- Python-2.5.2.orig/Lib/plat-linux/regen      1970-01-01 01:00:00.000000000 +0100
303 +++ Python-2.5.2.mingw32/Lib/plat-linux/regen   2008-10-06 14:55:15.000000000 +0100
304 @@ -0,0 +1,3 @@
305 +#! /bin/sh
306 +set -v
307 +python$EXE ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h
308 diff -urN Python-2.5.2.orig/Makefile.pre.in Python-2.5.2.mingw32/Makefile.pre.in
309 --- Python-2.5.2.orig/Makefile.pre.in   2008-10-06 14:54:19.000000000 +0100
310 +++ Python-2.5.2.mingw32/Makefile.pre.in        2008-10-06 18:31:47.000000000 +0100
311 @@ -27,6 +27,7 @@
312  VERSION=       @VERSION@
313  srcdir=                @srcdir@
314  VPATH=         @srcdir@
315 +export srcdir
316  
317  CC=            @CC@
318  CXX=           @CXX@
319 @@ -72,6 +73,15 @@
320  # C flags used for building the interpreter object files
321  PY_CFLAGS=     $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
322  
323 +# For cross compile: build compiler options
324 +CC_FOR_BUILD=  @CC_FOR_BUILD@
325 +CROSS_COMPILING=       @cross_compiling@
326 +EXEEXT         =       @EXEEXT@
327 +O_FOR_BUILD=   @O_FOR_BUILD@
328 +
329 +CFLAGS_FOR_BUILD=      @CFLAGS_FOR_BUILD@
330 +CPPFLAGS_FOR_BUILD=    @CPPFLAGS_FOR_BUILD@ -I$(srcdir)/Include
331 +LDFLAGS_FOR_BUILD=     @LDFLAGS_FOR_BUILD@
332  
333  # Machine-dependent subdirectories
334  MACHDEP=       @MACHDEP@
335 @@ -108,7 +118,6 @@
336  
337  # Executable suffix (.exe on Windows and Mac OS X)
338  EXE=           @EXEEXT@
339 -BUILDEXE=      @BUILDEXEEXT@
340  
341  # Short name and location for Mac OS X Python framework
342  UNIVERSALSDK=@UNIVERSALSDK@
343 @@ -172,7 +181,8 @@
344  UNICODE_OBJS=   @UNICODE_OBJS@
345  
346  PYTHON=                python$(EXE)
347 -BUILDPYTHON=   python$(BUILDEXE)
348 +BUILDPYTHON=   python$(EXE)
349 +PYTHON_FOR_BUILD=      @PYTHON_FOR_BUILD@
350  
351  # === Definitions added by makesetup ===
352  
353 @@ -198,7 +208,7 @@
354  
355  ##########################################################################
356  # Parser
357 -PGEN=          Parser/pgen$(EXE)
358 +PGEN_FOR_BUILD=        Parser/pgen$(EXEEXT)
359  
360  POBJS=         \
361                 Parser/acceler.o \
362 @@ -215,14 +225,27 @@
363  
364  PARSER_OBJS=   $(POBJS) Parser/myreadline.o Parser/tokenizer.o
365  
366 -PGOBJS=                \
367 -               Objects/obmalloc.o \
368 -               Python/mysnprintf.o \
369 -               Parser/tokenizer_pgen.o \
370 -               Parser/printgrammar.o \
371 -               Parser/pgenmain.o
372 +POBJS_FOR_BUILD=               \
373 +               Parser/acceler.$(O_FOR_BUILD) \
374 +               Parser/grammar1.$(O_FOR_BUILD) \
375 +               Parser/listnode.$(O_FOR_BUILD) \
376 +               Parser/node.$(O_FOR_BUILD) \
377 +               Parser/parser.$(O_FOR_BUILD) \
378 +               Parser/parsetok.$(O_FOR_BUILD) \
379 +               Parser/bitset.$(O_FOR_BUILD) \
380 +               Parser/metagrammar.$(O_FOR_BUILD) \
381 +               Parser/firstsets.$(O_FOR_BUILD) \
382 +               Parser/grammar.$(O_FOR_BUILD) \
383 +               Parser/pgen.$(O_FOR_BUILD)
384 +
385 +PGOBJS_FOR_BUILD=              \
386 +               Objects/obmalloc.$(O_FOR_BUILD) \
387 +               Python/mysnprintf.$(O_FOR_BUILD) \
388 +               Parser/tokenizer_pgen.$(O_FOR_BUILD) \
389 +               Parser/printgrammar.$(O_FOR_BUILD) \
390 +               Parser/pgenmain.$(O_FOR_BUILD)
391  
392 -PGENOBJS=      $(PGENMAIN) $(POBJS) $(PGOBJS)
393 +PGENOBJS=      $(POBJS_FOR_BUILD) $(PGOBJS_FOR_BUILD)
394  
395  ##########################################################################
396  # AST
397 @@ -341,15 +364,18 @@
398                         Modules/python.o \
399                         $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
400  
401 -platform: $(BUILDPYTHON)
402 -       $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
403 -
404 +platform: $(PYTHON_FOR_BUILD)
405 +       $(RUNSHARED) $(PYTHON_FOR_BUILD) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
406  
407  # Build the shared modules
408 -sharedmods: $(BUILDPYTHON)
409 +sharedmods: $(PYTHON_FOR_BUILD)
410         case $$MAKEFLAGS in \
411 -       *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
412 -       *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
413 +       *-s*) $(RUNSHARED) CROSS_COMPILING=$(CROSS_COMPILING) CC='$(CC)' \
414 +             CFLAGS='$(CFLAGS) $(CPPFLAGS)' \
415 +             LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py -q build;; \
416 +       *) $(RUNSHARED) CROSS_COMPILING=$(CROSS_COMPILING) CC='$(CC)' \
417 +             CFLAGS='$(CFLAGS) $(CPPFLAGS)' \
418 +             LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py build;; \
419         esac
420  
421  # Build static library
422 @@ -472,12 +498,12 @@
423         $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
424  
425  
426 -$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
427 +$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN_FOR_BUILD) $(GRAMMAR_INPUT)
428                 -@ mkdir Include
429 -               -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
430 +               -$(PGEN_FOR_BUILD) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
431  
432 -$(PGEN):       $(PGENOBJS)
433 -               $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
434 +$(PGEN_FOR_BUILD):     $(PGENOBJS)
435 +               $(CC_FOR_BUILD) $(OPT) $(LDFLAGS_FOR_BUILD) $(PGENOBJS) $(LIBS) -o $(PGEN_FOR_BUILD)
436  
437  Parser/grammar.o:      $(srcdir)/Parser/grammar.c \
438                                 $(srcdir)/Include/token.h \
439 @@ -504,6 +530,14 @@
440                                 $(srcdir)/Objects/unicodetype_db.h
441  
442  ############################################################################
443 +# Cross compile rules
444 +
445 +# .x is a native object file during cross-compile. 
446 +.SUFFIXES: .x 
447 +.c.x:
448 +       $(CC_FOR_BUILD) -c $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -o $@ $<
449 +
450 +############################################################################
451  # Header files
452  
453  PYTHON_HEADERS= \
454 @@ -576,7 +610,7 @@
455  
456  TESTOPTS=      -l $(EXTRATESTOPTS)
457  TESTPROG=      $(srcdir)/Lib/test/regrtest.py
458 -TESTPYTHON=    $(RUNSHARED) ./$(BUILDPYTHON) -E -tt
459 +TESTPYTHON=    $(RUNSHARED) $(PYTHON_FOR_BUILD) -E -tt
460  test:          all platform
461                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
462                 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
463 @@ -597,7 +631,7 @@
464                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
465                 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
466                 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
467 -               $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E -tt $(TESTPROG) $(TESTOPTS) -uall
468 +               $(RUNSHARED) /usr/libexec/oah/translate $(PYTHON_FOR_BUILD) -E -tt $(TESTPROG) $(TESTOPTS) -uall
469  
470  
471  # Like testall, but with a single pass only
472 @@ -725,7 +759,7 @@
473                 distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
474                 setuptools setuptools/command setuptools/tests setuptools.egg-info \
475                 curses $(MACHDEPS)
476 -libinstall:    $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR)
477 +libinstall: $(srcdir)/Lib/$(PLATDIR) $(PYTHON_FOR_BUILD)
478         @for i in $(SCRIPTDIR) $(LIBDEST); \
479         do \
480                 if test ! -d $(DESTDIR)$$i; then \
481 @@ -782,19 +816,19 @@
482         done
483         $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
484         PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
485 -               ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
486 +               $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
487                 -d $(LIBDEST) -f \
488                 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
489         PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
490 -               ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
491 +               $(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
492                 -d $(LIBDEST) -f \
493                 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
494         -PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
495 -               ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
496 +               $(PYTHON_FOR_BUILD) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
497                 -d $(LIBDEST)/site-packages -f \
498                 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
499         -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
500 -               ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
501 +               $(PYTHON_FOR_BUILD) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
502                 -d $(LIBDEST)/site-packages -f \
503                 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
504  
505 @@ -805,7 +839,7 @@
506         export PATH; PATH="`pwd`:$$PATH"; \
507         export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
508         export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
509 -       export EXE; EXE="$(BUILDEXE)"; \
510 +       export EXE; EXE="$(EXEEXT)"; \
511         cd $(srcdir)/Lib/$(PLATDIR); ./regen
512  
513  # Install the include files
514 @@ -894,8 +928,9 @@
515  # Install the dynamically loadable modules
516  # This goes into $(exec_prefix)
517  sharedinstall:
518 -       $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
519 -               --prefix=$(prefix) \
520 +       CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILING='$(CROSS_COMPILING)' \
521 +               $(RUNSHARED) $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py install \
522 +               --prefix=$(prefix) \
523                 --install-scripts=$(BINDIR) \
524                 --install-platlib=$(DESTSHARED) \
525                 --root=/$(DESTDIR)
526 @@ -967,8 +1002,8 @@
527  
528  # This installs a few of the useful scripts in Tools/scripts
529  scriptsinstall:
530 -       SRCDIR=$(srcdir) $(RUNSHARED) \
531 -       ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
532 +       $(RUNSHARED) \
533 +       $(PYTHON_FOR_BUILD) $(srcdir)/Tools/scripts/setup.py install \
534         --prefix=$(prefix) \
535         --install-scripts=$(BINDIR) \
536         --root=/$(DESTDIR)
537 @@ -1029,11 +1064,12 @@
538         find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
539  
540  clobber: clean
541 -       -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
542 +       -rm -f $(BUILDPYTHON) $(PGEN_FOR_BUILD) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
543                 tags TAGS \
544                 config.cache config.log pyconfig.h Modules/config.c
545         -rm -rf build platform
546         -rm -rf $(PYTHONFRAMEWORKDIR)
547 +       -rm -rf buildpython
548  
549  # Make things extra clean, before making a distribution:
550  # remove all generated files, even Makefile[.pre]
551 diff -urN Python-2.5.2.orig/Makefile.pre.in~ Python-2.5.2.mingw32/Makefile.pre.in~
552 --- Python-2.5.2.orig/Makefile.pre.in~  1970-01-01 01:00:00.000000000 +0100
553 +++ Python-2.5.2.mingw32/Makefile.pre.in~       2008-10-06 14:55:15.000000000 +0100
554 @@ -0,0 +1,1135 @@
555 +# Top-level Makefile for Python
556 +#
557 +# As distributed, this file is called Makefile.pre.in; it is processed
558 +# into the real Makefile by running the script ./configure, which
559 +# replaces things like @spam@ with values appropriate for your system.
560 +# This means that if you edit Makefile, your changes get lost the next
561 +# time you run the configure script.  Ideally, you can do:
562 +#
563 +#      ./configure
564 +#      make
565 +#      make test
566 +#      make install
567 +#
568 +# If you have a previous version of Python installed that you don't
569 +# want to overwrite, you can use "make altinstall" instead of "make
570 +# install".  Refer to the "Installing" section in the README file for
571 +# additional details.
572 +#
573 +# See also the section "Build instructions" in the README file.
574 +
575 +# === Variables set by makesetup ===
576 +
577 +MODOBJS=        _MODOBJS_
578 +MODLIBS=        _MODLIBS_
579 +
580 +# === Variables set by configure
581 +VERSION=       @VERSION@
582 +srcdir=                @srcdir@
583 +VPATH=         @srcdir@
584 +export srcdir
585 +
586 +CC=            @CC@
587 +CXX=           @CXX@
588 +MAINCC=                @MAINCC@
589 +LINKCC=                @LINKCC@
590 +AR=            @AR@
591 +RANLIB=                @RANLIB@
592 +SVNVERSION=    @SVNVERSION@
593 +
594 +# Shell used by make (some versions default to the login shell, which is bad)
595 +SHELL=         /bin/sh
596 +
597 +# Use this to make a link between python$(VERSION) and python in $(BINDIR)
598 +LN=            @LN@
599 +
600 +# Portable install script (configure doesn't always guess right)
601 +INSTALL=       @INSTALL@
602 +INSTALL_PROGRAM=@INSTALL_PROGRAM@
603 +INSTALL_SCRIPT= @INSTALL_SCRIPT@
604 +INSTALL_DATA=  @INSTALL_DATA@
605 +# Shared libraries must be installed with executable mode on some systems;
606 +# rather than figuring out exactly which, we always give them executable mode.
607 +# Also, making them read-only seems to be a good idea...
608 +INSTALL_SHARED= ${INSTALL} -m 555
609 +
610 +MAKESETUP=      $(srcdir)/Modules/makesetup
611 +
612 +# Compiler options
613 +OPT=           @OPT@
614 +BASECFLAGS=    @BASECFLAGS@
615 +CFLAGS=                $(BASECFLAGS) $(OPT) $(EXTRA_CFLAGS)
616 +# Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
617 +# be able to build extension modules using the directories specified in the
618 +# environment variables
619 +CPPFLAGS=      -I. -IInclude -I$(srcdir)/Include @CPPFLAGS@
620 +LDFLAGS=       @LDFLAGS@
621 +LDLAST=                @LDLAST@
622 +SGI_ABI=       @SGI_ABI@
623 +CCSHARED=      @CCSHARED@
624 +LINKFORSHARED= @LINKFORSHARED@
625 +# Extra C flags added for building the interpreter object files.
626 +CFLAGSFORSHARED=@CFLAGSFORSHARED@
627 +# C flags used for building the interpreter object files
628 +PY_CFLAGS=     $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
629 +
630 +# For cross compile: build compiler options
631 +CC_FOR_BUILD=  @CC_FOR_BUILD@
632 +CROSS_COMPILING=       @cross_compiling@
633 +EXEEXT_FOR_BUILD=      @EXEEXT_FOR_BUILD@
634 +O_FOR_BUILD=   @O_FOR_BUILD@
635 +
636 +CFLAGS_FOR_BUILD=      @CFLAGS_FOR_BUILD@
637 +CPPFLAGS_FOR_BUILD=    @CPPFLAGS_FOR_BUILD@ -I$(srcdir)/Include
638 +LDFLAGS_FOR_BUILD=     @LDFLAGS_FOR_BUILD@
639 +LIBS_FOR_BUILD=        @LIBS_FOR_BUILD@
640 +
641 +# Machine-dependent subdirectories
642 +MACHDEP=       @MACHDEP@
643 +
644 +# Install prefix for architecture-independent files
645 +prefix=                @prefix@
646 +
647 +# Install prefix for architecture-dependent files
648 +exec_prefix=   @exec_prefix@
649 +
650 +# Install prefix for data files
651 +datarootdir=    @datarootdir@
652 +
653 +# Expanded directories
654 +BINDIR=                $(exec_prefix)/bin
655 +LIBDIR=                $(exec_prefix)/lib64
656 +MANDIR=                @mandir@
657 +INCLUDEDIR=    @includedir@
658 +CONFINCLUDEDIR=        $(exec_prefix)/include
659 +SCRIPTDIR=     $(prefix)/lib64
660 +
661 +# Detailed destination directories
662 +BINLIBDEST=    $(LIBDIR)/python$(VERSION)
663 +LIBDEST=       $(SCRIPTDIR)/python$(VERSION)
664 +INCLUDEPY=     $(INCLUDEDIR)/python$(VERSION)
665 +CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
666 +LIBP=          $(LIBDIR)/python$(VERSION)
667 +
668 +# Symbols used for using shared libraries
669 +SO=            @SO@
670 +LDSHARED=      @LDSHARED@
671 +BLDSHARED=     @BLDSHARED@
672 +DESTSHARED=    $(BINLIBDEST)/lib-dynload
673 +
674 +# Executable suffix (.exe on Windows and Mac OS X)
675 +EXE=           @EXEEXT@
676 +BUILDEXE=      @BUILDEXEEXT@
677 +
678 +# Short name and location for Mac OS X Python framework
679 +UNIVERSALSDK=@UNIVERSALSDK@
680 +PYTHONFRAMEWORK=       @PYTHONFRAMEWORK@
681 +PYTHONFRAMEWORKDIR=    @PYTHONFRAMEWORKDIR@
682 +PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@
683 +PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
684 +# Deployment target selected during configure, to be checked
685 +# by distutils. The export statement is needed to ensure that the
686 +# deployment target is active during build.
687 +MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
688 +@EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
689 +
690 +# Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
691 +OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
692 +
693 +# Environment to run shared python without installed libraries
694 +RUNSHARED=       @RUNSHARED@
695 +
696 +# Modes for directories, executables and data files created by the
697 +# install process.  Default to user-only-writable for all file types.
698 +DIRMODE=       755
699 +EXEMODE=       755
700 +FILEMODE=      644
701 +
702 +# configure script arguments
703 +CONFIG_ARGS=   @CONFIG_ARGS@
704 +
705 +
706 +# Subdirectories with code
707 +SRCDIRS=       @SRCDIRS@
708 +
709 +# Other subdirectories
710 +SUBDIRSTOO=    Include Lib Misc Demo
711 +
712 +# Files and directories to be distributed
713 +CONFIGFILES=   configure configure.in acconfig.h pyconfig.h.in Makefile.pre.in
714 +DISTFILES=     README ChangeLog $(CONFIGFILES)
715 +DISTDIRS=      $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
716 +DIST=          $(DISTFILES) $(DISTDIRS)
717 +
718 +
719 +LIBRARY=       @LIBRARY@
720 +LDLIBRARY=      @LDLIBRARY@
721 +BLDLIBRARY=     @BLDLIBRARY@
722 +DLLLIBRARY=    @DLLLIBRARY@
723 +LDLIBRARYDIR=   @LDLIBRARYDIR@
724 +INSTSONAME=    @INSTSONAME@
725 +
726 +
727 +LIBS=          @LIBS@
728 +LIBM=          @LIBM@
729 +LIBC=          @LIBC@
730 +SYSLIBS=       $(LIBM) $(LIBC)
731 +SHLIBS=                @SHLIBS@
732 +
733 +THREADOBJ=     @THREADOBJ@
734 +DLINCLDIR=     @DLINCLDIR@
735 +DYNLOADFILE=   @DYNLOADFILE@
736 +MACHDEP_OBJS=  @MACHDEP_OBJS@
737 +UNICODE_OBJS=   @UNICODE_OBJS@
738 +
739 +PYTHON=                python$(EXE)
740 +BUILDPYTHON=   python$(EXE)
741 +PYTHON_FOR_BUILD=      @PYTHON_FOR_BUILD@
742 +
743 +# === Definitions added by makesetup ===
744 +
745 +
746 +##########################################################################
747 +# Modules
748 +MODULE_OBJS=   \
749 +               Modules/config.o \
750 +               Modules/getpath.o \
751 +               Modules/main.o \
752 +               Modules/gcmodule.o
753 +
754 +# Used of signalmodule.o is not available
755 +SIGNAL_OBJS=   @SIGNAL_OBJS@
756 +
757 +
758 +##########################################################################
759 +# Grammar
760 +GRAMMAR_H=     $(srcdir)/Include/graminit.h
761 +GRAMMAR_C=     $(srcdir)/Python/graminit.c
762 +GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
763 +
764 +
765 +##########################################################################
766 +# Parser
767 +PGEN_FOR_BUILD=        Parser/pgen$(EXEEXT_FOR_BUILD)
768 +
769 +POBJS=         \
770 +               Parser/acceler.o \
771 +               Parser/grammar1.o \
772 +               Parser/listnode.o \
773 +               Parser/node.o \
774 +               Parser/parser.o \
775 +               Parser/parsetok.o \
776 +               Parser/bitset.o \
777 +               Parser/metagrammar.o \
778 +               Parser/firstsets.o \
779 +               Parser/grammar.o \
780 +               Parser/pgen.o
781 +
782 +PARSER_OBJS=   $(POBJS) Parser/myreadline.o Parser/tokenizer.o
783 +
784 +POBJS_FOR_BUILD=               \
785 +               Parser/acceler.$(O_FOR_BUILD) \
786 +               Parser/grammar1.$(O_FOR_BUILD) \
787 +               Parser/listnode.$(O_FOR_BUILD) \
788 +               Parser/node.$(O_FOR_BUILD) \
789 +               Parser/parser.$(O_FOR_BUILD) \
790 +               Parser/parsetok.$(O_FOR_BUILD) \
791 +               Parser/bitset.$(O_FOR_BUILD) \
792 +               Parser/metagrammar.$(O_FOR_BUILD) \
793 +               Parser/firstsets.$(O_FOR_BUILD) \
794 +               Parser/grammar.$(O_FOR_BUILD) \
795 +               Parser/pgen.$(O_FOR_BUILD)
796 +
797 +PGOBJS_FOR_BUILD=              \
798 +               Objects/obmalloc.$(O_FOR_BUILD) \
799 +               Python/mysnprintf.$(O_FOR_BUILD) \
800 +               Parser/tokenizer_pgen.$(O_FOR_BUILD) \
801 +               Parser/printgrammar.$(O_FOR_BUILD) \
802 +               Parser/pgenmain.$(O_FOR_BUILD)
803 +
804 +PGENOBJS=      $(POBJS_FOR_BUILD) $(PGOBJS_FOR_BUILD)
805 +
806 +##########################################################################
807 +# AST
808 +AST_H_DIR=     $(srcdir)/Include
809 +AST_H=         $(AST_H_DIR)/Python-ast.h
810 +AST_C_DIR=     $(srcdir)/Python
811 +AST_C=         $(AST_C_DIR)/Python-ast.c
812 +AST_ASDL=      $(srcdir)/Parser/Python.asdl
813 +
814 +ASDLGEN_FILES= $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
815 +# XXX Note that a build now requires Python exist before the build starts
816 +ASDLGEN=       $(srcdir)/Parser/asdl_c.py
817 +
818 +##########################################################################
819 +# Python
820 +PYTHON_OBJS=   \
821 +               Python/Python-ast.o \
822 +               Python/asdl.o \
823 +               Python/ast.o \
824 +               Python/bltinmodule.o \
825 +               Python/ceval.o \
826 +               Python/compile.o \
827 +               Python/codecs.o \
828 +               Python/errors.o \
829 +               Python/frozen.o \
830 +               Python/frozenmain.o \
831 +               Python/future.o \
832 +               Python/getargs.o \
833 +               Python/getcompiler.o \
834 +               Python/getcopyright.o \
835 +               Python/getmtime.o \
836 +               Python/getplatform.o \
837 +               Python/getversion.o \
838 +               Python/graminit.o \
839 +               Python/import.o \
840 +               Python/importdl.o \
841 +               Python/marshal.o \
842 +               Python/modsupport.o \
843 +               Python/mystrtoul.o \
844 +               Python/mysnprintf.o \
845 +               Python/pyarena.o \
846 +               Python/pyfpe.o \
847 +               Python/pystate.o \
848 +               Python/pythonrun.o \
849 +               Python/structmember.o \
850 +               Python/symtable.o \
851 +               Python/sysmodule.o \
852 +               Python/traceback.o \
853 +               Python/getopt.o \
854 +               Python/pystrtod.o \
855 +               Python/$(DYNLOADFILE) \
856 +               $(MACHDEP_OBJS) \
857 +               $(THREADOBJ)
858 +
859 +
860 +##########################################################################
861 +# Objects
862 +OBJECT_OBJS=   \
863 +               Objects/abstract.o \
864 +               Objects/boolobject.o \
865 +               Objects/bufferobject.o \
866 +               Objects/cellobject.o \
867 +               Objects/classobject.o \
868 +               Objects/cobject.o \
869 +               Objects/codeobject.o \
870 +               Objects/complexobject.o \
871 +               Objects/descrobject.o \
872 +               Objects/enumobject.o \
873 +               Objects/exceptions.o \
874 +               Objects/genobject.o \
875 +               Objects/fileobject.o \
876 +               Objects/floatobject.o \
877 +               Objects/frameobject.o \
878 +               Objects/funcobject.o \
879 +               Objects/intobject.o \
880 +               Objects/iterobject.o \
881 +               Objects/listobject.o \
882 +               Objects/longobject.o \
883 +               Objects/dictobject.o \
884 +               Objects/methodobject.o \
885 +               Objects/moduleobject.o \
886 +               Objects/object.o \
887 +               Objects/obmalloc.o \
888 +               Objects/rangeobject.o \
889 +                Objects/setobject.o \
890 +               Objects/sliceobject.o \
891 +               Objects/stringobject.o \
892 +               Objects/structseq.o \
893 +               Objects/tupleobject.o \
894 +               Objects/typeobject.o \
895 +               Objects/weakrefobject.o \
896 +               $(UNICODE_OBJS)
897 +
898 +
899 +##########################################################################
900 +# objects that get linked into the Python library
901 +LIBRARY_OBJS=  \
902 +               Modules/_typesmodule.o \
903 +               Modules/getbuildinfo.o \
904 +               $(PARSER_OBJS) \
905 +               $(OBJECT_OBJS) \
906 +               $(PYTHON_OBJS) \
907 +               $(MODULE_OBJS) \
908 +               $(SIGNAL_OBJS) \
909 +               $(MODOBJS)
910 +
911 +#########################################################################
912 +# Rules
913 +
914 +# Default target
915 +all:           $(BUILDPYTHON) oldsharedmods sharedmods
916 +
917 +# Build the interpreter
918 +$(BUILDPYTHON):        Modules/python.o $(LIBRARY) $(LDLIBRARY)
919 +               $(LINKCC) $(CFLAGS) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
920 +                       Modules/python.o \
921 +                       $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
922 +
923 +platform: $(PYTHON_FOR_BUILD)
924 +       $(RUNSHARED) $(PYTHON_FOR_BUILD) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
925 +
926 +# Build the shared modules
927 +sharedmods: $(PYTHON_FOR_BUILD)
928 +       case $$MAKEFLAGS in \
929 +       *-s*) $(RUNSHARED) CROSS_COMPILING=$(CROSS_COMPILING) CC='$(CC)' \
930 +             CFLAGS='$(CFLAGS) $(CPPFLAGS)' \
931 +             LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py -q build;; \
932 +       *) $(RUNSHARED) CROSS_COMPILING=$(CROSS_COMPILING) CC='$(CC)' \
933 +             CFLAGS='$(CFLAGS) $(CPPFLAGS)' \
934 +             LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py build;; \
935 +       esac
936 +
937 +# Build static library
938 +# avoid long command lines, same as LIBRARY_OBJS
939 +$(LIBRARY): $(LIBRARY_OBJS)
940 +       -rm -f $@
941 +       $(AR) cr $@ Modules/getbuildinfo.o
942 +       $(AR) cr $@ Modules/_typesmodule.o
943 +       $(AR) cr $@ $(PARSER_OBJS)
944 +       $(AR) cr $@ $(OBJECT_OBJS)
945 +       $(AR) cr $@ $(PYTHON_OBJS)
946 +       $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
947 +       $(AR) cr $@ $(MODOBJS)
948 +       $(RANLIB) $@
949 +
950 +libpython$(VERSION).so: $(LIBRARY_OBJS)
951 +       if test $(INSTSONAME) != $(LDLIBRARY); then \
952 +               $(LDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
953 +               $(LN) -f $(INSTSONAME) $@; \
954 +       else\
955 +               $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
956 +       fi
957 +
958 +libpython$(VERSION).sl: $(LIBRARY_OBJS)
959 +       $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM)
960 +
961 +# This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
962 +# minimal framework (not including the Lib directory and such) in the current
963 +# directory.
964 +RESSRCDIR=$(srcdir)/Mac/Resources/framework
965 +$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
966 +               $(LIBRARY) \
967 +               $(RESSRCDIR)/Info.plist \
968 +                $(RESSRCDIR)/version.plist \
969 +                $(RESSRCDIR)/English.lproj/InfoPlist.strings
970 +       $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
971 +       if test "${UNIVERSALSDK}"; then \
972 +               $(CC) -o $(LDLIBRARY) -arch i386 -arch ppc -dynamiclib \
973 +                       -isysroot "${UNIVERSALSDK}" \
974 +                       -all_load $(LIBRARY) -Wl,-single_module \
975 +                       -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/Python \
976 +                       -compatibility_version $(VERSION) \
977 +                       -current_version $(VERSION); \
978 +        else \
979 +               /usr/bin/libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
980 +                       @LIBTOOL_CRUFT@ ;\
981 +       fi
982 +       $(INSTALL) -d -m $(DIRMODE)  \
983 +               $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
984 +       $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
985 +               $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
986 +       $(INSTALL_DATA) $(RESSRCDIR)/version.plist \
987 +               $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/version.plist
988 +       $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
989 +               $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj/InfoPlist.strings
990 +       $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
991 +       $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
992 +       $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
993 +       $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
994 +
995 +# This rule builds the Cygwin Python DLL and import library if configured
996 +# for a shared core library; otherwise, this rule is a noop.
997 +$(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
998 +       if test -n "$(DLLLIBRARY)"; then \
999 +               $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
1000 +                       $(LIBS) $(MODLIBS) $(SYSLIBS); \
1001 +       else true; \
1002 +       fi
1003 +
1004 +
1005 +oldsharedmods: $(SHAREDMODS)
1006 +
1007 +
1008 +Makefile Modules/config.c: Makefile.pre \
1009 +                               $(srcdir)/Modules/config.c.in \
1010 +                               $(MAKESETUP) \
1011 +                               Modules/Setup.config \
1012 +                               Modules/Setup \
1013 +                               Modules/Setup.local
1014 +       $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
1015 +                               -s Modules \
1016 +                               Modules/Setup.config \
1017 +                               Modules/Setup.local \
1018 +                               Modules/Setup
1019 +       @mv config.c Modules
1020 +       @echo "The Makefile was updated, you may need to re-run make."
1021 +
1022 +
1023 +Modules/Setup: $(srcdir)/Modules/Setup.dist
1024 +       @if test -f Modules/Setup; then \
1025 +               echo "-----------------------------------------------"; \
1026 +               echo "Modules/Setup.dist is newer than Modules/Setup;"; \
1027 +               echo "check to make sure you have all the updates you"; \
1028 +               echo "need in your Modules/Setup file."; \
1029 +               echo "Usually, copying Setup.dist to Setup will work."; \
1030 +               echo "-----------------------------------------------"; \
1031 +       fi
1032 +
1033 +############################################################################
1034 +# Special rules for object files
1035 +
1036 +Modules/getbuildinfo.o: $(PARSER_OBJS) \
1037 +               $(OBJECT_OBJS) \
1038 +               $(PYTHON_OBJS) \
1039 +               $(MODULE_OBJS) \
1040 +               $(SIGNAL_OBJS) \
1041 +               $(MODOBJS) \
1042 +               $(srcdir)/Modules/getbuildinfo.c
1043 +       $(CC) -c $(PY_CFLAGS) -DSVNVERSION=\"`LC_ALL=C $(SVNVERSION)`\" -o $@ $(srcdir)/Modules/getbuildinfo.c
1044 +
1045 +Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
1046 +       $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
1047 +               -DPREFIX='"$(prefix)"' \
1048 +               -DEXEC_PREFIX='"$(exec_prefix)"' \
1049 +               -DVERSION='"$(VERSION)"' \
1050 +               -DVPATH='"$(VPATH)"' \
1051 +               -o $@ $(srcdir)/Modules/getpath.c
1052 +
1053 +Modules/python.o: $(srcdir)/Modules/python.c
1054 +       $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
1055 +
1056 +
1057 +$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN_FOR_BUILD) $(GRAMMAR_INPUT)
1058 +               -@ mkdir Include
1059 +               -$(PGEN_FOR_BUILD) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
1060 +
1061 +$(PGEN_FOR_BUILD):     $(PGENOBJS)
1062 +               $(CC_FOR_BUILD) $(OPT) $(LDFLAGS_FOR_BUILD) $(PGENOBJS) $(LIBS_FOR_BUILD) -o $(PGEN_FOR_BUILD)
1063 +
1064 +Parser/grammar.o:      $(srcdir)/Parser/grammar.c \
1065 +                               $(srcdir)/Include/token.h \
1066 +                               $(srcdir)/Include/grammar.h
1067 +Parser/metagrammar.o:  $(srcdir)/Parser/metagrammar.c
1068 +
1069 +Parser/tokenizer_pgen.o:       $(srcdir)/Parser/tokenizer.c
1070 +
1071 +$(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
1072 +       $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
1073 +
1074 +$(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
1075 +       $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
1076 +
1077 +Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H)
1078 +
1079 +Python/getplatform.o: $(srcdir)/Python/getplatform.c
1080 +               $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
1081 +
1082 +Python/importdl.o: $(srcdir)/Python/importdl.c
1083 +               $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
1084 +
1085 +Objects/unicodectype.o:        $(srcdir)/Objects/unicodectype.c \
1086 +                               $(srcdir)/Objects/unicodetype_db.h
1087 +
1088 +############################################################################
1089 +# Cross compile rules
1090 +
1091 +# .x is a native object file during cross-compile. 
1092 +.SUFFIXES: .x 
1093 +.c.x:
1094 +       $(CC_FOR_BUILD) -c $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -o $@ $<
1095 +
1096 +############################################################################
1097 +# Header files
1098 +
1099 +PYTHON_HEADERS= \
1100 +               Include/Python.h \
1101 +               Include/Python-ast.h \
1102 +               Include/asdl.h \
1103 +               Include/abstract.h \
1104 +               Include/boolobject.h \
1105 +               Include/bufferobject.h \
1106 +               Include/ceval.h \
1107 +               Include/classobject.h \
1108 +               Include/cobject.h \
1109 +               Include/code.h \
1110 +               Include/codecs.h \
1111 +               Include/compile.h \
1112 +               Include/complexobject.h \
1113 +               Include/descrobject.h \
1114 +               Include/dictobject.h \
1115 +               Include/enumobject.h \
1116 +               Include/genobject.h \
1117 +               Include/fileobject.h \
1118 +               Include/floatobject.h \
1119 +               Include/funcobject.h \
1120 +               Include/import.h \
1121 +               Include/intobject.h \
1122 +               Include/intrcheck.h \
1123 +               Include/iterobject.h \
1124 +               Include/listobject.h \
1125 +               Include/longobject.h \
1126 +               Include/methodobject.h \
1127 +               Include/modsupport.h \
1128 +               Include/moduleobject.h \
1129 +               Include/object.h \
1130 +               Include/objimpl.h \
1131 +               Include/patchlevel.h \
1132 +               Include/pyarena.h \
1133 +               Include/pydebug.h \
1134 +               Include/pyerrors.h \
1135 +               Include/pyfpe.h \
1136 +               Include/pymem.h \
1137 +               Include/pyport.h \
1138 +               Include/pystate.h \
1139 +               Include/pythonrun.h \
1140 +               Include/rangeobject.h \
1141 +                Include/setobject.h \
1142 +               Include/sliceobject.h \
1143 +               Include/stringobject.h \
1144 +               Include/structseq.h \
1145 +               Include/structmember.h \
1146 +               Include/symtable.h \
1147 +               Include/sysmodule.h \
1148 +               Include/traceback.h \
1149 +               Include/tupleobject.h \
1150 +               Include/unicodeobject.h \
1151 +               Include/weakrefobject.h \
1152 +               pyconfig.h
1153 +
1154 +$(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
1155 +
1156 +
1157 +######################################################################
1158 +
1159 +# Test the interpreter (twice, once without .pyc files, once with)
1160 +# In the past, we've had problems where bugs in the marshalling or
1161 +# elsewhere caused bytecode read from .pyc files to behave differently
1162 +# than bytecode generated directly from a .py source file.  Sometimes
1163 +# the bytecode read from a .pyc file had the bug, somtimes the directly
1164 +# generated bytecode.  This is sometimes a very shy bug needing a lot of
1165 +# sample data.
1166 +
1167 +TESTOPTS=      -l $(EXTRATESTOPTS)
1168 +TESTPROG=      $(srcdir)/Lib/test/regrtest.py
1169 +TESTPYTHON=    $(RUNSHARED) $(PYTHON_FOR_BUILD) -E -tt
1170 +test:          all platform
1171 +               -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
1172 +               -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
1173 +               $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
1174 +
1175 +testall:       all platform
1176 +               -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
1177 +               -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
1178 +               $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
1179 +
1180 +#  Run the unitests for both architectures in a Universal build on OSX
1181 +#  Must be run on an Intel box.
1182 +testuniversal: all platform
1183 +               if [ `arch` != 'i386' ];then \
1184 +                       echo "This can only be used on OSX/i386" ;\
1185 +                       exit 1 ;\
1186 +               fi
1187 +               -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
1188 +               -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
1189 +               $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
1190 +               $(RUNSHARED) /usr/libexec/oah/translate $(PYTHON_FOR_BUILD) -E -tt $(TESTPROG) $(TESTOPTS) -uall
1191 +
1192 +
1193 +# Like testall, but with a single pass only
1194 +# run an optional script to include some information about the build environment
1195 +buildbottest:  all platform
1196 +               -@if which pybuildbot.identify >/dev/null 2>&1; then \
1197 +                       pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
1198 +               fi
1199 +               $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw
1200 +
1201 +QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
1202 +               test_unicodedata test_re test_sre test_select test_poll \
1203 +               test_linuxaudiodev test_struct test_sunaudiodev test_zlib
1204 +quicktest:     all platform
1205 +               -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
1206 +               -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
1207 +               $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
1208 +
1209 +MEMTESTOPTS=    $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
1210 +               test_longexp
1211 +memtest:       all platform
1212 +               -rm -f $(srcdir)/Lib/test/*.py[co]
1213 +               -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
1214 +               $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
1215 +
1216 +# Install everything
1217 +install:       @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
1218 +
1219 +# Install almost everything without disturbing previous versions
1220 +altinstall:    @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
1221 +                sharedinstall oldsharedinstall @FRAMEWORKALTINSTALLLAST@
1222 +
1223 +# Install shared libraries enabled by Setup
1224 +DESTDIRS=      $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
1225 +
1226 +oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
1227 +               @for i in X $(SHAREDMODS); do \
1228 +                 if test $$i != X; then \
1229 +                   echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
1230 +                   $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
1231 +                 fi; \
1232 +               done
1233 +
1234 +$(DESTSHARED):
1235 +               @for i in $(DESTDIRS); \
1236 +               do \
1237 +                       if test ! -d $(DESTDIR)$$i; then \
1238 +                               echo "Creating directory $$i"; \
1239 +                               $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1240 +                       else    true; \
1241 +                       fi; \
1242 +               done
1243 +
1244 +
1245 +# Install the interpreter (by creating a hard link to python$(VERSION))
1246 +bininstall:    altbininstall
1247 +       -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
1248 +       then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
1249 +       else true; \
1250 +       fi
1251 +       (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
1252 +       -rm -f $(DESTDIR)$(BINDIR)/python-config
1253 +       (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python-config)
1254 +
1255 +# Install the interpreter with $(VERSION) affixed
1256 +# This goes into $(exec_prefix)
1257 +altbininstall: $(BUILDPYTHON)
1258 +       @for i in $(BINDIR) $(LIBDIR); \
1259 +       do \
1260 +               if test ! -d $(DESTDIR)$$i; then \
1261 +                       echo "Creating directory $$i"; \
1262 +                       $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1263 +               else    true; \
1264 +               fi; \
1265 +       done
1266 +       $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
1267 +       if test -f libpython$(VERSION)$(SO); then \
1268 +               if test "$(SO)" = .dll; then \
1269 +                       $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(BINDIR); \
1270 +               else \
1271 +                       $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
1272 +                       if test libpython$(VERSION)$(SO) != $(INSTSONAME); then \
1273 +                               (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) libpython$(VERSION)$(SO)); \
1274 +                       fi \
1275 +               fi; \
1276 +       else    true; \
1277 +       fi
1278 +
1279 +# Install the manual page
1280 +maninstall:
1281 +       @for i in $(MANDIR) $(MANDIR)/man1; \
1282 +       do \
1283 +               if test ! -d $(DESTDIR)$$i; then \
1284 +                       echo "Creating directory $$i"; \
1285 +                       $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1286 +               else    true; \
1287 +               fi; \
1288 +       done
1289 +       $(INSTALL_DATA) $(srcdir)/Misc/python.man \
1290 +               $(DESTDIR)$(MANDIR)/man1/python.1
1291 +
1292 +# Install the library
1293 +PLATDIR=       plat-$(MACHDEP)
1294 +EXTRAPLATDIR= @EXTRAPLATDIR@
1295 +EXTRAMACHDEPPATH=@EXTRAMACHDEPPATH@
1296 +MACHDEPS=      $(PLATDIR) $(EXTRAPLATDIR)
1297 +XMLLIBSUBDIRS=  xml xml/dom xml/etree xml/parsers xml/sax
1298 +PLATMACDIRS= plat-mac plat-mac/Carbon plat-mac/lib-scriptpackages \
1299 +       plat-mac/lib-scriptpackages/_builtinSuites \
1300 +       plat-mac/lib-scriptpackages/CodeWarrior \
1301 +       plat-mac/lib-scriptpackages/Explorer \
1302 +       plat-mac/lib-scriptpackages/Finder \
1303 +       plat-mac/lib-scriptpackages/Netscape \
1304 +       plat-mac/lib-scriptpackages/StdSuites \
1305 +       plat-mac/lib-scriptpackages/SystemEvents \
1306 +       plat-mac/lib-scriptpackages/Terminal 
1307 +PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages
1308 +LIBSUBDIRS=    lib-tk site-packages test test/output test/data \
1309 +               test/decimaltestdata \
1310 +               encodings compiler hotshot \
1311 +               email email/mime email/test email/test/data \
1312 +               sqlite3 sqlite3/test \
1313 +               logging bsddb bsddb/test csv wsgiref \
1314 +               ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
1315 +               distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
1316 +               setuptools setuptools/command setuptools/tests setuptools.egg-info \
1317 +               curses $(MACHDEPS)
1318 +libinstall: $(srcdir)/Lib/$(PLATDIR) $(PYTHON_FOR_BUILD)
1319 +       @for i in $(SCRIPTDIR) $(LIBDEST); \
1320 +       do \
1321 +               if test ! -d $(DESTDIR)$$i; then \
1322 +                       echo "Creating directory $$i"; \
1323 +                       $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1324 +               else    true; \
1325 +               fi; \
1326 +       done
1327 +       @for d in $(LIBSUBDIRS); \
1328 +       do \
1329 +               a=$(srcdir)/Lib/$$d; \
1330 +               if test ! -d $$a; then continue; else true; fi; \
1331 +               b=$(LIBDEST)/$$d; \
1332 +               if test ! -d $(DESTDIR)$$b; then \
1333 +                       echo "Creating directory $$b"; \
1334 +                       $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
1335 +               else    true; \
1336 +               fi; \
1337 +       done
1338 +       @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
1339 +       do \
1340 +               if test -x $$i; then \
1341 +                       $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
1342 +                       echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
1343 +               else \
1344 +                       $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
1345 +                       echo $(INSTALL_DATA) $$i $(LIBDEST); \
1346 +               fi; \
1347 +       done
1348 +       @for d in $(LIBSUBDIRS); \
1349 +       do \
1350 +               a=$(srcdir)/Lib/$$d; \
1351 +               if test ! -d $$a; then continue; else true; fi; \
1352 +               if test `ls $$a | wc -l` -lt 1; then continue; fi; \
1353 +               b=$(LIBDEST)/$$d; \
1354 +               for i in $$a/*; \
1355 +               do \
1356 +                       case $$i in \
1357 +                       *CVS) ;; \
1358 +                       *.py[co]) ;; \
1359 +                       *.orig) ;; \
1360 +                       *~) ;; \
1361 +                       *) \
1362 +                               if test -d $$i; then continue; fi; \
1363 +                               if test -x $$i; then \
1364 +                                   echo $(INSTALL_SCRIPT) $$i $$b; \
1365 +                                   $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
1366 +                               else \
1367 +                                   echo $(INSTALL_DATA) $$i $$b; \
1368 +                                   $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
1369 +                               fi;; \
1370 +                       esac; \
1371 +               done; \
1372 +       done
1373 +       $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
1374 +       PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
1375 +               $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
1376 +               -d $(LIBDEST) -f \
1377 +               -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
1378 +       PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1379 +               $(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
1380 +               -d $(LIBDEST) -f \
1381 +               -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
1382 +       -PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
1383 +               $(PYTHON_FOR_BUILD) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
1384 +               -d $(LIBDEST)/site-packages -f \
1385 +               -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
1386 +       -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1387 +               $(PYTHON_FOR_BUILD) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
1388 +               -d $(LIBDEST)/site-packages -f \
1389 +               -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
1390 +
1391 +# Create the PLATDIR source directory, if one wasn't distributed..
1392 +$(srcdir)/Lib/$(PLATDIR):
1393 +       mkdir $(srcdir)/Lib/$(PLATDIR)
1394 +       cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
1395 +       export PATH; PATH="`pwd`:$$PATH"; \
1396 +       export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
1397 +       export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
1398 +       export EXE; EXE="$(BUILDEXE)"; \
1399 +       cd $(srcdir)/Lib/$(PLATDIR); ./regen
1400 +
1401 +# Install the include files
1402 +INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
1403 +inclinstall:
1404 +       @for i in $(INCLDIRSTOMAKE); \
1405 +       do \
1406 +               if test ! -d $(DESTDIR)$$i; then \
1407 +                       echo "Creating directory $$i"; \
1408 +                       $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1409 +               else    true; \
1410 +               fi; \
1411 +       done
1412 +       @for i in $(srcdir)/Include/*.h; \
1413 +       do \
1414 +               echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
1415 +               $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
1416 +       done
1417 +       $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
1418 +
1419 +# Install the library and miscellaneous stuff needed for extending/embedding
1420 +# This goes into $(exec_prefix)
1421 +LIBPL=         $(LIBP)/config
1422 +libainstall:   all
1423 +       @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
1424 +       do \
1425 +               if test ! -d $(DESTDIR)$$i; then \
1426 +                       echo "Creating directory $$i"; \
1427 +                       $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1428 +               else    true; \
1429 +               fi; \
1430 +       done
1431 +       @if test -d $(LIBRARY); then :; else \
1432 +               if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
1433 +                       if test "$(SO)" = .dll; then \
1434 +                               $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
1435 +                       else \
1436 +                               $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
1437 +                               $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
1438 +                       fi; \
1439 +               else \
1440 +                       echo Skip install of $(LIBRARY) - use make frameworkinstall; \
1441 +               fi; \
1442 +       fi
1443 +       $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
1444 +       $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
1445 +       $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
1446 +       $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
1447 +       $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
1448 +       $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
1449 +       $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
1450 +       $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
1451 +       $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
1452 +       # Substitution happens here, as the completely-expanded BINDIR
1453 +       # is not available in configure
1454 +       sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
1455 +       $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
1456 +       rm python-config
1457 +       @if [ -s Modules/python.exp -a \
1458 +               "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
1459 +               echo; echo "Installing support files for building shared extension modules on AIX:"; \
1460 +               $(INSTALL_DATA) Modules/python.exp              \
1461 +                               $(DESTDIR)$(LIBPL)/python.exp;          \
1462 +               echo; echo "$(LIBPL)/python.exp";               \
1463 +               $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix  \
1464 +                               $(DESTDIR)$(LIBPL)/makexp_aix;          \
1465 +               echo "$(LIBPL)/makexp_aix";                     \
1466 +               $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix   \
1467 +                               $(DESTDIR)$(LIBPL)/ld_so_aix;           \
1468 +               echo "$(LIBPL)/ld_so_aix";                      \
1469 +               echo; echo "See Misc/AIX-NOTES for details.";   \
1470 +       else true; \
1471 +       fi
1472 +       @case "$(MACHDEP)" in beos*) \
1473 +               echo; echo "Installing support files for building shared extension modules on BeOS:"; \
1474 +               $(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README;      \
1475 +               echo; echo "$(LIBPL)/README";                   \
1476 +               $(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \
1477 +               echo "$(LIBPL)/ar_beos";                        \
1478 +               $(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \
1479 +               echo "$(LIBPL)/ld_so_beos";                     \
1480 +               echo; echo "See Misc/BeOS-NOTES for details.";  \
1481 +               ;; \
1482 +       esac
1483 +
1484 +# Install the dynamically loadable modules
1485 +# This goes into $(exec_prefix)
1486 +sharedinstall:
1487 +       CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILING='$(CROSS_COMPILING)' \
1488 +               $(RUNSHARED) $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py install \
1489 +               --prefix=$(prefix) \
1490 +               --install-scripts=$(BINDIR) \
1491 +               --install-platlib=$(DESTSHARED) \
1492 +               --root=/$(DESTDIR)
1493 +
1494 +# Here are a couple of targets for MacOSX again, to install a full
1495 +# framework-based Python. frameworkinstall installs everything, the
1496 +# subtargets install specific parts. Much of the actual work is offloaded to
1497 +# the Makefile in Mac
1498 +#
1499 +#
1500 +# This target is here for backward compatiblity, previous versions of Python
1501 +# hadn't integrated framework installation in the normal install process.
1502 +frameworkinstall: install
1503 +
1504 +# On install, we re-make the framework
1505 +# structure in the install location, /Library/Frameworks/ or the argument to
1506 +# --enable-framework. If --enable-framework has been specified then we have
1507 +# automatically set prefix to the location deep down in the framework, so we
1508 +# only have to cater for the structural bits of the framework.
1509 +
1510 +frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
1511 +
1512 +frameworkinstallstructure:     $(LDLIBRARY)
1513 +       @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
1514 +               echo Not configured with --enable-framework; \
1515 +               exit 1; \
1516 +       else true; \
1517 +       fi
1518 +       @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
1519 +               if test ! -d $(DESTDIR)$$i; then \
1520 +                       echo "Creating directory $(DESTDIR)$$i"; \
1521 +                       $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1522 +               else    true; \
1523 +               fi; \
1524 +       done
1525 +       $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
1526 +       $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(DESTDIR)$(prefix)/Resources/Info.plist
1527 +       $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(DESTDIR)$(prefix)/Resources/version.plist
1528 +       $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
1529 +               $(DESTDIR)$(prefix)/Resources/English.lproj/InfoPlist.strings
1530 +       $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
1531 +       $(LN) -fsn Versions/Current/Python $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Python
1532 +       $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
1533 +       $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
1534 +       $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
1535 +
1536 +# This installs Mac/Lib into the framework
1537 +# Install a number of symlinks to keep software that expects a normal unix
1538 +# install (which includes python-config) happy.
1539 +frameworkinstallmaclib:
1540 +       ln -fs "../../../Python" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a"
1541 +       cd Mac && $(MAKE) installmacsubtree DESTDIR="$(DESTDIR)"
1542 +
1543 +# This installs the IDE, the Launcher and other apps into /Applications
1544 +frameworkinstallapps:
1545 +       cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
1546 +
1547 +# This install the unix python and pythonw tools in /usr/local/bin
1548 +frameworkinstallunixtools:
1549 +       cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
1550 +
1551 +frameworkaltinstallunixtools:
1552 +       cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
1553 +
1554 +# This installs the Demos and Tools into the applications directory.
1555 +# It is not part of a normal frameworkinstall
1556 +frameworkinstallextras:
1557 +       cd Mac && Make installextras DESTDIR="$(DESTDIR)"
1558 +
1559 +# This installs a few of the useful scripts in Tools/scripts
1560 +scriptsinstall:
1561 +       $(RUNSHARED) \
1562 +       $(PYTHON_FOR_BUILD) $(srcdir)/Tools/scripts/setup.py install \
1563 +       --prefix=$(prefix) \
1564 +       --install-scripts=$(BINDIR) \
1565 +       --root=/$(DESTDIR)
1566 +
1567 +# Build the toplevel Makefile
1568 +Makefile.pre: Makefile.pre.in config.status
1569 +       CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
1570 +       $(MAKE) -f Makefile.pre Makefile
1571 +
1572 +# Run the configure script.
1573 +config.status: $(srcdir)/configure
1574 +       $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
1575 +
1576 +.PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
1577 +
1578 +# Some make's put the object file in the current directory
1579 +.c.o:
1580 +       $(CC) -c $(PY_CFLAGS) -o $@ $<
1581 +
1582 +# Run reindent on the library
1583 +reindent:
1584 +       ./python$(EXEEXT) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
1585 +
1586 +# Rerun configure with the same options as it was run last time,
1587 +# provided the config.status script exists
1588 +recheck:
1589 +       $(SHELL) config.status --recheck
1590 +       $(SHELL) config.status
1591 +
1592 +# Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
1593 +autoconf:
1594 +       (cd $(srcdir); autoconf)
1595 +       (cd $(srcdir); autoheader)
1596 +
1597 +# Create a tags file for vi
1598 +tags::
1599 +       cd $(srcdir); \
1600 +       ctags -w -t Include/*.h; \
1601 +       for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
1602 +       done; \
1603 +       sort -o tags tags
1604 +
1605 +# Create a tags file for GNU Emacs
1606 +TAGS::
1607 +       cd $(srcdir); \
1608 +       etags Include/*.h; \
1609 +       for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
1610 +
1611 +# Sanitation targets -- clean leaves libraries, executables and tags
1612 +# files, which clobber removes those as well
1613 +pycremoval:
1614 +       find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
1615 +
1616 +clean: pycremoval
1617 +       find . -name '*.o' -exec rm -f {} ';'
1618 +       find . -name '*.s[ol]' -exec rm -f {} ';'
1619 +       find $(srcdir)/build -name 'fficonfig.h' -exec rm -f {} ';' || true
1620 +       find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
1621 +
1622 +clobber: clean
1623 +       -rm -f $(BUILDPYTHON) $(PGEN_FOR_BUILD) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
1624 +               tags TAGS \
1625 +               config.cache config.log pyconfig.h Modules/config.c
1626 +       -rm -rf build platform
1627 +       -rm -rf $(PYTHONFRAMEWORKDIR)
1628 +       -rm -rf buildpython
1629 +
1630 +# Make things extra clean, before making a distribution:
1631 +# remove all generated files, even Makefile[.pre]
1632 +# Keep configure and Python-ast.[ch], it's possible they can't be generated
1633 +distclean: clobber
1634 +       -rm -f core Makefile Makefile.pre config.status \
1635 +               Modules/Setup Modules/Setup.local Modules/Setup.config
1636 +       find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
1637 +                          -o -name '[@,#]*' -o -name '*.old' \
1638 +                          -o -name '*.orig' -o -name '*.rej' \
1639 +                          -o -name '*.bak' ')' \
1640 +                          -exec rm -f {} ';'
1641 +
1642 +# Check for smelly exported symbols (not starting with Py/_Py)
1643 +smelly: all
1644 +       nm -p $(LIBRARY) | \
1645 +               sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
1646 +
1647 +# Find files with funny names
1648 +funny:
1649 +       find $(DISTDIRS) -type d \
1650 +               -o -name '*.[chs]' \
1651 +               -o -name '*.py' \
1652 +               -o -name '*.doc' \
1653 +               -o -name '*.sty' \
1654 +               -o -name '*.bib' \
1655 +               -o -name '*.dat' \
1656 +               -o -name '*.el' \
1657 +               -o -name '*.fd' \
1658 +               -o -name '*.in' \
1659 +               -o -name '*.tex' \
1660 +               -o -name '*,[vpt]' \
1661 +               -o -name 'Setup' \
1662 +               -o -name 'Setup.*' \
1663 +               -o -name README \
1664 +               -o -name Makefile \
1665 +               -o -name ChangeLog \
1666 +               -o -name Repository \
1667 +               -o -name Root \
1668 +               -o -name Entries \
1669 +               -o -name Tag \
1670 +               -o -name tags \
1671 +               -o -name TAGS \
1672 +               -o -name .cvsignore \
1673 +               -o -name MANIFEST \
1674 +               -o -print
1675 +
1676 +# Dependencies
1677 +
1678 +Python/thread.o: @THREADHEADERS@
1679 +
1680 +# Declare targets that aren't real files
1681 +.PHONY: all sharedmods oldsharedmods test quicktest memtest
1682 +.PHONY: install altinstall oldsharedinstall bininstall altbininstall
1683 +.PHONY: maninstall libinstall inclinstall libainstall sharedinstall
1684 +.PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
1685 +.PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
1686 +.PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean 
1687 +.PHONY: smelly funny
1688 +
1689 +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
1690 diff -urN Python-2.5.2.orig/Modules/gdbmmodule.c Python-2.5.2.mingw32/Modules/gdbmmodule.c
1691 --- Python-2.5.2.orig/Modules/gdbmmodule.c      2006-05-29 22:04:52.000000000 +0100
1692 +++ Python-2.5.2.mingw32/Modules/gdbmmodule.c   2008-10-06 17:32:07.000000000 +0100
1693 @@ -11,7 +11,7 @@
1694  #include <fcntl.h>
1695  #include "gdbm.h"
1696  
1697 -#if defined(WIN32) && !defined(__CYGWIN__)
1698 +#if defined(WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
1699  #include "gdbmerrno.h"
1700  extern const char * gdbm_strerror(gdbm_error);
1701  #endif
1702 diff -urN Python-2.5.2.orig/Modules/posixmodule.c Python-2.5.2.mingw32/Modules/posixmodule.c
1703 --- Python-2.5.2.orig/Modules/posixmodule.c     2008-10-06 14:54:19.000000000 +0100
1704 +++ Python-2.5.2.mingw32/Modules/posixmodule.c  2008-10-06 16:44:25.000000000 +0100
1705 @@ -130,6 +130,16 @@
1706  #define HAVE_CWAIT     1
1707  #define HAVE_FSYNC     1
1708  #define fsync _commit
1709 +#ifdef __MINGW32__     /* MinGW compiler */
1710 +#define HAVE_GETCWD     1
1711 +#define HAVE_SPAWNV    1
1712 +#define HAVE_EXECV      1
1713 +#define HAVE_PIPE       1
1714 +#define HAVE_POPEN      1
1715 +#define HAVE_SYSTEM    1
1716 +#define HAVE_CWAIT     1
1717 +#define HAVE_FSYNC     1
1718 +#define fsync _commit
1719  #else
1720  #if defined(PYOS_OS2) && defined(PYCC_GCC) || defined(__VMS)
1721  /* Everything needed is defined in PC/os2emx/pyconfig.h or vms/pyconfig.h */
1722 @@ -156,6 +166,7 @@
1723  #define HAVE_WAIT       1
1724  #define HAVE_TTYNAME   1
1725  #endif  /* PYOS_OS2 && PYCC_GCC && __VMS */
1726 +#endif  /* __MINGW32__ */
1727  #endif  /* _MSC_VER */
1728  #endif  /* __BORLANDC__ */
1729  #endif  /* ! __WATCOMC__ || __QNX__ */
1730 @@ -173,7 +184,7 @@
1731  #if defined(PYCC_VACPP)
1732  extern int mkdir(char *);
1733  #else
1734 -#if ( defined(__WATCOMC__) || defined(_MSC_VER) ) && !defined(__QNX__)
1735 +#if ( defined(__WATCOMC__) || defined(_MSC_VER) || defined(__MINGW32__) ) && !defined(__QNX__)
1736  extern int mkdir(const char *);
1737  #else
1738  extern int mkdir(const char *, mode_t);
1739 @@ -189,9 +200,13 @@
1740  #ifdef __BORLANDC__
1741  extern int chmod(const char *, int);
1742  #else
1743 +#ifndef __MINGW32__
1744  extern int chmod(const char *, mode_t);
1745  #endif
1746 +#endif
1747 +#ifndef __MINGW32__
1748  extern int chown(const char *, uid_t, gid_t);
1749 +#endif
1750  extern char *getcwd(char *, int);
1751  extern char *strerror(int);
1752  extern int link(const char *, const char *);
1753 @@ -252,7 +267,7 @@
1754  #endif
1755  #endif
1756  
1757 -#ifdef _MSC_VER
1758 +#if defined(_MSC_VER) || defined(__MINGW32__)
1759  #ifdef HAVE_DIRECT_H
1760  #include <direct.h>
1761  #endif
1762 @@ -345,7 +360,7 @@
1763  */
1764  #include <crt_externs.h>
1765  static char **environ;
1766 -#elif !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) )
1767 +#elif !defined(_MSC_VER) && !defined(__MINGW32__) && ( !defined(__WATCOMC__) || defined(__QNX__) )
1768  extern char **environ;
1769  #endif /* !_MSC_VER */
1770  
1771 @@ -2328,7 +2343,7 @@
1772                               Py_FileSystemDefaultEncoding, &path, &mode))
1773                 return NULL;
1774         Py_BEGIN_ALLOW_THREADS
1775 -#if ( defined(__WATCOMC__) || defined(PYCC_VACPP) ) && !defined(__QNX__)
1776 +#if ( defined(__MINGW32__) || defined(__WATCOMC__) || defined(PYCC_VACPP) ) && !defined(__QNX__)
1777         res = mkdir(path);
1778  #else
1779         res = mkdir(path, mode);
1780 @@ -7972,7 +7987,7 @@
1781  }
1782  #endif
1783  
1784 -#ifdef MS_WINDOWS
1785 +#if defined(MS_WINDOWS) && !defined(__MINGW32__)
1786  
1787  PyDoc_STRVAR(win32_urandom__doc__,
1788  "urandom(n) -> str\n\n\
1789 @@ -8371,9 +8386,9 @@
1790  #ifdef HAVE_GETLOADAVG
1791         {"getloadavg",  posix_getloadavg, METH_NOARGS, posix_getloadavg__doc__},
1792  #endif
1793 - #ifdef MS_WINDOWS
1794 +#if defined(MS_WINDOWS) && !defined(__MINGW32__)
1795         {"urandom", win32_urandom, METH_VARARGS, win32_urandom__doc__},
1796 - #endif
1797 +#endif
1798   #ifdef __VMS
1799         {"urandom", vms_urandom, METH_VARARGS, vms_urandom__doc__},
1800   #endif
1801 @@ -8653,7 +8668,7 @@
1802  }
1803  
1804  
1805 -#if (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__)) && !defined(__QNX__)
1806 +#if (defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__) || defined(__BORLANDC__)) && !defined(__QNX__)
1807  #define INITFUNC initnt
1808  #define MODNAME "nt"
1809  
1810 diff -urN Python-2.5.2.orig/Modules/Setup.dist Python-2.5.2.mingw32/Modules/Setup.dist
1811 --- Python-2.5.2.orig/Modules/Setup.dist        2008-10-06 14:54:19.000000000 +0100
1812 +++ Python-2.5.2.mingw32/Modules/Setup.dist     2008-10-06 17:38:27.000000000 +0100
1813 @@ -111,7 +111,7 @@
1814  
1815  posix posixmodule.c            # posix (UNIX) system calls
1816  errno errnomodule.c            # posix (UNIX) errno values
1817 -pwd pwdmodule.c                        # this is needed to find out the user's home dir
1818 +#pwd pwdmodule.c                       # this is needed to find out the user's home dir
1819                                 # if $HOME is not set
1820  _sre _sre.c                    # Fredrik Lundh's new regular expressions
1821  _codecs _codecsmodule.c                # access to the builtin codecs and codec registry
1822 @@ -159,7 +159,7 @@
1823  # it, depending on your system -- see the GNU readline instructions.
1824  # It's okay for this to be a shared library, too.
1825  
1826 -readline readline.c -lreadline -lncursesw
1827 +readline readline.c -lreadline
1828  
1829  
1830  # Modules that should always be present (non UNIX dependent):
1831 @@ -187,9 +187,9 @@
1832  # (If you have a really backward UNIX, select and socket may not be
1833  # supported...)
1834  
1835 -fcntl fcntlmodule.c    # fcntl(2) and ioctl(2)
1836 -spwd spwdmodule.c              # spwd(3) 
1837 -grp grpmodule.c                # grp(3)
1838 +#fcntl fcntlmodule.c   # fcntl(2) and ioctl(2)
1839 +#spwd spwdmodule.c             # spwd(3) 
1840 +#grp grpmodule.c               # grp(3)
1841  select selectmodule.c  # select(2); not on ancient System V
1842  
1843  # Memory-mapped files (also works on Win32).
1844 @@ -219,9 +219,9 @@
1845  # Some more UNIX dependent modules -- off by default, since these
1846  # are not supported by all UNIX systems:
1847  
1848 -nis nismodule.c -lnsl  # Sun yellow pages -- not everywhere
1849 -termios termios.c      # Steen Lumholt's termios module
1850 -resource resource.c    # Jeremy Hylton's rlimit interface
1851 +#nis nismodule.c -lnsl # Sun yellow pages -- not everywhere
1852 +#termios termios.c     # Steen Lumholt's termios module
1853 +#resource resource.c   # Jeremy Hylton's rlimit interface
1854  
1855  
1856  # Multimedia modules -- off by default.
1857 @@ -293,12 +293,12 @@
1858  # A Linux specific module -- off by default; this may also work on 
1859  # some *BSDs.
1860  
1861 -linuxaudiodev linuxaudiodev.c
1862 +#linuxaudiodev linuxaudiodev.c
1863  
1864  
1865  # George Neville-Neil's timing module:
1866  
1867 -timing timingmodule.c
1868 +#timing timingmodule.c
1869  
1870  
1871  # The _tkinter module.
1872 @@ -313,7 +313,7 @@
1873  # every system.
1874  
1875  # *** Always uncomment this (leave the leading underscore in!):
1876 -_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
1877 +#_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
1878  # *** Uncomment and edit to reflect where your Tcl/Tk libraries are:
1879  #      -L/usr/local/lib \
1880  # *** Uncomment and edit to reflect where your Tcl/Tk headers are:
1881 @@ -323,7 +323,7 @@
1882  # *** Or uncomment this for Solaris:
1883  #      -I/usr/openwin/include \
1884  # *** Uncomment and edit for Tix extension only:
1885 -       -DWITH_TIX -ltix \
1886 +#      -DWITH_TIX -ltix \
1887  # *** Uncomment and edit for BLT extension only:
1888  #      -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \
1889  # *** Uncomment and edit for PIL (TkImaging) extension only:
1890 @@ -332,7 +332,7 @@
1891  # *** Uncomment and edit for TOGL extension only:
1892  #      -DWITH_TOGL togl.c \
1893  # *** Uncomment and edit to reflect your Tcl/Tk versions:
1894 -       -ltk -ltcl \
1895 +#      -ltk -ltcl \
1896  # *** Uncomment and edit to reflect where your X11 libraries are:
1897  #      -L/usr/X11R6/lib \
1898  # *** Or uncomment this for Solaris:
1899 @@ -342,7 +342,7 @@
1900  # *** Uncomment for AIX:
1901  #      -lld \
1902  # *** Always uncomment this; X11 libraries to link with:
1903 -       -lX11
1904 +#      -lX11
1905  
1906  # Lance Ellinghaus's syslog module
1907  #syslog syslogmodule.c         # syslog daemon interface
1908 @@ -354,9 +354,11 @@
1909  #
1910  # First, look at Setup.config; configure may have set this for you.
1911  
1912 -_curses _cursesmodule.c -lncursesw
1913 +# XXX Should be possible to make this work with pdcurses.
1914 +
1915 +#_curses _cursesmodule.c -lncursesw
1916  # Wrapper for the panel library that's part of ncurses and SYSV curses.
1917 -_curses_panel _curses_panel.c -lpanel -lncursesw 
1918 +#_curses_panel _curses_panel.c -lpanel -lncursesw 
1919  
1920  
1921  # Generic (SunOS / SVR4) dynamic loading module.
1922 @@ -364,7 +366,7 @@
1923  # it is a highly experimental and dangerous device for calling
1924  # *arbitrary* C functions in *arbitrary* shared libraries:
1925  
1926 -dl dlmodule.c
1927 +#dl dlmodule.c
1928  
1929  
1930  # Modules that provide persistent dictionary-like semantics.  You will
1931 @@ -402,10 +404,10 @@
1932  #
1933  # Edit the variables DB and DBLIBVERto point to the db top directory
1934  # and the subdirectory of PORT where you built it.
1935 -DBLIBVER=4.7
1936 -DBINC=/usr/include/db4
1937 -DBLIB=/usr/lib64
1938 -_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER)
1939 +#DBLIBVER=4.7
1940 +#DBINC=/usr/include/db4
1941 +#DBLIB=/usr/lib64
1942 +#_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER)
1943  
1944  # Historical Berkeley DB 1.85
1945  #
1946 @@ -464,7 +466,7 @@
1947  # More information on Expat can be found at www.libexpat.org.
1948  #
1949  #EXPAT_DIR=/usr/local/src/expat-1.95.2
1950 -pyexpat pyexpat.c -DHAVE_EXPAT_H -lexpat
1951 +#pyexpat pyexpat.c -DHAVE_EXPAT_H -lexpat
1952  
1953  
1954  # Hye-Shik Chang's CJKCodecs
1955 diff -urN Python-2.5.2.orig/Python/pythonrun.c Python-2.5.2.mingw32/Python/pythonrun.c
1956 --- Python-2.5.2.orig/Python/pythonrun.c        2007-05-02 17:02:48.000000000 +0100
1957 +++ Python-2.5.2.mingw32/Python/pythonrun.c     2008-10-06 15:59:16.000000000 +0100
1958 @@ -1669,6 +1669,8 @@
1959  int
1960  PyOS_CheckStack(void)
1961  {
1962 +/* MinGW (gcc) defines _MSC_VER but doesn't have this exception stuff. */
1963 +#ifndef __MINGW32__
1964         __try {
1965                 /* alloca throws a stack overflow exception if there's
1966                    not enough space left on the stack */
1967 @@ -1678,6 +1680,9 @@
1968                 /* just ignore all errors */
1969         }
1970         return 1;
1971 +#else
1972 +       return 0;
1973 +#endif
1974  }
1975  
1976  #endif /* WIN32 && _MSC_VER */
1977 diff -urN Python-2.5.2.orig/README Python-2.5.2.mingw32/README
1978 --- Python-2.5.2.orig/README    2008-02-21 11:53:40.000000000 +0000
1979 +++ Python-2.5.2.mingw32/README 2008-10-06 14:55:15.000000000 +0100
1980 @@ -1189,6 +1189,57 @@
1981  do this.
1982  
1983  
1984 +Cross Compiling
1985 +---------------
1986 +
1987 +Python can be cross compiled by supplying different --build and --host
1988 +parameters to configure.  Python is compiled on the "build" system and
1989 +executed on the "host" system.  Cross compiling python requires a
1990 +native Python on the build host, and a natively compiled tool `Pgen'.
1991 +
1992 +Before cross compiling, the correct version of Python must be compiled
1993 +and installed on the build host.  The configure script will use `cc'
1994 +and `python', or environment variables PYTHON_FOR_BUILD, eg:
1995 +
1996 +
1997 +  PYTHON_FOR_BUILD=python2.5
1998 +
1999 +  # set these values according to your cross-compiler setup
2000 +  PATH="$HOME/cross-target/freebsd-x86/usr/cross/bin:$PATH"
2001 +
2002 +  # headers & libraries for target system
2003 +  CROSS_ROOT=$HOME/cross-target/freebsd-x86/
2004 +
2005 +  # supply all settings not correctly detected by configure.
2006 +  # This can also be put a config.cache file
2007 +  ac_cv_file__dev_ptmx=no
2008 +  # .... insert more relevant settings
2009 +  
2010 +  export CROSS_ROOT PATH PYTHON_FOR_BUILD \
2011 +        ac_cv_file__dev_ptmx  
2012 +  
2013 +  configure --host=i686-freebsd4 --with-system-ffi
2014 +  make 
2015 +
2016 +   
2017 +Cross compiling has been tested under linux. Your mileage may vary for
2018 +other platforms.
2019 +
2020 +A few reminders on using configure to cross compile:
2021 +- Cross compile tools must be in PATH,
2022 +- Cross compile tools must be prefixed with the host type
2023 +  (ie i586-mingw32-gcc, powerpc-darwin8-ranlib, ...),
2024 +- CC, CXX, AR, and RANLIB must be undefined when running configure,
2025 +  they will be auto-detected.
2026 +- Autoconf must be stopped from autodetecting definitions for the
2027 +  build machine.  This is easiest done by creating a config.cache
2028 +  that overrides ac_cv_* variables appropriately.
2029 +
2030 +If you need a cross compiler, Debian ships several several (eg: avr,
2031 +m68hc1x, mingw32), while dpkg-cross easily creates others.  Otherwise,
2032 +check out Dan Kegel's crosstool: http://www.kegel.com/crosstool .
2033 +
2034 +
2035  Miscellaneous issues
2036  ====================
2037  
2038 diff -urN Python-2.5.2.orig/setup.py Python-2.5.2.mingw32/setup.py
2039 --- Python-2.5.2.orig/setup.py  2008-10-06 14:54:19.000000000 +0100
2040 +++ Python-2.5.2.mingw32/setup.py       2008-10-06 17:40:57.000000000 +0100
2041 @@ -17,6 +17,15 @@
2042  # This global variable is used to hold the list of modules to be disabled.
2043  disabled_module_list = []
2044  
2045 +import os
2046 +
2047 +if os.environ.get('CROSS_COMPILING') == 'yes':
2048 +    sysconfig.get_config_vars()
2049 +    sysconfig._config_vars.update (os.environ)
2050 +else:
2051 +    sysconfig.get_config_vars()
2052 +    sysconfig._config_vars['srcdir'] = os.environ['srcdir']
2053 +    
2054  def add_dir_to_list(dirlist, dir):
2055      """Add the directory 'dir' to the list 'dirlist' (at the front) if
2056      1) 'dir' is not already in 'dirlist'
2057 @@ -203,6 +212,8 @@
2058              self.announce('WARNING: skipping import check for Cygwin-based "%s"'
2059                  % ext.name)
2060              return
2061 +        if os.environ.get('CROSS_COMPILING') == 'yes':
2062 +            return
2063          ext_filename = os.path.join(
2064              self.build_lib,
2065              self.get_ext_filename(self.get_ext_fullname(ext.name)))
2066 @@ -236,11 +247,15 @@
2067                            level=3)
2068  
2069      def get_platform(self):
2070 -        # Get value of sys.platform
2071 -        for platform in ['cygwin', 'beos', 'darwin', 'atheos', 'osf1']:
2072 -            if sys.platform.startswith(platform):
2073 +        # Get value of target's sys.platform
2074 +        p = sys.platform
2075 +        if os.environ.get('CROSS_COMPILING') == 'yes':
2076 +            p = os.environ.get('MACHDEP').lower()
2077 +
2078 +        for platform in ['cygwin', 'mingw', 'beos', 'darwin', 'atheos', 'osf1']:
2079 +            if p.startswith(platform):
2080                  return platform
2081 -        return sys.platform
2082 +        return p
2083  
2084      def detect_modules(self):
2085          # Ensure that /usr/local is always used
2086 @@ -294,11 +309,15 @@
2087          # lib_dirs and inc_dirs are used to search for files;
2088          # if a file is found in one of those directories, it can
2089          # be assumed that no additional -I,-L directives are needed.
2090 -        lib_dirs = self.compiler.library_dirs + [
2091 -            '/lib64', '/usr/lib64',
2092 -            '/lib', '/usr/lib',
2093 -            ]
2094 -        inc_dirs = self.compiler.include_dirs + ['/usr/include']
2095 +        lib_dirs = []
2096 +        inc_dirs = []
2097 +        if os.environ.get('CROSS_COMPILING') != 'yes':
2098 +            lib_dirs = self.compiler.library_dirs + [
2099 +                '/lib64', '/usr/lib64',
2100 +                '/lib', '/usr/lib',
2101 +                ]
2102 +            inc_dirs = self.compiler.include_dirs + ['/usr/include']
2103 +            
2104          exts = []
2105  
2106          config_h = sysconfig.get_config_h_filename()
2107 @@ -643,6 +662,9 @@
2108              db_inc_paths.append('/pkg/db-3.%d/include' % x)
2109              db_inc_paths.append('/opt/db-3.%d/include' % x)
2110  
2111 +        if os.environ.get('CROSS_COMPILING') == 'yes':
2112 +            db_inc_paths = []
2113 +
2114          # Add some common subdirectories for Sleepycat DB to the list,
2115          # based on the standard include directories. This way DB3/4 gets
2116          # picked up when it is installed in a non-standard prefix and
2117 @@ -771,6 +793,9 @@
2118          MIN_SQLITE_VERSION = ".".join([str(x)
2119                                      for x in MIN_SQLITE_VERSION_NUMBER])
2120  
2121 +        if os.environ.get('CROSS_COMPILING') == 'yes':
2122 +            sqlite_inc_paths = []
2123 +
2124          # Scan the default include directories before the SQLite specific
2125          # ones. This allows one to override the copy of sqlite on OSX,
2126          # where /usr/include contains an old version of sqlite.
2127 @@ -857,6 +882,8 @@
2128          # the more recent berkeleydb's db.h file first in the include path
2129          # when attempting to compile and it will fail.
2130          f = "/usr/include/db.h"
2131 +       if os.environ.get('CROSS_COMPILING') == 'yes':
2132 +               f = ''
2133          if os.path.exists(f) and not db_incs:
2134              data = open(f).read()
2135              m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)