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
5 AC_CONFIG_SRCDIR([Include/object.h])
6 AC_CONFIG_HEADER(pyconfig.h)
8 +# find compiler while respecting --host setting
10 +AC_CHECK_TOOLS(CC,gcc cc)
11 +AC_CHECK_TOOLS(CXX,g++ c++)
13 dnl This is for stuff that absolutely must end up in pyconfig.h.
14 dnl Please use pyport.h instead, if possible.
17 # Set name for machine-dependent library files
19 AC_MSG_CHECKING(MACHDEP)
20 -if test -z "$MACHDEP"
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
29 ac_sys_release=`uname -r`
32 + m=`$CC -dumpmachine`
33 + changequote(<<, >>)#dnl
34 + ac_sys_system=`expr "$m" : "[^-]*-\([^-]*\)"`
35 + changequote([, ])#dnl
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 `;;
48 ac_md_system=`echo $ac_sys_system |
49 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
50 ac_md_release=`echo $ac_sys_release |
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]) ;;
60 if test "$CXX" = "notfound"
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"
75 -AC_MSG_CHECKING(for --with-suffix)
77 - AC_HELP_STRING(--with-suffix=.exe, set executable suffix),
82 - *) EXEEXT=$withval;;
84 -AC_MSG_RESULT($EXEEXT)
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
94 -if test -d casesensitivetestdir
100 - BUILDEXEEXT=$EXEEXT
102 -rmdir CaseSensitiveTestDir
108 AC_MSG_RESULT($LDLIBRARY)
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)
118 AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
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)
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 @@
132 -AC_MSG_CHECKING(for /dev/ptmx)
134 -if test -r /dev/ptmx
137 - AC_DEFINE(HAVE_DEV_PTMX, 1,
138 - [Define if we have /dev/ptmx.])
143 -AC_MSG_CHECKING(for /dev/ptc)
148 - AC_DEFINE(HAVE_DEV_PTC, 1,
149 - [Define if we have /dev/ptc.])
153 +AC_CHECK_FILE(/dev/ptmx,
154 + [AC_DEFINE(HAVE_DEV_PTMX, 1,
155 + [Define if we have /dev/ptmx.])],
158 +AC_CHECK_FILE(/dev/ptc,
159 + [AC_DEFINE(HAVE_DEV_PTC, 1,
160 + [Define if we have /dev/ptc.])],
165 @@ -3411,7 +3393,8 @@
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>
175 @@ -3447,7 +3430,7 @@
178 AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])],
180 + AC_MSG_RESULT(no)))
182 AC_CHECK_TYPE(socklen_t,,
183 AC_DEFINE(socklen_t,int,
184 @@ -3477,10 +3460,76 @@
189 +AC_SUBST(cross_compiling)
191 +if test "$cross_compiling" = "yes"; then
192 + AC_MSG_CHECKING(cc for build)
193 + CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
195 + CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
198 +if test "$cross_compiling" = "yes"; then
199 + AC_MSG_RESULT($CC_FOR_BUILD)
202 +AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler (default: cc)])
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`
209 + PYTHON_FOR_BUILD='./$(BUILDPYTHON)'
212 +if test "$cross_compiling" = "yes"; then
213 + AC_MSG_RESULT($PYTHON_FOR_BUILD)
215 +AC_ARG_VAR(PYTHON_FOR_BUILD,[build system python (default: python)])
216 +AC_SUBST(PYTHON_FOR_BUILD)
218 +if test "$cross_compiling" = "yes"; then
219 + CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-}
220 + CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD- -I.}
222 + LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-}
224 + RUNSHARED="MACHDEP=$ac_sys_system SRCDIR=$srcdir SO=${SO}"
226 + # Extra flags for MinGW host.
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" ;;
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)
243 # generate output files
244 AC_CONFIG_FILES(Makefile.pre Modules/Setup.config)
247 +if test "$cross_compiling" = "yes"; then
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
258 echo "creating Modules/Setup"
259 if test ! -f Modules/Setup
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
265 #define LONG_BIT (8 * SIZEOF_LONG)
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
274 #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
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
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
296 + if os.environ.get('CROSS_COMPILING') == 'yes':
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
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
320 # C flags used for building the interpreter object files
321 PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
323 +# For cross compile: build compiler options
324 +CC_FOR_BUILD= @CC_FOR_BUILD@
325 +CROSS_COMPILING= @cross_compiling@
327 +O_FOR_BUILD= @O_FOR_BUILD@
329 +CFLAGS_FOR_BUILD= @CFLAGS_FOR_BUILD@
330 +CPPFLAGS_FOR_BUILD= @CPPFLAGS_FOR_BUILD@ -I$(srcdir)/Include
331 +LDFLAGS_FOR_BUILD= @LDFLAGS_FOR_BUILD@
333 # Machine-dependent subdirectories
337 # Executable suffix (.exe on Windows and Mac OS X)
339 -BUILDEXE= @BUILDEXEEXT@
341 # Short name and location for Mac OS X Python framework
342 UNIVERSALSDK=@UNIVERSALSDK@
344 UNICODE_OBJS= @UNICODE_OBJS@
347 -BUILDPYTHON= python$(BUILDEXE)
348 +BUILDPYTHON= python$(EXE)
349 +PYTHON_FOR_BUILD= @PYTHON_FOR_BUILD@
351 # === Definitions added by makesetup ===
355 ##########################################################################
357 -PGEN= Parser/pgen$(EXE)
358 +PGEN_FOR_BUILD= Parser/pgen$(EXEEXT)
362 @@ -215,14 +225,27 @@
364 PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/tokenizer.o
367 - Objects/obmalloc.o \
368 - Python/mysnprintf.o \
369 - Parser/tokenizer_pgen.o \
370 - Parser/printgrammar.o \
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)
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)
392 -PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS)
393 +PGENOBJS= $(POBJS_FOR_BUILD) $(PGOBJS_FOR_BUILD)
395 ##########################################################################
397 @@ -341,15 +364,18 @@
399 $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
401 -platform: $(BUILDPYTHON)
402 - $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
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
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;; \
421 # Build static library
422 @@ -472,12 +498,12 @@
423 $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
426 -$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
427 +$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN_FOR_BUILD) $(GRAMMAR_INPUT)
429 - -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
430 + -$(PGEN_FOR_BUILD) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
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)
437 Parser/grammar.o: $(srcdir)/Parser/grammar.c \
438 $(srcdir)/Include/token.h \
440 $(srcdir)/Objects/unicodetype_db.h
442 ############################################################################
443 +# Cross compile rules
445 +# .x is a native object file during cross-compile.
448 + $(CC_FOR_BUILD) -c $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -o $@ $<
450 +############################################################################
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
461 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
462 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
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
471 # Like testall, but with a single pass only
473 distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
474 setuptools setuptools/command setuptools/tests setuptools.egg-info \
476 -libinstall: $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR)
477 +libinstall: $(srcdir)/Lib/$(PLATDIR) $(PYTHON_FOR_BUILD)
478 @for i in $(SCRIPTDIR) $(LIBDEST); \
480 if test ! -d $(DESTDIR)$$i; then \
481 @@ -782,19 +816,19 @@
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 \
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 \
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
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
513 # Install the include files
515 # Install the dynamically loadable modules
516 # This goes into $(exec_prefix)
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) \
528 # This installs a few of the useful scripts in Tools/scripts
530 - SRCDIR=$(srcdir) $(RUNSHARED) \
531 - ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
533 + $(PYTHON_FOR_BUILD) $(srcdir)/Tools/scripts/setup.py install \
535 --install-scripts=$(BINDIR) \
537 @@ -1029,11 +1064,12 @@
538 find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
541 - -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
542 + -rm -f $(BUILDPYTHON) $(PGEN_FOR_BUILD) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
544 config.cache config.log pyconfig.h Modules/config.c
545 -rm -rf build platform
546 -rm -rf $(PYTHONFRAMEWORKDIR)
547 + -rm -rf buildpython
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
555 +# Top-level Makefile for Python
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:
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.
573 +# See also the section "Build instructions" in the README file.
575 +# === Variables set by makesetup ===
580 +# === Variables set by configure
592 +SVNVERSION= @SVNVERSION@
594 +# Shell used by make (some versions default to the login shell, which is bad)
597 +# Use this to make a link between python$(VERSION) and python in $(BINDIR)
600 +# Portable install script (configure doesn't always guess right)
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
610 +MAKESETUP= $(srcdir)/Modules/makesetup
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@
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
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@
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@
641 +# Machine-dependent subdirectories
644 +# Install prefix for architecture-independent files
647 +# Install prefix for architecture-dependent files
648 +exec_prefix= @exec_prefix@
650 +# Install prefix for data files
651 +datarootdir= @datarootdir@
653 +# Expanded directories
654 +BINDIR= $(exec_prefix)/bin
655 +LIBDIR= $(exec_prefix)/lib64
657 +INCLUDEDIR= @includedir@
658 +CONFINCLUDEDIR= $(exec_prefix)/include
659 +SCRIPTDIR= $(prefix)/lib64
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)
668 +# Symbols used for using shared libraries
670 +LDSHARED= @LDSHARED@
671 +BLDSHARED= @BLDSHARED@
672 +DESTSHARED= $(BINLIBDEST)/lib-dynload
674 +# Executable suffix (.exe on Windows and Mac OS X)
676 +BUILDEXE= @BUILDEXEEXT@
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
690 +# Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
691 +OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
693 +# Environment to run shared python without installed libraries
694 +RUNSHARED= @RUNSHARED@
696 +# Modes for directories, executables and data files created by the
697 +# install process. Default to user-only-writable for all file types.
702 +# configure script arguments
703 +CONFIG_ARGS= @CONFIG_ARGS@
706 +# Subdirectories with code
709 +# Other subdirectories
710 +SUBDIRSTOO= Include Lib Misc Demo
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)
720 +LDLIBRARY= @LDLIBRARY@
721 +BLDLIBRARY= @BLDLIBRARY@
722 +DLLLIBRARY= @DLLLIBRARY@
723 +LDLIBRARYDIR= @LDLIBRARYDIR@
724 +INSTSONAME= @INSTSONAME@
730 +SYSLIBS= $(LIBM) $(LIBC)
733 +THREADOBJ= @THREADOBJ@
734 +DLINCLDIR= @DLINCLDIR@
735 +DYNLOADFILE= @DYNLOADFILE@
736 +MACHDEP_OBJS= @MACHDEP_OBJS@
737 +UNICODE_OBJS= @UNICODE_OBJS@
739 +PYTHON= python$(EXE)
740 +BUILDPYTHON= python$(EXE)
741 +PYTHON_FOR_BUILD= @PYTHON_FOR_BUILD@
743 +# === Definitions added by makesetup ===
746 +##########################################################################
750 + Modules/getpath.o \
754 +# Used of signalmodule.o is not available
755 +SIGNAL_OBJS= @SIGNAL_OBJS@
758 +##########################################################################
760 +GRAMMAR_H= $(srcdir)/Include/graminit.h
761 +GRAMMAR_C= $(srcdir)/Python/graminit.c
762 +GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
765 +##########################################################################
767 +PGEN_FOR_BUILD= Parser/pgen$(EXEEXT_FOR_BUILD)
771 + Parser/grammar1.o \
772 + Parser/listnode.o \
775 + Parser/parsetok.o \
777 + Parser/metagrammar.o \
778 + Parser/firstsets.o \
782 +PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/tokenizer.o
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)
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)
804 +PGENOBJS= $(POBJS_FOR_BUILD) $(PGOBJS_FOR_BUILD)
806 +##########################################################################
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
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
818 +##########################################################################
821 + Python/Python-ast.o \
824 + Python/bltinmodule.o \
830 + Python/frozenmain.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 \
840 + Python/importdl.o \
842 + Python/modsupport.o \
843 + Python/mystrtoul.o \
844 + Python/mysnprintf.o \
848 + Python/pythonrun.o \
849 + Python/structmember.o \
850 + Python/symtable.o \
851 + Python/sysmodule.o \
852 + Python/traceback.o \
854 + Python/pystrtod.o \
855 + Python/$(DYNLOADFILE) \
860 +##########################################################################
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 \
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 \
899 +##########################################################################
900 +# objects that get linked into the Python library
902 + Modules/_typesmodule.o \
903 + Modules/getbuildinfo.o \
911 +#########################################################################
915 +all: $(BUILDPYTHON) oldsharedmods sharedmods
917 +# Build the interpreter
918 +$(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY)
919 + $(LINKCC) $(CFLAGS) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
921 + $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
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
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;; \
937 +# Build static library
938 +# avoid long command lines, same as LIBRARY_OBJS
939 +$(LIBRARY): $(LIBRARY_OBJS)
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)
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) $@; \
955 + $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
958 +libpython$(VERSION).sl: $(LIBRARY_OBJS)
959 + $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM)
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
964 +RESSRCDIR=$(srcdir)/Mac/Resources/framework
965 +$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
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); \
979 + /usr/bin/libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
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
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); \
1005 +oldsharedmods: $(SHAREDMODS)
1008 +Makefile Modules/config.c: Makefile.pre \
1009 + $(srcdir)/Modules/config.c.in \
1011 + Modules/Setup.config \
1013 + Modules/Setup.local
1014 + $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
1016 + Modules/Setup.config \
1017 + Modules/Setup.local \
1019 + @mv config.c Modules
1020 + @echo "The Makefile was updated, you may need to re-run make."
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 "-----------------------------------------------"; \
1033 +############################################################################
1034 +# Special rules for object files
1036 +Modules/getbuildinfo.o: $(PARSER_OBJS) \
1042 + $(srcdir)/Modules/getbuildinfo.c
1043 + $(CC) -c $(PY_CFLAGS) -DSVNVERSION=\"`LC_ALL=C $(SVNVERSION)`\" -o $@ $(srcdir)/Modules/getbuildinfo.c
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
1053 +Modules/python.o: $(srcdir)/Modules/python.c
1054 + $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
1057 +$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN_FOR_BUILD) $(GRAMMAR_INPUT)
1059 + -$(PGEN_FOR_BUILD) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
1061 +$(PGEN_FOR_BUILD): $(PGENOBJS)
1062 + $(CC_FOR_BUILD) $(OPT) $(LDFLAGS_FOR_BUILD) $(PGENOBJS) $(LIBS_FOR_BUILD) -o $(PGEN_FOR_BUILD)
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
1069 +Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.c
1071 +$(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
1072 + $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
1074 +$(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
1075 + $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
1077 +Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H)
1079 +Python/getplatform.o: $(srcdir)/Python/getplatform.c
1080 + $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
1082 +Python/importdl.o: $(srcdir)/Python/importdl.c
1083 + $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
1085 +Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
1086 + $(srcdir)/Objects/unicodetype_db.h
1088 +############################################################################
1089 +# Cross compile rules
1091 +# .x is a native object file during cross-compile.
1094 + $(CC_FOR_BUILD) -c $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -o $@ $<
1096 +############################################################################
1100 + Include/Python.h \
1101 + Include/Python-ast.h \
1103 + Include/abstract.h \
1104 + Include/boolobject.h \
1105 + Include/bufferobject.h \
1107 + Include/classobject.h \
1108 + Include/cobject.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 \
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 \
1154 +$(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
1157 +######################################################################
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
1167 +TESTOPTS= -l $(EXTRATESTOPTS)
1168 +TESTPROG= $(srcdir)/Lib/test/regrtest.py
1169 +TESTPYTHON= $(RUNSHARED) $(PYTHON_FOR_BUILD) -E -tt
1171 + -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
1172 + -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
1173 + $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
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
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" ;\
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
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)'"; \
1199 + $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw
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)
1209 +MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
1211 +memtest: all platform
1212 + -rm -f $(srcdir)/Lib/test/*.py[co]
1213 + -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
1214 + $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
1216 +# Install everything
1217 +install: @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
1219 +# Install almost everything without disturbing previous versions
1220 +altinstall: @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
1221 + sharedinstall oldsharedinstall @FRAMEWORKALTINSTALLLAST@
1223 +# Install shared libraries enabled by Setup
1224 +DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
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`; \
1235 + @for i in $(DESTDIRS); \
1237 + if test ! -d $(DESTDIR)$$i; then \
1238 + echo "Creating directory $$i"; \
1239 + $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
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); \
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)
1255 +# Install the interpreter with $(VERSION) affixed
1256 +# This goes into $(exec_prefix)
1257 +altbininstall: $(BUILDPYTHON)
1258 + @for i in $(BINDIR) $(LIBDIR); \
1260 + if test ! -d $(DESTDIR)$$i; then \
1261 + echo "Creating directory $$i"; \
1262 + $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
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); \
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)); \
1279 +# Install the manual page
1281 + @for i in $(MANDIR) $(MANDIR)/man1; \
1283 + if test ! -d $(DESTDIR)$$i; then \
1284 + echo "Creating directory $$i"; \
1285 + $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1289 + $(INSTALL_DATA) $(srcdir)/Misc/python.man \
1290 + $(DESTDIR)$(MANDIR)/man1/python.1
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); \
1321 + if test ! -d $(DESTDIR)$$i; then \
1322 + echo "Creating directory $$i"; \
1323 + $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1327 + @for d in $(LIBSUBDIRS); \
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; \
1338 + @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
1340 + if test -x $$i; then \
1341 + $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
1342 + echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
1344 + $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
1345 + echo $(INSTALL_DATA) $$i $(LIBDEST); \
1348 + @for d in $(LIBSUBDIRS); \
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; \
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; \
1367 + echo $(INSTALL_DATA) $$i $$b; \
1368 + $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
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
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
1401 +# Install the include files
1402 +INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
1404 + @for i in $(INCLDIRSTOMAKE); \
1406 + if test ! -d $(DESTDIR)$$i; then \
1407 + echo "Creating directory $$i"; \
1408 + $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1412 + @for i in $(srcdir)/Include/*.h; \
1414 + echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
1415 + $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
1417 + $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
1419 +# Install the library and miscellaneous stuff needed for extending/embedding
1420 +# This goes into $(exec_prefix)
1421 +LIBPL= $(LIBP)/config
1423 + @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
1425 + if test ! -d $(DESTDIR)$$i; then \
1426 + echo "Creating directory $$i"; \
1427 + $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
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) ; \
1436 + $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
1437 + $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
1440 + echo Skip install of $(LIBRARY) - use make frameworkinstall; \
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
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."; \
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."; \
1484 +# Install the dynamically loadable modules
1485 +# This goes into $(exec_prefix)
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)
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
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
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.
1510 +frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
1512 +frameworkinstallstructure: $(LDLIBRARY)
1513 + @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
1514 + echo Not configured with --enable-framework; \
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; \
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)
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)"
1543 +# This installs the IDE, the Launcher and other apps into /Applications
1544 +frameworkinstallapps:
1545 + cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
1547 +# This install the unix python and pythonw tools in /usr/local/bin
1548 +frameworkinstallunixtools:
1549 + cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
1551 +frameworkaltinstallunixtools:
1552 + cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
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)"
1559 +# This installs a few of the useful scripts in Tools/scripts
1562 + $(PYTHON_FOR_BUILD) $(srcdir)/Tools/scripts/setup.py install \
1563 + --prefix=$(prefix) \
1564 + --install-scripts=$(BINDIR) \
1565 + --root=/$(DESTDIR)
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
1572 +# Run the configure script.
1573 +config.status: $(srcdir)/configure
1574 + $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
1576 +.PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
1578 +# Some make's put the object file in the current directory
1580 + $(CC) -c $(PY_CFLAGS) -o $@ $<
1582 +# Run reindent on the library
1584 + ./python$(EXEEXT) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
1586 +# Rerun configure with the same options as it was run last time,
1587 +# provided the config.status script exists
1589 + $(SHELL) config.status --recheck
1590 + $(SHELL) config.status
1592 +# Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
1594 + (cd $(srcdir); autoconf)
1595 + (cd $(srcdir); autoheader)
1597 +# Create a tags file for vi
1600 + ctags -w -t Include/*.h; \
1601 + for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
1605 +# Create a tags file for GNU Emacs
1608 + etags Include/*.h; \
1609 + for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
1611 +# Sanitation targets -- clean leaves libraries, executables and tags
1612 +# files, which clobber removes those as well
1614 + find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
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
1623 + -rm -f $(BUILDPYTHON) $(PGEN_FOR_BUILD) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
1625 + config.cache config.log pyconfig.h Modules/config.c
1626 + -rm -rf build platform
1627 + -rm -rf $(PYTHONFRAMEWORKDIR)
1628 + -rm -rf buildpython
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
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 {} ';'
1642 +# Check for smelly exported symbols (not starting with Py/_Py)
1644 + nm -p $(LIBRARY) | \
1645 + sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
1647 +# Find files with funny names
1649 + find $(DISTDIRS) -type d \
1650 + -o -name '*.[chs]' \
1652 + -o -name '*.doc' \
1653 + -o -name '*.sty' \
1654 + -o -name '*.bib' \
1655 + -o -name '*.dat' \
1659 + -o -name '*.tex' \
1660 + -o -name '*,[vpt]' \
1661 + -o -name 'Setup' \
1662 + -o -name 'Setup.*' \
1664 + -o -name Makefile \
1665 + -o -name ChangeLog \
1666 + -o -name Repository \
1668 + -o -name Entries \
1672 + -o -name .cvsignore \
1673 + -o -name MANIFEST \
1678 +Python/thread.o: @THREADHEADERS@
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
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
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);
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
1720 #if defined(PYOS_OS2) && defined(PYCC_GCC) || defined(__VMS)
1721 /* Everything needed is defined in PC/os2emx/pyconfig.h or vms/pyconfig.h */
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__ */
1731 #if defined(PYCC_VACPP)
1732 extern int mkdir(char *);
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 *);
1738 extern int mkdir(const char *, mode_t);
1739 @@ -189,9 +200,13 @@
1741 extern int chmod(const char *, int);
1743 +#ifndef __MINGW32__
1744 extern int chmod(const char *, mode_t);
1747 +#ifndef __MINGW32__
1748 extern int chown(const char *, uid_t, gid_t);
1750 extern char *getcwd(char *, int);
1751 extern char *strerror(int);
1752 extern int link(const char *, const char *);
1758 +#if defined(_MSC_VER) || defined(__MINGW32__)
1759 #ifdef HAVE_DIRECT_H
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 */
1771 @@ -2328,7 +2343,7 @@
1772 Py_FileSystemDefaultEncoding, &path, &mode))
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__)
1779 res = mkdir(path, mode);
1780 @@ -7972,7 +7987,7 @@
1785 +#if defined(MS_WINDOWS) && !defined(__MINGW32__)
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__},
1794 +#if defined(MS_WINDOWS) && !defined(__MINGW32__)
1795 {"urandom", win32_urandom, METH_VARARGS, win32_urandom__doc__},
1799 {"urandom", vms_urandom, METH_VARARGS, vms_urandom__doc__},
1801 @@ -8653,7 +8668,7 @@
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"
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
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
1823 # it, depending on your system -- see the GNU readline instructions.
1824 # It's okay for this to be a shared library, too.
1826 -readline readline.c -lreadline -lncursesw
1827 +readline readline.c -lreadline
1830 # Modules that should always be present (non UNIX dependent):
1832 # (If you have a really backward UNIX, select and socket may not be
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
1843 # Memory-mapped files (also works on Win32).
1845 # Some more UNIX dependent modules -- off by default, since these
1846 # are not supported by all UNIX systems:
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
1856 # Multimedia modules -- off by default.
1857 @@ -293,12 +293,12 @@
1858 # A Linux specific module -- off by default; this may also work on
1861 -linuxaudiodev linuxaudiodev.c
1862 +#linuxaudiodev linuxaudiodev.c
1865 # George Neville-Neil's timing module:
1867 -timing timingmodule.c
1868 +#timing timingmodule.c
1871 # The _tkinter module.
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:
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:
1891 # *** Uncomment and edit for TOGL extension only:
1892 # -DWITH_TOGL togl.c \
1893 # *** Uncomment and edit to reflect your Tcl/Tk versions:
1896 # *** Uncomment and edit to reflect where your X11 libraries are:
1897 # -L/usr/X11R6/lib \
1898 # *** Or uncomment this for Solaris:
1900 # *** Uncomment for AIX:
1902 # *** Always uncomment this; X11 libraries to link with:
1906 # Lance Ellinghaus's syslog module
1907 #syslog syslogmodule.c # syslog daemon interface
1908 @@ -354,9 +354,11 @@
1910 # First, look at Setup.config; configure may have set this for you.
1912 -_curses _cursesmodule.c -lncursesw
1913 +# XXX Should be possible to make this work with pdcurses.
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
1921 # Generic (SunOS / SVR4) dynamic loading module.
1923 # it is a highly experimental and dangerous device for calling
1924 # *arbitrary* C functions in *arbitrary* shared libraries:
1930 # Modules that provide persistent dictionary-like semantics. You will
1931 @@ -402,10 +404,10 @@
1933 # Edit the variables DB and DBLIBVERto point to the db top directory
1934 # and the subdirectory of PORT where you built it.
1936 -DBINC=/usr/include/db4
1938 -_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER)
1940 +#DBINC=/usr/include/db4
1942 +#_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER)
1944 # Historical Berkeley DB 1.85
1947 # More information on Expat can be found at www.libexpat.org.
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
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 @@
1960 PyOS_CheckStack(void)
1962 +/* MinGW (gcc) defines _MSC_VER but doesn't have this exception stuff. */
1963 +#ifndef __MINGW32__
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 */
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 @@
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'.
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:
1997 + PYTHON_FOR_BUILD=python2.5
1999 + # set these values according to your cross-compiler setup
2000 + PATH="$HOME/cross-target/freebsd-x86/usr/cross/bin:$PATH"
2002 + # headers & libraries for target system
2003 + CROSS_ROOT=$HOME/cross-target/freebsd-x86/
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
2010 + export CROSS_ROOT PATH PYTHON_FOR_BUILD \
2011 + ac_cv_file__dev_ptmx
2013 + configure --host=i686-freebsd4 --with-system-ffi
2017 +Cross compiling has been tested under linux. Your mileage may vary for
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.
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 .
2035 Miscellaneous issues
2036 ====================
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
2042 # This global variable is used to hold the list of modules to be disabled.
2043 disabled_module_list = []
2047 +if os.environ.get('CROSS_COMPILING') == 'yes':
2048 + sysconfig.get_config_vars()
2049 + sysconfig._config_vars.update (os.environ)
2051 + sysconfig.get_config_vars()
2052 + sysconfig._config_vars['srcdir'] = os.environ['srcdir']
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'
2058 self.announce('WARNING: skipping import check for Cygwin-based "%s"'
2061 + if os.environ.get('CROSS_COMPILING') == 'yes':
2063 ext_filename = os.path.join(
2065 self.get_ext_filename(self.get_ext_fullname(ext.name)))
2066 @@ -236,11 +247,15 @@
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
2075 + if os.environ.get('CROSS_COMPILING') == 'yes':
2076 + p = os.environ.get('MACHDEP').lower()
2078 + for platform in ['cygwin', 'mingw', 'beos', 'darwin', 'atheos', 'osf1']:
2079 + if p.startswith(platform):
2081 - return sys.platform
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',
2094 - inc_dirs = self.compiler.include_dirs + ['/usr/include']
2097 + if os.environ.get('CROSS_COMPILING') != 'yes':
2098 + lib_dirs = self.compiler.library_dirs + [
2099 + '/lib64', '/usr/lib64',
2100 + '/lib', '/usr/lib',
2102 + inc_dirs = self.compiler.include_dirs + ['/usr/include']
2106 config_h = sysconfig.get_config_h_filename()
2108 db_inc_paths.append('/pkg/db-3.%d/include' % x)
2109 db_inc_paths.append('/opt/db-3.%d/include' % x)
2111 + if os.environ.get('CROSS_COMPILING') == 'yes':
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
2118 MIN_SQLITE_VERSION = ".".join([str(x)
2119 for x in MIN_SQLITE_VERSION_NUMBER])
2121 + if os.environ.get('CROSS_COMPILING') == 'yes':
2122 + sqlite_inc_paths = []
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.
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':
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)