794e2e601f
Change-Id: I39c880e8615b164a66eb900c11b26da9d6489e02
2029 lines
64 KiB
Diff
2029 lines
64 KiB
Diff
--- misc/build/Python-2.6.1/configure.in 2009-03-30 19:56:14.000000000 +0200
|
|
+++ misc/build/Python-2.6.1/configure.in 2009-05-09 13:48:16.000000000 +0200
|
|
@@ -12,6 +12,11 @@
|
|
AC_CONFIG_SRCDIR([Include/object.h])
|
|
AC_CONFIG_HEADER(pyconfig.h)
|
|
|
|
+# find compiler while respecting --host setting
|
|
+AC_CANONICAL_HOST()
|
|
+AC_CHECK_TOOLS(CC,gcc cc)
|
|
+AC_CHECK_TOOLS(CXX,g++ c++)
|
|
+
|
|
dnl This is for stuff that absolutely must end up in pyconfig.h.
|
|
dnl Please use pyport.h instead, if possible.
|
|
AH_TOP([
|
|
@@ -215,8 +220,8 @@
|
|
# Set name for machine-dependent library files
|
|
AC_SUBST(MACHDEP)
|
|
AC_MSG_CHECKING(MACHDEP)
|
|
-if test -z "$MACHDEP"
|
|
-then
|
|
+if test -z "$MACHDEP"; then
|
|
+ if test "$cross_compiling" = "no"; then
|
|
ac_sys_system=`uname -s`
|
|
if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64" \
|
|
-o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
|
|
@@ -224,6 +229,24 @@
|
|
else
|
|
ac_sys_release=`uname -r`
|
|
fi
|
|
+ else
|
|
+ #m=`$CC -dumpmachine`
|
|
+ #changequote(<<, >>)#dnl
|
|
+ #ac_sys_system=`expr "$m" : "[^-]*-\([^-]*\)"`
|
|
+ #changequote([, ])#dnl
|
|
+
|
|
+ m=`$CC -dumpmachine`
|
|
+ ac_sys_system=`echo $m | cut -d- -f3`
|
|
+
|
|
+ case $ac_sys_system in
|
|
+ cygwin*) ac_sys_system=`echo $ac_sys_system | sed s/cygwin/CYGWIN/g `;;
|
|
+ darwin*) ac_sys_system=`echo $ac_sys_system | sed s/darwin/Darwin/g `;;
|
|
+ linux*) ac_sys_system=`echo $ac_sys_system | sed s/linux/Linux/g `;;
|
|
+ esac
|
|
+
|
|
+
|
|
+ fi
|
|
+
|
|
ac_md_system=`echo $ac_sys_system |
|
|
tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
|
|
ac_md_release=`echo $ac_sys_release |
|
|
@@ -232,6 +255,7 @@
|
|
|
|
case $MACHDEP in
|
|
cygwin*) MACHDEP="cygwin";;
|
|
+ mingw*) MACHDEP="mingw";;
|
|
darwin*) MACHDEP="darwin";;
|
|
atheos*) MACHDEP="atheos";;
|
|
irix646) MACHDEP="irix6";;
|
|
@@ -363,7 +387,7 @@
|
|
fi
|
|
AC_MSG_RESULT($MACHDEP)
|
|
|
|
-# And add extra plat-mac for darwin
|
|
+# And add extra plat-mac for Darwin
|
|
AC_SUBST(EXTRAPLATDIR)
|
|
AC_SUBST(EXTRAMACHDEPPATH)
|
|
AC_MSG_CHECKING(EXTRAPLATDIR)
|
|
@@ -382,6 +406,23 @@
|
|
fi
|
|
AC_MSG_RESULT($EXTRAPLATDIR)
|
|
|
|
+AC_MSG_CHECKING(posix flavour)
|
|
+if test -z "$POSIX"
|
|
+then
|
|
+ case $ac_sys_system/$ac_sys_release in
|
|
+ mingw*)
|
|
+ DELIM=';'
|
|
+ POSIX=nt
|
|
+ ;;
|
|
+ *)
|
|
+ DELIM=':'
|
|
+ POSIX=posix
|
|
+ ;;
|
|
+ esac
|
|
+ fi
|
|
+AC_SUBST(DELIM)
|
|
+AC_MSG_RESULT($POSIX)
|
|
+
|
|
# Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
|
|
# it may influence the way we can build extensions, so distutils
|
|
# needs to check it
|
|
@@ -546,9 +587,11 @@
|
|
then
|
|
AC_MSG_RESULT(yes)
|
|
BUILDEXEEXT=.exe
|
|
+ case_sensitive=no
|
|
else
|
|
- AC_MSG_RESULT(no)
|
|
- BUILDEXEEXT=$EXEEXT
|
|
+ AC_MSG_RESULT(no)
|
|
+ BUILDEXEEXT=$EXEEXT
|
|
+ case_sensitive=yes
|
|
fi
|
|
rmdir CaseSensitiveTestDir
|
|
|
|
@@ -645,7 +688,7 @@
|
|
if test -z "$enable_shared"
|
|
then
|
|
case $ac_sys_system in
|
|
- CYGWIN* | atheos*)
|
|
+ CYGWIN* | atheos* | mingw*)
|
|
enable_shared="yes";;
|
|
*)
|
|
enable_shared="no";;
|
|
@@ -700,6 +743,10 @@
|
|
LDLIBRARY='libpython$(VERSION).dll.a'
|
|
DLLLIBRARY='libpython$(VERSION).dll'
|
|
;;
|
|
+ mingw*)
|
|
+ LDLIBRARY='libpython$(VERSION).dll.a'
|
|
+ DLLLIBRARY='libpython$(VERSION).dll'
|
|
+ ;;
|
|
SunOS*)
|
|
LDLIBRARY='libpython$(VERSION).so'
|
|
BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
|
|
@@ -752,14 +799,18 @@
|
|
BLDLIBRARY='$(LIBRARY)'
|
|
LDLIBRARY='libpython$(VERSION).dll.a'
|
|
;;
|
|
+ mingw*)
|
|
+ BLDLIBRARY='$(LIBRARY)'
|
|
+ LDLIBRARY='libpython$(VERSION).dll.a'
|
|
+ ;;
|
|
esac
|
|
fi
|
|
|
|
AC_MSG_RESULT($LDLIBRARY)
|
|
|
|
-AC_PROG_RANLIB
|
|
-AC_SUBST(AR)
|
|
-AC_CHECK_PROGS(AR, ar aal, ar)
|
|
+# find tools while respecting --host setting
|
|
+AC_CHECK_TOOL(RANLIB,ranlib)
|
|
+AC_CHECK_TOOLS(AR,ar aal,ar)
|
|
|
|
AC_SUBST(SVNVERSION)
|
|
AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
|
|
@@ -965,6 +1016,9 @@
|
|
OSF*)
|
|
BASECFLAGS="$BASECFLAGS -mieee"
|
|
;;
|
|
+ mingw*)
|
|
+ OPT="-DMS_WINDOWS -DPy_WIN_WIDE_FILENAMES $OPT"
|
|
+ ;;
|
|
esac
|
|
;;
|
|
|
|
@@ -1013,7 +1067,7 @@
|
|
if test $ac_cv_opt_olimit_ok = yes; then
|
|
case $ac_sys_system in
|
|
# XXX is this branch needed? On MacOSX 10.2.2 the result of the
|
|
- # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
|
|
+ # olimit_ok test is "no". Is it "yes" in some other darwin-esque
|
|
# environment?
|
|
Darwin*)
|
|
;;
|
|
@@ -1590,6 +1644,7 @@
|
|
esac
|
|
;;
|
|
CYGWIN*) SO=.dll;;
|
|
+ mingw*) SO=.dll;;
|
|
*) SO=.so;;
|
|
esac
|
|
else
|
|
@@ -1713,6 +1768,8 @@
|
|
SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
|
|
Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
|
|
CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
|
|
+ mingw*) LDSHARED='$(CC) -mdll'
|
|
+ BLDSHARED='$(CC) -mdll libpython$(VERSION).dll';;
|
|
atheos*) LDSHARED="gcc -shared";;
|
|
*) LDSHARED="ld";;
|
|
esac
|
|
@@ -1805,6 +1862,11 @@
|
|
then
|
|
LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
|
|
fi;;
|
|
+ mingw*)
|
|
+ if test $enable_shared = "no"
|
|
+ then
|
|
+ LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
|
|
+ fi;;
|
|
QNX*)
|
|
# -Wl,-E causes the symbols to be added to the dynamic
|
|
# symbol table so that they can be found when a module
|
|
@@ -1882,6 +1944,16 @@
|
|
# BeOS' sockets are stashed in libnet.
|
|
AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
|
|
AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
|
|
+AC_CHECK_HEADER(winsock2.h)
|
|
+AC_CHECK_LIB(wsock32, select, [LIBS="-lws2_32 -lwsock32 $LIBS"], [], $LIBS) # Mingw32 select
|
|
+save_LIBS="$LIBS"
|
|
+LIBS="-lws2_32 -lwsock32 $LIBS"
|
|
+AC_MSG_CHECKING([for include <winsock2.h> select in libwinsock32])
|
|
+AC_TRY_LINK([#include <winsock2.h>],
|
|
+ [select (1,2,3,4,5);],
|
|
+ [AC_MSG_RESULT(yes)],
|
|
+ [AC_MSG_RESULT(no)]
|
|
+ [LIBS="$save_LIBS"])
|
|
|
|
case "$ac_sys_system" in
|
|
BeOS*)
|
|
@@ -2424,6 +2496,7 @@
|
|
# Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
|
|
Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
|
|
atheos*) DYNLOADFILE="dynload_atheos.o";;
|
|
+ mingw*) DYNLOADFILE="dynload_win.o";;
|
|
*)
|
|
# use dynload_shlib.c and dlopen() if we have it; otherwise stub
|
|
# out any dynamic loading
|
|
@@ -2568,7 +2641,7 @@
|
|
# On Tru64, chflags seems to be present, but calling it will
|
|
# exit Python
|
|
AC_MSG_CHECKING(for chflags)
|
|
-AC_TRY_RUN([
|
|
+AC_TRY_COMPILE([
|
|
#include <sys/stat.h>
|
|
#include <unistd.h>
|
|
int main(int argc, char*argv[])
|
|
@@ -2577,13 +2650,13 @@
|
|
return 1;
|
|
return 0;
|
|
}
|
|
-],AC_DEFINE(HAVE_CHFLAGS, 1, Define to 1 if you have the `chflags' function.)
|
|
+],void* p=chflags, AC_DEFINE(HAVE_CHFLAGS, 1, Define to 1 if you have the `chflags' function.)
|
|
AC_MSG_RESULT(yes),
|
|
AC_MSG_RESULT(no)
|
|
)
|
|
|
|
AC_MSG_CHECKING(for lchflags)
|
|
-AC_TRY_RUN([
|
|
+AC_TRY_COMPILE([
|
|
#include <sys/stat.h>
|
|
#include <unistd.h>
|
|
int main(int argc, char*argv[])
|
|
@@ -2592,7 +2665,7 @@
|
|
return 1;
|
|
return 0;
|
|
}
|
|
-],AC_DEFINE(HAVE_LCHFLAGS, 1, Define to 1 if you have the `lchflags' function.)
|
|
+],void* p=lchflags, AC_DEFINE(HAVE_LCHFLAGS, 1, Define to 1 if you have the `lchflags' function.)
|
|
AC_MSG_RESULT(yes),
|
|
AC_MSG_RESULT(no)
|
|
)
|
|
@@ -2722,6 +2795,8 @@
|
|
)
|
|
)
|
|
|
|
+AC_CHECK_FUNCS(cwait fsync pipe popen spawnv system)
|
|
+
|
|
AC_MSG_CHECKING(for major, minor, and makedev)
|
|
AC_TRY_LINK([
|
|
#if defined(MAJOR_IN_MKDEV)
|
|
@@ -2871,7 +2946,7 @@
|
|
AC_CHECK_MEMBERS([struct stat.st_flags])
|
|
AC_CHECK_MEMBERS([struct stat.st_gen])
|
|
AC_CHECK_MEMBERS([struct stat.st_birthtime])
|
|
-AC_STRUCT_ST_BLOCKS
|
|
+#AC_STRUCT_ST_BLOCKS
|
|
|
|
AC_MSG_CHECKING(for time.h that defines altzone)
|
|
AC_CACHE_VAL(ac_cv_header_time_altzone,
|
|
@@ -3657,7 +3732,8 @@
|
|
fi
|
|
|
|
AC_MSG_CHECKING(for %zd printf() format support)
|
|
-AC_TRY_RUN([#include <stdio.h>
|
|
+AC_CACHE_VAL(ac_cv_printf_zd_format,
|
|
+ AC_TRY_RUN([#include <stdio.h>
|
|
#include <stddef.h>
|
|
#include <string.h>
|
|
|
|
@@ -3693,7 +3769,7 @@
|
|
}],
|
|
[AC_MSG_RESULT(yes)
|
|
AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])],
|
|
- AC_MSG_RESULT(no))
|
|
+ AC_MSG_RESULT(no)))
|
|
|
|
AC_CHECK_TYPE(socklen_t,,
|
|
AC_DEFINE(socklen_t,int,
|
|
@@ -3704,6 +3780,9 @@
|
|
#ifdef HAVE_SYS_SOCKET_H
|
|
#include <sys/socket.h>
|
|
#endif
|
|
+#ifdef _WIN32
|
|
+#include <ws2tcpip.h>
|
|
+#endif
|
|
])
|
|
|
|
AC_SUBST(THREADHEADERS)
|
|
@@ -3723,6 +3802,67 @@
|
|
done
|
|
AC_MSG_RESULT(done)
|
|
|
|
+# Cross compiling
|
|
+AC_SUBST(cross_compiling)
|
|
+
|
|
+if test "$cross_compiling" = "yes"; then
|
|
+ AC_MSG_CHECKING(cc for build)
|
|
+ ## /usr/bin/cc still uses wrong assembler
|
|
+ ## CC_FOR_BUILD="${CC_FOR_BUILD-/usr/bin/cc}"
|
|
+ CC_FOR_BUILD="${CC_FOR_BUILD-PATH=/usr/bin:$PATH cc}"
|
|
+else
|
|
+ CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
|
|
+fi
|
|
+
|
|
+if test "$cross_compiling" = "yes"; then
|
|
+ AC_MSG_RESULT($CC_FOR_BUILD)
|
|
+fi
|
|
+
|
|
+AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler (default: cc)])
|
|
+
|
|
+if test "$cross_compiling" = "yes"; then
|
|
+ AC_MSG_CHECKING(python for build)
|
|
+ PYTHON_FOR_BUILD="${PYTHON_FOR_BUILD-python}"
|
|
+else
|
|
+ PYTHON_FOR_BUILD='$(BUILDPYTHON)'
|
|
+fi
|
|
+
|
|
+if test "$cross_compiling" = "yes"; then
|
|
+ AC_MSG_RESULT($PYTHON_FOR_BUILD)
|
|
+fi
|
|
+AC_ARG_VAR(PYTHON_FOR_BUILD,[build system python (default: python)])
|
|
+AC_SUBST(PYTHON_FOR_BUILD)
|
|
+
|
|
+if test "$cross_compiling" = "yes"; then
|
|
+ CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-}
|
|
+ changequote(<<, >>)#dnl
|
|
+ python_include=`$PYTHON_FOR_BUILD -c 'import sys; sys.stdout.write ("%s/include/python%s" % (sys.prefix, sys.version[:3]))'`
|
|
+ changequote([, ])#dnl
|
|
+ CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-"-I$python_include"}
|
|
+ CROSS_COMMENT=#
|
|
+ if test "$case_sensitive" = "yes"
|
|
+ then
|
|
+ EXEEXT_FOR_BUILD=
|
|
+ else
|
|
+ EXEEXT_FOR_BUILD=.exe
|
|
+ fi
|
|
+ LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-}
|
|
+ LIBS_FOR_BUILD=${LIBS_FOR_BUILD-}
|
|
+ O_FOR_BUILD=x
|
|
+ RUNSHARED="CROSS_TARGET=$ac_sys_system SRCDIR=$srcdir SO=${SO}"
|
|
+else
|
|
+ CROSS_COMMENT=
|
|
+ EXEEXT_FOR_BUILD=$BUILDEXEEXT
|
|
+ O_FOR_BUILD=o
|
|
+fi
|
|
+AC_SUBST(CFLAGS_FOR_BUILD)
|
|
+AC_SUBST(CPPFLAGS_FOR_BUILD)
|
|
+AC_SUBST(CROSS_COMMENT)
|
|
+AC_SUBST(EXEEXT_FOR_BUILD)
|
|
+AC_SUBST(LDFLAGS_FOR_BUILD)
|
|
+AC_SUBST(LIBS_FOR_BUILD)
|
|
+AC_SUBST(O_FOR_BUILD)
|
|
+
|
|
# generate output files
|
|
AC_CONFIG_FILES(Makefile.pre Modules/Setup.config)
|
|
AC_OUTPUT
|
|
@@ -3732,6 +3872,9 @@
|
|
then
|
|
cp $srcdir/Modules/Setup.dist Modules/Setup
|
|
fi
|
|
+mv Modules/Setup Modules/Setup~
|
|
+sed -e "s/@POSIX@/$POSIX/g" < Modules/Setup~ > Modules/Setup
|
|
+
|
|
|
|
echo "creating Modules/Setup.local"
|
|
if test ! -f Modules/Setup.local
|
|
--- misc/build/Python-2.6.1/Include/osdefs.h 2006-04-25 17:29:46.000000000 +0200
|
|
+++ misc/build/Python-2.6.1/Include/osdefs.h 2009-05-09 13:35:04.000000000 +0200
|
|
@@ -9,7 +9,7 @@
|
|
|
|
/* Mod by chrish: QNX has WATCOM, but isn't DOS */
|
|
#if !defined(__QNX__)
|
|
-#if defined(MS_WINDOWS) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__DJGPP__) || defined(PYOS_OS2)
|
|
+#if defined(MS_WINDOWS) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__DJGPP__) || defined(PYOS_OS2) || defined(__MINGW32__)
|
|
#if defined(PYOS_OS2) && defined(PYCC_GCC)
|
|
#define MAXPATHLEN 260
|
|
#define SEP '/'
|
|
@@ -18,6 +18,7 @@
|
|
#define SEP '\\'
|
|
#define ALTSEP '/'
|
|
#define MAXPATHLEN 256
|
|
+#define ROOTSEP ':'
|
|
#endif
|
|
#define DELIM ';'
|
|
#endif
|
|
--- misc/build/Python-2.6.1/Include/pyport.h 2009-01-14 01:00:17.000000000 +0100
|
|
+++ misc/build/Python-2.6.1/Include/pyport.h 2009-05-09 13:35:04.000000000 +0200
|
|
@@ -551,31 +551,31 @@
|
|
BeOS and cygwin are the only other autoconf platform requiring special
|
|
linkage handling and both of these use __declspec().
|
|
*/
|
|
-#if defined(__CYGWIN__) || defined(__BEOS__)
|
|
+#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BEOS__)
|
|
# define HAVE_DECLSPEC_DLL
|
|
#endif
|
|
|
|
/* only get special linkage if built as shared or platform is Cygwin */
|
|
-#if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__)
|
|
+#if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__) || defined(__MINGW32__)
|
|
# if defined(HAVE_DECLSPEC_DLL)
|
|
# ifdef Py_BUILD_CORE
|
|
# define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE
|
|
# define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE
|
|
/* module init functions inside the core need no external linkage */
|
|
/* except for Cygwin to handle embedding (FIXME: BeOS too?) */
|
|
-# if defined(__CYGWIN__)
|
|
+# if defined(__CYGWIN__) || defined(__MINGW32__)
|
|
# define PyMODINIT_FUNC __declspec(dllexport) void
|
|
-# else /* __CYGWIN__ */
|
|
+# else /* __CYGWIN__ || __MINGW32__ */
|
|
# define PyMODINIT_FUNC void
|
|
-# endif /* __CYGWIN__ */
|
|
+# endif /* __CYGWIN__ || __MINGW32__ */
|
|
# else /* Py_BUILD_CORE */
|
|
/* Building an extension module, or an embedded situation */
|
|
/* public Python functions and data are imported */
|
|
/* Under Cygwin, auto-import functions to prevent compilation */
|
|
/* failures similar to http://python.org/doc/FAQ.html#3.24 */
|
|
-# if !defined(__CYGWIN__)
|
|
+# if !defined(__CYGWIN__) && !defined(__MINGW32__)
|
|
# define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE
|
|
-# endif /* !__CYGWIN__ */
|
|
+# endif /* !__CYGWIN__ && ! __MINGW32__ */
|
|
# define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE
|
|
/* module init functions outside the core must be exported */
|
|
# if defined(__cplusplus)
|
|
--- misc/build/Python-2.6.1/Lib/distutils/command/build_ext.py 2009-02-05 23:55:00.000000000 +0100
|
|
+++ misc/build/Python-2.6.1/Lib/distutils/command/build_ext.py 2009-05-09 13:35:04.000000000 +0200
|
|
@@ -679,6 +679,8 @@
|
|
ext_path[len(ext_path) - 1] = ext_path[len(ext_path) - 1][:8]
|
|
# extensions in debug_mode are named 'module_d.pyd' under windows
|
|
so_ext = get_config_var('SO')
|
|
+ if os.environ.get('CROSS_COMPILING') == 'yes':
|
|
+ so_ext = os.environ.get('SO')
|
|
if os.name == 'nt' and self.debug:
|
|
return apply(os.path.join, ext_path) + '_d' + so_ext
|
|
return os.path.join(*ext_path) + so_ext
|
|
@@ -731,7 +733,7 @@
|
|
# don't extend ext.libraries, it may be shared with other
|
|
# extensions, it is a reference to the original list
|
|
return ext.libraries + [pythonlib]
|
|
- elif sys.platform[:6] == "cygwin":
|
|
+ elif sys.platform[:6] == "cygwin" or sys.platform[:5] == "mingw":
|
|
template = "python%d.%d"
|
|
pythonlib = (template %
|
|
(sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff))
|
|
--- misc/build/Python-2.6.1/Lib/plat-mingw/regen 1970-01-01 01:00:00.000000000 +0100
|
|
+++ misc/build/Python-2.6.1/Lib/plat-mingw/regen 2009-05-09 13:35:04.000000000 +0200
|
|
@@ -0,0 +1,3 @@
|
|
+#! /bin/sh
|
|
+set -v
|
|
+python$EXE ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h
|
|
--- misc/build/Python-2.6.1/Lib/plat-mingw32msvc2/regen 1970-01-01 01:00:00.000000000 +0100
|
|
+++ misc/build/Python-2.6.1/Lib/plat-mingw32msvc2/regen 2009-05-09 13:35:04.000000000 +0200
|
|
@@ -0,0 +1,3 @@
|
|
+#! /bin/sh
|
|
+set -v
|
|
+python$EXE ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h
|
|
--- misc/build/Python-2.6.1/Lib/plat-pc/regen 1970-01-01 01:00:00.000000000 +0100
|
|
+++ misc/build/Python-2.6.1/Lib/plat-pc/regen 2009-05-09 13:35:04.000000000 +0200
|
|
@@ -0,0 +1,3 @@
|
|
+#! /bin/sh
|
|
+set -v
|
|
+python$EXE ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h
|
|
--- misc/build/Python-2.6.1/Lib/test/test_future5.py 2008-10-26 21:59:05.000000000 +0100
|
|
+++ misc/build/Python-2.6.1/Lib/test/test_future5.py 2009-05-09 14:42:22.000000000 +0200
|
|
@@ -13,7 +13,7 @@
|
|
|
|
def test_print_function(self):
|
|
with test_support.captured_output("stderr") as s:
|
|
- print("foo", file=sys.stderr)
|
|
+ print >> sys.stderr, "foo"
|
|
self.assertEqual(s.getvalue(), "foo\n")
|
|
|
|
|
|
--- misc/build/Python-2.6.1/Makefile.pre.in 2009-02-24 12:07:44.000000000 +0100
|
|
+++ misc/build/Python-2.6.1/Makefile.pre.in 2009-05-09 13:35:04.000000000 +0200
|
|
@@ -18,6 +18,8 @@
|
|
#
|
|
# See also the section "Build instructions" in the README file.
|
|
|
|
+DELIM=@DELIM@
|
|
+
|
|
# === Variables set by makesetup ===
|
|
|
|
MODOBJS= _MODOBJS_
|
|
@@ -72,6 +74,16 @@
|
|
# C flags used for building the interpreter object files
|
|
PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
|
|
|
|
+# For cross compile: build compiler options
|
|
+CC_FOR_BUILD= @CC_FOR_BUILD@
|
|
+CROSS_COMPILING= @cross_compiling@
|
|
+EXEEXT_FOR_BUILD= @EXEEXT_FOR_BUILD@
|
|
+O_FOR_BUILD= @O_FOR_BUILD@
|
|
+
|
|
+CFLAGS_FOR_BUILD= @CFLAGS_FOR_BUILD@
|
|
+CPPFLAGS_FOR_BUILD= @CPPFLAGS_FOR_BUILD@ -I$(srcdir)/Include
|
|
+LDFLAGS_FOR_BUILD= @LDFLAGS_FOR_BUILD@
|
|
+LIBS_FOR_BUILD= @LIBS_FOR_BUILD@
|
|
|
|
# Machine-dependent subdirectories
|
|
MACHDEP= @MACHDEP@
|
|
@@ -106,6 +118,10 @@
|
|
BLDSHARED= @BLDSHARED@
|
|
DESTSHARED= $(BINLIBDEST)/lib-dynload
|
|
|
|
+comma=,
|
|
+BLDFLAGS=$(subst -Wl$(comma),,$(LDFLAGS))
|
|
+
|
|
+
|
|
# Executable suffix (.exe on Windows and Mac OS X)
|
|
EXE= @EXEEXT@
|
|
BUILDEXE= @BUILDEXEEXT@
|
|
@@ -174,7 +190,8 @@
|
|
UNICODE_OBJS= @UNICODE_OBJS@
|
|
|
|
PYTHON= python$(EXE)
|
|
-BUILDPYTHON= python$(BUILDEXE)
|
|
+BUILDPYTHON= python$(EXE)
|
|
+PYTHON_FOR_BUILD= @PYTHON_FOR_BUILD@
|
|
|
|
# The task to run while instrument when building the profile-opt target
|
|
PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
|
|
@@ -204,7 +221,7 @@
|
|
|
|
##########################################################################
|
|
# Parser
|
|
-PGEN= Parser/pgen$(EXE)
|
|
+PGEN_FOR_BUILD= Parser/pgen$(EXEEXT_FOR_BUILD)
|
|
|
|
POBJS= \
|
|
Parser/acceler.o \
|
|
@@ -221,18 +238,28 @@
|
|
|
|
PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/tokenizer.o
|
|
|
|
-PGOBJS= \
|
|
- Objects/obmalloc.o \
|
|
- Python/mysnprintf.o \
|
|
- Parser/tokenizer_pgen.o \
|
|
- Parser/printgrammar.o \
|
|
- Parser/pgenmain.o
|
|
-
|
|
-PARSER_HEADERS= \
|
|
- Parser/parser.h \
|
|
- Parser/tokenizer.h
|
|
+POBJS_FOR_BUILD= \
|
|
+ Parser/acceler.$(O_FOR_BUILD) \
|
|
+ Parser/grammar1.$(O_FOR_BUILD) \
|
|
+ Parser/listnode.$(O_FOR_BUILD) \
|
|
+ Parser/node.$(O_FOR_BUILD) \
|
|
+ Parser/parser.$(O_FOR_BUILD) \
|
|
+ Parser/parsetok.$(O_FOR_BUILD) \
|
|
+ Parser/bitset.$(O_FOR_BUILD) \
|
|
+ Parser/metagrammar.$(O_FOR_BUILD) \
|
|
+ Parser/firstsets.$(O_FOR_BUILD) \
|
|
+ Parser/grammar.$(O_FOR_BUILD) \
|
|
+ Parser/pgen.$(O_FOR_BUILD)
|
|
+
|
|
+PGOBJS_FOR_BUILD= \
|
|
+ Objects/obmalloc.$(O_FOR_BUILD) \
|
|
+ Python/mysnprintf.$(O_FOR_BUILD) \
|
|
+ Parser/tokenizer_pgen.$(O_FOR_BUILD) \
|
|
+ Parser/printgrammar.$(O_FOR_BUILD) \
|
|
+ Parser/pgenmain.$(O_FOR_BUILD)
|
|
+
|
|
+PGENOBJS= $(POBJS_FOR_BUILD) $(PGOBJS_FOR_BUILD)
|
|
|
|
-PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS)
|
|
|
|
##########################################################################
|
|
# AST
|
|
@@ -387,16 +414,15 @@
|
|
Modules/python.o \
|
|
$(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
|
|
|
|
-platform: $(BUILDPYTHON)
|
|
- $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
|
|
-
|
|
+platform: @CROSS_COMMENT@ $(BUILDPYTHON)
|
|
+ $(RUNSHARED) $(PYTHON_FOR_BUILD) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
|
|
|
|
# Build the shared modules
|
|
-sharedmods: $(BUILDPYTHON)
|
|
- @case $$MAKEFLAGS in \
|
|
- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
|
|
- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
|
|
- esac
|
|
+sharedmods: @CROSS_COMMENT@ $(BUILDPYTHON)
|
|
+ case $$MAKEFLAGS in \
|
|
+ *-s*) $(RUNSHARED) CC='$(CC)' LDFLAGS="$(BLDFLAGS)" CROSS_COMPILING='$(CROSS_COMPILING)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py -q build;; \
|
|
+ *) $(RUNSHARED) CC='$(CC)' LDFLAGS="$(BLDFLAGS)" CROSS_COMPILING='$(CROSS_COMPILING)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py build;; \
|
|
+ esac
|
|
|
|
# Build static library
|
|
# avoid long command lines, same as LIBRARY_OBJS
|
|
@@ -515,12 +541,13 @@
|
|
$(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
|
|
|
|
|
|
-$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
|
|
+$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN_FOR_BUILD) $(GRAMMAR_INPUT)
|
|
-@$(INSTALL) -d Include
|
|
- -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
|
|
+ -$(PGEN_FOR_BUILD) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
|
|
+
|
|
+$(PGEN_FOR_BUILD): $(PGENOBJS)
|
|
+ $(CC_FOR_BUILD) $(OPT) $(LDFLAGS_FOR_BUILD) $(PGENOBJS) $(LIBS_FOR_BUILD) -o $(PGEN_FOR_BUILD)
|
|
|
|
-$(PGEN): $(PGENOBJS)
|
|
- $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
|
|
|
|
Parser/grammar.o: $(srcdir)/Parser/grammar.c \
|
|
$(srcdir)/Include/token.h \
|
|
@@ -578,6 +605,13 @@
|
|
$(STRINGLIB_HEADERS)
|
|
|
|
############################################################################
|
|
+# Cross compile rules
|
|
+
|
|
+.SUFFIXES: .x
|
|
+.c.x:
|
|
+ $(CC_FOR_BUILD) -c $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -o $@ $<
|
|
+
|
|
+############################################################################
|
|
# Header files
|
|
|
|
PYTHON_HEADERS= \
|
|
@@ -676,7 +710,7 @@
|
|
|
|
TESTOPTS= -l $(EXTRATESTOPTS)
|
|
TESTPROG= $(srcdir)/Lib/test/regrtest.py
|
|
-TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -E -tt
|
|
+TESTPYTHON= $(RUNSHARED) $(PYTHON_FOR_BUILD) -E -tt
|
|
test: all platform
|
|
-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
|
|
-$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
|
|
@@ -830,7 +864,7 @@
|
|
multiprocessing multiprocessing/dummy \
|
|
lib-old \
|
|
curses $(MACHDEPS)
|
|
-libinstall: build_all $(srcdir)/Lib/$(PLATDIR)
|
|
+libinstall: $(srcdir)/Lib/$(PLATDIR) @CROSS_COMMENT@ $(BUILDPYTHON)
|
|
@for i in $(SCRIPTDIR) $(LIBDEST); \
|
|
do \
|
|
if test ! -d $(DESTDIR)$$i; then \
|
|
@@ -887,19 +921,19 @@
|
|
done
|
|
$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
|
|
PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
|
- ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
|
|
+ $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
|
|
-d $(LIBDEST) -f \
|
|
-x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
|
|
PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
|
- ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
|
|
+ $(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
|
|
-d $(LIBDEST) -f \
|
|
-x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
|
|
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
|
- ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
|
|
+ $(PYTHON_FOR_BUILD) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
|
|
-d $(LIBDEST)/site-packages -f \
|
|
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
|
|
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
|
- ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
|
|
+ $(PYTHON_FOR_BUILD) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
|
|
-d $(LIBDEST)/site-packages -f \
|
|
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
|
|
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
|
@@ -909,9 +943,9 @@
|
|
$(srcdir)/Lib/$(PLATDIR):
|
|
mkdir $(srcdir)/Lib/$(PLATDIR)
|
|
cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
|
|
- export PATH; PATH="`pwd`:$$PATH"; \
|
|
- export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
|
|
- export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
|
|
+@CROSS_COMMENT@ export PATH; PATH="`pwd`:$$PATH"; \
|
|
+@CROSS_COMMENT@ export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
|
|
+@CROSS_COMMENT@ export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
|
|
export EXE; EXE="$(BUILDEXE)"; \
|
|
cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
|
|
|
|
@@ -1001,8 +1035,9 @@
|
|
# Install the dynamically loadable modules
|
|
# This goes into $(exec_prefix)
|
|
sharedinstall:
|
|
- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
|
|
- --prefix=$(prefix) \
|
|
+ CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILING='$(CROSS_COMPILING)' \
|
|
+ $(RUNSHARED) $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py install \
|
|
+ --prefix=$(prefix) \
|
|
--install-scripts=$(BINDIR) \
|
|
--install-platlib=$(DESTSHARED) \
|
|
--root=/$(DESTDIR)
|
|
@@ -1081,7 +1116,7 @@
|
|
# This installs a few of the useful scripts in Tools/scripts
|
|
scriptsinstall:
|
|
SRCDIR=$(srcdir) $(RUNSHARED) \
|
|
- ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
|
|
+ $(PYTHON_FOR_BUILD) $(srcdir)/Tools/scripts/setup.py install \
|
|
--prefix=$(prefix) \
|
|
--install-scripts=$(BINDIR) \
|
|
--root=/$(DESTDIR)
|
|
@@ -1145,11 +1180,12 @@
|
|
find . -name '*.gc??' -exec rm -f {} ';'
|
|
|
|
clobber: clean profile-removal
|
|
- -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
|
|
+ -rm -f $(BUILDPYTHON) $(PGEN_FOR_BUILD) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
|
|
tags TAGS \
|
|
config.cache config.log pyconfig.h Modules/config.c
|
|
-rm -rf build platform
|
|
-rm -rf $(PYTHONFRAMEWORKDIR)
|
|
+ -rm -rf buildpython
|
|
|
|
# Make things extra clean, before making a distribution:
|
|
# remove all generated files, even Makefile[.pre]
|
|
--- misc/build/Python-2.6.1/Modules/datetimemodule.c 2008-06-11 09:41:16.000000000 +0200
|
|
+++ misc/build/Python-2.6.1/Modules/datetimemodule.c 2009-05-11 23:36:02.000000000 +0200
|
|
@@ -10,6 +10,10 @@
|
|
|
|
#include <time.h>
|
|
|
|
+#ifdef MS_WINDOWS
|
|
+#include <winsock2.h>
|
|
+#endif
|
|
+
|
|
#include "timefuncs.h"
|
|
|
|
/* Differentiate between building the core module and building extension
|
|
--- misc/build/Python-2.6.1/Modules/dl_nt.c 1970-01-01 01:00:00.000000000 +0100
|
|
+++ misc/build/Python-2.6.1/Modules/dl_nt.c 2009-05-09 13:35:04.000000000 +0200
|
|
@@ -0,0 +1,39 @@
|
|
+/*
|
|
+
|
|
+Entry point for the Windows NT DLL.
|
|
+
|
|
+About the only reason for having this, is so initall() can automatically
|
|
+be called, removing that burden (and possible source of frustration if
|
|
+forgotten) from the programmer.
|
|
+
|
|
+*/
|
|
+#include "windows.h"
|
|
+
|
|
+/* NT and Python share these */
|
|
+#include "pyconfig.h"
|
|
+#include "Python.h"
|
|
+
|
|
+char dllVersionBuffer[16] = ""; // a private buffer
|
|
+
|
|
+// Python Globals
|
|
+HMODULE PyWin_DLLhModule = NULL;
|
|
+const char *PyWin_DLLVersionString = dllVersionBuffer;
|
|
+
|
|
+
|
|
+BOOL WINAPI DllMain (HANDLE hInst,
|
|
+ ULONG ul_reason_for_call,
|
|
+ LPVOID lpReserved)
|
|
+{
|
|
+ switch (ul_reason_for_call)
|
|
+ {
|
|
+ case DLL_PROCESS_ATTACH:
|
|
+ PyWin_DLLhModule = hInst;
|
|
+ // 1000 is a magic number I picked out of the air. Could do with a #define, I spose...
|
|
+ LoadString(hInst, 1000, dllVersionBuffer, sizeof(dllVersionBuffer));
|
|
+ //initall();
|
|
+ break;
|
|
+ case DLL_PROCESS_DETACH:
|
|
+ break;
|
|
+ }
|
|
+ return TRUE;
|
|
+}
|
|
--- misc/build/Python-2.6.1/Modules/getpath.c 2007-03-10 08:38:14.000000000 +0100
|
|
+++ misc/build/Python-2.6.1/Modules/getpath.c 2009-05-09 13:35:04.000000000 +0200
|
|
@@ -125,6 +125,14 @@
|
|
#define LANDMARK "os.py"
|
|
#endif
|
|
|
|
+#ifndef __MINGW32__
|
|
+#define IS_ABSOLUTE(x) (x[0] == SEP)
|
|
+#else /* __MINGW32__ */
|
|
+#define IS_ABSOLUTE(x) (x[0] == SEP || x[0] == ALTSEP\
|
|
+ || (x[1] && x[1] == ROOTSEP\
|
|
+ && x[2] && (x[2] == SEP || x[2] == ALTSEP)))
|
|
+#endif /* __MINGW32__ */
|
|
+
|
|
static char prefix[MAXPATHLEN+1];
|
|
static char exec_prefix[MAXPATHLEN+1];
|
|
static char progpath[MAXPATHLEN+1];
|
|
@@ -135,7 +143,12 @@
|
|
reduce(char *dir)
|
|
{
|
|
size_t i = strlen(dir);
|
|
- while (i > 0 && dir[i] != SEP)
|
|
+ while (i > 0
|
|
+ && dir[i] != SEP
|
|
+#ifdef ALTSEP
|
|
+ && dir[i] != ALTSEP
|
|
+#endif /* ALTSEP */
|
|
+ )
|
|
--i;
|
|
dir[i] = '\0';
|
|
}
|
|
@@ -208,11 +221,16 @@
|
|
joinpath(char *buffer, char *stuff)
|
|
{
|
|
size_t n, k;
|
|
- if (stuff[0] == SEP)
|
|
+ if (IS_ABSOLUTE(stuff))
|
|
n = 0;
|
|
else {
|
|
n = strlen(buffer);
|
|
- if (n > 0 && buffer[n-1] != SEP && n < MAXPATHLEN)
|
|
+ if (n > 0
|
|
+ && buffer[n-1] != SEP
|
|
+#ifdef ALTSEP
|
|
+ && buffer[n-1] != ALTSEP
|
|
+#endif /* ALTSEP */
|
|
+ && n < MAXPATHLEN)
|
|
buffer[n++] = SEP;
|
|
}
|
|
if (n > MAXPATHLEN)
|
|
@@ -229,11 +247,16 @@
|
|
static void
|
|
copy_absolute(char *path, char *p)
|
|
{
|
|
- if (p[0] == SEP)
|
|
+ if (IS_ABSOLUTE(p))
|
|
strcpy(path, p);
|
|
else {
|
|
getcwd(path, MAXPATHLEN);
|
|
- if (p[0] == '.' && p[1] == SEP)
|
|
+ if (p[0] == '.'
|
|
+ && (p[1] == SEP
|
|
+#ifdef ALTSEP
|
|
+ || p[1] == ALTSEP
|
|
+#endif /* ALTSEP */
|
|
+ ))
|
|
p += 2;
|
|
joinpath(path, p);
|
|
}
|
|
@@ -245,7 +268,7 @@
|
|
{
|
|
char buffer[MAXPATHLEN + 1];
|
|
|
|
- if (path[0] == SEP)
|
|
+ if (IS_ABSOLUTE(path))
|
|
return;
|
|
copy_absolute(buffer, path);
|
|
strcpy(path, buffer);
|
|
@@ -393,13 +416,23 @@
|
|
#endif
|
|
#endif
|
|
|
|
- /* If there is no slash in the argv0 path, then we have to
|
|
- * assume python is on the user's $PATH, since there's no
|
|
- * other way to find a directory to start the search from. If
|
|
- * $PATH isn't exported, you lose.
|
|
- */
|
|
- if (strchr(prog, SEP))
|
|
- strncpy(progpath, prog, MAXPATHLEN);
|
|
+ /* If PROG is an absolute name, then we're done. If PROG is not
|
|
+ * an absolute name and contains SEP/ALTSEP, then it must be
|
|
+ * reachable from CWD. Otherwise, python is on the user's $PATH,
|
|
+ * since there's no other way to find a directory to start the
|
|
+ * search from. If $PATH isn't exported, you lose.
|
|
+ */
|
|
+ if (IS_ABSOLUTE(prog))
|
|
+ strncpy(progpath, prog, MAXPATHLEN);
|
|
+ else if (strchr(prog, SEP)
|
|
+#ifdef ALTSEP
|
|
+ || strchr(prog, ALTSEP)
|
|
+#endif /* ALTSEP */
|
|
+ )
|
|
+ {
|
|
+ getcwd(progpath, MAXPATHLEN);
|
|
+ joinpath(progpath, prog);
|
|
+ }
|
|
#ifdef __APPLE__
|
|
/* On Mac OS X, if a script uses an interpreter of the form
|
|
* "#!/opt/python2.3/bin/python", the kernel only passes "python"
|
|
@@ -415,6 +448,9 @@
|
|
;
|
|
#endif /* __APPLE__ */
|
|
else if (path) {
|
|
+#ifdef __MINGW32__
|
|
+ char const *ext = strchr(prog, '.') ? "" : ".exe";
|
|
+#endif
|
|
while (1) {
|
|
char *delim = strchr(path, DELIM);
|
|
|
|
@@ -429,9 +465,11 @@
|
|
strncpy(progpath, path, MAXPATHLEN);
|
|
|
|
joinpath(progpath, prog);
|
|
+#ifdef __MINGW32__
|
|
+ strcat(progpath, ext);
|
|
+#endif
|
|
if (isxfile(progpath))
|
|
break;
|
|
-
|
|
if (!delim) {
|
|
progpath[0] = '\0';
|
|
break;
|
|
@@ -441,7 +479,7 @@
|
|
}
|
|
else
|
|
progpath[0] = '\0';
|
|
- if (progpath[0] != SEP)
|
|
+ if (!IS_ABSOLUTE(progpath))
|
|
absolutize(progpath);
|
|
strncpy(argv0_path, progpath, MAXPATHLEN);
|
|
argv0_path[MAXPATHLEN] = '\0';
|
|
@@ -487,7 +525,7 @@
|
|
while (linklen != -1) {
|
|
/* It's not null terminated! */
|
|
tmpbuffer[linklen] = '\0';
|
|
- if (tmpbuffer[0] == SEP)
|
|
+ if (IS_ABSOLUTE(tmpbuffer))
|
|
/* tmpbuffer should never be longer than MAXPATHLEN,
|
|
but extra check does not hurt */
|
|
strncpy(argv0_path, tmpbuffer, MAXPATHLEN);
|
|
@@ -554,7 +592,7 @@
|
|
while (1) {
|
|
char *delim = strchr(defpath, DELIM);
|
|
|
|
- if (defpath[0] != SEP)
|
|
+ if (!IS_ABSOLUTE(defpath))
|
|
/* Paths are relative to prefix */
|
|
bufsz += prefixsz;
|
|
|
|
@@ -599,7 +637,7 @@
|
|
while (1) {
|
|
char *delim = strchr(defpath, DELIM);
|
|
|
|
- if (defpath[0] != SEP) {
|
|
+ if (!IS_ABSOLUTE(defpath)) {
|
|
strcat(buf, prefix);
|
|
strcat(buf, separator);
|
|
}
|
|
--- misc/build/Python-2.6.1/Modules/Makefile 1970-01-01 01:00:00.000000000 +0100
|
|
+++ misc/build/Python-2.6.1/Modules/Makefile 2009-05-11 22:34:01.000000000 +0200
|
|
@@ -0,0 +1,15 @@
|
|
+
|
|
+# Rules appended by makedepend
|
|
+
|
|
+./posixmodule.o: $(srcdir)/./posixmodule.c; $(CC) $(PY_CFLAGS) -c $(srcdir)/./posixmodule.c -o ./posixmodule.o
|
|
+./ntmodule$(SO): ./posixmodule.o; $(BLDSHARED) ./posixmodule.o -o ./ntmodule$(SO)
|
|
+./_sre.o: $(srcdir)/./_sre.c; $(CC) $(PY_CFLAGS) -c $(srcdir)/./_sre.c -o ./_sre.o
|
|
+./_sre$(SO): ./_sre.o; $(BLDSHARED) ./_sre.o -o ./_sre$(SO)
|
|
+./_codecsmodule.o: $(srcdir)/./_codecsmodule.c; $(CC) $(PY_CFLAGS) -c $(srcdir)/./_codecsmodule.c -o ./_codecsmodule.o
|
|
+./_codecsmodule$(SO): ./_codecsmodule.o; $(BLDSHARED) ./_codecsmodule.o -o ./_codecsmodule$(SO)
|
|
+./zipimport.o: $(srcdir)/./zipimport.c; $(CC) $(PY_CFLAGS) -c $(srcdir)/./zipimport.c -o ./zipimport.o
|
|
+./zipimport$(SO): ./zipimport.o; $(BLDSHARED) ./zipimport.o -o ./zipimport$(SO)
|
|
+./symtablemodule.o: $(srcdir)/./symtablemodule.c; $(CC) $(PY_CFLAGS) -c $(srcdir)/./symtablemodule.c -o ./symtablemodule.o
|
|
+./_symtablemodule$(SO): ./symtablemodule.o; $(BLDSHARED) ./symtablemodule.o -o ./_symtablemodule$(SO)
|
|
+./xxsubtype.o: $(srcdir)/./xxsubtype.c; $(CC) $(PY_CFLAGS) -c $(srcdir)/./xxsubtype.c -o ./xxsubtype.o
|
|
+./xxsubtype$(SO): ./xxsubtype.o; $(BLDSHARED) ./xxsubtype.o -o ./xxsubtype$(SO)
|
|
--- misc/build/Python-2.6.1/Modules/posixmodule.c 2009-04-06 08:47:37.000000000 +0200
|
|
+++ misc/build/Python-2.6.1/Modules/posixmodule.c 2009-05-09 13:35:04.000000000 +0200
|
|
@@ -96,6 +96,11 @@
|
|
#include <sys/loadavg.h>
|
|
#endif
|
|
|
|
+/* Additional defines for the mingw32 build */
|
|
+#if defined(__MINGW32__)
|
|
+#undef HAVE_DEV_PTMX
|
|
+#endif
|
|
+
|
|
/* Various compilers have only certain posix functions */
|
|
/* XXX Gosh I wish these were all moved into pyconfig.h */
|
|
#if defined(PYCC_VACPP) && defined(PYOS_OS2)
|
|
@@ -131,6 +136,10 @@
|
|
#define HAVE_FSYNC 1
|
|
#define fsync _commit
|
|
#else
|
|
+#ifdef __MINGW32__ /* MINGW32 (cross-)compiler*/
|
|
+#define HAVE_FSYNC 1
|
|
+#define fsync _commit
|
|
+#else
|
|
#if defined(PYOS_OS2) && defined(PYCC_GCC) || defined(__VMS)
|
|
/* Everything needed is defined in PC/os2emx/pyconfig.h or vms/pyconfig.h */
|
|
#else /* all other compilers */
|
|
@@ -156,12 +165,13 @@
|
|
#define HAVE_WAIT 1
|
|
#define HAVE_TTYNAME 1
|
|
#endif /* PYOS_OS2 && PYCC_GCC && __VMS */
|
|
+#endif /* __MINGW32__ */
|
|
#endif /* _MSC_VER */
|
|
#endif /* __BORLANDC__ */
|
|
#endif /* ! __WATCOMC__ || __QNX__ */
|
|
#endif /* ! __IBMC__ */
|
|
|
|
-#ifndef _MSC_VER
|
|
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
|
|
|
|
#if defined(__sgi)&&_COMPILER_VERSION>=700
|
|
/* declare ctermid_r if compiling with MIPSPro 7.x in ANSI C mode
|
|
@@ -173,7 +183,7 @@
|
|
#if defined(PYCC_VACPP)
|
|
extern int mkdir(char *);
|
|
#else
|
|
-#if ( defined(__WATCOMC__) || defined(_MSC_VER) ) && !defined(__QNX__)
|
|
+#if ( defined(__WATCOMC__) || defined(_MSC_VER) || defined(__MINGW32__)) && !defined(__QNX__)
|
|
extern int mkdir(const char *);
|
|
#else
|
|
extern int mkdir(const char *, mode_t);
|
|
@@ -213,7 +223,7 @@
|
|
#endif /* HAVE_LSTAT */
|
|
#endif /* !HAVE_UNISTD_H */
|
|
|
|
-#endif /* !_MSC_VER */
|
|
+#endif /* !_MSC_VER && !__MINGW32__ */
|
|
|
|
#ifdef HAVE_UTIME_H
|
|
#include <utime.h>
|
|
@@ -258,7 +268,7 @@
|
|
#endif
|
|
#endif
|
|
|
|
-#ifdef _MSC_VER
|
|
+#if defined (_MSC_VER) || defined (__MINGW32__)
|
|
#ifdef HAVE_DIRECT_H
|
|
#include <direct.h>
|
|
#endif
|
|
@@ -273,7 +283,7 @@
|
|
#include <shellapi.h> /* for ShellExecute() */
|
|
#define popen _popen
|
|
#define pclose _pclose
|
|
-#endif /* _MSC_VER */
|
|
+#endif /* _MSC_VER || __MINGW32__ */
|
|
|
|
#if defined(PYCC_VACPP) && defined(PYOS_OS2)
|
|
#include <io.h>
|
|
@@ -322,7 +332,7 @@
|
|
|
|
/* choose the appropriate stat and fstat functions and return structs */
|
|
#undef STAT
|
|
-#if defined(MS_WIN64) || defined(MS_WINDOWS)
|
|
+#if defined(MS_WIN64) || defined(MS_WINDOWS) || defined(__MINGW32__)
|
|
# define STAT win32_stat
|
|
# define FSTAT win32_fstat
|
|
# define STRUCT_STAT struct win32_stat
|
|
@@ -350,9 +360,9 @@
|
|
*/
|
|
#include <crt_externs.h>
|
|
static char **environ;
|
|
-#elif !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) )
|
|
+#elif !defined(_MSC_VER) && !defined(__MINGW32__) && ( !defined(__WATCOMC__) || defined(__QNX__) )
|
|
extern char **environ;
|
|
-#endif /* !_MSC_VER */
|
|
+#endif /* !_MSC_VER && ! __MINGW32__ */
|
|
|
|
static PyObject *
|
|
convertenviron(void)
|
|
@@ -446,7 +456,7 @@
|
|
return rc;
|
|
}
|
|
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined (MS_WINDOWS) || defined (__MINGW32__)
|
|
static PyObject *
|
|
win32_error(char* function, char* filename)
|
|
{
|
|
@@ -749,7 +759,7 @@
|
|
}
|
|
#endif
|
|
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined(MS_WINDOWS) || defined(__MINGW32__)
|
|
/* The CRT of Windows has a number of flaws wrt. its stat() implementation:
|
|
- time stamps are restricted to second resolution
|
|
- file modification times suffer from forth-and-back conversions between
|
|
@@ -1074,7 +1084,7 @@
|
|
return 0;
|
|
}
|
|
|
|
-#endif /* MS_WINDOWS */
|
|
+#endif /* MS_WINDOWS and __MINGW32__ */
|
|
|
|
PyDoc_STRVAR(stat_result__doc__,
|
|
"stat_result: Result from stat or lstat.\n\n\
|
|
@@ -1286,7 +1296,7 @@
|
|
#else
|
|
PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long)st->st_ino));
|
|
#endif
|
|
-#if defined(HAVE_LONG_LONG) && !defined(MS_WINDOWS)
|
|
+#if defined(HAVE_LONG_LONG) && !defined(MS_WINDOWS) && !defined(__MINGW32__)
|
|
PyStructSequence_SET_ITEM(v, 2,
|
|
PyLong_FromLongLong((PY_LONG_LONG)st->st_dev));
|
|
#else
|
|
@@ -1369,7 +1379,7 @@
|
|
return v;
|
|
}
|
|
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined(MS_WINDOWS) || defined(__MINGW32__)
|
|
|
|
/* IsUNCRoot -- test whether the supplied path is of the form \\SERVER\SHARE\,
|
|
where / can be used in place of \ and the trailing slash is optional.
|
|
@@ -1429,7 +1439,7 @@
|
|
#undef ISSLASH
|
|
}
|
|
#endif /* Py_WIN_WIDE_FILENAMES */
|
|
-#endif /* MS_WINDOWS */
|
|
+#endif /* MS_WINDOWS and __MINGW32__ */
|
|
|
|
static PyObject *
|
|
posix_do_stat(PyObject *self, PyObject *args,
|
|
@@ -1482,7 +1492,7 @@
|
|
Py_END_ALLOW_THREADS
|
|
|
|
if (res != 0) {
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined(MS_WINDOWS) || defined(__MINGW32__)
|
|
result = win32_error("stat", pathfree);
|
|
#else
|
|
result = posix_error_with_filename(pathfree);
|
|
@@ -1630,7 +1640,7 @@
|
|
static PyObject *
|
|
posix_chdir(PyObject *self, PyObject *args)
|
|
{
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined(MS_WINDOWS) || defined(__MINGW32__)
|
|
return win32_1str(args, "chdir", "s:chdir", win32_chdir, "U:chdir", win32_wchdir);
|
|
#elif defined(PYOS_OS2) && defined(PYCC_GCC)
|
|
return posix_1str(args, "et:chdir", _chdir2);
|
|
@@ -2073,7 +2083,7 @@
|
|
{
|
|
/* XXX Should redo this putting the (now four) versions of opendir
|
|
in separate files instead of having them all here... */
|
|
-#if defined(MS_WINDOWS) && !defined(HAVE_OPENDIR)
|
|
+#if (defined(MS_WINDOWS) || defined(__MINGW32__)) && !defined(HAVE_OPENDIR)
|
|
|
|
PyObject *d, *v;
|
|
HANDLE hFindFile;
|
|
@@ -2378,7 +2388,7 @@
|
|
#endif /* which OS */
|
|
} /* end of posix_listdir */
|
|
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined(MS_WINDOWS) || defined(__MINGW32__)
|
|
/* A helper function for abspath on win32 */
|
|
static PyObject *
|
|
posix__getfullpathname(PyObject *self, PyObject *args)
|
|
@@ -2433,7 +2443,7 @@
|
|
}
|
|
return PyString_FromString(outbuf);
|
|
} /* end of posix__getfullpathname */
|
|
-#endif /* MS_WINDOWS */
|
|
+#endif /* MS_WINDOWS and __MINGW32__ */
|
|
|
|
PyDoc_STRVAR(posix_mkdir__doc__,
|
|
"mkdir(path [, mode=0777])\n\n\
|
|
@@ -2486,7 +2496,7 @@
|
|
Py_FileSystemDefaultEncoding, &path, &mode))
|
|
return NULL;
|
|
Py_BEGIN_ALLOW_THREADS
|
|
-#if ( defined(__WATCOMC__) || defined(PYCC_VACPP) ) && !defined(__QNX__)
|
|
+#if ( defined(__WATCOMC__) || defined(PYCC_VACPP)) && !defined(__QNX__)
|
|
res = mkdir(path);
|
|
#else
|
|
res = mkdir(path, mode);
|
|
@@ -2550,7 +2560,7 @@
|
|
static PyObject *
|
|
posix_rename(PyObject *self, PyObject *args)
|
|
{
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined(MS_WINDOWS) || defined(__MINGW32__)
|
|
PyObject *o1, *o2;
|
|
char *p1, *p2;
|
|
BOOL result;
|
|
@@ -2598,7 +2608,7 @@
|
|
static PyObject *
|
|
posix_rmdir(PyObject *self, PyObject *args)
|
|
{
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined(MS_WINDOWS) || defined(__MINGW32__)
|
|
return win32_1str(args, "rmdir", "s:rmdir", RemoveDirectoryA, "U:rmdir", RemoveDirectoryW);
|
|
#else
|
|
return posix_1str(args, "et:rmdir", rmdir);
|
|
@@ -2613,7 +2623,7 @@
|
|
static PyObject *
|
|
posix_stat(PyObject *self, PyObject *args)
|
|
{
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined(MS_WINDOWS) || defined(__MINGW32__)
|
|
return posix_do_stat(self, args, "et:stat", STAT, "U:stat", win32_wstat);
|
|
#else
|
|
return posix_do_stat(self, args, "et:stat", STAT, NULL, NULL);
|
|
@@ -2669,7 +2679,7 @@
|
|
static PyObject *
|
|
posix_unlink(PyObject *self, PyObject *args)
|
|
{
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined(MS_WINDOWS) || defined(__MINGW32__)
|
|
return win32_1str(args, "remove", "s:remove", DeleteFileA, "U:remove", DeleteFileW);
|
|
#else
|
|
return posix_1str(args, "et:remove", unlink);
|
|
@@ -4720,7 +4730,7 @@
|
|
|
|
#endif /* PYCC_??? */
|
|
|
|
-#elif defined(MS_WINDOWS)
|
|
+#elif defined(MS_WINDOWS) || defined(__MINGW32__)
|
|
|
|
/*
|
|
* Portable 'popen' replacement for Win32.
|
|
@@ -5913,7 +5923,7 @@
|
|
#ifdef HAVE_LSTAT
|
|
return posix_do_stat(self, args, "et:lstat", lstat, NULL, NULL);
|
|
#else /* !HAVE_LSTAT */
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined(MS_WINDOWS) || defined(__MINGW32__)
|
|
return posix_do_stat(self, args, "et:lstat", STAT, "U:lstat", win32_wstat);
|
|
#else
|
|
return posix_do_stat(self, args, "et:lstat", STAT, NULL, NULL);
|
|
@@ -6046,7 +6056,7 @@
|
|
#endif /* HAVE_TIMES */
|
|
|
|
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined(MS_WINDOWS) || defined(__MINGW32__)
|
|
#define HAVE_TIMES /* so the method table will pick it up */
|
|
static PyObject *
|
|
posix_times(PyObject *self, PyObject *noargs)
|
|
@@ -6070,7 +6080,7 @@
|
|
(double)0,
|
|
(double)0);
|
|
}
|
|
-#endif /* MS_WINDOWS */
|
|
+#endif /* MS_WINDOWS and __MINGW32__ */
|
|
|
|
#ifdef HAVE_TIMES
|
|
PyDoc_STRVAR(posix_times__doc__,
|
|
@@ -6186,7 +6196,7 @@
|
|
int mode = 0777;
|
|
int fd;
|
|
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined(MS_WINDOWS) || defined(__MINGW32__)
|
|
if (unicode_file_names()) {
|
|
PyUnicodeObject *po;
|
|
if (PyArg_ParseTuple(args, "Ui|i:mkdir", &po, &flag, &mode)) {
|
|
@@ -6305,7 +6315,7 @@
|
|
posix_lseek(PyObject *self, PyObject *args)
|
|
{
|
|
int fd, how;
|
|
-#if defined(MS_WIN64) || defined(MS_WINDOWS)
|
|
+#if defined(MS_WIN64) || defined(MS_WINDOWS) || defined(__MINGW32__)
|
|
PY_LONG_LONG pos, res;
|
|
#else
|
|
off_t pos, res;
|
|
@@ -6332,7 +6342,7 @@
|
|
return NULL;
|
|
|
|
Py_BEGIN_ALLOW_THREADS
|
|
-#if defined(MS_WIN64) || defined(MS_WINDOWS)
|
|
+#if defined(MS_WIN64) || defined(MS_WINDOWS) || defined(__MINGW32__)
|
|
res = _lseeki64(fd, pos, how);
|
|
#else
|
|
res = lseek(fd, pos, how);
|
|
@@ -6348,7 +6358,6 @@
|
|
#endif
|
|
}
|
|
|
|
-
|
|
PyDoc_STRVAR(posix_read__doc__,
|
|
"read(fd, buffersize) -> string\n\n\
|
|
Read a file descriptor.");
|
|
@@ -6423,7 +6432,7 @@
|
|
res = FSTAT(fd, &st);
|
|
Py_END_ALLOW_THREADS
|
|
if (res != 0) {
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined(MS_WINDOWS) || defined(__MINGW32__)
|
|
return win32_error("fstat", NULL);
|
|
#else
|
|
return posix_error();
|
|
@@ -6462,7 +6471,7 @@
|
|
return NULL;
|
|
}
|
|
Py_BEGIN_ALLOW_THREADS
|
|
-#if !defined(MS_WINDOWS) && defined(HAVE_FCNTL_H)
|
|
+#if !defined(MS_WINDOWS) || !defined(__MINGW32__) && defined(HAVE_FCNTL_H)
|
|
if (mode[0] == 'a') {
|
|
/* try to make sure the O_APPEND flag is set */
|
|
int flags;
|
|
@@ -6523,7 +6532,7 @@
|
|
|
|
return Py_BuildValue("(ii)", read, write);
|
|
#else
|
|
-#if !defined(MS_WINDOWS)
|
|
+#if !defined(MS_WINDOWS) || !defined(__MINGW32__)
|
|
int fds[2];
|
|
int res;
|
|
Py_BEGIN_ALLOW_THREADS
|
|
@@ -6532,7 +6541,7 @@
|
|
if (res != 0)
|
|
return posix_error();
|
|
return Py_BuildValue("(ii)", fds[0], fds[1]);
|
|
-#else /* MS_WINDOWS */
|
|
+#else /* MS_WINDOWS and __MINGW32__ */
|
|
HANDLE read, write;
|
|
int read_fd, write_fd;
|
|
BOOL ok;
|
|
@@ -7078,7 +7087,7 @@
|
|
"tempnam is a potential security risk to your program") < 0)
|
|
return NULL;
|
|
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined(MS_WINDOWS) || defined(__MINGW32__)
|
|
name = _tempnam(dir, pfx);
|
|
#else
|
|
name = tempnam(dir, pfx);
|
|
@@ -8137,7 +8146,7 @@
|
|
return NULL;
|
|
}
|
|
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined(MS_WINDOWS) || defined(__MINGW32__)
|
|
PyDoc_STRVAR(win32_startfile__doc__,
|
|
"startfile(filepath [, operation]) - Start a file with its associated\n\
|
|
application.\n\
|
|
@@ -8239,7 +8248,7 @@
|
|
}
|
|
#endif
|
|
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined(MS_WINDOWS) && !defined(__MINGW32__)
|
|
|
|
PyDoc_STRVAR(win32_urandom__doc__,
|
|
"urandom(n) -> str\n\n\
|
|
@@ -8484,7 +8493,7 @@
|
|
#endif /* HAVE_PLOCK */
|
|
#ifdef HAVE_POPEN
|
|
{"popen", posix_popen, METH_VARARGS, posix_popen__doc__},
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined(MS_WINDOWS) || defined(__MINGW32__)
|
|
{"popen2", win32_popen2, METH_VARARGS},
|
|
{"popen3", win32_popen3, METH_VARARGS},
|
|
{"popen4", win32_popen4, METH_VARARGS},
|
|
@@ -8649,13 +8658,13 @@
|
|
{"pathconf", posix_pathconf, METH_VARARGS, posix_pathconf__doc__},
|
|
#endif
|
|
{"abort", posix_abort, METH_NOARGS, posix_abort__doc__},
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined(MS_WINDOWS) || defined(__MINGW32__)
|
|
{"_getfullpathname", posix__getfullpathname, METH_VARARGS, NULL},
|
|
#endif
|
|
#ifdef HAVE_GETLOADAVG
|
|
{"getloadavg", posix_getloadavg, METH_NOARGS, posix_getloadavg__doc__},
|
|
#endif
|
|
- #ifdef MS_WINDOWS
|
|
+ #if defined(MS_WINDOWS) && !defined(__MINGW32__)
|
|
{"urandom", win32_urandom, METH_VARARGS, win32_urandom__doc__},
|
|
#endif
|
|
#ifdef __VMS
|
|
@@ -8946,7 +8955,7 @@
|
|
}
|
|
|
|
|
|
-#if (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__)) && !defined(__QNX__)
|
|
+#if (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined (__MINGW32__)) && !defined(__QNX__)
|
|
#define INITFUNC initnt
|
|
#define MODNAME "nt"
|
|
|
|
--- misc/build/Python-2.6.1/Modules/pwdmodule.c 2008-06-09 06:58:54.000000000 +0200
|
|
+++ misc/build/Python-2.6.1/Modules/pwdmodule.c 2009-05-09 13:35:04.000000000 +0200
|
|
@@ -1,9 +1,10 @@
|
|
-
|
|
/* UNIX password file access module */
|
|
|
|
#include "Python.h"
|
|
#include "structseq.h"
|
|
|
|
+#ifndef __MINGW32__
|
|
+
|
|
#include <sys/types.h>
|
|
#include <pwd.h>
|
|
|
|
@@ -196,3 +197,9 @@
|
|
PyModule_AddObject(m, "struct_pwent", (PyObject *) &StructPwdType);
|
|
initialized = 1;
|
|
}
|
|
+#else
|
|
+PyMODINIT_FUNC
|
|
+initpwd(void)
|
|
+{
|
|
+}
|
|
+#endif // !__MINGW32__
|
|
--- misc/build/Python-2.6.1/Modules/Setup.dist 2008-11-27 11:15:12.000000000 +0100
|
|
+++ misc/build/Python-2.6.1/Modules/Setup.dist 2009-05-12 00:28:08.000000000 +0200
|
|
@@ -91,12 +91,12 @@
|
|
TESTPATH=
|
|
|
|
# Path components for machine- or system-dependent modules and shared libraries
|
|
-MACHDEPPATH=:plat-$(MACHDEP)
|
|
+MACHDEPPATH=$(DELIM)plat-$(MACHDEP)
|
|
EXTRAMACHDEPPATH=
|
|
|
|
# Path component for the Tkinter-related modules
|
|
# The TKPATH variable is always enabled, to save you the effort.
|
|
-TKPATH=:lib-tk
|
|
+TKPATH=$(DELIM)lib-tk
|
|
|
|
# Path component for old modules.
|
|
OLDPATH=:lib-old
|
|
@@ -112,9 +112,9 @@
|
|
# This only contains the minimal set of modules required to run the
|
|
# setup.py script in the root of the Python source tree.
|
|
|
|
-posix posixmodule.c # posix (UNIX) system calls
|
|
+@POSIX@ posixmodule.c # posix (UNIX) system calls
|
|
errno errnomodule.c # posix (UNIX) errno values
|
|
-pwd pwdmodule.c # this is needed to find out the user's home dir
|
|
+#pwd pwdmodule.c # this is needed to find out the user's home dir
|
|
# if $HOME is not set
|
|
_sre _sre.c # Fredrik Lundh's new regular expressions
|
|
_codecs _codecsmodule.c # access to the builtin codecs and codec registry
|
|
@@ -162,33 +162,33 @@
|
|
# it, depending on your system -- see the GNU readline instructions.
|
|
# It's okay for this to be a shared library, too.
|
|
|
|
-#readline readline.c -lreadline -ltermcap
|
|
+readline readline.c -lreadline -ltermcap
|
|
|
|
|
|
# Modules that should always be present (non UNIX dependent):
|
|
|
|
-#array arraymodule.c # array objects
|
|
-#cmath cmathmodule.c # -lm # complex math library functions
|
|
-#math mathmodule.c # -lm # math library functions, e.g. sin()
|
|
-#_struct _struct.c # binary structure packing/unpacking
|
|
-#time timemodule.c # -lm # time operations and variables
|
|
-#operator operator.c # operator.add() and similar goodies
|
|
-#_weakref _weakref.c # basic weak reference support
|
|
-#_testcapi _testcapimodule.c # Python C API test module
|
|
-#_random _randommodule.c # Random number generator
|
|
-#_collections _collectionsmodule.c # Container types
|
|
-#itertools itertoolsmodule.c # Functions creating iterators for efficient looping
|
|
-#strop stropmodule.c # String manipulations
|
|
-#_functools _functoolsmodule.c # Tools for working with functions and callable objects
|
|
-#_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c # elementtree accelerator
|
|
+array arraymodule.c # array objects
|
|
+cmath cmathmodule.c -lm # complex math library functions
|
|
+math mathmodule.c -lm # math library functions, e.g. sin()
|
|
+_struct _struct.c # binary structure packing/unpacking
|
|
+time timemodule.c -lm # time operations and variables
|
|
+operator operator.c # operator.add() and similar goodies
|
|
+_weakref _weakref.c # basic weak reference support
|
|
+_testcapi _testcapimodule.c # Python C API test module
|
|
+_random _randommodule.c # Random number generator
|
|
+_collections _collectionsmodule.c # Container types
|
|
+itertools itertoolsmodule.c # Functions creating iterators for efficient looping
|
|
+strop stropmodule.c # String manipulations
|
|
+_functools _functoolsmodule.c # Tools for working with functions and callable objects
|
|
+_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c # elementtree accelerator
|
|
#_pickle _pickle.c # pickle accelerator
|
|
-#datetime datetimemodule.c # date/time type
|
|
-#_bisect _bisectmodule.c # Bisection algorithms
|
|
+datetime datetimemodule.c # date/time type
|
|
+_bisect _bisectmodule.c # Bisection algorithms
|
|
|
|
-#unicodedata unicodedata.c # static Unicode character database
|
|
+unicodedata unicodedata.c # static Unicode character database
|
|
|
|
# access to ISO C locale support
|
|
-#_locale _localemodule.c # -lintl
|
|
+_locale _localemodule.c -lintl
|
|
|
|
|
|
# Modules with some UNIX dependencies -- on by default:
|
|
@@ -198,16 +198,16 @@
|
|
#fcntl fcntlmodule.c # fcntl(2) and ioctl(2)
|
|
#spwd spwdmodule.c # spwd(3)
|
|
#grp grpmodule.c # grp(3)
|
|
-#select selectmodule.c # select(2); not on ancient System V
|
|
+select selectmodule.c -lws2_32 -lwsock32 # select(2); not on ancient System V
|
|
|
|
# Memory-mapped files (also works on Win32).
|
|
-#mmap mmapmodule.c
|
|
+mmap mmapmodule.c
|
|
|
|
# CSV file helper
|
|
-#_csv _csv.c
|
|
+_csv _csv.c
|
|
|
|
# Socket module helper for socket(2)
|
|
-#_socket socketmodule.c
|
|
+_socket socketmodule.c -lws2_32 -lwsock32
|
|
|
|
# Socket module helper for SSL support; you must comment out the other
|
|
# socket line above, and possibly edit the SSL variable:
|
|
@@ -248,14 +248,14 @@
|
|
# Message-Digest Algorithm, described in RFC 1321. The necessary files
|
|
# md5.c and md5.h are included here.
|
|
|
|
-#_md5 md5module.c md5.c
|
|
+_md5 md5module.c md5.c
|
|
|
|
|
|
# The _sha module implements the SHA checksum algorithms.
|
|
# (NIST's Secure Hash Algorithms.)
|
|
-#_sha shamodule.c
|
|
-#_sha256 sha256module.c
|
|
-#_sha512 sha512module.c
|
|
+_sha shamodule.c
|
|
+_sha256 sha256module.c
|
|
+_sha512 sha512module.c
|
|
|
|
|
|
# SGI IRIX specific modules -- off by default.
|
|
@@ -307,7 +307,7 @@
|
|
|
|
# George Neville-Neil's timing module:
|
|
|
|
-#timing timingmodule.c
|
|
+timing timingmodule.c
|
|
|
|
|
|
# The _tkinter module.
|
|
@@ -411,11 +411,11 @@
|
|
#
|
|
# Edit the variables DB and DBLIBVERto point to the db top directory
|
|
# and the subdirectory of PORT where you built it.
|
|
-#DB=/usr/local/BerkeleyDB.4.0
|
|
-#DBLIBVER=4.0
|
|
-#DBINC=$(DB)/include
|
|
-#DBLIB=$(DB)/lib
|
|
-#_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER)
|
|
+DB=$(prefix)
|
|
+DBLIBVER=4.8
|
|
+DBINC=$(DB)/include
|
|
+DBLIB=$(DB)/lib
|
|
+_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER)
|
|
|
|
# Historical Berkeley DB 1.85
|
|
#
|
|
@@ -430,14 +430,14 @@
|
|
|
|
|
|
# Helper module for various ascii-encoders
|
|
-#binascii binascii.c
|
|
+binascii binascii.c
|
|
|
|
# Fred Drake's interface to the Python parser
|
|
-#parser parsermodule.c
|
|
+parser parsermodule.c
|
|
|
|
# cStringIO and cPickle
|
|
-#cStringIO cStringIO.c
|
|
-#cPickle cPickle.c
|
|
+cStringIO cStringIO.c
|
|
+cPickle cPickle.c
|
|
|
|
|
|
# Lee Busby's SIGFPE modules.
|
|
@@ -460,7 +460,7 @@
|
|
# Andrew Kuchling's zlib module.
|
|
# This require zlib 1.1.3 (or later).
|
|
# See http://www.gzip.org/zlib/
|
|
-#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
|
|
+zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
|
|
|
|
# Interface to the Expat XML parser
|
|
#
|
|
@@ -473,23 +473,23 @@
|
|
#
|
|
# More information on Expat can be found at www.libexpat.org.
|
|
#
|
|
-#pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI
|
|
+pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI
|
|
|
|
|
|
# Hye-Shik Chang's CJKCodecs
|
|
|
|
# multibytecodec is required for all the other CJK codec modules
|
|
-#_multibytecodec cjkcodecs/multibytecodec.c
|
|
+_multibytecodec cjkcodecs/multibytecodec.c
|
|
|
|
-#_codecs_cn cjkcodecs/_codecs_cn.c
|
|
-#_codecs_hk cjkcodecs/_codecs_hk.c
|
|
-#_codecs_iso2022 cjkcodecs/_codecs_iso2022.c
|
|
-#_codecs_jp cjkcodecs/_codecs_jp.c
|
|
-#_codecs_kr cjkcodecs/_codecs_kr.c
|
|
-#_codecs_tw cjkcodecs/_codecs_tw.c
|
|
+_codecs_cn cjkcodecs/_codecs_cn.c
|
|
+_codecs_hk cjkcodecs/_codecs_hk.c
|
|
+_codecs_iso2022 cjkcodecs/_codecs_iso2022.c
|
|
+_codecs_jp cjkcodecs/_codecs_jp.c
|
|
+_codecs_kr cjkcodecs/_codecs_kr.c
|
|
+_codecs_tw cjkcodecs/_codecs_tw.c
|
|
|
|
# Example -- included for reference only:
|
|
# xx xxmodule.c
|
|
|
|
# Another example -- the 'xxsubtype' module shows C-level subtyping in action
|
|
-xxsubtype xxsubtype.c
|
|
+# xxsubtype xxsubtype.c
|
|
--- misc/build/Python-2.6.1/Modules/timemodule.c 2008-07-05 21:19:50.000000000 +0200
|
|
+++ misc/build/Python-2.6.1/Modules/timemodule.c 2009-05-09 13:35:04.000000000 +0200
|
|
@@ -42,6 +42,10 @@
|
|
#include <windows.h>
|
|
#include "pythread.h"
|
|
|
|
+#ifdef MS_WINDOWS
|
|
+#include <winsock2.h>
|
|
+#endif
|
|
+
|
|
/* helper to allow us to interrupt sleep() on Windows*/
|
|
static HANDLE hInterruptEvent = NULL;
|
|
static BOOL WINAPI PyCtrlHandler(DWORD dwCtrlType)
|
|
@@ -837,7 +841,9 @@
|
|
If Ctrl+C event delivered while not sleeping
|
|
it will be ignored.
|
|
*/
|
|
+#ifdef WITH_THREAD
|
|
main_thread = PyThread_get_thread_ident();
|
|
+#endif
|
|
hInterruptEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
|
SetConsoleCtrlHandler( PyCtrlHandler, TRUE);
|
|
#endif /* MS_WINDOWS */
|
|
@@ -939,8 +945,11 @@
|
|
* by Guido, only the main thread can be interrupted.
|
|
*/
|
|
ul_millis = (unsigned long)millisecs;
|
|
- if (ul_millis == 0 ||
|
|
- main_thread != PyThread_get_thread_ident())
|
|
+ if (ul_millis == 0
|
|
+#ifdef WITH_THREAD
|
|
+ || main_thread != PyThread_get_thread_ident()
|
|
+#endif
|
|
+ )
|
|
Sleep(ul_millis);
|
|
else {
|
|
DWORD rc;
|
|
--- misc/build/Python-2.6.1/Modules/xxsubtype.c 2007-07-21 08:55:02.000000000 +0200
|
|
+++ misc/build/Python-2.6.1/Modules/xxsubtype.c 2009-05-09 13:35:04.000000000 +0200
|
|
@@ -1,6 +1,10 @@
|
|
#include "Python.h"
|
|
#include "structmember.h"
|
|
|
|
+#ifndef CLOCKS_PER_SEC
|
|
+#include <bits/time.h>
|
|
+#endif
|
|
+
|
|
PyDoc_STRVAR(xxsubtype__doc__,
|
|
"xxsubtype is an example module showing how to subtype builtin types from C.\n"
|
|
"test_descr.py in the standard test suite requires it in order to complete.\n"
|
|
--- misc/build/Python-2.6.1/Objects/exceptions.c 2008-07-30 19:45:10.000000000 +0200
|
|
+++ misc/build/Python-2.6.1/Objects/exceptions.c 2009-05-09 13:35:04.000000000 +0200
|
|
@@ -792,7 +792,7 @@
|
|
* WindowsError extends OSError
|
|
*/
|
|
#ifdef MS_WINDOWS
|
|
-#include "errmap.h"
|
|
+#include "../PC/errmap.h"
|
|
|
|
static int
|
|
WindowsError_clear(PyWindowsErrorObject *self)
|
|
--- misc/build/Python-2.6.1/Python/dynload_shlib.c 2006-01-04 02:30:17.000000000 +0100
|
|
+++ misc/build/Python-2.6.1/Python/dynload_shlib.c 2009-05-09 13:35:04.000000000 +0200
|
|
@@ -32,7 +32,7 @@
|
|
|
|
|
|
const struct filedescr _PyImport_DynLoadFiletab[] = {
|
|
-#ifdef __CYGWIN__
|
|
+#if defined(__CYGWIN__) || defined(__MINGW32__)
|
|
{".dll", "rb", C_EXTENSION},
|
|
{"module.dll", "rb", C_EXTENSION},
|
|
#else
|
|
--- misc/build/Python-2.6.1/Python/dynload_win.c 2009-01-28 00:30:15.000000000 +0100
|
|
+++ misc/build/Python-2.6.1/Python/dynload_win.c 2009-05-09 13:35:04.000000000 +0200
|
|
@@ -1,7 +1,112 @@
|
|
|
|
/* Support for dynamic loading of extension modules */
|
|
|
|
+/*
|
|
+Entry point for the Windows NT DLL.
|
|
+
|
|
+About the only reason for having this, is so initall() can automatically
|
|
+be called, removing that burden (and possible source of frustration if
|
|
+forgotten) from the programmer.
|
|
+
|
|
+*/
|
|
+
|
|
#include "Python.h"
|
|
+#include "windows.h"
|
|
+
|
|
+#ifdef Py_ENABLE_SHARED
|
|
+char dllVersionBuffer[16] = ""; // a private buffer
|
|
+
|
|
+// Python Globals
|
|
+HMODULE PyWin_DLLhModule = NULL;
|
|
+const char *PyWin_DLLVersionString = dllVersionBuffer;
|
|
+
|
|
+// Windows "Activation Context" work:
|
|
+// Our .pyd extension modules are generally built without a manifest (ie,
|
|
+// those included with Python and those built with a default distutils.
|
|
+// This requires we perform some "activation context" magic when loading our
|
|
+// extensions. In summary:
|
|
+// * As our DLL loads we save the context being used.
|
|
+// * Before loading our extensions we re-activate our saved context.
|
|
+// * After extension load is complete we restore the old context.
|
|
+// As an added complication, this magic only works on XP or later - we simply
|
|
+// use the existence (or not) of the relevant function pointers from kernel32.
|
|
+// See bug 4566 (http://python.org/sf/4566) for more details.
|
|
+
|
|
+typedef BOOL (WINAPI * PFN_GETCURRENTACTCTX)(HANDLE *);
|
|
+typedef BOOL (WINAPI * PFN_ACTIVATEACTCTX)(HANDLE, ULONG_PTR *);
|
|
+typedef BOOL (WINAPI * PFN_DEACTIVATEACTCTX)(DWORD, ULONG_PTR);
|
|
+typedef BOOL (WINAPI * PFN_ADDREFACTCTX)(HANDLE);
|
|
+typedef BOOL (WINAPI * PFN_RELEASEACTCTX)(HANDLE);
|
|
+
|
|
+// locals and function pointers for this activation context magic.
|
|
+static HANDLE PyWin_DLLhActivationContext = NULL; // one day it might be public
|
|
+static PFN_GETCURRENTACTCTX pfnGetCurrentActCtx = NULL;
|
|
+static PFN_ACTIVATEACTCTX pfnActivateActCtx = NULL;
|
|
+static PFN_DEACTIVATEACTCTX pfnDeactivateActCtx = NULL;
|
|
+static PFN_ADDREFACTCTX pfnAddRefActCtx = NULL;
|
|
+static PFN_RELEASEACTCTX pfnReleaseActCtx = NULL;
|
|
+
|
|
+void _LoadActCtxPointers()
|
|
+{
|
|
+ HINSTANCE hKernel32 = GetModuleHandleW(L"kernel32.dll");
|
|
+ if (hKernel32)
|
|
+ pfnGetCurrentActCtx = (PFN_GETCURRENTACTCTX) GetProcAddress(hKernel32, "GetCurrentActCtx");
|
|
+ // If we can't load GetCurrentActCtx (ie, pre XP) , don't bother with the rest.
|
|
+ if (pfnGetCurrentActCtx) {
|
|
+ pfnActivateActCtx = (PFN_ACTIVATEACTCTX) GetProcAddress(hKernel32, "ActivateActCtx");
|
|
+ pfnDeactivateActCtx = (PFN_DEACTIVATEACTCTX) GetProcAddress(hKernel32, "DeactivateActCtx");
|
|
+ pfnAddRefActCtx = (PFN_ADDREFACTCTX) GetProcAddress(hKernel32, "AddRefActCtx");
|
|
+ pfnReleaseActCtx = (PFN_RELEASEACTCTX) GetProcAddress(hKernel32, "ReleaseActCtx");
|
|
+ }
|
|
+}
|
|
+
|
|
+ULONG_PTR _Py_ActivateActCtx()
|
|
+{
|
|
+ ULONG_PTR ret = 0;
|
|
+ if (PyWin_DLLhActivationContext && pfnActivateActCtx)
|
|
+ if (!(*pfnActivateActCtx)(PyWin_DLLhActivationContext, &ret)) {
|
|
+ OutputDebugString("Python failed to activate the activation context before loading a DLL\n");
|
|
+ ret = 0; // no promise the failing function didn't change it!
|
|
+ }
|
|
+ return ret;
|
|
+}
|
|
+
|
|
+void _Py_DeactivateActCtx(ULONG_PTR cookie)
|
|
+{
|
|
+ if (cookie && pfnDeactivateActCtx)
|
|
+ if (!(*pfnDeactivateActCtx)(0, cookie))
|
|
+ OutputDebugString("Python failed to de-activate the activation context\n");
|
|
+}
|
|
+
|
|
+BOOL WINAPI DllMain (HANDLE hInst,
|
|
+ ULONG ul_reason_for_call,
|
|
+ LPVOID lpReserved)
|
|
+{
|
|
+ switch (ul_reason_for_call)
|
|
+ {
|
|
+ case DLL_PROCESS_ATTACH:
|
|
+ PyWin_DLLhModule = hInst;
|
|
+ // 1000 is a magic number I picked out of the air. Could do with a #define, I spose...
|
|
+ LoadString(hInst, 1000, dllVersionBuffer, sizeof(dllVersionBuffer));
|
|
+
|
|
+ // and capture our activation context for use when loading extensions.
|
|
+ _LoadActCtxPointers();
|
|
+ if (pfnGetCurrentActCtx && pfnAddRefActCtx)
|
|
+ if ((*pfnGetCurrentActCtx)(&PyWin_DLLhActivationContext))
|
|
+ if (!(*pfnAddRefActCtx)(PyWin_DLLhActivationContext))
|
|
+ OutputDebugString("Python failed to load the default activation context\n");
|
|
+ break;
|
|
+
|
|
+ case DLL_PROCESS_DETACH:
|
|
+ if (pfnReleaseActCtx)
|
|
+ (*pfnReleaseActCtx)(PyWin_DLLhActivationContext);
|
|
+ break;
|
|
+ }
|
|
+ return TRUE;
|
|
+}
|
|
+
|
|
+#endif /* Py_ENABLE_SHARED */
|
|
+
|
|
|
|
#ifdef HAVE_DIRECT_H
|
|
#include <direct.h>
|
|
@@ -28,6 +133,9 @@
|
|
/* Case insensitive string compare, to avoid any dependencies on particular
|
|
C RTL implementations */
|
|
|
|
+#ifdef __MINGW32__
|
|
+#define strcasecmp py_strcasecmp
|
|
+#endif
|
|
static int strcasecmp (char *string1, char *string2)
|
|
{
|
|
int first, second;
|
|
--- misc/build/Python-2.6.1/Python/frozenmain.c 2002-06-30 17:26:10.000000000 +0200
|
|
+++ misc/build/Python-2.6.1/Python/frozenmain.c 2009-05-09 13:35:04.000000000 +0200
|
|
@@ -3,7 +3,7 @@
|
|
|
|
#include "Python.h"
|
|
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined (MS_WINDOWS) && ! defined (__MINGW32__)
|
|
extern void PyWinFreeze_ExeInit(void);
|
|
extern void PyWinFreeze_ExeTerm(void);
|
|
extern int PyInitFrozenExtensions(void);
|
|
@@ -32,12 +32,12 @@
|
|
setbuf(stderr, (char *)NULL);
|
|
}
|
|
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined (MS_WINDOWS) && ! defined (__MINGW32__)
|
|
PyInitFrozenExtensions();
|
|
#endif /* MS_WINDOWS */
|
|
Py_SetProgramName(argv[0]);
|
|
Py_Initialize();
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined (MS_WINDOWS) && ! defined (__MINGW32__)
|
|
PyWinFreeze_ExeInit();
|
|
#endif
|
|
|
|
@@ -60,7 +60,7 @@
|
|
if (inspect && isatty((int)fileno(stdin)))
|
|
sts = PyRun_AnyFile(stdin, "<stdin>") != 0;
|
|
|
|
-#ifdef MS_WINDOWS
|
|
+#if defined (MS_WINDOWS) && ! defined (__MINGW32__)
|
|
PyWinFreeze_ExeTerm();
|
|
#endif
|
|
Py_Finalize();
|
|
--- misc/build/Python-2.6.1/README 2009-04-07 03:54:02.000000000 +0200
|
|
+++ misc/build/Python-2.6.1/README 2009-05-09 13:35:04.000000000 +0200
|
|
@@ -1160,6 +1160,37 @@
|
|
do this.
|
|
|
|
|
|
+Cross Compiling
|
|
+---------------
|
|
+
|
|
+Python can be cross compiled by supplying different --build and --host
|
|
+parameters to configure. Python is compiled on the "build" system and
|
|
+executed on the "host" system. Cross compiling python requires a
|
|
+native Python on the build host, and a natively compiled tool `Pgen'.
|
|
+
|
|
+Before cross compiling, Python must first be compiled and installed on
|
|
+the build host. The configure script will use `cc' and `python', or
|
|
+environment variables CC_FOR_BUILD or PYTHON_FOR_BUILD, eg:
|
|
+
|
|
+ CC_FOR_BUILD=gcc-3.3 \
|
|
+ PYTHON_FOR_BUILD=python2.4 \
|
|
+ .../configure --build=i686-linux --host=i586-mingw32
|
|
+
|
|
+Cross compiling has been tested under linux, mileage may vary for
|
|
+other platforms.
|
|
+
|
|
+A few reminders on using configure to cross compile:
|
|
+- Cross compile tools must be in PATH,
|
|
+- Cross compile tools must be prefixed with the host type
|
|
+ (ie i586-mingw32-gcc, i586-mingw32-ranlib, ...),
|
|
+- CC, CXX, AR, and RANLIB must be undefined when running configure,
|
|
+ they will be auto-detected.
|
|
+
|
|
+If you need a cross compiler, Debian ships several several (eg: avr,
|
|
+m68hc1x, mingw32), while dpkg-cross easily creates others. Otherwise,
|
|
+check out Dan Kegel's crosstool: http://www.kegel.com/crosstool .
|
|
+
|
|
+
|
|
Miscellaneous issues
|
|
====================
|
|
|
|
--- misc/build/Python-2.6.1/setup.py 2009-03-31 20:20:48.000000000 +0200
|
|
+++ misc/build/Python-2.6.1/setup.py 2009-05-09 13:35:04.000000000 +0200
|
|
@@ -19,6 +19,11 @@
|
|
# This global variable is used to hold the list of modules to be disabled.
|
|
disabled_module_list = []
|
|
|
|
+import os
|
|
+sysconfig.get_config_vars()
|
|
+sysconfig._config_vars.update (os.environ)
|
|
+
|
|
+
|
|
def add_dir_to_list(dirlist, dir):
|
|
"""Add the directory 'dir' to the list 'dirlist' (at the front) if
|
|
1) 'dir' is not already in 'dirlist'
|
|
@@ -115,6 +120,8 @@
|
|
# Fix up the autodetected modules, prefixing all the source files
|
|
# with Modules/ and adding Python's include directory to the path.
|
|
(srcdir,) = sysconfig.get_config_vars('srcdir')
|
|
+ if os.environ.get('CROSS_COMPILING') == 'yes':
|
|
+ srcdir = os.environ.get('SRCDIR')
|
|
if not srcdir:
|
|
# Maybe running on Windows but not using CYGWIN?
|
|
raise ValueError("No source directory; cannot proceed.")
|
|
@@ -267,6 +274,10 @@
|
|
self.announce('WARNING: skipping import check for Cygwin-based "%s"'
|
|
% ext.name)
|
|
return
|
|
+ if os.environ.get('CROSS_COMPILING') == 'yes':
|
|
+ self.announce('WARNING: skipping import check for cross compiled "%s"'
|
|
+ % ext.name)
|
|
+ return
|
|
ext_filename = os.path.join(
|
|
self.build_lib,
|
|
self.get_ext_filename(self.get_ext_fullname(ext.name)))
|
|
@@ -302,11 +313,14 @@
|
|
self.failed.append(ext.name)
|
|
|
|
def get_platform(self):
|
|
- # Get value of sys.platform
|
|
- for platform in ['cygwin', 'beos', 'darwin', 'atheos', 'osf1']:
|
|
- if sys.platform.startswith(platform):
|
|
+ # Get value of target's sys.platform
|
|
+ p = sys.platform
|
|
+ if os.environ.get('CROSS_COMPILING') == 'yes':
|
|
+ p = os.environ.get('CROSS_TARGET')
|
|
+ for platform in ['cygwin', 'mingw', 'beos', 'darwin', 'atheos', 'osf1']:
|
|
+ if p.startswith(platform):
|
|
return platform
|
|
- return sys.platform
|
|
+ return p
|
|
|
|
def detect_modules(self):
|
|
# Ensure that /usr/local is always used
|
|
@@ -889,13 +903,11 @@
|
|
# We hunt for #define SQLITE_VERSION "n.n.n"
|
|
# We need to find >= sqlite version 3.0.8
|
|
sqlite_incdir = sqlite_libdir = None
|
|
- sqlite_inc_paths = [ '/usr/include',
|
|
- '/usr/include/sqlite',
|
|
- '/usr/include/sqlite3',
|
|
- '/usr/local/include',
|
|
- '/usr/local/include/sqlite',
|
|
- '/usr/local/include/sqlite3',
|
|
- ]
|
|
+ sqlite_inc_paths = []
|
|
+
|
|
+ # Broken for x-compile
|
|
+ #'/usr/include', '/usr/include/sqlite', '/usr/include/sqlite3', '/usr/local/include', '/usr/local/include/sqlite', '/usr/local/include/sqlite3', ]
|
|
+
|
|
MIN_SQLITE_VERSION_NUMBER = (3, 0, 8)
|
|
MIN_SQLITE_VERSION = ".".join([str(x)
|
|
for x in MIN_SQLITE_VERSION_NUMBER])
|
|
@@ -1809,6 +1821,8 @@
|
|
# mode 755. All installed directories will get mode 755.
|
|
|
|
so_ext = sysconfig.get_config_var("SO")
|
|
+ if os.environ.get('CROSS_COMPILING') == 'yes':
|
|
+ so_ext = os.environ.get('SO')
|
|
|
|
def install(self):
|
|
outfiles = install_lib.install(self)
|
|
--- misc/build/Python-2.6.1/Python/thread.c 2008-08-04 09:33:37.000000000 +0200
|
|
+++ misc/build/Python-2.6.1/Python/thread.c 2009-05-12 01:00:57.000000000 +0200
|
|
@@ -61,6 +61,13 @@
|
|
|
|
#endif /* _POSIX_THREADS */
|
|
|
|
+#ifdef __MINGW32__
|
|
+#ifdef _POSIX_THREADS
|
|
+#undef _POSIX_THREADS
|
|
+#endif
|
|
+#define NT_THREADS
|
|
+#endif
|
|
+
|
|
|
|
#ifdef Py_DEBUG
|
|
static int thread_debug = 0;
|
|
--- misc/build/Python-2.6.1/Modules/addrinfo.h 2009-05-12 01:30:32.000000000 +0200
|
|
+++ misc/build/Python-2.6.1/Modules/addrinfo.h 2009-05-12 01:34:34.000000000 +0200
|
|
@@ -123,7 +123,7 @@
|
|
|
|
#endif /* !HAVE_GETNAMEINFO */
|
|
|
|
-#ifndef HAVE_ADDRINFO
|
|
+#if !defined(HAVE_ADDRINFO) && !defined(_WIN32)
|
|
struct addrinfo {
|
|
int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
|
|
int ai_family; /* PF_xxx */
|
|
@@ -136,7 +136,7 @@
|
|
};
|
|
#endif /* !HAVE_ADDRINFO */
|
|
|
|
-#ifndef HAVE_SOCKADDR_STORAGE
|
|
+#if !defined(HAVE_SOCKADDR_STORAGE) && !defined(_WIN32)
|
|
/*
|
|
* RFC 2553: protocol-independent placeholder for socket addresses
|
|
*/
|
|
--- misc/build/Python-2.6.1/Modules/socketmodule.c 2009-05-12 01:29:43.000000000 +0200
|
|
+++ misc/build/Python-2.6.1/Modules/socketmodule.c 2009-05-12 01:29:51.000000000 +0200
|
|
@@ -3134,7 +3134,11 @@
|
|
if (h->h_addrtype != af) {
|
|
/* Let's get real error message to return */
|
|
PyErr_SetString(socket_error,
|
|
+#ifdef _WIN32
|
|
+ (char *)strerror(WSAEAFNOSUPPORT));
|
|
+#else
|
|
(char *)strerror(EAFNOSUPPORT));
|
|
+#endif
|
|
|
|
return NULL;
|
|
}
|
|
--- misc/build/Python-2.6.1/Modules/socketmodule.h 2009-08-10 17:15:24.000000000 +0200
|
|
+++ misc/build/Python-2.6.1/Modules/socketmodule.h 2009-08-10 17:15:48.000000000 +0200
|
|
@@ -21,7 +21,7 @@
|
|
* I use SIO_GET_MULTICAST_FILTER to detect a decent SDK.
|
|
*/
|
|
# ifdef SIO_GET_MULTICAST_FILTER
|
|
-# include <MSTcpIP.h> /* for SIO_RCVALL */
|
|
+# include <mstcpip.h> /* for SIO_RCVALL */
|
|
# define HAVE_ADDRINFO
|
|
# define HAVE_SOCKADDR_STORAGE
|
|
# define HAVE_GETADDRINFO
|