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