sync master with lastest vba changes
[ooovba.git] / python / Python-2.6.1-mingw.patch
blob63067227c112252f8d2d8a32d6331c04126c3f13
1 --- misc/Python-2.6.1/Include/pyport.h 2008-06-11 16:41:16.000000000 +0900
2 +++ misc/build/Python-2.6.1/Include/pyport.h 2009-03-29 23:28:13.859000000 +0900
3 @@ -3,6 +3,26 @@
5 #include "pyconfig.h" /* include for defines */
7 +#if defined(__MINGW32__)
8 +#undef HAVE_FORKPTY
9 +#undef HAVE_OPENPTY
10 +#undef HAVE_DEV_PTMX
11 +#undef _POSIX_THREADS
12 +#define MS_WINDOWS
13 +#define MS_WIN32
14 +#define Py_WIN_WIDE_FILENAMES
15 +#ifndef PYTHONPATH
16 +# define PYTHONPATH ".\\lib;.\\lib\\python" VERSION ";.\\lib\\python" VERSION "\\lib-dynload;.\\lib\\python" VERSION "\\plat-winmingw32;.\\lib\\python" VERSION "\\lib-tk"
17 +#endif
18 +#define NT_THREADS
19 +#define WITH_THREAD
20 +#define WINVER 0x0501
21 +#define HAVE_ADDRINFO
22 +#define HAVE_GETADDRINFO
23 +#define HAVE_GETNAMEINFO
24 +#define HAVE_GETPEERNAME
25 +#endif
27 #ifdef HAVE_STDINT_H
28 #include <stdint.h>
29 #endif
30 --- misc/Python-2.6.1/Lib/distutils/ccompiler.py 2008-02-22 03:18:37.000000000 +0900
31 +++ misc/build/Python-2.6.1/Lib/distutils/ccompiler.py 2009-04-04 01:00:37.014250000 +0900
32 @@ -1058,6 +1058,7 @@
33 # on a cygwin built python we can use gcc like an ordinary UNIXish
34 # compiler
35 ('cygwin.*', 'unix'),
36 + ('winmingw*', 'unix'),
37 ('os2emx', 'emx'),
39 # OS name mappings
40 --- misc/Python-2.6.1/Lib/distutils/command/build_ext.py 2008-08-17 13:16:04.000000000 +0900
41 +++ misc/build/Python-2.6.1/Lib/distutils/command/build_ext.py 2009-04-04 01:05:32.311125000 +0900
42 @@ -223,7 +223,7 @@
44 # for extensions under Cygwin and AtheOS Python's library directory must be
45 # appended to library_dirs
46 - if sys.platform[:6] == 'cygwin' or sys.platform[:6] == 'atheos':
47 + if sys.platform[:6] == 'cygwin' or sys.platform[:8] == 'winmingw' or sys.platform[:6] == 'atheos':
48 if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")):
49 # building third party extensions
50 self.library_dirs.append(os.path.join(sys.prefix, "lib",
51 @@ -729,7 +729,7 @@
52 # don't extend ext.libraries, it may be shared with other
53 # extensions, it is a reference to the original list
54 return ext.libraries + [pythonlib]
55 - elif sys.platform[:6] == "cygwin":
56 + elif sys.platform[:6] == "cygwin" or sys.platform[:8] == "winmingw":
57 template = "python%d.%d"
58 pythonlib = (template %
59 (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff))
60 --- misc/Python-2.6.1/Lib/distutils/command/install.py 2008-05-07 07:41:46.000000000 +0900
61 +++ misc/build/Python-2.6.1/Lib/distutils/command/install.py 2009-04-05 23:15:56.540750000 +0900
62 @@ -362,9 +362,10 @@
64 # Convert directories from Unix /-separated syntax to the local
65 # convention.
66 - self.convert_paths('lib', 'purelib', 'platlib',
67 - 'scripts', 'data', 'headers',
68 - 'userbase', 'usersite')
69 + if os.sep != '/':
70 + self.convert_paths('lib', 'purelib', 'platlib',
71 + 'scripts', 'data', 'headers',
72 + 'userbase', 'usersite')
74 # Well, we're not actually fully completely finalized yet: we still
75 # have to deal with 'extra_path', which is the hack for allowing
76 @@ -376,7 +377,7 @@
78 # If a new root directory was supplied, make all the installation
79 # dirs relative to it.
80 - if self.root is not None:
81 + if self.root is not None and self.root != "":
82 self.change_roots('libbase', 'lib', 'purelib', 'platlib',
83 'scripts', 'data', 'headers')
85 @@ -515,7 +516,10 @@
86 def convert_paths (self, *names):
87 for name in names:
88 attr = "install_" + name
89 - setattr(self, attr, convert_path(getattr(self, attr)))
90 + if self.root is None or self.root == "":
91 + setattr(self, attr, getattr(self, attr).replace('/', os.sep))
92 + else:
93 + setattr(self, attr, convert_path(getattr(self, attr)))
96 def handle_extra_path (self):
97 --- misc/Python-2.6.1/Lib/distutils/spawn.py 2004-11-11 07:23:15.000000000 +0900
98 +++ misc/build/Python-2.6.1/Lib/distutils/spawn.py 2009-03-22 19:38:32.935625000 +0900
99 @@ -186,7 +186,7 @@
100 path = os.environ['PATH']
101 paths = string.split(path, os.pathsep)
102 (base, ext) = os.path.splitext(executable)
103 - if (sys.platform == 'win32' or os.name == 'os2') and (ext != '.exe'):
104 + if (sys.platform == 'win32' or sys.platform[:8] == "winmingw" or os.name == 'os2') and (ext != '.exe'):
105 executable = executable + '.exe'
106 if not os.path.isfile(executable):
107 for p in paths:
108 --- misc/Python-2.6.1/Lib/distutils/sysconfig.py 2008-06-05 21:58:24.000000000 +0900
109 +++ misc/build/Python-2.6.1/Lib/distutils/sysconfig.py 2009-03-29 10:56:10.965750000 +0900
110 @@ -381,6 +381,9 @@
112 raise DistutilsPlatformError(my_msg)
114 + if sys.platform[:8] == "winmingw":
115 + g['SO'] = '.pyd'
117 # On MacOSX we need to check the setting of the environment variable
118 # MACOSX_DEPLOYMENT_TARGET: configure bases some choices on it so
119 # it needs to be compatible.
120 @@ -510,6 +513,9 @@
121 global _config_vars
122 if _config_vars is None:
123 func = globals().get("_init_" + os.name)
124 + if sys.platform[:8] == "winmingw":
125 + func = globals().get("_init_posix")
127 if func:
128 func()
129 else:
130 --- misc/Python-2.6.1/Lib/distutils/unixccompiler.py 2008-07-16 22:24:06.000000000 +0900
131 +++ misc/build/Python-2.6.1/Lib/distutils/unixccompiler.py 2009-04-04 01:11:18.420500000 +0900
132 @@ -139,7 +139,7 @@
133 shared_lib_extension = ".so"
134 dylib_lib_extension = ".dylib"
135 static_lib_format = shared_lib_format = dylib_lib_format = "lib%s%s"
136 - if sys.platform == "cygwin":
137 + if sys.platform == "cygwin" or sys.platform == "winmingw":
138 exe_extension = ".exe"
140 def preprocess(self, source,
141 --- misc/Python-2.6.1/Lib/os.py 2008-09-02 14:36:11.000000000 +0900
142 +++ misc/build/Python-2.6.1/Lib/os.py 2009-03-22 16:55:18.356375000 +0900
143 @@ -38,7 +38,21 @@
144 except AttributeError:
145 return [n for n in dir(module) if n[0] != '_']
147 -if 'posix' in _names:
148 +if 'winmingw32' in _names:
149 + name = 'nt'
150 + linesep = '\r\n'
151 + from posix import *
152 + try:
153 + from posix import _exit
154 + except ImportError:
155 + pass
156 + import ntpath as path
158 + import posix
159 + __all__.extend(_get_exports_list(posix))
160 + del posix
162 +elif 'posix' in _names:
163 name = 'posix'
164 linesep = '\n'
165 from posix import *
166 --- misc/Python-2.6.1/Lib/socket.py 2008-08-08 13:27:28.000000000 +0900
167 +++ misc/build/Python-2.6.1/Lib/socket.py 2009-04-02 00:40:46.941750000 +0900
168 @@ -148,7 +148,7 @@
169 'sendall', 'setblocking',
170 'settimeout', 'gettimeout', 'shutdown')
172 -if os.name == "nt":
173 +if os.name == "nt" and sys.platform[:8] != "winmingw":
174 _socketmethods = _socketmethods + ('ioctl',)
176 if sys.platform == "riscos":
177 --- misc/Python-2.6.1/Makefile.pre.in 2008-10-22 01:48:37.000000000 +0900
178 +++ misc/build/Python-2.6.1/Makefile.pre.in 2009-04-08 23:38:27.989250000 +0900
179 @@ -105,6 +105,16 @@
180 LDSHARED= @LDSHARED@
181 BLDSHARED= @BLDSHARED@
182 DESTSHARED= $(BINLIBDEST)/lib-dynload
183 +ifeq (@MACHDEP@,winmingw32)
184 +DESTSHAREDFORRULES= $(shell cd $(DESTSHARED) && pwd || echo DESTSHARED)
185 +LIBPYTHONPATH= $(shell cd $(DESTDIR)$(LIBDEST) && cmd /c cd | sed -e s:\\\\:/:g)
186 +DESTPYTHONPATH= $(LIBPYTHONPATH);$(shell cd $(DESTDIR)$(DESTSHARED) && cmd /c cd | sed -e s:\\\\:/:g)
187 +LIBDESTPARAM= $(shell if test -z "$(DESTDIR)" ; then cd $(LIBDEST) && cmd /c cd | sed -e s:\\\\:/:g ; else echo $(LIBDEST) ; fi)
188 +PREFIXPARAM= $(shell if test -z "$(DESTDIR)" ; then cd $(prefix) && cmd /c cd | sed -e s:\\\\:/:g ; else echo $(prefix) ; fi)
189 +BINDIRPARAM= $(shell if test -z "$(DESTDIR)" ; then cd $(BINDIR) && cmd /c cd | sed -e s:\\\\:/:g ; else echo $(BINDIR) ; fi)
190 +DESTSHAREDPARAM= $(shell if test -z "$(DESTDIR)" ; then cd $(DESTSHARED) && cmd /c cd | sed -e s:\\\\:/:g ; else echo $(DESTSHARED) ; fi)
191 +DESTDIRPARAM= $(shell if test ! -z "$(DESTDIR)" ; then cd $(DESTDIR) && cmd /c | sed -e s:\\\\:/:g ; fi)
192 +endif
194 # Executable suffix (.exe on Windows and Mac OS X)
195 EXE= @EXEEXT@
196 @@ -187,7 +197,7 @@
197 # Modules
198 MODULE_OBJS= \
199 Modules/config.o \
200 - Modules/getpath.o \
201 + @GETPATH_OBJS@ \
202 Modules/main.o \
203 Modules/gcmodule.o
205 @@ -507,6 +517,10 @@
206 -DVPATH='"$(VPATH)"' \
207 -o $@ $(srcdir)/Modules/getpath.c
209 +PC/getpathp.o: $(srcdir)/PC/getpathp.c Makefile
210 + $(CC) -c $(PY_CFLAGS) -DVERSION='"$(VERSION)"' \
211 + -o $@ $(srcdir)/PC/getpathp.c
213 Modules/python.o: $(srcdir)/Modules/python.c
214 $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
216 @@ -544,6 +558,12 @@
217 Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
218 $(srcdir)/Objects/unicodetype_db.h
220 +Objects/exceptions.o: $(srcdir)/Objects/exceptions.c
221 + $(CC) -c $(PY_CFLAGS) -I$(srcdir)/PC -o $@ $(srcdir)/Objects/exceptions.c
223 +PC/import_nt.o: $(srcdir)/PC/import_nt.c
224 + $(CC) -c $(PY_CFLAGS) -I$(srcdir)/Python -o $@ $(srcdir)/PC/import_nt.c
226 STRINGLIB_HEADERS= \
227 $(srcdir)/Include/bytes_methods.h \
228 $(srcdir)/Objects/stringlib/count.h \
229 @@ -727,7 +747,11 @@
230 # Install shared libraries enabled by Setup
231 DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
233 +ifeq (@MACHDEP@,winmingw32)
234 +oldsharedinstall: $(DESTSHAREDFORRULES) $(SHAREDMODS)
235 +else
236 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
237 +endif
238 @for i in X $(SHAREDMODS); do \
239 if test $$i != X; then \
240 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
241 @@ -735,7 +759,11 @@
242 fi; \
243 done
245 +ifeq (@MACHDEP@,winmingw32)
246 +$(DESTSHAREDFORRULES):
247 +else
248 $(DESTSHARED):
249 +endif
250 @for i in $(DESTDIRS); \
251 do \
252 if test ! -d $(DESTDIR)$$i; then \
253 @@ -822,7 +850,11 @@
254 multiprocessing multiprocessing/dummy \
255 lib-old \
256 curses $(MACHDEPS)
257 +ifeq (@MACHDEP@,winmingw32)
258 +libinstall: build_all $(srcdir)/Lib/$(PLATDIR) sharedinstall
259 +else
260 libinstall: build_all $(srcdir)/Lib/$(PLATDIR)
261 +endif
262 @for i in $(SCRIPTDIR) $(LIBDEST); \
263 do \
264 if test ! -d $(DESTDIR)$$i; then \
265 @@ -878,6 +910,26 @@
266 done; \
267 done
268 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
269 +ifeq (@MACHDEP@,winmingw32)
270 + PYTHONPATH="$(DESTPYTHONPATH)" $(RUNSHARED) \
271 + ./$(BUILDPYTHON) -Wi -tt $(LIBPYTHONPATH)/compileall.py \
272 + -d $(LIBDESTPARAM) -f \
273 + -x 'bad_coding|badsyntax|site-packages' $(LIBPYTHONPATH)
274 + PYTHONPATH="$(DESTPYTHONPATH)" $(RUNSHARED) \
275 + ./$(BUILDPYTHON) -Wi -tt -O $(LIBPYTHONPATH)/compileall.py \
276 + -d $(LIBDESTPARAM) -f \
277 + -x 'bad_coding|badsyntax|site-packages' $(LIBPYTHONPATH)
278 + -PYTHONPATH="$(DESTPYTHONPATH)" $(RUNSHARED) \
279 + ./$(BUILDPYTHON) -Wi -t $(LIBPYTHONPATH)/compileall.py \
280 + -d $(LIBDESTPARAM)/site-packages -f \
281 + -x badsyntax $(LIBPYTHONPATH)/site-packages
282 + -PYTHONPATH="$(DESTPYTHONPATH)" $(RUNSHARED) \
283 + ./$(BUILDPYTHON) -Wi -t -O $(LIBPYTHONPATH)/compileall.py \
284 + -d $(LIBDESTPARAM)/site-packages -f \
285 + -x badsyntax $(LIBPYTHONPATH)/site-packages
286 + -PYTHONPATH="$(DESTPYTHONPATH)" $(RUNSHARED) \
287 + ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
288 +else
289 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
290 ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
291 -d $(LIBDEST) -f \
292 @@ -896,16 +948,19 @@
293 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
294 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
295 ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
296 +endif
298 # Create the PLATDIR source directory, if one wasn't distributed..
299 $(srcdir)/Lib/$(PLATDIR):
300 mkdir $(srcdir)/Lib/$(PLATDIR)
301 +ifneq (@MACHDEP@,winmingw32)
302 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
303 export PATH; PATH="`pwd`:$$PATH"; \
304 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
305 export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
306 export EXE; EXE="$(BUILDEXE)"; \
307 cd $(srcdir)/Lib/$(PLATDIR); ./regen
308 +endif
310 # Install the include files
311 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
312 @@ -992,12 +1047,21 @@
314 # Install the dynamically loadable modules
315 # This goes into $(exec_prefix)
316 +ifeq (@MACHDEP@,winmingw32)
317 +sharedinstall: $(DESTSHAREDFORRULES)
318 + $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
319 + --prefix=$(PREFIXPARAM) \
320 + --install-scripts=$(BINDIRPARAM) \
321 + --install-platlib=$(DESTSHAREDPARAM) \
322 + --root=$(DESTDIRPARAM)
323 +else
324 sharedinstall:
325 $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
326 --prefix=$(prefix) \
327 --install-scripts=$(BINDIR) \
328 --install-platlib=$(DESTSHARED) \
329 --root=/$(DESTDIR)
330 +endif
332 # Here are a couple of targets for MacOSX again, to install a full
333 # framework-based Python. frameworkinstall installs everything, the
334 --- misc/Python-2.6.1/Modules/Setup.config.in 2002-12-13 02:37:50.000000000 +0900
335 +++ misc/build/Python-2.6.1/Modules/Setup.config.in 2009-03-21 18:46:57.988875000 +0900
336 @@ -9,5 +9,9 @@
337 # The signal module
338 @USE_SIGNAL_MODULE@signal signalmodule.c
340 +# The password module
341 +@USE_PASSWORD_MODULE@pwd pwdmodule.c # this is needed to find out the user's home dir
342 + # if $HOME is not set
344 # The rest of the modules previously listed in this file are built
345 # by the setup.py script in Python 2.1 and later.
346 --- misc/Python-2.6.1/Modules/Setup.dist 2008-11-27 19:15:12.000000000 +0900
347 +++ misc/build/Python-2.6.1/Modules/Setup.dist 2009-03-21 18:46:53.785750000 +0900
348 @@ -114,7 +114,7 @@
350 posix posixmodule.c # posix (UNIX) system calls
351 errno errnomodule.c # posix (UNIX) errno values
352 -pwd pwdmodule.c # this is needed to find out the user's home dir
353 +#pwd pwdmodule.c # this is needed to find out the user's home dir
354 # if $HOME is not set
355 _sre _sre.c # Fredrik Lundh's new regular expressions
356 _codecs _codecsmodule.c # access to the builtin codecs and codec registry
357 --- misc/Python-2.6.1/Modules/_ctypes/libffi/configure 2008-05-24 00:06:50.000000000 +0900
358 +++ misc/build/Python-2.6.1/Modules/_ctypes/libffi/configure 2009-04-05 08:30:43.964750000 +0900
359 @@ -22707,19 +22707,41 @@
360 multilib_arg=
363 +case $host_os in
364 +mingw*)
365 + srcdir=`cd $srcdir && cmd /c cd | sed -e 's:\\\\:/:g'`
366 + ;;
367 +esac
369 ac_config_commands="$ac_config_commands include"
371 ac_config_commands="$ac_config_commands src"
374 +case $host_os in
375 +mingw*)
376 +ac_config_commands="$ac_config_commands mingw_ffitarget.h"
380 ac_config_links="$ac_config_links include/ffitarget.h:src/$TARGETDIR/ffitarget.h"
383 +esac
385 ac_config_files="$ac_config_files include/ffi.h"
388 +case $host_os in
389 +mingw*)
390 +ac_config_commands="$ac_config_commands mingw_ffi_common.h"
394 ac_config_links="$ac_config_links include/ffi_common.h:include/ffi_common.h"
397 +esac
399 ac_config_files="$ac_config_files fficonfig.py"
401 @@ -23506,8 +23528,10 @@
402 "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
403 "include") CONFIG_COMMANDS="$CONFIG_COMMANDS include" ;;
404 "src") CONFIG_COMMANDS="$CONFIG_COMMANDS src" ;;
405 + "mingw_ffitarget.h") CONFIG_COMMANDS="$CONFIG_COMMANDS mingw_ffitarget.h" ;;
406 "include/ffitarget.h") CONFIG_LINKS="$CONFIG_LINKS include/ffitarget.h:src/$TARGETDIR/ffitarget.h" ;;
407 "include/ffi.h") CONFIG_FILES="$CONFIG_FILES include/ffi.h" ;;
408 + "mingw_ffi_common.h") CONFIG_COMMANDS="$CONFIG_COMMANDS mingw_ffi_common.h" ;;
409 "include/ffi_common.h") CONFIG_LINKS="$CONFIG_LINKS include/ffi_common.h:include/ffi_common.h" ;;
410 "fficonfig.py") CONFIG_FILES="$CONFIG_FILES fficonfig.py" ;;
412 @@ -24386,6 +24410,16 @@
413 test -d src || mkdir src
414 test -d src/$TARGETDIR || mkdir src/$TARGETDIR
416 + "mingw_ffitarget.h":C)
417 +{ echo "$as_me:$LINENO: copying $srcdir/src/$TARGETDIR/ffitarget.h to include/ffitarget.h" >&5
418 +echo "$as_me: copying $srcdir/src/$TARGETDIR/ffitarget.h to include/ffitarget.h" >&6;}
419 +cp -p $srcdir/src/$TARGETDIR/ffitarget.h include/ffitarget.h
420 + ;;
421 + "mingw_ffi_common.h":C)
422 +{ echo "$as_me:$LINENO: copying $srcdir/include/ffi_common.h to include/ffi_common.h" >&5
423 +echo "$as_me: copying $srcdir/include/ffi_common.h to include/ffi_common.h" >&6;}
424 +cp -p $srcdir/include/ffi_common.h include/ffi_common.h
425 + ;;
427 esac
428 done # for ac_tag
429 --- misc/Python-2.6.1/Modules/_ctypes/libffi/configure.ac 2008-05-24 00:06:50.000000000 +0900
430 +++ misc/build/Python-2.6.1/Modules/_ctypes/libffi/configure.ac 2009-04-05 08:30:27.527250000 +0900
431 @@ -358,17 +358,43 @@
432 multilib_arg=
435 +case $host_os in
436 +mingw*)
437 + srcdir=`cd $srcdir && cmd /c cd | sed -e 's:\\\\:/:g'`
438 + ;;
439 +esac
441 AC_CONFIG_COMMANDS(include, [test -d include || mkdir include])
442 AC_CONFIG_COMMANDS(src, [
443 test -d src || mkdir src
444 test -d src/$TARGETDIR || mkdir src/$TARGETDIR
445 ], [TARGETDIR="$TARGETDIR"])
447 +case $host_os in
448 +mingw*)
449 +AC_CONFIG_COMMANDS(mingw_ffitarget.h, [
450 +AC_MSG_NOTICE(copying $srcdir/src/$TARGETDIR/ffitarget.h to include/ffitarget.h)
451 +cp -p $srcdir/src/$TARGETDIR/ffitarget.h include/ffitarget.h
455 AC_CONFIG_LINKS(include/ffitarget.h:src/$TARGETDIR/ffitarget.h)
457 +esac
459 AC_CONFIG_FILES(include/ffi.h)
461 +case $host_os in
462 +mingw*)
463 +AC_CONFIG_COMMANDS(mingw_ffi_common.h, [
464 +AC_MSG_NOTICE(copying $srcdir/include/ffi_common.h to include/ffi_common.h)
465 +cp -p $srcdir/include/ffi_common.h include/ffi_common.h
469 AC_CONFIG_LINKS(include/ffi_common.h:include/ffi_common.h)
471 +esac
473 AC_CONFIG_FILES(fficonfig.py)
475 --- misc/Python-2.6.1/Modules/_ctypes/libffi/include/ffi.h.in 2008-04-05 01:01:54.000000000 +0900
476 +++ misc/build/Python-2.6.1/Modules/_ctypes/libffi/include/ffi.h.in 2009-03-24 20:53:04.519875000 +0900
477 @@ -350,7 +350,11 @@
478 ffi_type *rtype,
479 ffi_type **atypes);
481 +#ifdef MS_WIN32
482 +int ffi_call(ffi_cif *cif,
483 +#else
484 void ffi_call(ffi_cif *cif,
485 +#endif
486 void (*fn)(void),
487 void *rvalue,
488 void **avalue);
489 --- misc/Python-2.6.1/Modules/config.c.in 2008-09-19 08:20:28.000000000 +0900
490 +++ misc/build/Python-2.6.1/Modules/config.c.in 2009-03-22 16:28:09.418875000 +0900
491 @@ -48,6 +48,9 @@
492 {"__builtin__", NULL},
493 {"sys", NULL},
494 {"exceptions", NULL},
495 +#ifdef __MINGW32__
496 + {"winmingw32", NULL},
497 +#endif
499 /* This lives in gcmodule.c */
500 {"gc", initgc},
501 --- misc/Python-2.6.1/Modules/posixmodule.c 2008-10-10 03:06:58.000000000 +0900
502 +++ misc/build/Python-2.6.1/Modules/posixmodule.c 2009-03-22 20:04:01.404375000 +0900
503 @@ -131,6 +131,15 @@
504 #define HAVE_FSYNC 1
505 #define fsync _commit
506 #else
507 +#ifdef __MINGW32__
508 +#define HAVE_SPAWNV 1
509 +#define HAVE_EXECV 1
510 +#define HAVE_GETCWD 1
511 +#define HAVE_OPENDIR 1
512 +#define HAVE_PIPE 1
513 +#define HAVE_POPEN 1
514 +#define HAVE_SYSTEM 1
515 +#else
516 #if defined(PYOS_OS2) && defined(PYCC_GCC) || defined(__VMS)
517 /* Everything needed is defined in PC/os2emx/pyconfig.h or vms/pyconfig.h */
518 #else /* all other compilers */
519 @@ -156,6 +165,7 @@
520 #define HAVE_WAIT 1
521 #define HAVE_TTYNAME 1
522 #endif /* PYOS_OS2 && PYCC_GCC && __VMS */
523 +#endif /* __MINGW32__ */
524 #endif /* _MSC_VER */
525 #endif /* __BORLANDC__ */
526 #endif /* ! __WATCOMC__ || __QNX__ */
527 @@ -275,6 +285,14 @@
528 #define pclose _pclose
529 #endif /* _MSC_VER */
531 +#ifdef __MINGW32__
532 +#include "osdefs.h"
533 +#include <windows.h>
534 +#include <shellapi.h> /* for ShellExecute() */
535 +#define popen _popen
536 +#define pclose _pclose
537 +#endif
539 #if defined(PYCC_VACPP) && defined(PYOS_OS2)
540 #include <io.h>
541 #endif /* OS2 */
542 @@ -350,7 +368,7 @@
544 #include <crt_externs.h>
545 static char **environ;
546 -#elif !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) )
547 +#elif !defined(_MSC_VER) && !defined(__MINGW32__) && ( !defined(__WATCOMC__) || defined(__QNX__) )
548 extern char **environ;
549 #endif /* !_MSC_VER */
551 @@ -775,7 +793,7 @@
552 int st_ctime_nsec;
555 -static __int64 secs_between_epochs = 11644473600; /* Seconds between 1.1.1601 and 1.1.1970 */
556 +static __int64 secs_between_epochs = 11644473600LL; /* Seconds between 1.1.1601 and 1.1.1970 */
558 static void
559 FILE_TIME_to_time_t_nsec(FILETIME *in_ptr, int *time_out, int* nsec_out)
560 @@ -8189,7 +8207,7 @@
562 #endif
564 -#ifdef MS_WINDOWS
565 +#if defined(MS_WINDOWS) && !defined(__MINGW32__)
567 PyDoc_STRVAR(win32_urandom__doc__,
568 "urandom(n) -> str\n\n\
569 @@ -8605,7 +8623,7 @@
570 #ifdef HAVE_GETLOADAVG
571 {"getloadavg", posix_getloadavg, METH_NOARGS, posix_getloadavg__doc__},
572 #endif
573 - #ifdef MS_WINDOWS
574 + #if defined(MS_WINDOWS) && !defined(__MINGW32__)
575 {"urandom", win32_urandom, METH_VARARGS, win32_urandom__doc__},
576 #endif
577 #ifdef __VMS
578 --- misc/Python-2.6.1/Modules/socketmodule.c 2008-08-12 23:49:50.000000000 +0900
579 +++ misc/build/Python-2.6.1/Modules/socketmodule.c 2009-03-29 20:55:19.750375000 +0900
580 @@ -312,7 +312,7 @@
581 /* Do not include addrinfo.h for MSVC7 or greater. 'addrinfo' and
582 * EAI_* constants are defined in (the already included) ws2tcpip.h.
584 -#else
585 +#elif !defined(__MINGW32__)
586 # include "addrinfo.h"
587 #endif
589 --- misc/Python-2.6.1/PC/_winreg.c 2008-06-09 13:58:54.000000000 +0900
590 +++ misc/build/Python-2.6.1/PC/_winreg.c 2009-04-12 18:25:01.944250000 +0900
591 @@ -1630,6 +1630,9 @@
594 #define ADD_KEY(val) inskey(d, #val, val)
595 +#ifndef REG_LEGAL_CHANGE_FILTER
596 +#define REG_LEGAL_CHANGE_FILTER (REG_NOTIFY_CHANGE_NAME|REG_NOTIFY_CHANGE_ATTRIBUTES|REG_NOTIFY_CHANGE_LAST_SET|REG_NOTIFY_CHANGE_SECURITY)
597 +#endif
599 PyMODINIT_FUNC init_winreg(void)
601 --- misc/Python-2.6.1/Python/dynload_win.c 2008-01-24 02:15:06.000000000 +0900
602 +++ misc/build/Python-2.6.1/Python/dynload_win.c 2009-03-21 22:05:59.683125000 +0900
603 @@ -24,6 +24,7 @@
604 /* Case insensitive string compare, to avoid any dependencies on particular
605 C RTL implementations */
607 +#ifndef __MINGW32__
608 static int strcasecmp (char *string1, char *string2)
610 int first, second;
611 @@ -37,6 +38,7 @@
613 return (first - second);
615 +#endif
618 /* Function to return the name of the "python" DLL that the supplied module
619 --- misc/Python-2.6.1/Python/frozenmain.c 2002-07-01 00:26:10.000000000 +0900
620 +++ misc/build/Python-2.6.1/Python/frozenmain.c 2009-03-22 15:36:03.993875000 +0900
621 @@ -3,7 +3,7 @@
623 #include "Python.h"
625 -#ifdef MS_WINDOWS
626 +#if defined(MS_WINDOWS) && !defined(__MINGW32__)
627 extern void PyWinFreeze_ExeInit(void);
628 extern void PyWinFreeze_ExeTerm(void);
629 extern int PyInitFrozenExtensions(void);
630 @@ -32,12 +32,12 @@
631 setbuf(stderr, (char *)NULL);
634 -#ifdef MS_WINDOWS
635 +#if defined(MS_WINDOWS) && !defined(__MINGW32__)
636 PyInitFrozenExtensions();
637 #endif /* MS_WINDOWS */
638 Py_SetProgramName(argv[0]);
639 Py_Initialize();
640 -#ifdef MS_WINDOWS
641 +#if defined(MS_WINDOWS) && !defined(__MINGW32__)
642 PyWinFreeze_ExeInit();
643 #endif
645 @@ -60,7 +60,7 @@
646 if (inspect && isatty((int)fileno(stdin)))
647 sts = PyRun_AnyFile(stdin, "<stdin>") != 0;
649 -#ifdef MS_WINDOWS
650 +#if defined(MS_WINDOWS) && !defined(__MINGW32__)
651 PyWinFreeze_ExeTerm();
652 #endif
653 Py_Finalize();
654 --- misc/Python-2.6.1/configure 2008-11-17 02:57:10.000000000 +0900
655 +++ misc/build/Python-2.6.1/configure 2009-04-11 16:57:56.149375000 +0900
656 @@ -719,8 +719,10 @@
657 USE_THREAD_MODULE
658 LDLAST
659 THREADOBJ
660 +USE_PASSWORD_MODULE
661 DLINCLDIR
662 DYNLOADFILE
663 +GETPATH_OBJS
664 MACHDEP_OBJS
665 TRUE
666 LIBOBJS
667 @@ -2201,6 +2203,13 @@
668 LDFLAGS="$SGI_ABI $LDFLAGS"
669 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
671 +case $MACHDEP in
672 + *mingw*|*MINGW*|*MinGW*)
673 + MACHDEP="winmingw32"
674 + ac_sys_system=`uname -s`
675 + ac_sys_release=`uname -r`
676 + ;;
677 +esac
678 { echo "$as_me:$LINENO: result: $MACHDEP" >&5
679 echo "${ECHO_T}$MACHDEP" >&6; }
681 @@ -3995,7 +4004,7 @@
682 if test -z "$enable_shared"
683 then
684 case $ac_sys_system in
685 - CYGWIN* | atheos*)
686 + CYGWIN* | MINGW* | atheos*)
687 enable_shared="yes";;
689 enable_shared="no";;
690 @@ -4096,7 +4105,7 @@
691 BeOS*)
692 LDLIBRARY='libpython$(VERSION).so'
694 - CYGWIN*)
695 + CYGWIN* | MINGW*)
696 LDLIBRARY='libpython$(VERSION).dll.a'
697 DLLLIBRARY='libpython$(VERSION).dll'
699 @@ -4142,7 +4151,7 @@
700 esac
701 else # shared is disabled
702 case $ac_sys_system in
703 - CYGWIN*)
704 + CYGWIN* | MINGW*)
705 BLDLIBRARY='$(LIBRARY)'
706 LDLIBRARY='libpython$(VERSION).dll.a'
708 @@ -12645,6 +12654,10 @@
709 _ACEOF
712 +ac_cv_sizeof_off_t=`echo $ac_cv_sizeof_off_t | tr -d '\015'`
713 +ac_cv_sizeof_long=`echo $ac_cv_sizeof_long | tr -d '\015'`
714 +ac_cv_sizeof_long_long=`echo $ac_cv_sizeof_long_long | tr -d '\015'`
715 +ac_cv_sizeof_short=`echo $ac_cv_sizeof_short | tr -d '\015'`
716 { echo "$as_me:$LINENO: checking whether to enable large file support" >&5
717 echo $ECHO_N "checking whether to enable large file support... $ECHO_C" >&6; }
718 if test "$have_long_long" = yes -a \
719 @@ -12985,7 +12998,7 @@
720 *) SO=.sl;;
721 esac
723 - CYGWIN*) SO=.dll;;
724 + CYGWIN* | MINGW*) SO=.dll;;
725 *) SO=.so;;
726 esac
727 else
728 @@ -13113,7 +13126,7 @@
729 fi;;
730 SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
731 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
732 - CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
733 + CYGWIN* | MINGW*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base ${LDFLAGS}";;
734 atheos*) LDSHARED="gcc -shared";;
735 *) LDSHARED="ld";;
736 esac
737 @@ -13205,7 +13218,7 @@
738 LINKFORSHARED="-Xlinker --export-dynamic"
739 fi;;
740 esac;;
741 - CYGWIN*)
742 + CYGWIN* | MINGW*)
743 if test $enable_shared = "no"
744 then
745 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
746 @@ -13229,7 +13242,7 @@
747 if test ! "$LIBRARY" = "$LDLIBRARY"
748 then
749 case $ac_sys_system in
750 - CYGWIN*)
751 + CYGWIN* | MINGW*)
752 # Cygwin needs CCSHARED when building extension DLLs
753 # but not when building the interpreter DLL.
754 CFLAGSFORSHARED='';;
755 @@ -15443,7 +15456,7 @@
756 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
757 _ACEOF
758 case $ac_sys_system in
759 - CYGWIN*)
760 + CYGWIN* | MINGW*)
762 cat >>confdefs.h <<\_ACEOF
763 #define HAVE_BROKEN_PTHREAD_SIGMASK 1
764 @@ -15457,6 +15470,17 @@
768 +case $MACHDEP in
769 +winmingw*)
770 + THREADOBJ="Python/thread.o"
771 + USE_THREAD_MODULE="#"
772 + USE_PASSWORD_MODULE="#"
773 + ;;
775 + USE_PASSWORD_MODULE=""
776 + ;;
777 +esac
779 # Check for enable-ipv6
782 @@ -16057,6 +16081,11 @@
783 # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
784 Darwin/[0156]\..*) DYNLOADFILE="dynload_next.o";;
785 atheos*) DYNLOADFILE="dynload_atheos.o";;
786 + CYGWIN* | MINGW*)
787 + case $MACHDEP in
788 + winmingw*) DYNLOADFILE="dynload_win.o PC/import_nt.o PC/dl_nt.o";;
789 + esac
790 + ;;
792 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
793 # out any dynamic loading
794 @@ -16078,6 +16107,21 @@
799 +{ echo "$as_me:$LINENO: checking GETPATH_OBJS" >&5
800 +echo $ECHO_N "checking GETPATH_OBJS... $ECHO_C" >&6; }
801 +if test -z "$GETPATH_OBJS"
802 +then
803 + case $MACHDEP in
804 + winmingw*)
805 + GETPATH_OBJS='PC/getpathp.o';;
806 + *)
807 + GETPATH_OBJS='Modules/getpath.o';;
808 + esac
810 +{ echo "$as_me:$LINENO: result: $GETPATH_OBJS" >&5
811 +echo "${ECHO_T}$GETPATH_OBJS" >&6; }
813 # MACHDEP_OBJS can be set to platform-specific object files needed by Python
816 @@ -19952,6 +19996,112 @@
820 +case $MACHDEP in
821 +winmingw*)
822 +{ echo "$as_me:$LINENO: checking for struct stat.st_blocks" >&5
823 +echo $ECHO_N "checking for struct stat.st_blocks... $ECHO_C" >&6; }
824 +if test "${ac_cv_member_struct_stat_st_blocks+set}" = set; then
825 + echo $ECHO_N "(cached) $ECHO_C" >&6
826 +else
827 + cat >conftest.$ac_ext <<_ACEOF
828 +/* confdefs.h. */
829 +_ACEOF
830 +cat confdefs.h >>conftest.$ac_ext
831 +cat >>conftest.$ac_ext <<_ACEOF
832 +/* end confdefs.h. */
833 +$ac_includes_default
834 +int
835 +main ()
837 +static struct stat ac_aggr;
838 +if (ac_aggr.st_blocks)
839 +return 0;
841 + return 0;
843 +_ACEOF
844 +rm -f conftest.$ac_objext
845 +if { (ac_try="$ac_compile"
846 +case "(($ac_try" in
847 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
848 + *) ac_try_echo=$ac_try;;
849 +esac
850 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
851 + (eval "$ac_compile") 2>conftest.er1
852 + ac_status=$?
853 + grep -v '^ *+' conftest.er1 >conftest.err
854 + rm -f conftest.er1
855 + cat conftest.err >&5
856 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
857 + (exit $ac_status); } && {
858 + test -z "$ac_c_werror_flag" ||
859 + test ! -s conftest.err
860 + } && test -s conftest.$ac_objext; then
861 + ac_cv_member_struct_stat_st_blocks=yes
862 +else
863 + echo "$as_me: failed program was:" >&5
864 +sed 's/^/| /' conftest.$ac_ext >&5
866 + cat >conftest.$ac_ext <<_ACEOF
867 +/* confdefs.h. */
868 +_ACEOF
869 +cat confdefs.h >>conftest.$ac_ext
870 +cat >>conftest.$ac_ext <<_ACEOF
871 +/* end confdefs.h. */
872 +$ac_includes_default
873 +int
874 +main ()
876 +static struct stat ac_aggr;
877 +if (sizeof ac_aggr.st_blocks)
878 +return 0;
880 + return 0;
882 +_ACEOF
883 +rm -f conftest.$ac_objext
884 +if { (ac_try="$ac_compile"
885 +case "(($ac_try" in
886 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
887 + *) ac_try_echo=$ac_try;;
888 +esac
889 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
890 + (eval "$ac_compile") 2>conftest.er1
891 + ac_status=$?
892 + grep -v '^ *+' conftest.er1 >conftest.err
893 + rm -f conftest.er1
894 + cat conftest.err >&5
895 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
896 + (exit $ac_status); } && {
897 + test -z "$ac_c_werror_flag" ||
898 + test ! -s conftest.err
899 + } && test -s conftest.$ac_objext; then
900 + ac_cv_member_struct_stat_st_blocks=yes
901 +else
902 + echo "$as_me: failed program was:" >&5
903 +sed 's/^/| /' conftest.$ac_ext >&5
905 + ac_cv_member_struct_stat_st_blocks=no
908 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
911 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
913 +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blocks" >&5
914 +echo "${ECHO_T}$ac_cv_member_struct_stat_st_blocks" >&6; }
915 +if test $ac_cv_member_struct_stat_st_blocks = yes; then
917 +cat >>confdefs.h <<_ACEOF
918 +#define HAVE_STRUCT_STAT_ST_BLOCKS 1
919 +_ACEOF
926 { echo "$as_me:$LINENO: checking for struct stat.st_blocks" >&5
927 echo $ECHO_N "checking for struct stat.st_blocks... $ECHO_C" >&6; }
928 if test "${ac_cv_member_struct_stat_st_blocks+set}" = set; then
929 @@ -20066,6 +20216,8 @@
934 +esac
936 { echo "$as_me:$LINENO: checking for time.h that defines altzone" >&5
937 echo $ECHO_N "checking for time.h that defines altzone... $ECHO_C" >&6; }
938 @@ -22530,6 +22682,7 @@
942 +ac_cv_sizeof_wchar_t=`echo $ac_cv_sizeof_wchar_t | tr -d '\015'`
944 if test "$enable_unicode" = "no"
945 then
946 @@ -25368,8 +25521,10 @@
947 USE_THREAD_MODULE!$USE_THREAD_MODULE$ac_delim
948 LDLAST!$LDLAST$ac_delim
949 THREADOBJ!$THREADOBJ$ac_delim
950 +USE_PASSWORD_MODULE!$USE_PASSWORD_MODULE$ac_delim
951 DLINCLDIR!$DLINCLDIR$ac_delim
952 DYNLOADFILE!$DYNLOADFILE$ac_delim
953 +GETPATH_OBJS!$GETPATH_OBJS$ac_delim
954 MACHDEP_OBJS!$MACHDEP_OBJS$ac_delim
955 TRUE!$TRUE$ac_delim
956 LIBOBJS!$LIBOBJS$ac_delim
957 @@ -25386,7 +25541,7 @@
958 LTLIBOBJS!$LTLIBOBJS$ac_delim
959 _ACEOF
961 - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 22; then
962 + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 24; then
963 break
964 elif $ac_last_try; then
965 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
966 --- misc/Python-2.6.1/configure.in 2008-11-16 17:02:56.000000000 +0900
967 +++ misc/build/Python-2.6.1/configure.in 2009-04-11 16:56:07.258750000 +0900
968 @@ -359,6 +359,13 @@
969 LDFLAGS="$SGI_ABI $LDFLAGS"
970 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
972 +case $MACHDEP in
973 + *mingw*|*MINGW*|*MinGW*)
974 + MACHDEP="winmingw32"
975 + ac_sys_system=`uname -s`
976 + ac_sys_release=`uname -r`
977 + ;;
978 +esac
979 AC_MSG_RESULT($MACHDEP)
981 # And add extra plat-mac for darwin
982 @@ -643,7 +650,7 @@
983 if test -z "$enable_shared"
984 then
985 case $ac_sys_system in
986 - CYGWIN* | atheos*)
987 + CYGWIN* | MINGW* | atheos*)
988 enable_shared="yes";;
990 enable_shared="no";;
991 @@ -694,7 +701,7 @@
992 BeOS*)
993 LDLIBRARY='libpython$(VERSION).so'
995 - CYGWIN*)
996 + CYGWIN* | MINGW*)
997 LDLIBRARY='libpython$(VERSION).dll.a'
998 DLLLIBRARY='libpython$(VERSION).dll'
1000 @@ -740,7 +747,7 @@
1001 esac
1002 else # shared is disabled
1003 case $ac_sys_system in
1004 - CYGWIN*)
1005 + CYGWIN* | MINGW*)
1006 BLDLIBRARY='$(LIBRARY)'
1007 LDLIBRARY='libpython$(VERSION).dll.a'
1009 @@ -1402,6 +1409,10 @@
1010 AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t,
1011 [The number of bytes in an off_t.])
1013 +ac_cv_sizeof_off_t=`echo $ac_cv_sizeof_off_t | tr -d '\015'`
1014 +ac_cv_sizeof_long=`echo $ac_cv_sizeof_long | tr -d '\015'`
1015 +ac_cv_sizeof_long_long=`echo $ac_cv_sizeof_long_long | tr -d '\015'`
1016 +ac_cv_sizeof_short=`echo $ac_cv_sizeof_short | tr -d '\015'`
1017 AC_MSG_CHECKING(whether to enable large file support)
1018 if test "$have_long_long" = yes -a \
1019 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
1020 @@ -1581,7 +1592,7 @@
1021 *) SO=.sl;;
1022 esac
1024 - CYGWIN*) SO=.dll;;
1025 + CYGWIN* | MINGW*) SO=.dll;;
1026 *) SO=.so;;
1027 esac
1028 else
1029 @@ -1703,7 +1714,7 @@
1030 fi;;
1031 SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
1032 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
1033 - CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
1034 + CYGWIN* | MINGW*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base ${LDFLAGS}";;
1035 atheos*) LDSHARED="gcc -shared";;
1036 *) LDSHARED="ld";;
1037 esac
1038 @@ -1791,7 +1802,7 @@
1039 LINKFORSHARED="-Xlinker --export-dynamic"
1040 fi;;
1041 esac;;
1042 - CYGWIN*)
1043 + CYGWIN* | MINGW*)
1044 if test $enable_shared = "no"
1045 then
1046 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
1047 @@ -1813,7 +1824,7 @@
1048 if test ! "$LIBRARY" = "$LDLIBRARY"
1049 then
1050 case $ac_sys_system in
1051 - CYGWIN*)
1052 + CYGWIN* | MINGW*)
1053 # Cygwin needs CCSHARED when building extension DLLs
1054 # but not when building the interpreter DLL.
1055 CFLAGSFORSHARED='';;
1056 @@ -2149,13 +2160,24 @@
1058 AC_CHECK_FUNCS(pthread_sigmask,
1059 [case $ac_sys_system in
1060 - CYGWIN*)
1061 + CYGWIN* | MINGW*)
1062 AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
1063 [Define if pthread_sigmask() does not work on your system.])
1065 esac])
1068 +AC_SUBST(USE_PASSWORD_MODULE)
1069 +case $MACHDEP in
1070 +winmingw*)
1071 + THREADOBJ="Python/thread.o"
1072 + USE_THREAD_MODULE="#"
1073 + USE_PASSWORD_MODULE="#"
1074 + ;;
1076 + USE_PASSWORD_MODULE=""
1077 + ;;
1078 +esac
1080 # Check for enable-ipv6
1081 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
1082 @@ -2415,6 +2437,11 @@
1083 # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
1084 Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
1085 atheos*) DYNLOADFILE="dynload_atheos.o";;
1086 + CYGWIN* | MINGW*)
1087 + case $MACHDEP in
1088 + winmingw*) DYNLOADFILE="dynload_win.o PC/import_nt.o PC/dl_nt.o";;
1089 + esac
1090 + ;;
1092 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1093 # out any dynamic loading
1094 @@ -2432,6 +2459,19 @@
1095 [Defined when any dynamic module loading is enabled.])
1098 +AC_SUBST(GETPATH_OBJS)
1099 +AC_MSG_CHECKING(GETPATH_OBJS)
1100 +if test -z "$GETPATH_OBJS"
1101 +then
1102 + case $MACHDEP in
1103 + winmingw*)
1104 + GETPATH_OBJS='PC/getpathp.o';;
1105 + *)
1106 + GETPATH_OBJS='Modules/getpath.o';;
1107 + esac
1109 +AC_MSG_RESULT($GETPATH_OBJS)
1111 # MACHDEP_OBJS can be set to platform-specific object files needed by Python
1113 AC_SUBST(MACHDEP_OBJS)
1114 @@ -2862,7 +2902,14 @@
1115 AC_CHECK_MEMBERS([struct stat.st_flags])
1116 AC_CHECK_MEMBERS([struct stat.st_gen])
1117 AC_CHECK_MEMBERS([struct stat.st_birthtime])
1118 +case $MACHDEP in
1119 +winmingw*)
1120 +AC_CHECK_MEMBERS([struct stat.st_blocks])
1123 AC_STRUCT_ST_BLOCKS
1125 +esac
1127 AC_MSG_CHECKING(for time.h that defines altzone)
1128 AC_CACHE_VAL(ac_cv_header_time_altzone,
1129 @@ -3247,6 +3294,7 @@
1130 AH_TEMPLATE(PY_UNICODE_TYPE,
1131 [Define as the integral type used for Unicode representation.])
1133 +ac_cv_sizeof_wchar_t=`echo $ac_cv_sizeof_wchar_t | tr -d '\015'`
1134 AC_SUBST(UNICODE_OBJS)
1135 if test "$enable_unicode" = "no"
1136 then
1137 --- misc/Python-2.6.1/setup.py 2008-11-05 05:43:31.000000000 +0900
1138 +++ misc/build/Python-2.6.1/setup.py 2009-04-12 16:02:22.654125000 +0900
1139 @@ -234,6 +234,18 @@
1140 if not self.configure_ctypes(ext):
1141 return
1143 + if self.get_platform() == "winmingw":
1144 + if ext.name == '_ctypes_test':
1145 + ext.libraries.append('oleaut32')
1146 + elif ext.name == 'select':
1147 + ext.libraries.append('ws2_32')
1148 + elif ext.name == '_socket':
1149 + ext.libraries.append('ws2_32')
1150 + if ext.name == '_ctypes':
1151 + ext.libraries.append('uuid')
1152 + ext.libraries.append('oleaut32')
1153 + ext.libraries.append('ole32')
1155 try:
1156 build_ext.build_extension(self, ext)
1157 except (CCompilerError, DistutilsError), why:
1158 @@ -263,7 +275,7 @@
1160 # Workaround for Cygwin: Cygwin currently has fork issues when many
1161 # modules have been imported
1162 - if self.get_platform() == 'cygwin':
1163 + if self.get_platform() in ['cygwin', 'winmingw']:
1164 self.announce('WARNING: skipping import check for Cygwin-based "%s"'
1165 % ext.name)
1166 return
1167 @@ -303,7 +315,7 @@
1169 def get_platform(self):
1170 # Get value of sys.platform
1171 - for platform in ['cygwin', 'beos', 'darwin', 'atheos', 'osf1']:
1172 + for platform in ['cygwin', 'winmingw', 'beos', 'darwin', 'atheos', 'osf1']:
1173 if sys.platform.startswith(platform):
1174 return platform
1175 return sys.platform
1176 @@ -1009,7 +1021,7 @@
1177 missing.append('bsddb185')
1179 # The standard Unix dbm module:
1180 - if platform not in ['cygwin']:
1181 + if platform not in ['cygwin', 'winmingw']:
1182 if find_file("ndbm.h", inc_dirs, []) is not None:
1183 # Some systems have -lndbm, others don't
1184 if self.compiler.find_library_file(lib_dirs, 'ndbm'):
1185 @@ -1053,7 +1065,7 @@
1186 missing.append('resource')
1188 # Sun yellow pages. Some systems have the functions in libc.
1189 - if platform not in ['cygwin', 'atheos', 'qnx6']:
1190 + if platform not in ['cygwin', 'winmingw', 'atheos', 'qnx6']:
1191 if (self.compiler.find_library_file(lib_dirs, 'nsl')):
1192 libs = ['nsl']
1193 else:
1194 @@ -1252,14 +1264,14 @@
1196 libraries = []
1198 - elif platform == 'cygwin': # Cygwin
1199 + elif platform in ['cygwin', 'winmingw']: # Cygwin
1200 macros = dict(
1201 HAVE_SEM_OPEN=1,
1202 HAVE_SEM_TIMEDWAIT=1,
1203 HAVE_FD_TRANSFER=0,
1204 HAVE_BROKEN_SEM_UNLINK=1
1206 - libraries = []
1207 + libraries = ['ws2_32']
1209 elif platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'):
1210 # FreeBSD's P1003.1b semaphore support is very experimental
1211 @@ -1287,7 +1299,7 @@
1213 libraries = ['rt']
1215 - if platform == 'win32':
1216 + if platform in ['win32', 'winmingw']:
1217 multiprocessing_srcs = [ '_multiprocessing/multiprocessing.c',
1218 '_multiprocessing/semaphore.c',
1219 '_multiprocessing/pipe_connection.c',
1220 @@ -1305,6 +1317,7 @@
1222 exts.append ( Extension('_multiprocessing', multiprocessing_srcs,
1223 define_macros=macros.items(),
1224 + libraries=libraries,
1225 include_dirs=["Modules/_multiprocessing"]))
1226 # End multiprocessing
1228 @@ -1423,6 +1436,10 @@
1229 '-framework', 'Carbon']) )
1232 + if platform == 'winmingw':
1233 + exts.append( Extension('_winreg', ['../PC/_winreg.c']) )
1234 + exts.append( Extension('winsound', ['../PC/winsound.c'], libraries = ['winmm']) )
1236 self.extensions.extend(exts)
1238 # Call the method for detecting whether _tkinter can be compiled
1239 @@ -1575,7 +1592,7 @@
1240 added_lib_dirs.append('/usr/X11/lib')
1242 # If Cygwin, then verify that X is installed before proceeding
1243 - if platform == 'cygwin':
1244 + if platform in ['cygwin', 'winmingw']:
1245 x11_inc = find_file('X11/Xlib.h', [], include_dirs)
1246 if x11_inc is None:
1247 return
1248 @@ -1598,7 +1615,7 @@
1249 libs.append('ld')
1251 # Finally, link with the X11 libraries (not appropriate on cygwin)
1252 - if platform != "cygwin":
1253 + if not platform in ["cygwin", "winmingw"]:
1254 libs.append('X11')
1256 ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
1257 @@ -1669,6 +1686,8 @@
1258 from distutils.dir_util import mkpath
1259 mkpath(ffi_builddir)
1260 config_args = []
1261 + if self.get_platform() == "winmingw":
1262 + config_args.append(" --build=mingw32")
1264 # Pass empty CFLAGS because we'll just append the resulting
1265 # CFLAGS to Python's; -g or -O2 is to be avoided.