Add patches for 2.5 to fix biuld on OS X 10.7/10.8 (#33)

This commit is contained in:
Yamashita Yuu 2013-07-17 23:48:24 +09:00
parent 4c006959fa
commit f5807424c2
14 changed files with 3059 additions and 0 deletions

View file

@ -0,0 +1,166 @@
diff -r -u ./configure ../Python-2.5/configure
--- ./configure 2006-09-05 11:54:42.000000000 +0900
+++ ../Python-2.5/configure 2013-07-19 15:27:46.000000000 +0900
@@ -1396,6 +1396,16 @@
_ACEOF
+# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
+# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
+# them.
+
+cat >>confdefs.h <<\_ACEOF
+#define _DARWIN_C_SOURCE 1
+_ACEOF
+
+
+
define_xopen_source=yes
# Arguments passed to configure.
@@ -3885,11 +3895,110 @@
;;
# is there any other compiler on Darwin besides gcc?
Darwin*)
- BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
+ # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
+ # used to be here, but non-Apple gcc doesn't accept them.
+ if test "${CC}" = gcc
+ then
+ { echo "$as_me:${as_lineno-$LINENO}: checking which compiler should be used" >&5
+echo -n "checking which compiler should be used... " >&6; }
+ case "${UNIVERSALSDK}" in
+ */MacOSX10.4u.sdk)
+ # Build using 10.4 SDK, force usage of gcc when the
+ # compiler is gcc, otherwise the user will get very
+ # confusing error messages when building on OSX 10.6
+ CC=gcc-4.0
+ CPP=cpp-4.0
+ ;;
+ esac
+ { echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+echo "$CC" >&6; }
+ fi
+
+
if test "${enable_universalsdk}"; then
- BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
+ UNIVERSAL_ARCH_FLAGS=""
+ if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
+ ARCH_RUN_32BIT=""
+ LIPO_32BIT_FLAGS=""
+ elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
+ LIPO_32BIT_FLAGS=""
+ ARCH_RUN_32BIT="true"
+
+ elif test "$UNIVERSAL_ARCHS" = "all" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
+ LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
+ ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
+
+ elif test "$UNIVERSAL_ARCHS" = "intel" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
+ LIPO_32BIT_FLAGS="-extract i386"
+ ARCH_RUN_32BIT="/usr/bin/arch -i386"
+
+ elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
+ LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
+ ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
+
+ else
+ as_fn_error $? "proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way" "$LINENO" 5
+
+ fi
+
+
+ CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
+ if test "${UNIVERSALSDK}" != "/"
+ then
+ CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}"
+ LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}"
+ CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
+ fi
fi
+ # Calculate the right deployment target for this build.
+ #
+ cur_target=`sw_vers -productVersion | sed 's/\(10\.[0-9]*\).*/\1/'`
+ if test ${cur_target} '>' 10.2 && \
+ test ${cur_target} '<' 10.6
+ then
+ cur_target=10.3
+ if test ${enable_universalsdk}; then
+ if test "${UNIVERSAL_ARCHS}" = "all"; then
+ # Ensure that the default platform for a
+ # 4-way universal build is OSX 10.5,
+ # that's the first OS release where
+ # 4-way builds make sense.
+ cur_target='10.5'
+
+ elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
+ cur_target='10.5'
+
+ elif test "${UNIVERSAL_ARCHS}" = "intel"; then
+ cur_target='10.5'
+
+ elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
+ cur_target='10.5'
+ fi
+ else
+ if test `/usr/bin/arch` = "i386"; then
+ # On Intel macs default to a deployment
+ # target of 10.4, that's the first OSX
+ # release with Intel support.
+ cur_target="10.4"
+ fi
+ fi
+ fi
+ CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
+
+ # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
+ # environment with a value that is the same as what we'll use
+ # in the Makefile to ensure that we'll get the same compiler
+ # environment during configure and build time.
+ MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
+ export MACOSX_DEPLOYMENT_TARGET
+ EXPORT_MACOSX_DEPLOYMENT_TARGET=''
+
;;
OSF*)
BASECFLAGS="$BASECFLAGS -mieee"
@@ -10851,7 +10960,7 @@
if test "${enable_universalsdk}"; then
:
else
- LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
+ LIBTOOL_CRUFT="${LIBTOOL_CRUFT}"
fi
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
@@ -10863,7 +10972,7 @@
else
LIBTOOL_CRUFT=""
fi
- LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only `arch`"
+ LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs"
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
esac
diff -r -u ./pyconfig.h.in ../Python-2.5/pyconfig.h.in
--- ./pyconfig.h.in 2006-07-30 23:09:47.000000000 +0900
+++ ../Python-2.5/pyconfig.h.in 2013-07-17 23:12:31.000000000 +0900
@@ -912,6 +912,11 @@
/* Define on Irix to enable u_int */
#undef _BSD_TYPES
+/* Define on Darwin to activate all library features */
+#ifndef _DARWIN_C_SOURCE
+#define _DARWIN_C_SOURCE
+#endif
+
/* This must be set to 64 on some systems to enable large file support. */
#undef _FILE_OFFSET_BITS

View file

@ -0,0 +1,271 @@
diff -r -u ./Include/pymactoolbox.h ../Python-2.5/Include/pymactoolbox.h
--- ./Include/pymactoolbox.h 2004-11-05 16:02:59.000000000 +0900
+++ ../Python-2.5/Include/pymactoolbox.h 2013-07-17 23:38:51.000000000 +0900
@@ -8,7 +8,10 @@
#endif
#include <Carbon/Carbon.h>
+
+#ifndef __LP64__
#include <QuickTime/QuickTime.h>
+#endif /* !__LP64__ */
/*
** Helper routines for error codes and such.
@@ -18,8 +21,11 @@
PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */
PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */
PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */
+#ifndef __LP64__
extern OSErr PyMac_GetFullPathname(FSSpec *, char *, int); /* convert
fsspec->path */
+#endif /* __LP64__ */
+
/*
** These conversion routines are defined in mactoolboxglue.c itself.
*/
@@ -83,8 +89,10 @@
#endif /* USE_TOOLBOX_OBJECT_GLUE */
/* macfs exports */
+#ifndef __LP64__
int PyMac_GetFSSpec(PyObject *, FSSpec *); /* argument parser for FSSpec */
PyObject *PyMac_BuildFSSpec(FSSpec *); /* Convert FSSpec to PyObject */
+#endif /* !__LP64__ */
int PyMac_GetFSRef(PyObject *, FSRef *); /* argument parser for FSRef */
PyObject *PyMac_BuildFSRef(FSRef *); /* Convert FSRef to PyObject */
@@ -101,39 +109,54 @@
extern int CmpInstObj_Convert(PyObject *, ComponentInstance *);
/* Ctl exports */
+#ifndef __LP64__
extern PyObject *CtlObj_New(ControlHandle);
extern int CtlObj_Convert(PyObject *, ControlHandle *);
+#endif /* !__LP64__ */
/* Dlg exports */
+#ifndef __LP64__
extern PyObject *DlgObj_New(DialogPtr);
extern int DlgObj_Convert(PyObject *, DialogPtr *);
extern PyObject *DlgObj_WhichDialog(DialogPtr);
+#endif /* !__LP64__ */
/* Drag exports */
+#ifndef __LP64__
extern PyObject *DragObj_New(DragReference);
extern int DragObj_Convert(PyObject *, DragReference *);
+#endif /* !__LP64__ */
/* List exports */
+#ifndef __LP64__
extern PyObject *ListObj_New(ListHandle);
extern int ListObj_Convert(PyObject *, ListHandle *);
+#endif /* !__LP64__ */
/* Menu exports */
+#ifndef __LP64__
extern PyObject *MenuObj_New(MenuHandle);
extern int MenuObj_Convert(PyObject *, MenuHandle *);
+#endif /* !__LP64__ */
/* Qd exports */
+#ifndef __LP64__
extern PyObject *GrafObj_New(GrafPtr);
extern int GrafObj_Convert(PyObject *, GrafPtr *);
extern PyObject *BMObj_New(BitMapPtr);
extern int BMObj_Convert(PyObject *, BitMapPtr *);
extern PyObject *QdRGB_New(RGBColor *);
extern int QdRGB_Convert(PyObject *, RGBColor *);
+#endif /* !__LP64__ */
/* Qdoffs exports */
+#ifndef __LP64__
extern PyObject *GWorldObj_New(GWorldPtr);
extern int GWorldObj_Convert(PyObject *, GWorldPtr *);
+#endif /* !__LP64__ */
/* Qt exports */
+#ifndef __LP64__
extern PyObject *TrackObj_New(Track);
extern int TrackObj_Convert(PyObject *, Track *);
extern PyObject *MovieObj_New(Movie);
@@ -146,6 +169,7 @@
extern int UserDataObj_Convert(PyObject *, UserData *);
extern PyObject *MediaObj_New(Media);
extern int MediaObj_Convert(PyObject *, Media *);
+#endif /* !__LP64__ */
/* Res exports */
extern PyObject *ResObj_New(Handle);
@@ -154,13 +178,17 @@
extern int OptResObj_Convert(PyObject *, Handle *);
/* TE exports */
+#ifndef __LP64__
extern PyObject *TEObj_New(TEHandle);
extern int TEObj_Convert(PyObject *, TEHandle *);
+#endif /* !__LP64__ */
/* Win exports */
+#ifndef __LP64__
extern PyObject *WinObj_New(WindowPtr);
extern int WinObj_Convert(PyObject *, WindowPtr *);
extern PyObject *WinObj_WhichWindow(WindowPtr);
+#endif /* !__LP64__ */
/* CF exports */
extern PyObject *CFObj_New(CFTypeRef);
diff -r -u ./Mac/Modules/res/_Resmodule.c ../Python-2.5/Mac/Modules/res/_Resmodule.c
--- ./Mac/Modules/res/_Resmodule.c 2005-07-04 05:59:44.000000000 +0900
+++ ../Python-2.5/Mac/Modules/res/_Resmodule.c 2013-07-17 23:38:51.000000000 +0900
@@ -414,6 +414,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *ResObj_as_Control(ResourceObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -431,6 +432,7 @@
return _res;
}
+#endif /* !__LP64__ */
static PyObject *ResObj_LoadResource(ResourceObject *_self, PyObject *_args)
{
@@ -1152,6 +1154,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *Res_OpenRFPerm(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1287,6 +1290,7 @@
_res = Py_None;
return _res;
}
+#endif /* !__LP64__ */
static PyObject *Res_InsertResourceFile(PyObject *_self, PyObject *_args)
{
@@ -1327,6 +1331,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *Res_FSpResourceFileAlreadyOpen(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1413,6 +1418,7 @@
nextRefNum);
return _res;
}
+#endif /* !__LP64__ */
static PyObject *Res_FSOpenResFile(PyObject *_self, PyObject *_args)
{
@@ -1438,6 +1444,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *Res_FSCreateResFile(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1534,6 +1541,7 @@
PyMac_BuildFSSpec, &newSpec);
return _res;
}
+#endif /* __LP64__ */
static PyObject *Res_FSOpenResourceFile(PyObject *_self, PyObject *_args)
{
@@ -1637,6 +1645,7 @@
PyDoc_STR("(short refNum) -> (short _rv)")},
{"SetResFileAttrs", (PyCFunction)Res_SetResFileAttrs, 1,
PyDoc_STR("(short refNum, short attrs) -> None")},
+#ifndef __LP64__
{"OpenRFPerm", (PyCFunction)Res_OpenRFPerm, 1,
PyDoc_STR("(Str255 fileName, short vRefNum, SignedByte permission) -> (short _rv)")},
{"HOpenResFile", (PyCFunction)Res_HOpenResFile, 1,
@@ -1647,10 +1656,12 @@
PyDoc_STR("(FSSpec spec, SignedByte permission) -> (short _rv)")},
{"FSpCreateResFile", (PyCFunction)Res_FSpCreateResFile, 1,
PyDoc_STR("(FSSpec spec, OSType creator, OSType fileType, ScriptCode scriptTag) -> None")},
+#endif /* !__LP64__ */
{"InsertResourceFile", (PyCFunction)Res_InsertResourceFile, 1,
PyDoc_STR("(SInt16 refNum, RsrcChainLocation where) -> None")},
{"DetachResourceFile", (PyCFunction)Res_DetachResourceFile, 1,
PyDoc_STR("(SInt16 refNum) -> None")},
+#ifndef __LP64__
{"FSpResourceFileAlreadyOpen", (PyCFunction)Res_FSpResourceFileAlreadyOpen, 1,
PyDoc_STR("(FSSpec resourceFile) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")},
{"FSpOpenOrphanResFile", (PyCFunction)Res_FSpOpenOrphanResFile, 1,
@@ -1659,14 +1670,17 @@
PyDoc_STR("() -> (SInt16 refNum)")},
{"GetNextResourceFile", (PyCFunction)Res_GetNextResourceFile, 1,
PyDoc_STR("(SInt16 curRefNum) -> (SInt16 nextRefNum)")},
+#endif /* __LP64__ */
{"FSOpenResFile", (PyCFunction)Res_FSOpenResFile, 1,
PyDoc_STR("(FSRef ref, SignedByte permission) -> (short _rv)")},
+#ifndef __LP64__
{"FSCreateResFile", (PyCFunction)Res_FSCreateResFile, 1,
PyDoc_STR("(FSRef parentRef, Buffer nameLength) -> (FSRef newRef, FSSpec newSpec)")},
{"FSResourceFileAlreadyOpen", (PyCFunction)Res_FSResourceFileAlreadyOpen, 1,
PyDoc_STR("(FSRef resourceFileRef) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")},
{"FSCreateResourceFile", (PyCFunction)Res_FSCreateResourceFile, 1,
PyDoc_STR("(FSRef parentRef, Buffer nameLength, Buffer forkNameLength) -> (FSRef newRef, FSSpec newSpec)")},
+#endif /* __LP64__ */
{"FSOpenResourceFile", (PyCFunction)Res_FSOpenResourceFile, 1,
PyDoc_STR("(FSRef ref, Buffer forkNameLength, SignedByte permissions) -> (SInt16 refNum)")},
{"Handle", (PyCFunction)Res_Handle, 1,
diff -r -u ./Modules/_ctypes/libffi/src/darwin/ffitarget.h ../Python-2.5/Modules/_ctypes/libffi/src/darwin/ffitarget.h
--- ./Modules/_ctypes/libffi/src/darwin/ffitarget.h 2006-05-26 06:58:05.000000000 +0900
+++ ../Python-2.5/Modules/_ctypes/libffi/src/darwin/ffitarget.h 2013-07-17 23:38:51.000000000 +0900
@@ -4,7 +4,7 @@
* created by configure). This makes is possible to build a univeral binary
* of ctypes in one go.
*/
-#if defined(__i386__)
+#if defined(__i386__) || defined(__x86_64__)
#ifndef X86_DARWIN
#define X86_DARWIN
diff -r -u ./Python/mactoolboxglue.c ../Python-2.5/Python/mactoolboxglue.c
--- ./Python/mactoolboxglue.c 2006-07-12 01:44:25.000000000 +0900
+++ ../Python-2.5/Python/mactoolboxglue.c 2013-07-17 23:39:09.000000000 +0900
@@ -106,6 +106,7 @@
}
+#ifndef __LP64__
OSErr
PyMac_GetFullPathname(FSSpec *fss, char *path, int len)
{
@@ -153,6 +154,7 @@
Py_XDECREF(fs);
return err;
}
+#endif /* !__LP64__ */
/* Convert a 4-char string object argument to an OSType value */
int
@@ -417,6 +419,7 @@
GLUE_NEW(GWorldPtr, GWorldObj_New, "Carbon.Qdoffs")
GLUE_CONVERT(GWorldPtr, GWorldObj_Convert, "Carbon.Qdoffs")
+#ifndef __LP64__
GLUE_NEW(Track, TrackObj_New, "Carbon.Qt")
GLUE_CONVERT(Track, TrackObj_Convert, "Carbon.Qt")
GLUE_NEW(Movie, MovieObj_New, "Carbon.Qt")
@@ -429,6 +432,7 @@
GLUE_CONVERT(UserData, UserDataObj_Convert, "Carbon.Qt")
GLUE_NEW(Media, MediaObj_New, "Carbon.Qt")
GLUE_CONVERT(Media, MediaObj_Convert, "Carbon.Qt")
+#endif /* !__LP64__ */
GLUE_NEW(Handle, ResObj_New, "Carbon.Res")
GLUE_CONVERT(Handle, ResObj_Convert, "Carbon.Res")

View file

@ -0,0 +1,166 @@
diff -r -u ./configure ../Python-2.5/configure
--- ./configure 2006-09-05 11:54:42.000000000 +0900
+++ ../Python-2.5/configure 2013-07-19 15:27:46.000000000 +0900
@@ -1396,6 +1396,16 @@
_ACEOF
+# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
+# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
+# them.
+
+cat >>confdefs.h <<\_ACEOF
+#define _DARWIN_C_SOURCE 1
+_ACEOF
+
+
+
define_xopen_source=yes
# Arguments passed to configure.
@@ -3885,11 +3895,110 @@
;;
# is there any other compiler on Darwin besides gcc?
Darwin*)
- BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
+ # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
+ # used to be here, but non-Apple gcc doesn't accept them.
+ if test "${CC}" = gcc
+ then
+ { echo "$as_me:${as_lineno-$LINENO}: checking which compiler should be used" >&5
+echo -n "checking which compiler should be used... " >&6; }
+ case "${UNIVERSALSDK}" in
+ */MacOSX10.4u.sdk)
+ # Build using 10.4 SDK, force usage of gcc when the
+ # compiler is gcc, otherwise the user will get very
+ # confusing error messages when building on OSX 10.6
+ CC=gcc-4.0
+ CPP=cpp-4.0
+ ;;
+ esac
+ { echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+echo "$CC" >&6; }
+ fi
+
+
if test "${enable_universalsdk}"; then
- BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
+ UNIVERSAL_ARCH_FLAGS=""
+ if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
+ ARCH_RUN_32BIT=""
+ LIPO_32BIT_FLAGS=""
+ elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
+ LIPO_32BIT_FLAGS=""
+ ARCH_RUN_32BIT="true"
+
+ elif test "$UNIVERSAL_ARCHS" = "all" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
+ LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
+ ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
+
+ elif test "$UNIVERSAL_ARCHS" = "intel" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
+ LIPO_32BIT_FLAGS="-extract i386"
+ ARCH_RUN_32BIT="/usr/bin/arch -i386"
+
+ elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
+ LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
+ ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
+
+ else
+ as_fn_error $? "proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way" "$LINENO" 5
+
+ fi
+
+
+ CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
+ if test "${UNIVERSALSDK}" != "/"
+ then
+ CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}"
+ LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}"
+ CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
+ fi
fi
+ # Calculate the right deployment target for this build.
+ #
+ cur_target=`sw_vers -productVersion | sed 's/\(10\.[0-9]*\).*/\1/'`
+ if test ${cur_target} '>' 10.2 && \
+ test ${cur_target} '<' 10.6
+ then
+ cur_target=10.3
+ if test ${enable_universalsdk}; then
+ if test "${UNIVERSAL_ARCHS}" = "all"; then
+ # Ensure that the default platform for a
+ # 4-way universal build is OSX 10.5,
+ # that's the first OS release where
+ # 4-way builds make sense.
+ cur_target='10.5'
+
+ elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
+ cur_target='10.5'
+
+ elif test "${UNIVERSAL_ARCHS}" = "intel"; then
+ cur_target='10.5'
+
+ elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
+ cur_target='10.5'
+ fi
+ else
+ if test `/usr/bin/arch` = "i386"; then
+ # On Intel macs default to a deployment
+ # target of 10.4, that's the first OSX
+ # release with Intel support.
+ cur_target="10.4"
+ fi
+ fi
+ fi
+ CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
+
+ # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
+ # environment with a value that is the same as what we'll use
+ # in the Makefile to ensure that we'll get the same compiler
+ # environment during configure and build time.
+ MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
+ export MACOSX_DEPLOYMENT_TARGET
+ EXPORT_MACOSX_DEPLOYMENT_TARGET=''
+
;;
OSF*)
BASECFLAGS="$BASECFLAGS -mieee"
@@ -10851,7 +10960,7 @@
if test "${enable_universalsdk}"; then
:
else
- LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
+ LIBTOOL_CRUFT="${LIBTOOL_CRUFT}"
fi
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
@@ -10863,7 +10972,7 @@
else
LIBTOOL_CRUFT=""
fi
- LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only `arch`"
+ LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs"
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
esac
diff -r -u ./pyconfig.h.in ../Python-2.5/pyconfig.h.in
--- ./pyconfig.h.in 2006-07-30 23:09:47.000000000 +0900
+++ ../Python-2.5/pyconfig.h.in 2013-07-17 23:12:31.000000000 +0900
@@ -912,6 +912,11 @@
/* Define on Irix to enable u_int */
#undef _BSD_TYPES
+/* Define on Darwin to activate all library features */
+#ifndef _DARWIN_C_SOURCE
+#define _DARWIN_C_SOURCE
+#endif
+
/* This must be set to 64 on some systems to enable large file support. */
#undef _FILE_OFFSET_BITS

View file

@ -0,0 +1,271 @@
diff -r -u ./Include/pymactoolbox.h ../Python-2.5/Include/pymactoolbox.h
--- ./Include/pymactoolbox.h 2004-11-05 16:02:59.000000000 +0900
+++ ../Python-2.5/Include/pymactoolbox.h 2013-07-17 23:38:51.000000000 +0900
@@ -8,7 +8,10 @@
#endif
#include <Carbon/Carbon.h>
+
+#ifndef __LP64__
#include <QuickTime/QuickTime.h>
+#endif /* !__LP64__ */
/*
** Helper routines for error codes and such.
@@ -18,8 +21,11 @@
PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */
PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */
PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */
+#ifndef __LP64__
extern OSErr PyMac_GetFullPathname(FSSpec *, char *, int); /* convert
fsspec->path */
+#endif /* __LP64__ */
+
/*
** These conversion routines are defined in mactoolboxglue.c itself.
*/
@@ -83,8 +89,10 @@
#endif /* USE_TOOLBOX_OBJECT_GLUE */
/* macfs exports */
+#ifndef __LP64__
int PyMac_GetFSSpec(PyObject *, FSSpec *); /* argument parser for FSSpec */
PyObject *PyMac_BuildFSSpec(FSSpec *); /* Convert FSSpec to PyObject */
+#endif /* !__LP64__ */
int PyMac_GetFSRef(PyObject *, FSRef *); /* argument parser for FSRef */
PyObject *PyMac_BuildFSRef(FSRef *); /* Convert FSRef to PyObject */
@@ -101,39 +109,54 @@
extern int CmpInstObj_Convert(PyObject *, ComponentInstance *);
/* Ctl exports */
+#ifndef __LP64__
extern PyObject *CtlObj_New(ControlHandle);
extern int CtlObj_Convert(PyObject *, ControlHandle *);
+#endif /* !__LP64__ */
/* Dlg exports */
+#ifndef __LP64__
extern PyObject *DlgObj_New(DialogPtr);
extern int DlgObj_Convert(PyObject *, DialogPtr *);
extern PyObject *DlgObj_WhichDialog(DialogPtr);
+#endif /* !__LP64__ */
/* Drag exports */
+#ifndef __LP64__
extern PyObject *DragObj_New(DragReference);
extern int DragObj_Convert(PyObject *, DragReference *);
+#endif /* !__LP64__ */
/* List exports */
+#ifndef __LP64__
extern PyObject *ListObj_New(ListHandle);
extern int ListObj_Convert(PyObject *, ListHandle *);
+#endif /* !__LP64__ */
/* Menu exports */
+#ifndef __LP64__
extern PyObject *MenuObj_New(MenuHandle);
extern int MenuObj_Convert(PyObject *, MenuHandle *);
+#endif /* !__LP64__ */
/* Qd exports */
+#ifndef __LP64__
extern PyObject *GrafObj_New(GrafPtr);
extern int GrafObj_Convert(PyObject *, GrafPtr *);
extern PyObject *BMObj_New(BitMapPtr);
extern int BMObj_Convert(PyObject *, BitMapPtr *);
extern PyObject *QdRGB_New(RGBColor *);
extern int QdRGB_Convert(PyObject *, RGBColor *);
+#endif /* !__LP64__ */
/* Qdoffs exports */
+#ifndef __LP64__
extern PyObject *GWorldObj_New(GWorldPtr);
extern int GWorldObj_Convert(PyObject *, GWorldPtr *);
+#endif /* !__LP64__ */
/* Qt exports */
+#ifndef __LP64__
extern PyObject *TrackObj_New(Track);
extern int TrackObj_Convert(PyObject *, Track *);
extern PyObject *MovieObj_New(Movie);
@@ -146,6 +169,7 @@
extern int UserDataObj_Convert(PyObject *, UserData *);
extern PyObject *MediaObj_New(Media);
extern int MediaObj_Convert(PyObject *, Media *);
+#endif /* !__LP64__ */
/* Res exports */
extern PyObject *ResObj_New(Handle);
@@ -154,13 +178,17 @@
extern int OptResObj_Convert(PyObject *, Handle *);
/* TE exports */
+#ifndef __LP64__
extern PyObject *TEObj_New(TEHandle);
extern int TEObj_Convert(PyObject *, TEHandle *);
+#endif /* !__LP64__ */
/* Win exports */
+#ifndef __LP64__
extern PyObject *WinObj_New(WindowPtr);
extern int WinObj_Convert(PyObject *, WindowPtr *);
extern PyObject *WinObj_WhichWindow(WindowPtr);
+#endif /* !__LP64__ */
/* CF exports */
extern PyObject *CFObj_New(CFTypeRef);
diff -r -u ./Mac/Modules/res/_Resmodule.c ../Python-2.5/Mac/Modules/res/_Resmodule.c
--- ./Mac/Modules/res/_Resmodule.c 2005-07-04 05:59:44.000000000 +0900
+++ ../Python-2.5/Mac/Modules/res/_Resmodule.c 2013-07-17 23:38:51.000000000 +0900
@@ -414,6 +414,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *ResObj_as_Control(ResourceObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -431,6 +432,7 @@
return _res;
}
+#endif /* !__LP64__ */
static PyObject *ResObj_LoadResource(ResourceObject *_self, PyObject *_args)
{
@@ -1152,6 +1154,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *Res_OpenRFPerm(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1287,6 +1290,7 @@
_res = Py_None;
return _res;
}
+#endif /* !__LP64__ */
static PyObject *Res_InsertResourceFile(PyObject *_self, PyObject *_args)
{
@@ -1327,6 +1331,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *Res_FSpResourceFileAlreadyOpen(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1413,6 +1418,7 @@
nextRefNum);
return _res;
}
+#endif /* !__LP64__ */
static PyObject *Res_FSOpenResFile(PyObject *_self, PyObject *_args)
{
@@ -1438,6 +1444,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *Res_FSCreateResFile(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1534,6 +1541,7 @@
PyMac_BuildFSSpec, &newSpec);
return _res;
}
+#endif /* __LP64__ */
static PyObject *Res_FSOpenResourceFile(PyObject *_self, PyObject *_args)
{
@@ -1637,6 +1645,7 @@
PyDoc_STR("(short refNum) -> (short _rv)")},
{"SetResFileAttrs", (PyCFunction)Res_SetResFileAttrs, 1,
PyDoc_STR("(short refNum, short attrs) -> None")},
+#ifndef __LP64__
{"OpenRFPerm", (PyCFunction)Res_OpenRFPerm, 1,
PyDoc_STR("(Str255 fileName, short vRefNum, SignedByte permission) -> (short _rv)")},
{"HOpenResFile", (PyCFunction)Res_HOpenResFile, 1,
@@ -1647,10 +1656,12 @@
PyDoc_STR("(FSSpec spec, SignedByte permission) -> (short _rv)")},
{"FSpCreateResFile", (PyCFunction)Res_FSpCreateResFile, 1,
PyDoc_STR("(FSSpec spec, OSType creator, OSType fileType, ScriptCode scriptTag) -> None")},
+#endif /* !__LP64__ */
{"InsertResourceFile", (PyCFunction)Res_InsertResourceFile, 1,
PyDoc_STR("(SInt16 refNum, RsrcChainLocation where) -> None")},
{"DetachResourceFile", (PyCFunction)Res_DetachResourceFile, 1,
PyDoc_STR("(SInt16 refNum) -> None")},
+#ifndef __LP64__
{"FSpResourceFileAlreadyOpen", (PyCFunction)Res_FSpResourceFileAlreadyOpen, 1,
PyDoc_STR("(FSSpec resourceFile) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")},
{"FSpOpenOrphanResFile", (PyCFunction)Res_FSpOpenOrphanResFile, 1,
@@ -1659,14 +1670,17 @@
PyDoc_STR("() -> (SInt16 refNum)")},
{"GetNextResourceFile", (PyCFunction)Res_GetNextResourceFile, 1,
PyDoc_STR("(SInt16 curRefNum) -> (SInt16 nextRefNum)")},
+#endif /* __LP64__ */
{"FSOpenResFile", (PyCFunction)Res_FSOpenResFile, 1,
PyDoc_STR("(FSRef ref, SignedByte permission) -> (short _rv)")},
+#ifndef __LP64__
{"FSCreateResFile", (PyCFunction)Res_FSCreateResFile, 1,
PyDoc_STR("(FSRef parentRef, Buffer nameLength) -> (FSRef newRef, FSSpec newSpec)")},
{"FSResourceFileAlreadyOpen", (PyCFunction)Res_FSResourceFileAlreadyOpen, 1,
PyDoc_STR("(FSRef resourceFileRef) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")},
{"FSCreateResourceFile", (PyCFunction)Res_FSCreateResourceFile, 1,
PyDoc_STR("(FSRef parentRef, Buffer nameLength, Buffer forkNameLength) -> (FSRef newRef, FSSpec newSpec)")},
+#endif /* __LP64__ */
{"FSOpenResourceFile", (PyCFunction)Res_FSOpenResourceFile, 1,
PyDoc_STR("(FSRef ref, Buffer forkNameLength, SignedByte permissions) -> (SInt16 refNum)")},
{"Handle", (PyCFunction)Res_Handle, 1,
diff -r -u ./Modules/_ctypes/libffi/src/darwin/ffitarget.h ../Python-2.5/Modules/_ctypes/libffi/src/darwin/ffitarget.h
--- ./Modules/_ctypes/libffi/src/darwin/ffitarget.h 2006-05-26 06:58:05.000000000 +0900
+++ ../Python-2.5/Modules/_ctypes/libffi/src/darwin/ffitarget.h 2013-07-17 23:38:51.000000000 +0900
@@ -4,7 +4,7 @@
* created by configure). This makes is possible to build a univeral binary
* of ctypes in one go.
*/
-#if defined(__i386__)
+#if defined(__i386__) || defined(__x86_64__)
#ifndef X86_DARWIN
#define X86_DARWIN
diff -r -u ./Python/mactoolboxglue.c ../Python-2.5/Python/mactoolboxglue.c
--- ./Python/mactoolboxglue.c 2006-07-12 01:44:25.000000000 +0900
+++ ../Python-2.5/Python/mactoolboxglue.c 2013-07-17 23:39:09.000000000 +0900
@@ -106,6 +106,7 @@
}
+#ifndef __LP64__
OSErr
PyMac_GetFullPathname(FSSpec *fss, char *path, int len)
{
@@ -153,6 +154,7 @@
Py_XDECREF(fs);
return err;
}
+#endif /* !__LP64__ */
/* Convert a 4-char string object argument to an OSType value */
int
@@ -417,6 +419,7 @@
GLUE_NEW(GWorldPtr, GWorldObj_New, "Carbon.Qdoffs")
GLUE_CONVERT(GWorldPtr, GWorldObj_Convert, "Carbon.Qdoffs")
+#ifndef __LP64__
GLUE_NEW(Track, TrackObj_New, "Carbon.Qt")
GLUE_CONVERT(Track, TrackObj_Convert, "Carbon.Qt")
GLUE_NEW(Movie, MovieObj_New, "Carbon.Qt")
@@ -429,6 +432,7 @@
GLUE_CONVERT(UserData, UserDataObj_Convert, "Carbon.Qt")
GLUE_NEW(Media, MediaObj_New, "Carbon.Qt")
GLUE_CONVERT(Media, MediaObj_Convert, "Carbon.Qt")
+#endif /* !__LP64__ */
GLUE_NEW(Handle, ResObj_New, "Carbon.Res")
GLUE_CONVERT(Handle, ResObj_Convert, "Carbon.Res")

View file

@ -0,0 +1,166 @@
diff -r -u ./configure ../Python-2.5/configure
--- ./configure 2006-09-05 11:54:42.000000000 +0900
+++ ../Python-2.5/configure 2013-07-19 15:27:46.000000000 +0900
@@ -1396,6 +1396,16 @@
_ACEOF
+# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
+# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
+# them.
+
+cat >>confdefs.h <<\_ACEOF
+#define _DARWIN_C_SOURCE 1
+_ACEOF
+
+
+
define_xopen_source=yes
# Arguments passed to configure.
@@ -3885,11 +3895,110 @@
;;
# is there any other compiler on Darwin besides gcc?
Darwin*)
- BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
+ # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
+ # used to be here, but non-Apple gcc doesn't accept them.
+ if test "${CC}" = gcc
+ then
+ { echo "$as_me:${as_lineno-$LINENO}: checking which compiler should be used" >&5
+echo -n "checking which compiler should be used... " >&6; }
+ case "${UNIVERSALSDK}" in
+ */MacOSX10.4u.sdk)
+ # Build using 10.4 SDK, force usage of gcc when the
+ # compiler is gcc, otherwise the user will get very
+ # confusing error messages when building on OSX 10.6
+ CC=gcc-4.0
+ CPP=cpp-4.0
+ ;;
+ esac
+ { echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+echo "$CC" >&6; }
+ fi
+
+
if test "${enable_universalsdk}"; then
- BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
+ UNIVERSAL_ARCH_FLAGS=""
+ if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
+ ARCH_RUN_32BIT=""
+ LIPO_32BIT_FLAGS=""
+ elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
+ LIPO_32BIT_FLAGS=""
+ ARCH_RUN_32BIT="true"
+
+ elif test "$UNIVERSAL_ARCHS" = "all" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
+ LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
+ ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
+
+ elif test "$UNIVERSAL_ARCHS" = "intel" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
+ LIPO_32BIT_FLAGS="-extract i386"
+ ARCH_RUN_32BIT="/usr/bin/arch -i386"
+
+ elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
+ LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
+ ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
+
+ else
+ as_fn_error $? "proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way" "$LINENO" 5
+
+ fi
+
+
+ CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
+ if test "${UNIVERSALSDK}" != "/"
+ then
+ CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}"
+ LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}"
+ CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
+ fi
fi
+ # Calculate the right deployment target for this build.
+ #
+ cur_target=`sw_vers -productVersion | sed 's/\(10\.[0-9]*\).*/\1/'`
+ if test ${cur_target} '>' 10.2 && \
+ test ${cur_target} '<' 10.6
+ then
+ cur_target=10.3
+ if test ${enable_universalsdk}; then
+ if test "${UNIVERSAL_ARCHS}" = "all"; then
+ # Ensure that the default platform for a
+ # 4-way universal build is OSX 10.5,
+ # that's the first OS release where
+ # 4-way builds make sense.
+ cur_target='10.5'
+
+ elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
+ cur_target='10.5'
+
+ elif test "${UNIVERSAL_ARCHS}" = "intel"; then
+ cur_target='10.5'
+
+ elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
+ cur_target='10.5'
+ fi
+ else
+ if test `/usr/bin/arch` = "i386"; then
+ # On Intel macs default to a deployment
+ # target of 10.4, that's the first OSX
+ # release with Intel support.
+ cur_target="10.4"
+ fi
+ fi
+ fi
+ CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
+
+ # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
+ # environment with a value that is the same as what we'll use
+ # in the Makefile to ensure that we'll get the same compiler
+ # environment during configure and build time.
+ MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
+ export MACOSX_DEPLOYMENT_TARGET
+ EXPORT_MACOSX_DEPLOYMENT_TARGET=''
+
;;
OSF*)
BASECFLAGS="$BASECFLAGS -mieee"
@@ -10851,7 +10960,7 @@
if test "${enable_universalsdk}"; then
:
else
- LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
+ LIBTOOL_CRUFT="${LIBTOOL_CRUFT}"
fi
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
@@ -10863,7 +10972,7 @@
else
LIBTOOL_CRUFT=""
fi
- LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only `arch`"
+ LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs"
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
esac
diff -r -u ./pyconfig.h.in ../Python-2.5/pyconfig.h.in
--- ./pyconfig.h.in 2006-07-30 23:09:47.000000000 +0900
+++ ../Python-2.5/pyconfig.h.in 2013-07-17 23:12:31.000000000 +0900
@@ -912,6 +912,11 @@
/* Define on Irix to enable u_int */
#undef _BSD_TYPES
+/* Define on Darwin to activate all library features */
+#ifndef _DARWIN_C_SOURCE
+#define _DARWIN_C_SOURCE
+#endif
+
/* This must be set to 64 on some systems to enable large file support. */
#undef _FILE_OFFSET_BITS

View file

@ -0,0 +1,271 @@
diff -r -u ./Include/pymactoolbox.h ../Python-2.5/Include/pymactoolbox.h
--- ./Include/pymactoolbox.h 2004-11-05 16:02:59.000000000 +0900
+++ ../Python-2.5/Include/pymactoolbox.h 2013-07-17 23:38:51.000000000 +0900
@@ -8,7 +8,10 @@
#endif
#include <Carbon/Carbon.h>
+
+#ifndef __LP64__
#include <QuickTime/QuickTime.h>
+#endif /* !__LP64__ */
/*
** Helper routines for error codes and such.
@@ -18,8 +21,11 @@
PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */
PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */
PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */
+#ifndef __LP64__
extern OSErr PyMac_GetFullPathname(FSSpec *, char *, int); /* convert
fsspec->path */
+#endif /* __LP64__ */
+
/*
** These conversion routines are defined in mactoolboxglue.c itself.
*/
@@ -83,8 +89,10 @@
#endif /* USE_TOOLBOX_OBJECT_GLUE */
/* macfs exports */
+#ifndef __LP64__
int PyMac_GetFSSpec(PyObject *, FSSpec *); /* argument parser for FSSpec */
PyObject *PyMac_BuildFSSpec(FSSpec *); /* Convert FSSpec to PyObject */
+#endif /* !__LP64__ */
int PyMac_GetFSRef(PyObject *, FSRef *); /* argument parser for FSRef */
PyObject *PyMac_BuildFSRef(FSRef *); /* Convert FSRef to PyObject */
@@ -101,39 +109,54 @@
extern int CmpInstObj_Convert(PyObject *, ComponentInstance *);
/* Ctl exports */
+#ifndef __LP64__
extern PyObject *CtlObj_New(ControlHandle);
extern int CtlObj_Convert(PyObject *, ControlHandle *);
+#endif /* !__LP64__ */
/* Dlg exports */
+#ifndef __LP64__
extern PyObject *DlgObj_New(DialogPtr);
extern int DlgObj_Convert(PyObject *, DialogPtr *);
extern PyObject *DlgObj_WhichDialog(DialogPtr);
+#endif /* !__LP64__ */
/* Drag exports */
+#ifndef __LP64__
extern PyObject *DragObj_New(DragReference);
extern int DragObj_Convert(PyObject *, DragReference *);
+#endif /* !__LP64__ */
/* List exports */
+#ifndef __LP64__
extern PyObject *ListObj_New(ListHandle);
extern int ListObj_Convert(PyObject *, ListHandle *);
+#endif /* !__LP64__ */
/* Menu exports */
+#ifndef __LP64__
extern PyObject *MenuObj_New(MenuHandle);
extern int MenuObj_Convert(PyObject *, MenuHandle *);
+#endif /* !__LP64__ */
/* Qd exports */
+#ifndef __LP64__
extern PyObject *GrafObj_New(GrafPtr);
extern int GrafObj_Convert(PyObject *, GrafPtr *);
extern PyObject *BMObj_New(BitMapPtr);
extern int BMObj_Convert(PyObject *, BitMapPtr *);
extern PyObject *QdRGB_New(RGBColor *);
extern int QdRGB_Convert(PyObject *, RGBColor *);
+#endif /* !__LP64__ */
/* Qdoffs exports */
+#ifndef __LP64__
extern PyObject *GWorldObj_New(GWorldPtr);
extern int GWorldObj_Convert(PyObject *, GWorldPtr *);
+#endif /* !__LP64__ */
/* Qt exports */
+#ifndef __LP64__
extern PyObject *TrackObj_New(Track);
extern int TrackObj_Convert(PyObject *, Track *);
extern PyObject *MovieObj_New(Movie);
@@ -146,6 +169,7 @@
extern int UserDataObj_Convert(PyObject *, UserData *);
extern PyObject *MediaObj_New(Media);
extern int MediaObj_Convert(PyObject *, Media *);
+#endif /* !__LP64__ */
/* Res exports */
extern PyObject *ResObj_New(Handle);
@@ -154,13 +178,17 @@
extern int OptResObj_Convert(PyObject *, Handle *);
/* TE exports */
+#ifndef __LP64__
extern PyObject *TEObj_New(TEHandle);
extern int TEObj_Convert(PyObject *, TEHandle *);
+#endif /* !__LP64__ */
/* Win exports */
+#ifndef __LP64__
extern PyObject *WinObj_New(WindowPtr);
extern int WinObj_Convert(PyObject *, WindowPtr *);
extern PyObject *WinObj_WhichWindow(WindowPtr);
+#endif /* !__LP64__ */
/* CF exports */
extern PyObject *CFObj_New(CFTypeRef);
diff -r -u ./Mac/Modules/res/_Resmodule.c ../Python-2.5/Mac/Modules/res/_Resmodule.c
--- ./Mac/Modules/res/_Resmodule.c 2005-07-04 05:59:44.000000000 +0900
+++ ../Python-2.5/Mac/Modules/res/_Resmodule.c 2013-07-17 23:38:51.000000000 +0900
@@ -414,6 +414,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *ResObj_as_Control(ResourceObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -431,6 +432,7 @@
return _res;
}
+#endif /* !__LP64__ */
static PyObject *ResObj_LoadResource(ResourceObject *_self, PyObject *_args)
{
@@ -1152,6 +1154,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *Res_OpenRFPerm(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1287,6 +1290,7 @@
_res = Py_None;
return _res;
}
+#endif /* !__LP64__ */
static PyObject *Res_InsertResourceFile(PyObject *_self, PyObject *_args)
{
@@ -1327,6 +1331,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *Res_FSpResourceFileAlreadyOpen(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1413,6 +1418,7 @@
nextRefNum);
return _res;
}
+#endif /* !__LP64__ */
static PyObject *Res_FSOpenResFile(PyObject *_self, PyObject *_args)
{
@@ -1438,6 +1444,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *Res_FSCreateResFile(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1534,6 +1541,7 @@
PyMac_BuildFSSpec, &newSpec);
return _res;
}
+#endif /* __LP64__ */
static PyObject *Res_FSOpenResourceFile(PyObject *_self, PyObject *_args)
{
@@ -1637,6 +1645,7 @@
PyDoc_STR("(short refNum) -> (short _rv)")},
{"SetResFileAttrs", (PyCFunction)Res_SetResFileAttrs, 1,
PyDoc_STR("(short refNum, short attrs) -> None")},
+#ifndef __LP64__
{"OpenRFPerm", (PyCFunction)Res_OpenRFPerm, 1,
PyDoc_STR("(Str255 fileName, short vRefNum, SignedByte permission) -> (short _rv)")},
{"HOpenResFile", (PyCFunction)Res_HOpenResFile, 1,
@@ -1647,10 +1656,12 @@
PyDoc_STR("(FSSpec spec, SignedByte permission) -> (short _rv)")},
{"FSpCreateResFile", (PyCFunction)Res_FSpCreateResFile, 1,
PyDoc_STR("(FSSpec spec, OSType creator, OSType fileType, ScriptCode scriptTag) -> None")},
+#endif /* !__LP64__ */
{"InsertResourceFile", (PyCFunction)Res_InsertResourceFile, 1,
PyDoc_STR("(SInt16 refNum, RsrcChainLocation where) -> None")},
{"DetachResourceFile", (PyCFunction)Res_DetachResourceFile, 1,
PyDoc_STR("(SInt16 refNum) -> None")},
+#ifndef __LP64__
{"FSpResourceFileAlreadyOpen", (PyCFunction)Res_FSpResourceFileAlreadyOpen, 1,
PyDoc_STR("(FSSpec resourceFile) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")},
{"FSpOpenOrphanResFile", (PyCFunction)Res_FSpOpenOrphanResFile, 1,
@@ -1659,14 +1670,17 @@
PyDoc_STR("() -> (SInt16 refNum)")},
{"GetNextResourceFile", (PyCFunction)Res_GetNextResourceFile, 1,
PyDoc_STR("(SInt16 curRefNum) -> (SInt16 nextRefNum)")},
+#endif /* __LP64__ */
{"FSOpenResFile", (PyCFunction)Res_FSOpenResFile, 1,
PyDoc_STR("(FSRef ref, SignedByte permission) -> (short _rv)")},
+#ifndef __LP64__
{"FSCreateResFile", (PyCFunction)Res_FSCreateResFile, 1,
PyDoc_STR("(FSRef parentRef, Buffer nameLength) -> (FSRef newRef, FSSpec newSpec)")},
{"FSResourceFileAlreadyOpen", (PyCFunction)Res_FSResourceFileAlreadyOpen, 1,
PyDoc_STR("(FSRef resourceFileRef) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")},
{"FSCreateResourceFile", (PyCFunction)Res_FSCreateResourceFile, 1,
PyDoc_STR("(FSRef parentRef, Buffer nameLength, Buffer forkNameLength) -> (FSRef newRef, FSSpec newSpec)")},
+#endif /* __LP64__ */
{"FSOpenResourceFile", (PyCFunction)Res_FSOpenResourceFile, 1,
PyDoc_STR("(FSRef ref, Buffer forkNameLength, SignedByte permissions) -> (SInt16 refNum)")},
{"Handle", (PyCFunction)Res_Handle, 1,
diff -r -u ./Modules/_ctypes/libffi/src/darwin/ffitarget.h ../Python-2.5/Modules/_ctypes/libffi/src/darwin/ffitarget.h
--- ./Modules/_ctypes/libffi/src/darwin/ffitarget.h 2006-05-26 06:58:05.000000000 +0900
+++ ../Python-2.5/Modules/_ctypes/libffi/src/darwin/ffitarget.h 2013-07-17 23:38:51.000000000 +0900
@@ -4,7 +4,7 @@
* created by configure). This makes is possible to build a univeral binary
* of ctypes in one go.
*/
-#if defined(__i386__)
+#if defined(__i386__) || defined(__x86_64__)
#ifndef X86_DARWIN
#define X86_DARWIN
diff -r -u ./Python/mactoolboxglue.c ../Python-2.5/Python/mactoolboxglue.c
--- ./Python/mactoolboxglue.c 2006-07-12 01:44:25.000000000 +0900
+++ ../Python-2.5/Python/mactoolboxglue.c 2013-07-17 23:39:09.000000000 +0900
@@ -106,6 +106,7 @@
}
+#ifndef __LP64__
OSErr
PyMac_GetFullPathname(FSSpec *fss, char *path, int len)
{
@@ -153,6 +154,7 @@
Py_XDECREF(fs);
return err;
}
+#endif /* !__LP64__ */
/* Convert a 4-char string object argument to an OSType value */
int
@@ -417,6 +419,7 @@
GLUE_NEW(GWorldPtr, GWorldObj_New, "Carbon.Qdoffs")
GLUE_CONVERT(GWorldPtr, GWorldObj_Convert, "Carbon.Qdoffs")
+#ifndef __LP64__
GLUE_NEW(Track, TrackObj_New, "Carbon.Qt")
GLUE_CONVERT(Track, TrackObj_Convert, "Carbon.Qt")
GLUE_NEW(Movie, MovieObj_New, "Carbon.Qt")
@@ -429,6 +432,7 @@
GLUE_CONVERT(UserData, UserDataObj_Convert, "Carbon.Qt")
GLUE_NEW(Media, MediaObj_New, "Carbon.Qt")
GLUE_CONVERT(Media, MediaObj_Convert, "Carbon.Qt")
+#endif /* !__LP64__ */
GLUE_NEW(Handle, ResObj_New, "Carbon.Res")
GLUE_CONVERT(Handle, ResObj_Convert, "Carbon.Res")

View file

@ -0,0 +1,166 @@
diff -r -u ./configure ../Python-2.5/configure
--- ./configure 2006-09-05 11:54:42.000000000 +0900
+++ ../Python-2.5/configure 2013-07-19 15:27:46.000000000 +0900
@@ -1396,6 +1396,16 @@
_ACEOF
+# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
+# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
+# them.
+
+cat >>confdefs.h <<\_ACEOF
+#define _DARWIN_C_SOURCE 1
+_ACEOF
+
+
+
define_xopen_source=yes
# Arguments passed to configure.
@@ -3885,11 +3895,110 @@
;;
# is there any other compiler on Darwin besides gcc?
Darwin*)
- BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
+ # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
+ # used to be here, but non-Apple gcc doesn't accept them.
+ if test "${CC}" = gcc
+ then
+ { echo "$as_me:${as_lineno-$LINENO}: checking which compiler should be used" >&5
+echo -n "checking which compiler should be used... " >&6; }
+ case "${UNIVERSALSDK}" in
+ */MacOSX10.4u.sdk)
+ # Build using 10.4 SDK, force usage of gcc when the
+ # compiler is gcc, otherwise the user will get very
+ # confusing error messages when building on OSX 10.6
+ CC=gcc-4.0
+ CPP=cpp-4.0
+ ;;
+ esac
+ { echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+echo "$CC" >&6; }
+ fi
+
+
if test "${enable_universalsdk}"; then
- BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
+ UNIVERSAL_ARCH_FLAGS=""
+ if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
+ ARCH_RUN_32BIT=""
+ LIPO_32BIT_FLAGS=""
+ elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
+ LIPO_32BIT_FLAGS=""
+ ARCH_RUN_32BIT="true"
+
+ elif test "$UNIVERSAL_ARCHS" = "all" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
+ LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
+ ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
+
+ elif test "$UNIVERSAL_ARCHS" = "intel" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
+ LIPO_32BIT_FLAGS="-extract i386"
+ ARCH_RUN_32BIT="/usr/bin/arch -i386"
+
+ elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
+ LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
+ ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
+
+ else
+ as_fn_error $? "proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way" "$LINENO" 5
+
+ fi
+
+
+ CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
+ if test "${UNIVERSALSDK}" != "/"
+ then
+ CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}"
+ LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}"
+ CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
+ fi
fi
+ # Calculate the right deployment target for this build.
+ #
+ cur_target=`sw_vers -productVersion | sed 's/\(10\.[0-9]*\).*/\1/'`
+ if test ${cur_target} '>' 10.2 && \
+ test ${cur_target} '<' 10.6
+ then
+ cur_target=10.3
+ if test ${enable_universalsdk}; then
+ if test "${UNIVERSAL_ARCHS}" = "all"; then
+ # Ensure that the default platform for a
+ # 4-way universal build is OSX 10.5,
+ # that's the first OS release where
+ # 4-way builds make sense.
+ cur_target='10.5'
+
+ elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
+ cur_target='10.5'
+
+ elif test "${UNIVERSAL_ARCHS}" = "intel"; then
+ cur_target='10.5'
+
+ elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
+ cur_target='10.5'
+ fi
+ else
+ if test `/usr/bin/arch` = "i386"; then
+ # On Intel macs default to a deployment
+ # target of 10.4, that's the first OSX
+ # release with Intel support.
+ cur_target="10.4"
+ fi
+ fi
+ fi
+ CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
+
+ # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
+ # environment with a value that is the same as what we'll use
+ # in the Makefile to ensure that we'll get the same compiler
+ # environment during configure and build time.
+ MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
+ export MACOSX_DEPLOYMENT_TARGET
+ EXPORT_MACOSX_DEPLOYMENT_TARGET=''
+
;;
OSF*)
BASECFLAGS="$BASECFLAGS -mieee"
@@ -10851,7 +10960,7 @@
if test "${enable_universalsdk}"; then
:
else
- LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
+ LIBTOOL_CRUFT="${LIBTOOL_CRUFT}"
fi
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
@@ -10863,7 +10972,7 @@
else
LIBTOOL_CRUFT=""
fi
- LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only `arch`"
+ LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs"
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
esac
diff -r -u ./pyconfig.h.in ../Python-2.5/pyconfig.h.in
--- ./pyconfig.h.in 2006-07-30 23:09:47.000000000 +0900
+++ ../Python-2.5/pyconfig.h.in 2013-07-17 23:12:31.000000000 +0900
@@ -912,6 +912,11 @@
/* Define on Irix to enable u_int */
#undef _BSD_TYPES
+/* Define on Darwin to activate all library features */
+#ifndef _DARWIN_C_SOURCE
+#define _DARWIN_C_SOURCE
+#endif
+
/* This must be set to 64 on some systems to enable large file support. */
#undef _FILE_OFFSET_BITS

View file

@ -0,0 +1,271 @@
diff -r -u ./Include/pymactoolbox.h ../Python-2.5/Include/pymactoolbox.h
--- ./Include/pymactoolbox.h 2004-11-05 16:02:59.000000000 +0900
+++ ../Python-2.5/Include/pymactoolbox.h 2013-07-17 23:38:51.000000000 +0900
@@ -8,7 +8,10 @@
#endif
#include <Carbon/Carbon.h>
+
+#ifndef __LP64__
#include <QuickTime/QuickTime.h>
+#endif /* !__LP64__ */
/*
** Helper routines for error codes and such.
@@ -18,8 +21,11 @@
PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */
PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */
PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */
+#ifndef __LP64__
extern OSErr PyMac_GetFullPathname(FSSpec *, char *, int); /* convert
fsspec->path */
+#endif /* __LP64__ */
+
/*
** These conversion routines are defined in mactoolboxglue.c itself.
*/
@@ -83,8 +89,10 @@
#endif /* USE_TOOLBOX_OBJECT_GLUE */
/* macfs exports */
+#ifndef __LP64__
int PyMac_GetFSSpec(PyObject *, FSSpec *); /* argument parser for FSSpec */
PyObject *PyMac_BuildFSSpec(FSSpec *); /* Convert FSSpec to PyObject */
+#endif /* !__LP64__ */
int PyMac_GetFSRef(PyObject *, FSRef *); /* argument parser for FSRef */
PyObject *PyMac_BuildFSRef(FSRef *); /* Convert FSRef to PyObject */
@@ -101,39 +109,54 @@
extern int CmpInstObj_Convert(PyObject *, ComponentInstance *);
/* Ctl exports */
+#ifndef __LP64__
extern PyObject *CtlObj_New(ControlHandle);
extern int CtlObj_Convert(PyObject *, ControlHandle *);
+#endif /* !__LP64__ */
/* Dlg exports */
+#ifndef __LP64__
extern PyObject *DlgObj_New(DialogPtr);
extern int DlgObj_Convert(PyObject *, DialogPtr *);
extern PyObject *DlgObj_WhichDialog(DialogPtr);
+#endif /* !__LP64__ */
/* Drag exports */
+#ifndef __LP64__
extern PyObject *DragObj_New(DragReference);
extern int DragObj_Convert(PyObject *, DragReference *);
+#endif /* !__LP64__ */
/* List exports */
+#ifndef __LP64__
extern PyObject *ListObj_New(ListHandle);
extern int ListObj_Convert(PyObject *, ListHandle *);
+#endif /* !__LP64__ */
/* Menu exports */
+#ifndef __LP64__
extern PyObject *MenuObj_New(MenuHandle);
extern int MenuObj_Convert(PyObject *, MenuHandle *);
+#endif /* !__LP64__ */
/* Qd exports */
+#ifndef __LP64__
extern PyObject *GrafObj_New(GrafPtr);
extern int GrafObj_Convert(PyObject *, GrafPtr *);
extern PyObject *BMObj_New(BitMapPtr);
extern int BMObj_Convert(PyObject *, BitMapPtr *);
extern PyObject *QdRGB_New(RGBColor *);
extern int QdRGB_Convert(PyObject *, RGBColor *);
+#endif /* !__LP64__ */
/* Qdoffs exports */
+#ifndef __LP64__
extern PyObject *GWorldObj_New(GWorldPtr);
extern int GWorldObj_Convert(PyObject *, GWorldPtr *);
+#endif /* !__LP64__ */
/* Qt exports */
+#ifndef __LP64__
extern PyObject *TrackObj_New(Track);
extern int TrackObj_Convert(PyObject *, Track *);
extern PyObject *MovieObj_New(Movie);
@@ -146,6 +169,7 @@
extern int UserDataObj_Convert(PyObject *, UserData *);
extern PyObject *MediaObj_New(Media);
extern int MediaObj_Convert(PyObject *, Media *);
+#endif /* !__LP64__ */
/* Res exports */
extern PyObject *ResObj_New(Handle);
@@ -154,13 +178,17 @@
extern int OptResObj_Convert(PyObject *, Handle *);
/* TE exports */
+#ifndef __LP64__
extern PyObject *TEObj_New(TEHandle);
extern int TEObj_Convert(PyObject *, TEHandle *);
+#endif /* !__LP64__ */
/* Win exports */
+#ifndef __LP64__
extern PyObject *WinObj_New(WindowPtr);
extern int WinObj_Convert(PyObject *, WindowPtr *);
extern PyObject *WinObj_WhichWindow(WindowPtr);
+#endif /* !__LP64__ */
/* CF exports */
extern PyObject *CFObj_New(CFTypeRef);
diff -r -u ./Mac/Modules/res/_Resmodule.c ../Python-2.5/Mac/Modules/res/_Resmodule.c
--- ./Mac/Modules/res/_Resmodule.c 2005-07-04 05:59:44.000000000 +0900
+++ ../Python-2.5/Mac/Modules/res/_Resmodule.c 2013-07-17 23:38:51.000000000 +0900
@@ -414,6 +414,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *ResObj_as_Control(ResourceObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -431,6 +432,7 @@
return _res;
}
+#endif /* !__LP64__ */
static PyObject *ResObj_LoadResource(ResourceObject *_self, PyObject *_args)
{
@@ -1152,6 +1154,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *Res_OpenRFPerm(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1287,6 +1290,7 @@
_res = Py_None;
return _res;
}
+#endif /* !__LP64__ */
static PyObject *Res_InsertResourceFile(PyObject *_self, PyObject *_args)
{
@@ -1327,6 +1331,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *Res_FSpResourceFileAlreadyOpen(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1413,6 +1418,7 @@
nextRefNum);
return _res;
}
+#endif /* !__LP64__ */
static PyObject *Res_FSOpenResFile(PyObject *_self, PyObject *_args)
{
@@ -1438,6 +1444,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *Res_FSCreateResFile(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1534,6 +1541,7 @@
PyMac_BuildFSSpec, &newSpec);
return _res;
}
+#endif /* __LP64__ */
static PyObject *Res_FSOpenResourceFile(PyObject *_self, PyObject *_args)
{
@@ -1637,6 +1645,7 @@
PyDoc_STR("(short refNum) -> (short _rv)")},
{"SetResFileAttrs", (PyCFunction)Res_SetResFileAttrs, 1,
PyDoc_STR("(short refNum, short attrs) -> None")},
+#ifndef __LP64__
{"OpenRFPerm", (PyCFunction)Res_OpenRFPerm, 1,
PyDoc_STR("(Str255 fileName, short vRefNum, SignedByte permission) -> (short _rv)")},
{"HOpenResFile", (PyCFunction)Res_HOpenResFile, 1,
@@ -1647,10 +1656,12 @@
PyDoc_STR("(FSSpec spec, SignedByte permission) -> (short _rv)")},
{"FSpCreateResFile", (PyCFunction)Res_FSpCreateResFile, 1,
PyDoc_STR("(FSSpec spec, OSType creator, OSType fileType, ScriptCode scriptTag) -> None")},
+#endif /* !__LP64__ */
{"InsertResourceFile", (PyCFunction)Res_InsertResourceFile, 1,
PyDoc_STR("(SInt16 refNum, RsrcChainLocation where) -> None")},
{"DetachResourceFile", (PyCFunction)Res_DetachResourceFile, 1,
PyDoc_STR("(SInt16 refNum) -> None")},
+#ifndef __LP64__
{"FSpResourceFileAlreadyOpen", (PyCFunction)Res_FSpResourceFileAlreadyOpen, 1,
PyDoc_STR("(FSSpec resourceFile) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")},
{"FSpOpenOrphanResFile", (PyCFunction)Res_FSpOpenOrphanResFile, 1,
@@ -1659,14 +1670,17 @@
PyDoc_STR("() -> (SInt16 refNum)")},
{"GetNextResourceFile", (PyCFunction)Res_GetNextResourceFile, 1,
PyDoc_STR("(SInt16 curRefNum) -> (SInt16 nextRefNum)")},
+#endif /* __LP64__ */
{"FSOpenResFile", (PyCFunction)Res_FSOpenResFile, 1,
PyDoc_STR("(FSRef ref, SignedByte permission) -> (short _rv)")},
+#ifndef __LP64__
{"FSCreateResFile", (PyCFunction)Res_FSCreateResFile, 1,
PyDoc_STR("(FSRef parentRef, Buffer nameLength) -> (FSRef newRef, FSSpec newSpec)")},
{"FSResourceFileAlreadyOpen", (PyCFunction)Res_FSResourceFileAlreadyOpen, 1,
PyDoc_STR("(FSRef resourceFileRef) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")},
{"FSCreateResourceFile", (PyCFunction)Res_FSCreateResourceFile, 1,
PyDoc_STR("(FSRef parentRef, Buffer nameLength, Buffer forkNameLength) -> (FSRef newRef, FSSpec newSpec)")},
+#endif /* __LP64__ */
{"FSOpenResourceFile", (PyCFunction)Res_FSOpenResourceFile, 1,
PyDoc_STR("(FSRef ref, Buffer forkNameLength, SignedByte permissions) -> (SInt16 refNum)")},
{"Handle", (PyCFunction)Res_Handle, 1,
diff -r -u ./Modules/_ctypes/libffi/src/darwin/ffitarget.h ../Python-2.5/Modules/_ctypes/libffi/src/darwin/ffitarget.h
--- ./Modules/_ctypes/libffi/src/darwin/ffitarget.h 2006-05-26 06:58:05.000000000 +0900
+++ ../Python-2.5/Modules/_ctypes/libffi/src/darwin/ffitarget.h 2013-07-17 23:38:51.000000000 +0900
@@ -4,7 +4,7 @@
* created by configure). This makes is possible to build a univeral binary
* of ctypes in one go.
*/
-#if defined(__i386__)
+#if defined(__i386__) || defined(__x86_64__)
#ifndef X86_DARWIN
#define X86_DARWIN
diff -r -u ./Python/mactoolboxglue.c ../Python-2.5/Python/mactoolboxglue.c
--- ./Python/mactoolboxglue.c 2006-07-12 01:44:25.000000000 +0900
+++ ../Python-2.5/Python/mactoolboxglue.c 2013-07-17 23:39:09.000000000 +0900
@@ -106,6 +106,7 @@
}
+#ifndef __LP64__
OSErr
PyMac_GetFullPathname(FSSpec *fss, char *path, int len)
{
@@ -153,6 +154,7 @@
Py_XDECREF(fs);
return err;
}
+#endif /* !__LP64__ */
/* Convert a 4-char string object argument to an OSType value */
int
@@ -417,6 +419,7 @@
GLUE_NEW(GWorldPtr, GWorldObj_New, "Carbon.Qdoffs")
GLUE_CONVERT(GWorldPtr, GWorldObj_Convert, "Carbon.Qdoffs")
+#ifndef __LP64__
GLUE_NEW(Track, TrackObj_New, "Carbon.Qt")
GLUE_CONVERT(Track, TrackObj_Convert, "Carbon.Qt")
GLUE_NEW(Movie, MovieObj_New, "Carbon.Qt")
@@ -429,6 +432,7 @@
GLUE_CONVERT(UserData, UserDataObj_Convert, "Carbon.Qt")
GLUE_NEW(Media, MediaObj_New, "Carbon.Qt")
GLUE_CONVERT(Media, MediaObj_Convert, "Carbon.Qt")
+#endif /* !__LP64__ */
GLUE_NEW(Handle, ResObj_New, "Carbon.Res")
GLUE_CONVERT(Handle, ResObj_Convert, "Carbon.Res")

View file

@ -0,0 +1,166 @@
diff -r -u ./configure ../Python-2.5/configure
--- ./configure 2006-09-05 11:54:42.000000000 +0900
+++ ../Python-2.5/configure 2013-07-19 15:27:46.000000000 +0900
@@ -1396,6 +1396,16 @@
_ACEOF
+# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
+# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
+# them.
+
+cat >>confdefs.h <<\_ACEOF
+#define _DARWIN_C_SOURCE 1
+_ACEOF
+
+
+
define_xopen_source=yes
# Arguments passed to configure.
@@ -3885,11 +3895,110 @@
;;
# is there any other compiler on Darwin besides gcc?
Darwin*)
- BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
+ # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
+ # used to be here, but non-Apple gcc doesn't accept them.
+ if test "${CC}" = gcc
+ then
+ { echo "$as_me:${as_lineno-$LINENO}: checking which compiler should be used" >&5
+echo -n "checking which compiler should be used... " >&6; }
+ case "${UNIVERSALSDK}" in
+ */MacOSX10.4u.sdk)
+ # Build using 10.4 SDK, force usage of gcc when the
+ # compiler is gcc, otherwise the user will get very
+ # confusing error messages when building on OSX 10.6
+ CC=gcc-4.0
+ CPP=cpp-4.0
+ ;;
+ esac
+ { echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+echo "$CC" >&6; }
+ fi
+
+
if test "${enable_universalsdk}"; then
- BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
+ UNIVERSAL_ARCH_FLAGS=""
+ if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
+ ARCH_RUN_32BIT=""
+ LIPO_32BIT_FLAGS=""
+ elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
+ LIPO_32BIT_FLAGS=""
+ ARCH_RUN_32BIT="true"
+
+ elif test "$UNIVERSAL_ARCHS" = "all" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
+ LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
+ ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
+
+ elif test "$UNIVERSAL_ARCHS" = "intel" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
+ LIPO_32BIT_FLAGS="-extract i386"
+ ARCH_RUN_32BIT="/usr/bin/arch -i386"
+
+ elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
+ LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
+ ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
+
+ else
+ as_fn_error $? "proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way" "$LINENO" 5
+
+ fi
+
+
+ CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
+ if test "${UNIVERSALSDK}" != "/"
+ then
+ CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}"
+ LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}"
+ CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
+ fi
fi
+ # Calculate the right deployment target for this build.
+ #
+ cur_target=`sw_vers -productVersion | sed 's/\(10\.[0-9]*\).*/\1/'`
+ if test ${cur_target} '>' 10.2 && \
+ test ${cur_target} '<' 10.6
+ then
+ cur_target=10.3
+ if test ${enable_universalsdk}; then
+ if test "${UNIVERSAL_ARCHS}" = "all"; then
+ # Ensure that the default platform for a
+ # 4-way universal build is OSX 10.5,
+ # that's the first OS release where
+ # 4-way builds make sense.
+ cur_target='10.5'
+
+ elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
+ cur_target='10.5'
+
+ elif test "${UNIVERSAL_ARCHS}" = "intel"; then
+ cur_target='10.5'
+
+ elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
+ cur_target='10.5'
+ fi
+ else
+ if test `/usr/bin/arch` = "i386"; then
+ # On Intel macs default to a deployment
+ # target of 10.4, that's the first OSX
+ # release with Intel support.
+ cur_target="10.4"
+ fi
+ fi
+ fi
+ CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
+
+ # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
+ # environment with a value that is the same as what we'll use
+ # in the Makefile to ensure that we'll get the same compiler
+ # environment during configure and build time.
+ MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
+ export MACOSX_DEPLOYMENT_TARGET
+ EXPORT_MACOSX_DEPLOYMENT_TARGET=''
+
;;
OSF*)
BASECFLAGS="$BASECFLAGS -mieee"
@@ -10851,7 +10960,7 @@
if test "${enable_universalsdk}"; then
:
else
- LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
+ LIBTOOL_CRUFT="${LIBTOOL_CRUFT}"
fi
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
@@ -10863,7 +10972,7 @@
else
LIBTOOL_CRUFT=""
fi
- LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only `arch`"
+ LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs"
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
esac
diff -r -u ./pyconfig.h.in ../Python-2.5/pyconfig.h.in
--- ./pyconfig.h.in 2006-07-30 23:09:47.000000000 +0900
+++ ../Python-2.5/pyconfig.h.in 2013-07-17 23:12:31.000000000 +0900
@@ -912,6 +912,11 @@
/* Define on Irix to enable u_int */
#undef _BSD_TYPES
+/* Define on Darwin to activate all library features */
+#ifndef _DARWIN_C_SOURCE
+#define _DARWIN_C_SOURCE
+#endif
+
/* This must be set to 64 on some systems to enable large file support. */
#undef _FILE_OFFSET_BITS

View file

@ -0,0 +1,271 @@
diff -r -u ./Include/pymactoolbox.h ../Python-2.5/Include/pymactoolbox.h
--- ./Include/pymactoolbox.h 2004-11-05 16:02:59.000000000 +0900
+++ ../Python-2.5/Include/pymactoolbox.h 2013-07-17 23:38:51.000000000 +0900
@@ -8,7 +8,10 @@
#endif
#include <Carbon/Carbon.h>
+
+#ifndef __LP64__
#include <QuickTime/QuickTime.h>
+#endif /* !__LP64__ */
/*
** Helper routines for error codes and such.
@@ -18,8 +21,11 @@
PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */
PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */
PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */
+#ifndef __LP64__
extern OSErr PyMac_GetFullPathname(FSSpec *, char *, int); /* convert
fsspec->path */
+#endif /* __LP64__ */
+
/*
** These conversion routines are defined in mactoolboxglue.c itself.
*/
@@ -83,8 +89,10 @@
#endif /* USE_TOOLBOX_OBJECT_GLUE */
/* macfs exports */
+#ifndef __LP64__
int PyMac_GetFSSpec(PyObject *, FSSpec *); /* argument parser for FSSpec */
PyObject *PyMac_BuildFSSpec(FSSpec *); /* Convert FSSpec to PyObject */
+#endif /* !__LP64__ */
int PyMac_GetFSRef(PyObject *, FSRef *); /* argument parser for FSRef */
PyObject *PyMac_BuildFSRef(FSRef *); /* Convert FSRef to PyObject */
@@ -101,39 +109,54 @@
extern int CmpInstObj_Convert(PyObject *, ComponentInstance *);
/* Ctl exports */
+#ifndef __LP64__
extern PyObject *CtlObj_New(ControlHandle);
extern int CtlObj_Convert(PyObject *, ControlHandle *);
+#endif /* !__LP64__ */
/* Dlg exports */
+#ifndef __LP64__
extern PyObject *DlgObj_New(DialogPtr);
extern int DlgObj_Convert(PyObject *, DialogPtr *);
extern PyObject *DlgObj_WhichDialog(DialogPtr);
+#endif /* !__LP64__ */
/* Drag exports */
+#ifndef __LP64__
extern PyObject *DragObj_New(DragReference);
extern int DragObj_Convert(PyObject *, DragReference *);
+#endif /* !__LP64__ */
/* List exports */
+#ifndef __LP64__
extern PyObject *ListObj_New(ListHandle);
extern int ListObj_Convert(PyObject *, ListHandle *);
+#endif /* !__LP64__ */
/* Menu exports */
+#ifndef __LP64__
extern PyObject *MenuObj_New(MenuHandle);
extern int MenuObj_Convert(PyObject *, MenuHandle *);
+#endif /* !__LP64__ */
/* Qd exports */
+#ifndef __LP64__
extern PyObject *GrafObj_New(GrafPtr);
extern int GrafObj_Convert(PyObject *, GrafPtr *);
extern PyObject *BMObj_New(BitMapPtr);
extern int BMObj_Convert(PyObject *, BitMapPtr *);
extern PyObject *QdRGB_New(RGBColor *);
extern int QdRGB_Convert(PyObject *, RGBColor *);
+#endif /* !__LP64__ */
/* Qdoffs exports */
+#ifndef __LP64__
extern PyObject *GWorldObj_New(GWorldPtr);
extern int GWorldObj_Convert(PyObject *, GWorldPtr *);
+#endif /* !__LP64__ */
/* Qt exports */
+#ifndef __LP64__
extern PyObject *TrackObj_New(Track);
extern int TrackObj_Convert(PyObject *, Track *);
extern PyObject *MovieObj_New(Movie);
@@ -146,6 +169,7 @@
extern int UserDataObj_Convert(PyObject *, UserData *);
extern PyObject *MediaObj_New(Media);
extern int MediaObj_Convert(PyObject *, Media *);
+#endif /* !__LP64__ */
/* Res exports */
extern PyObject *ResObj_New(Handle);
@@ -154,13 +178,17 @@
extern int OptResObj_Convert(PyObject *, Handle *);
/* TE exports */
+#ifndef __LP64__
extern PyObject *TEObj_New(TEHandle);
extern int TEObj_Convert(PyObject *, TEHandle *);
+#endif /* !__LP64__ */
/* Win exports */
+#ifndef __LP64__
extern PyObject *WinObj_New(WindowPtr);
extern int WinObj_Convert(PyObject *, WindowPtr *);
extern PyObject *WinObj_WhichWindow(WindowPtr);
+#endif /* !__LP64__ */
/* CF exports */
extern PyObject *CFObj_New(CFTypeRef);
diff -r -u ./Mac/Modules/res/_Resmodule.c ../Python-2.5/Mac/Modules/res/_Resmodule.c
--- ./Mac/Modules/res/_Resmodule.c 2005-07-04 05:59:44.000000000 +0900
+++ ../Python-2.5/Mac/Modules/res/_Resmodule.c 2013-07-17 23:38:51.000000000 +0900
@@ -414,6 +414,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *ResObj_as_Control(ResourceObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -431,6 +432,7 @@
return _res;
}
+#endif /* !__LP64__ */
static PyObject *ResObj_LoadResource(ResourceObject *_self, PyObject *_args)
{
@@ -1152,6 +1154,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *Res_OpenRFPerm(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1287,6 +1290,7 @@
_res = Py_None;
return _res;
}
+#endif /* !__LP64__ */
static PyObject *Res_InsertResourceFile(PyObject *_self, PyObject *_args)
{
@@ -1327,6 +1331,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *Res_FSpResourceFileAlreadyOpen(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1413,6 +1418,7 @@
nextRefNum);
return _res;
}
+#endif /* !__LP64__ */
static PyObject *Res_FSOpenResFile(PyObject *_self, PyObject *_args)
{
@@ -1438,6 +1444,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *Res_FSCreateResFile(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1534,6 +1541,7 @@
PyMac_BuildFSSpec, &newSpec);
return _res;
}
+#endif /* __LP64__ */
static PyObject *Res_FSOpenResourceFile(PyObject *_self, PyObject *_args)
{
@@ -1637,6 +1645,7 @@
PyDoc_STR("(short refNum) -> (short _rv)")},
{"SetResFileAttrs", (PyCFunction)Res_SetResFileAttrs, 1,
PyDoc_STR("(short refNum, short attrs) -> None")},
+#ifndef __LP64__
{"OpenRFPerm", (PyCFunction)Res_OpenRFPerm, 1,
PyDoc_STR("(Str255 fileName, short vRefNum, SignedByte permission) -> (short _rv)")},
{"HOpenResFile", (PyCFunction)Res_HOpenResFile, 1,
@@ -1647,10 +1656,12 @@
PyDoc_STR("(FSSpec spec, SignedByte permission) -> (short _rv)")},
{"FSpCreateResFile", (PyCFunction)Res_FSpCreateResFile, 1,
PyDoc_STR("(FSSpec spec, OSType creator, OSType fileType, ScriptCode scriptTag) -> None")},
+#endif /* !__LP64__ */
{"InsertResourceFile", (PyCFunction)Res_InsertResourceFile, 1,
PyDoc_STR("(SInt16 refNum, RsrcChainLocation where) -> None")},
{"DetachResourceFile", (PyCFunction)Res_DetachResourceFile, 1,
PyDoc_STR("(SInt16 refNum) -> None")},
+#ifndef __LP64__
{"FSpResourceFileAlreadyOpen", (PyCFunction)Res_FSpResourceFileAlreadyOpen, 1,
PyDoc_STR("(FSSpec resourceFile) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")},
{"FSpOpenOrphanResFile", (PyCFunction)Res_FSpOpenOrphanResFile, 1,
@@ -1659,14 +1670,17 @@
PyDoc_STR("() -> (SInt16 refNum)")},
{"GetNextResourceFile", (PyCFunction)Res_GetNextResourceFile, 1,
PyDoc_STR("(SInt16 curRefNum) -> (SInt16 nextRefNum)")},
+#endif /* __LP64__ */
{"FSOpenResFile", (PyCFunction)Res_FSOpenResFile, 1,
PyDoc_STR("(FSRef ref, SignedByte permission) -> (short _rv)")},
+#ifndef __LP64__
{"FSCreateResFile", (PyCFunction)Res_FSCreateResFile, 1,
PyDoc_STR("(FSRef parentRef, Buffer nameLength) -> (FSRef newRef, FSSpec newSpec)")},
{"FSResourceFileAlreadyOpen", (PyCFunction)Res_FSResourceFileAlreadyOpen, 1,
PyDoc_STR("(FSRef resourceFileRef) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")},
{"FSCreateResourceFile", (PyCFunction)Res_FSCreateResourceFile, 1,
PyDoc_STR("(FSRef parentRef, Buffer nameLength, Buffer forkNameLength) -> (FSRef newRef, FSSpec newSpec)")},
+#endif /* __LP64__ */
{"FSOpenResourceFile", (PyCFunction)Res_FSOpenResourceFile, 1,
PyDoc_STR("(FSRef ref, Buffer forkNameLength, SignedByte permissions) -> (SInt16 refNum)")},
{"Handle", (PyCFunction)Res_Handle, 1,
diff -r -u ./Modules/_ctypes/libffi/src/darwin/ffitarget.h ../Python-2.5/Modules/_ctypes/libffi/src/darwin/ffitarget.h
--- ./Modules/_ctypes/libffi/src/darwin/ffitarget.h 2006-05-26 06:58:05.000000000 +0900
+++ ../Python-2.5/Modules/_ctypes/libffi/src/darwin/ffitarget.h 2013-07-17 23:38:51.000000000 +0900
@@ -4,7 +4,7 @@
* created by configure). This makes is possible to build a univeral binary
* of ctypes in one go.
*/
-#if defined(__i386__)
+#if defined(__i386__) || defined(__x86_64__)
#ifndef X86_DARWIN
#define X86_DARWIN
diff -r -u ./Python/mactoolboxglue.c ../Python-2.5/Python/mactoolboxglue.c
--- ./Python/mactoolboxglue.c 2006-07-12 01:44:25.000000000 +0900
+++ ../Python-2.5/Python/mactoolboxglue.c 2013-07-17 23:39:09.000000000 +0900
@@ -106,6 +106,7 @@
}
+#ifndef __LP64__
OSErr
PyMac_GetFullPathname(FSSpec *fss, char *path, int len)
{
@@ -153,6 +154,7 @@
Py_XDECREF(fs);
return err;
}
+#endif /* !__LP64__ */
/* Convert a 4-char string object argument to an OSType value */
int
@@ -417,6 +419,7 @@
GLUE_NEW(GWorldPtr, GWorldObj_New, "Carbon.Qdoffs")
GLUE_CONVERT(GWorldPtr, GWorldObj_Convert, "Carbon.Qdoffs")
+#ifndef __LP64__
GLUE_NEW(Track, TrackObj_New, "Carbon.Qt")
GLUE_CONVERT(Track, TrackObj_Convert, "Carbon.Qt")
GLUE_NEW(Movie, MovieObj_New, "Carbon.Qt")
@@ -429,6 +432,7 @@
GLUE_CONVERT(UserData, UserDataObj_Convert, "Carbon.Qt")
GLUE_NEW(Media, MediaObj_New, "Carbon.Qt")
GLUE_CONVERT(Media, MediaObj_Convert, "Carbon.Qt")
+#endif /* !__LP64__ */
GLUE_NEW(Handle, ResObj_New, "Carbon.Res")
GLUE_CONVERT(Handle, ResObj_Convert, "Carbon.Res")

View file

@ -0,0 +1,166 @@
diff -r -u ./configure ../Python-2.5/configure
--- ./configure 2006-09-05 11:54:42.000000000 +0900
+++ ../Python-2.5/configure 2013-07-19 15:27:46.000000000 +0900
@@ -1396,6 +1396,16 @@
_ACEOF
+# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
+# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
+# them.
+
+cat >>confdefs.h <<\_ACEOF
+#define _DARWIN_C_SOURCE 1
+_ACEOF
+
+
+
define_xopen_source=yes
# Arguments passed to configure.
@@ -3885,11 +3895,110 @@
;;
# is there any other compiler on Darwin besides gcc?
Darwin*)
- BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
+ # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
+ # used to be here, but non-Apple gcc doesn't accept them.
+ if test "${CC}" = gcc
+ then
+ { echo "$as_me:${as_lineno-$LINENO}: checking which compiler should be used" >&5
+echo -n "checking which compiler should be used... " >&6; }
+ case "${UNIVERSALSDK}" in
+ */MacOSX10.4u.sdk)
+ # Build using 10.4 SDK, force usage of gcc when the
+ # compiler is gcc, otherwise the user will get very
+ # confusing error messages when building on OSX 10.6
+ CC=gcc-4.0
+ CPP=cpp-4.0
+ ;;
+ esac
+ { echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+echo "$CC" >&6; }
+ fi
+
+
if test "${enable_universalsdk}"; then
- BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
+ UNIVERSAL_ARCH_FLAGS=""
+ if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
+ ARCH_RUN_32BIT=""
+ LIPO_32BIT_FLAGS=""
+ elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
+ LIPO_32BIT_FLAGS=""
+ ARCH_RUN_32BIT="true"
+
+ elif test "$UNIVERSAL_ARCHS" = "all" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
+ LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
+ ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
+
+ elif test "$UNIVERSAL_ARCHS" = "intel" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
+ LIPO_32BIT_FLAGS="-extract i386"
+ ARCH_RUN_32BIT="/usr/bin/arch -i386"
+
+ elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
+ LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
+ ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
+
+ else
+ as_fn_error $? "proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way" "$LINENO" 5
+
+ fi
+
+
+ CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
+ if test "${UNIVERSALSDK}" != "/"
+ then
+ CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}"
+ LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}"
+ CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
+ fi
fi
+ # Calculate the right deployment target for this build.
+ #
+ cur_target=`sw_vers -productVersion | sed 's/\(10\.[0-9]*\).*/\1/'`
+ if test ${cur_target} '>' 10.2 && \
+ test ${cur_target} '<' 10.6
+ then
+ cur_target=10.3
+ if test ${enable_universalsdk}; then
+ if test "${UNIVERSAL_ARCHS}" = "all"; then
+ # Ensure that the default platform for a
+ # 4-way universal build is OSX 10.5,
+ # that's the first OS release where
+ # 4-way builds make sense.
+ cur_target='10.5'
+
+ elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
+ cur_target='10.5'
+
+ elif test "${UNIVERSAL_ARCHS}" = "intel"; then
+ cur_target='10.5'
+
+ elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
+ cur_target='10.5'
+ fi
+ else
+ if test `/usr/bin/arch` = "i386"; then
+ # On Intel macs default to a deployment
+ # target of 10.4, that's the first OSX
+ # release with Intel support.
+ cur_target="10.4"
+ fi
+ fi
+ fi
+ CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
+
+ # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
+ # environment with a value that is the same as what we'll use
+ # in the Makefile to ensure that we'll get the same compiler
+ # environment during configure and build time.
+ MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
+ export MACOSX_DEPLOYMENT_TARGET
+ EXPORT_MACOSX_DEPLOYMENT_TARGET=''
+
;;
OSF*)
BASECFLAGS="$BASECFLAGS -mieee"
@@ -10851,7 +10960,7 @@
if test "${enable_universalsdk}"; then
:
else
- LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
+ LIBTOOL_CRUFT="${LIBTOOL_CRUFT}"
fi
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
@@ -10863,7 +10972,7 @@
else
LIBTOOL_CRUFT=""
fi
- LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only `arch`"
+ LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs"
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
esac
diff -r -u ./pyconfig.h.in ../Python-2.5/pyconfig.h.in
--- ./pyconfig.h.in 2006-07-30 23:09:47.000000000 +0900
+++ ../Python-2.5/pyconfig.h.in 2013-07-17 23:12:31.000000000 +0900
@@ -912,6 +912,11 @@
/* Define on Irix to enable u_int */
#undef _BSD_TYPES
+/* Define on Darwin to activate all library features */
+#ifndef _DARWIN_C_SOURCE
+#define _DARWIN_C_SOURCE
+#endif
+
/* This must be set to 64 on some systems to enable large file support. */
#undef _FILE_OFFSET_BITS

View file

@ -0,0 +1,271 @@
diff -r -u ./Include/pymactoolbox.h ../Python-2.5/Include/pymactoolbox.h
--- ./Include/pymactoolbox.h 2004-11-05 16:02:59.000000000 +0900
+++ ../Python-2.5/Include/pymactoolbox.h 2013-07-17 23:38:51.000000000 +0900
@@ -8,7 +8,10 @@
#endif
#include <Carbon/Carbon.h>
+
+#ifndef __LP64__
#include <QuickTime/QuickTime.h>
+#endif /* !__LP64__ */
/*
** Helper routines for error codes and such.
@@ -18,8 +21,11 @@
PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */
PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */
PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */
+#ifndef __LP64__
extern OSErr PyMac_GetFullPathname(FSSpec *, char *, int); /* convert
fsspec->path */
+#endif /* __LP64__ */
+
/*
** These conversion routines are defined in mactoolboxglue.c itself.
*/
@@ -83,8 +89,10 @@
#endif /* USE_TOOLBOX_OBJECT_GLUE */
/* macfs exports */
+#ifndef __LP64__
int PyMac_GetFSSpec(PyObject *, FSSpec *); /* argument parser for FSSpec */
PyObject *PyMac_BuildFSSpec(FSSpec *); /* Convert FSSpec to PyObject */
+#endif /* !__LP64__ */
int PyMac_GetFSRef(PyObject *, FSRef *); /* argument parser for FSRef */
PyObject *PyMac_BuildFSRef(FSRef *); /* Convert FSRef to PyObject */
@@ -101,39 +109,54 @@
extern int CmpInstObj_Convert(PyObject *, ComponentInstance *);
/* Ctl exports */
+#ifndef __LP64__
extern PyObject *CtlObj_New(ControlHandle);
extern int CtlObj_Convert(PyObject *, ControlHandle *);
+#endif /* !__LP64__ */
/* Dlg exports */
+#ifndef __LP64__
extern PyObject *DlgObj_New(DialogPtr);
extern int DlgObj_Convert(PyObject *, DialogPtr *);
extern PyObject *DlgObj_WhichDialog(DialogPtr);
+#endif /* !__LP64__ */
/* Drag exports */
+#ifndef __LP64__
extern PyObject *DragObj_New(DragReference);
extern int DragObj_Convert(PyObject *, DragReference *);
+#endif /* !__LP64__ */
/* List exports */
+#ifndef __LP64__
extern PyObject *ListObj_New(ListHandle);
extern int ListObj_Convert(PyObject *, ListHandle *);
+#endif /* !__LP64__ */
/* Menu exports */
+#ifndef __LP64__
extern PyObject *MenuObj_New(MenuHandle);
extern int MenuObj_Convert(PyObject *, MenuHandle *);
+#endif /* !__LP64__ */
/* Qd exports */
+#ifndef __LP64__
extern PyObject *GrafObj_New(GrafPtr);
extern int GrafObj_Convert(PyObject *, GrafPtr *);
extern PyObject *BMObj_New(BitMapPtr);
extern int BMObj_Convert(PyObject *, BitMapPtr *);
extern PyObject *QdRGB_New(RGBColor *);
extern int QdRGB_Convert(PyObject *, RGBColor *);
+#endif /* !__LP64__ */
/* Qdoffs exports */
+#ifndef __LP64__
extern PyObject *GWorldObj_New(GWorldPtr);
extern int GWorldObj_Convert(PyObject *, GWorldPtr *);
+#endif /* !__LP64__ */
/* Qt exports */
+#ifndef __LP64__
extern PyObject *TrackObj_New(Track);
extern int TrackObj_Convert(PyObject *, Track *);
extern PyObject *MovieObj_New(Movie);
@@ -146,6 +169,7 @@
extern int UserDataObj_Convert(PyObject *, UserData *);
extern PyObject *MediaObj_New(Media);
extern int MediaObj_Convert(PyObject *, Media *);
+#endif /* !__LP64__ */
/* Res exports */
extern PyObject *ResObj_New(Handle);
@@ -154,13 +178,17 @@
extern int OptResObj_Convert(PyObject *, Handle *);
/* TE exports */
+#ifndef __LP64__
extern PyObject *TEObj_New(TEHandle);
extern int TEObj_Convert(PyObject *, TEHandle *);
+#endif /* !__LP64__ */
/* Win exports */
+#ifndef __LP64__
extern PyObject *WinObj_New(WindowPtr);
extern int WinObj_Convert(PyObject *, WindowPtr *);
extern PyObject *WinObj_WhichWindow(WindowPtr);
+#endif /* !__LP64__ */
/* CF exports */
extern PyObject *CFObj_New(CFTypeRef);
diff -r -u ./Mac/Modules/res/_Resmodule.c ../Python-2.5/Mac/Modules/res/_Resmodule.c
--- ./Mac/Modules/res/_Resmodule.c 2005-07-04 05:59:44.000000000 +0900
+++ ../Python-2.5/Mac/Modules/res/_Resmodule.c 2013-07-17 23:38:51.000000000 +0900
@@ -414,6 +414,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *ResObj_as_Control(ResourceObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -431,6 +432,7 @@
return _res;
}
+#endif /* !__LP64__ */
static PyObject *ResObj_LoadResource(ResourceObject *_self, PyObject *_args)
{
@@ -1152,6 +1154,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *Res_OpenRFPerm(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1287,6 +1290,7 @@
_res = Py_None;
return _res;
}
+#endif /* !__LP64__ */
static PyObject *Res_InsertResourceFile(PyObject *_self, PyObject *_args)
{
@@ -1327,6 +1331,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *Res_FSpResourceFileAlreadyOpen(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1413,6 +1418,7 @@
nextRefNum);
return _res;
}
+#endif /* !__LP64__ */
static PyObject *Res_FSOpenResFile(PyObject *_self, PyObject *_args)
{
@@ -1438,6 +1444,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *Res_FSCreateResFile(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1534,6 +1541,7 @@
PyMac_BuildFSSpec, &newSpec);
return _res;
}
+#endif /* __LP64__ */
static PyObject *Res_FSOpenResourceFile(PyObject *_self, PyObject *_args)
{
@@ -1637,6 +1645,7 @@
PyDoc_STR("(short refNum) -> (short _rv)")},
{"SetResFileAttrs", (PyCFunction)Res_SetResFileAttrs, 1,
PyDoc_STR("(short refNum, short attrs) -> None")},
+#ifndef __LP64__
{"OpenRFPerm", (PyCFunction)Res_OpenRFPerm, 1,
PyDoc_STR("(Str255 fileName, short vRefNum, SignedByte permission) -> (short _rv)")},
{"HOpenResFile", (PyCFunction)Res_HOpenResFile, 1,
@@ -1647,10 +1656,12 @@
PyDoc_STR("(FSSpec spec, SignedByte permission) -> (short _rv)")},
{"FSpCreateResFile", (PyCFunction)Res_FSpCreateResFile, 1,
PyDoc_STR("(FSSpec spec, OSType creator, OSType fileType, ScriptCode scriptTag) -> None")},
+#endif /* !__LP64__ */
{"InsertResourceFile", (PyCFunction)Res_InsertResourceFile, 1,
PyDoc_STR("(SInt16 refNum, RsrcChainLocation where) -> None")},
{"DetachResourceFile", (PyCFunction)Res_DetachResourceFile, 1,
PyDoc_STR("(SInt16 refNum) -> None")},
+#ifndef __LP64__
{"FSpResourceFileAlreadyOpen", (PyCFunction)Res_FSpResourceFileAlreadyOpen, 1,
PyDoc_STR("(FSSpec resourceFile) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")},
{"FSpOpenOrphanResFile", (PyCFunction)Res_FSpOpenOrphanResFile, 1,
@@ -1659,14 +1670,17 @@
PyDoc_STR("() -> (SInt16 refNum)")},
{"GetNextResourceFile", (PyCFunction)Res_GetNextResourceFile, 1,
PyDoc_STR("(SInt16 curRefNum) -> (SInt16 nextRefNum)")},
+#endif /* __LP64__ */
{"FSOpenResFile", (PyCFunction)Res_FSOpenResFile, 1,
PyDoc_STR("(FSRef ref, SignedByte permission) -> (short _rv)")},
+#ifndef __LP64__
{"FSCreateResFile", (PyCFunction)Res_FSCreateResFile, 1,
PyDoc_STR("(FSRef parentRef, Buffer nameLength) -> (FSRef newRef, FSSpec newSpec)")},
{"FSResourceFileAlreadyOpen", (PyCFunction)Res_FSResourceFileAlreadyOpen, 1,
PyDoc_STR("(FSRef resourceFileRef) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")},
{"FSCreateResourceFile", (PyCFunction)Res_FSCreateResourceFile, 1,
PyDoc_STR("(FSRef parentRef, Buffer nameLength, Buffer forkNameLength) -> (FSRef newRef, FSSpec newSpec)")},
+#endif /* __LP64__ */
{"FSOpenResourceFile", (PyCFunction)Res_FSOpenResourceFile, 1,
PyDoc_STR("(FSRef ref, Buffer forkNameLength, SignedByte permissions) -> (SInt16 refNum)")},
{"Handle", (PyCFunction)Res_Handle, 1,
diff -r -u ./Modules/_ctypes/libffi/src/darwin/ffitarget.h ../Python-2.5/Modules/_ctypes/libffi/src/darwin/ffitarget.h
--- ./Modules/_ctypes/libffi/src/darwin/ffitarget.h 2006-05-26 06:58:05.000000000 +0900
+++ ../Python-2.5/Modules/_ctypes/libffi/src/darwin/ffitarget.h 2013-07-17 23:38:51.000000000 +0900
@@ -4,7 +4,7 @@
* created by configure). This makes is possible to build a univeral binary
* of ctypes in one go.
*/
-#if defined(__i386__)
+#if defined(__i386__) || defined(__x86_64__)
#ifndef X86_DARWIN
#define X86_DARWIN
diff -r -u ./Python/mactoolboxglue.c ../Python-2.5/Python/mactoolboxglue.c
--- ./Python/mactoolboxglue.c 2006-07-12 01:44:25.000000000 +0900
+++ ../Python-2.5/Python/mactoolboxglue.c 2013-07-17 23:39:09.000000000 +0900
@@ -106,6 +106,7 @@
}
+#ifndef __LP64__
OSErr
PyMac_GetFullPathname(FSSpec *fss, char *path, int len)
{
@@ -153,6 +154,7 @@
Py_XDECREF(fs);
return err;
}
+#endif /* !__LP64__ */
/* Convert a 4-char string object argument to an OSType value */
int
@@ -417,6 +419,7 @@
GLUE_NEW(GWorldPtr, GWorldObj_New, "Carbon.Qdoffs")
GLUE_CONVERT(GWorldPtr, GWorldObj_Convert, "Carbon.Qdoffs")
+#ifndef __LP64__
GLUE_NEW(Track, TrackObj_New, "Carbon.Qt")
GLUE_CONVERT(Track, TrackObj_Convert, "Carbon.Qt")
GLUE_NEW(Movie, MovieObj_New, "Carbon.Qt")
@@ -429,6 +432,7 @@
GLUE_CONVERT(UserData, UserDataObj_Convert, "Carbon.Qt")
GLUE_NEW(Media, MediaObj_New, "Carbon.Qt")
GLUE_CONVERT(Media, MediaObj_Convert, "Carbon.Qt")
+#endif /* !__LP64__ */
GLUE_NEW(Handle, ResObj_New, "Carbon.Res")
GLUE_CONVERT(Handle, ResObj_Convert, "Carbon.Res")

View file

@ -0,0 +1,166 @@
diff -r -u ./configure ../Python-2.5/configure
--- ./configure 2006-09-05 11:54:42.000000000 +0900
+++ ../Python-2.5/configure 2013-07-19 15:27:46.000000000 +0900
@@ -1396,6 +1396,16 @@
_ACEOF
+# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
+# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
+# them.
+
+cat >>confdefs.h <<\_ACEOF
+#define _DARWIN_C_SOURCE 1
+_ACEOF
+
+
+
define_xopen_source=yes
# Arguments passed to configure.
@@ -3885,11 +3895,110 @@
;;
# is there any other compiler on Darwin besides gcc?
Darwin*)
- BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
+ # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
+ # used to be here, but non-Apple gcc doesn't accept them.
+ if test "${CC}" = gcc
+ then
+ { echo "$as_me:${as_lineno-$LINENO}: checking which compiler should be used" >&5
+echo -n "checking which compiler should be used... " >&6; }
+ case "${UNIVERSALSDK}" in
+ */MacOSX10.4u.sdk)
+ # Build using 10.4 SDK, force usage of gcc when the
+ # compiler is gcc, otherwise the user will get very
+ # confusing error messages when building on OSX 10.6
+ CC=gcc-4.0
+ CPP=cpp-4.0
+ ;;
+ esac
+ { echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+echo "$CC" >&6; }
+ fi
+
+
if test "${enable_universalsdk}"; then
- BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
+ UNIVERSAL_ARCH_FLAGS=""
+ if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
+ ARCH_RUN_32BIT=""
+ LIPO_32BIT_FLAGS=""
+ elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
+ LIPO_32BIT_FLAGS=""
+ ARCH_RUN_32BIT="true"
+
+ elif test "$UNIVERSAL_ARCHS" = "all" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
+ LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
+ ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
+
+ elif test "$UNIVERSAL_ARCHS" = "intel" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
+ LIPO_32BIT_FLAGS="-extract i386"
+ ARCH_RUN_32BIT="/usr/bin/arch -i386"
+
+ elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
+ UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
+ LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
+ ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
+
+ else
+ as_fn_error $? "proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way" "$LINENO" 5
+
+ fi
+
+
+ CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
+ if test "${UNIVERSALSDK}" != "/"
+ then
+ CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}"
+ LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}"
+ CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
+ fi
fi
+ # Calculate the right deployment target for this build.
+ #
+ cur_target=`sw_vers -productVersion | sed 's/\(10\.[0-9]*\).*/\1/'`
+ if test ${cur_target} '>' 10.2 && \
+ test ${cur_target} '<' 10.6
+ then
+ cur_target=10.3
+ if test ${enable_universalsdk}; then
+ if test "${UNIVERSAL_ARCHS}" = "all"; then
+ # Ensure that the default platform for a
+ # 4-way universal build is OSX 10.5,
+ # that's the first OS release where
+ # 4-way builds make sense.
+ cur_target='10.5'
+
+ elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
+ cur_target='10.5'
+
+ elif test "${UNIVERSAL_ARCHS}" = "intel"; then
+ cur_target='10.5'
+
+ elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
+ cur_target='10.5'
+ fi
+ else
+ if test `/usr/bin/arch` = "i386"; then
+ # On Intel macs default to a deployment
+ # target of 10.4, that's the first OSX
+ # release with Intel support.
+ cur_target="10.4"
+ fi
+ fi
+ fi
+ CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
+
+ # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
+ # environment with a value that is the same as what we'll use
+ # in the Makefile to ensure that we'll get the same compiler
+ # environment during configure and build time.
+ MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
+ export MACOSX_DEPLOYMENT_TARGET
+ EXPORT_MACOSX_DEPLOYMENT_TARGET=''
+
;;
OSF*)
BASECFLAGS="$BASECFLAGS -mieee"
@@ -10851,7 +10960,7 @@
if test "${enable_universalsdk}"; then
:
else
- LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
+ LIBTOOL_CRUFT="${LIBTOOL_CRUFT}"
fi
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
@@ -10863,7 +10972,7 @@
else
LIBTOOL_CRUFT=""
fi
- LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only `arch`"
+ LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs"
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
esac
diff -r -u ./pyconfig.h.in ../Python-2.5/pyconfig.h.in
--- ./pyconfig.h.in 2006-07-30 23:09:47.000000000 +0900
+++ ../Python-2.5/pyconfig.h.in 2013-07-17 23:12:31.000000000 +0900
@@ -912,6 +912,11 @@
/* Define on Irix to enable u_int */
#undef _BSD_TYPES
+/* Define on Darwin to activate all library features */
+#ifndef _DARWIN_C_SOURCE
+#define _DARWIN_C_SOURCE
+#endif
+
/* This must be set to 64 on some systems to enable large file support. */
#undef _FILE_OFFSET_BITS

View file

@ -0,0 +1,271 @@
diff -r -u ./Include/pymactoolbox.h ../Python-2.5/Include/pymactoolbox.h
--- ./Include/pymactoolbox.h 2004-11-05 16:02:59.000000000 +0900
+++ ../Python-2.5/Include/pymactoolbox.h 2013-07-17 23:38:51.000000000 +0900
@@ -8,7 +8,10 @@
#endif
#include <Carbon/Carbon.h>
+
+#ifndef __LP64__
#include <QuickTime/QuickTime.h>
+#endif /* !__LP64__ */
/*
** Helper routines for error codes and such.
@@ -18,8 +21,11 @@
PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */
PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */
PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */
+#ifndef __LP64__
extern OSErr PyMac_GetFullPathname(FSSpec *, char *, int); /* convert
fsspec->path */
+#endif /* __LP64__ */
+
/*
** These conversion routines are defined in mactoolboxglue.c itself.
*/
@@ -83,8 +89,10 @@
#endif /* USE_TOOLBOX_OBJECT_GLUE */
/* macfs exports */
+#ifndef __LP64__
int PyMac_GetFSSpec(PyObject *, FSSpec *); /* argument parser for FSSpec */
PyObject *PyMac_BuildFSSpec(FSSpec *); /* Convert FSSpec to PyObject */
+#endif /* !__LP64__ */
int PyMac_GetFSRef(PyObject *, FSRef *); /* argument parser for FSRef */
PyObject *PyMac_BuildFSRef(FSRef *); /* Convert FSRef to PyObject */
@@ -101,39 +109,54 @@
extern int CmpInstObj_Convert(PyObject *, ComponentInstance *);
/* Ctl exports */
+#ifndef __LP64__
extern PyObject *CtlObj_New(ControlHandle);
extern int CtlObj_Convert(PyObject *, ControlHandle *);
+#endif /* !__LP64__ */
/* Dlg exports */
+#ifndef __LP64__
extern PyObject *DlgObj_New(DialogPtr);
extern int DlgObj_Convert(PyObject *, DialogPtr *);
extern PyObject *DlgObj_WhichDialog(DialogPtr);
+#endif /* !__LP64__ */
/* Drag exports */
+#ifndef __LP64__
extern PyObject *DragObj_New(DragReference);
extern int DragObj_Convert(PyObject *, DragReference *);
+#endif /* !__LP64__ */
/* List exports */
+#ifndef __LP64__
extern PyObject *ListObj_New(ListHandle);
extern int ListObj_Convert(PyObject *, ListHandle *);
+#endif /* !__LP64__ */
/* Menu exports */
+#ifndef __LP64__
extern PyObject *MenuObj_New(MenuHandle);
extern int MenuObj_Convert(PyObject *, MenuHandle *);
+#endif /* !__LP64__ */
/* Qd exports */
+#ifndef __LP64__
extern PyObject *GrafObj_New(GrafPtr);
extern int GrafObj_Convert(PyObject *, GrafPtr *);
extern PyObject *BMObj_New(BitMapPtr);
extern int BMObj_Convert(PyObject *, BitMapPtr *);
extern PyObject *QdRGB_New(RGBColor *);
extern int QdRGB_Convert(PyObject *, RGBColor *);
+#endif /* !__LP64__ */
/* Qdoffs exports */
+#ifndef __LP64__
extern PyObject *GWorldObj_New(GWorldPtr);
extern int GWorldObj_Convert(PyObject *, GWorldPtr *);
+#endif /* !__LP64__ */
/* Qt exports */
+#ifndef __LP64__
extern PyObject *TrackObj_New(Track);
extern int TrackObj_Convert(PyObject *, Track *);
extern PyObject *MovieObj_New(Movie);
@@ -146,6 +169,7 @@
extern int UserDataObj_Convert(PyObject *, UserData *);
extern PyObject *MediaObj_New(Media);
extern int MediaObj_Convert(PyObject *, Media *);
+#endif /* !__LP64__ */
/* Res exports */
extern PyObject *ResObj_New(Handle);
@@ -154,13 +178,17 @@
extern int OptResObj_Convert(PyObject *, Handle *);
/* TE exports */
+#ifndef __LP64__
extern PyObject *TEObj_New(TEHandle);
extern int TEObj_Convert(PyObject *, TEHandle *);
+#endif /* !__LP64__ */
/* Win exports */
+#ifndef __LP64__
extern PyObject *WinObj_New(WindowPtr);
extern int WinObj_Convert(PyObject *, WindowPtr *);
extern PyObject *WinObj_WhichWindow(WindowPtr);
+#endif /* !__LP64__ */
/* CF exports */
extern PyObject *CFObj_New(CFTypeRef);
diff -r -u ./Mac/Modules/res/_Resmodule.c ../Python-2.5/Mac/Modules/res/_Resmodule.c
--- ./Mac/Modules/res/_Resmodule.c 2005-07-04 05:59:44.000000000 +0900
+++ ../Python-2.5/Mac/Modules/res/_Resmodule.c 2013-07-17 23:38:51.000000000 +0900
@@ -414,6 +414,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *ResObj_as_Control(ResourceObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -431,6 +432,7 @@
return _res;
}
+#endif /* !__LP64__ */
static PyObject *ResObj_LoadResource(ResourceObject *_self, PyObject *_args)
{
@@ -1152,6 +1154,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *Res_OpenRFPerm(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1287,6 +1290,7 @@
_res = Py_None;
return _res;
}
+#endif /* !__LP64__ */
static PyObject *Res_InsertResourceFile(PyObject *_self, PyObject *_args)
{
@@ -1327,6 +1331,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *Res_FSpResourceFileAlreadyOpen(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1413,6 +1418,7 @@
nextRefNum);
return _res;
}
+#endif /* !__LP64__ */
static PyObject *Res_FSOpenResFile(PyObject *_self, PyObject *_args)
{
@@ -1438,6 +1444,7 @@
return _res;
}
+#ifndef __LP64__
static PyObject *Res_FSCreateResFile(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1534,6 +1541,7 @@
PyMac_BuildFSSpec, &newSpec);
return _res;
}
+#endif /* __LP64__ */
static PyObject *Res_FSOpenResourceFile(PyObject *_self, PyObject *_args)
{
@@ -1637,6 +1645,7 @@
PyDoc_STR("(short refNum) -> (short _rv)")},
{"SetResFileAttrs", (PyCFunction)Res_SetResFileAttrs, 1,
PyDoc_STR("(short refNum, short attrs) -> None")},
+#ifndef __LP64__
{"OpenRFPerm", (PyCFunction)Res_OpenRFPerm, 1,
PyDoc_STR("(Str255 fileName, short vRefNum, SignedByte permission) -> (short _rv)")},
{"HOpenResFile", (PyCFunction)Res_HOpenResFile, 1,
@@ -1647,10 +1656,12 @@
PyDoc_STR("(FSSpec spec, SignedByte permission) -> (short _rv)")},
{"FSpCreateResFile", (PyCFunction)Res_FSpCreateResFile, 1,
PyDoc_STR("(FSSpec spec, OSType creator, OSType fileType, ScriptCode scriptTag) -> None")},
+#endif /* !__LP64__ */
{"InsertResourceFile", (PyCFunction)Res_InsertResourceFile, 1,
PyDoc_STR("(SInt16 refNum, RsrcChainLocation where) -> None")},
{"DetachResourceFile", (PyCFunction)Res_DetachResourceFile, 1,
PyDoc_STR("(SInt16 refNum) -> None")},
+#ifndef __LP64__
{"FSpResourceFileAlreadyOpen", (PyCFunction)Res_FSpResourceFileAlreadyOpen, 1,
PyDoc_STR("(FSSpec resourceFile) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")},
{"FSpOpenOrphanResFile", (PyCFunction)Res_FSpOpenOrphanResFile, 1,
@@ -1659,14 +1670,17 @@
PyDoc_STR("() -> (SInt16 refNum)")},
{"GetNextResourceFile", (PyCFunction)Res_GetNextResourceFile, 1,
PyDoc_STR("(SInt16 curRefNum) -> (SInt16 nextRefNum)")},
+#endif /* __LP64__ */
{"FSOpenResFile", (PyCFunction)Res_FSOpenResFile, 1,
PyDoc_STR("(FSRef ref, SignedByte permission) -> (short _rv)")},
+#ifndef __LP64__
{"FSCreateResFile", (PyCFunction)Res_FSCreateResFile, 1,
PyDoc_STR("(FSRef parentRef, Buffer nameLength) -> (FSRef newRef, FSSpec newSpec)")},
{"FSResourceFileAlreadyOpen", (PyCFunction)Res_FSResourceFileAlreadyOpen, 1,
PyDoc_STR("(FSRef resourceFileRef) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")},
{"FSCreateResourceFile", (PyCFunction)Res_FSCreateResourceFile, 1,
PyDoc_STR("(FSRef parentRef, Buffer nameLength, Buffer forkNameLength) -> (FSRef newRef, FSSpec newSpec)")},
+#endif /* __LP64__ */
{"FSOpenResourceFile", (PyCFunction)Res_FSOpenResourceFile, 1,
PyDoc_STR("(FSRef ref, Buffer forkNameLength, SignedByte permissions) -> (SInt16 refNum)")},
{"Handle", (PyCFunction)Res_Handle, 1,
diff -r -u ./Modules/_ctypes/libffi/src/darwin/ffitarget.h ../Python-2.5/Modules/_ctypes/libffi/src/darwin/ffitarget.h
--- ./Modules/_ctypes/libffi/src/darwin/ffitarget.h 2006-05-26 06:58:05.000000000 +0900
+++ ../Python-2.5/Modules/_ctypes/libffi/src/darwin/ffitarget.h 2013-07-17 23:38:51.000000000 +0900
@@ -4,7 +4,7 @@
* created by configure). This makes is possible to build a univeral binary
* of ctypes in one go.
*/
-#if defined(__i386__)
+#if defined(__i386__) || defined(__x86_64__)
#ifndef X86_DARWIN
#define X86_DARWIN
diff -r -u ./Python/mactoolboxglue.c ../Python-2.5/Python/mactoolboxglue.c
--- ./Python/mactoolboxglue.c 2006-07-12 01:44:25.000000000 +0900
+++ ../Python-2.5/Python/mactoolboxglue.c 2013-07-17 23:39:09.000000000 +0900
@@ -106,6 +106,7 @@
}
+#ifndef __LP64__
OSErr
PyMac_GetFullPathname(FSSpec *fss, char *path, int len)
{
@@ -153,6 +154,7 @@
Py_XDECREF(fs);
return err;
}
+#endif /* !__LP64__ */
/* Convert a 4-char string object argument to an OSType value */
int
@@ -417,6 +419,7 @@
GLUE_NEW(GWorldPtr, GWorldObj_New, "Carbon.Qdoffs")
GLUE_CONVERT(GWorldPtr, GWorldObj_Convert, "Carbon.Qdoffs")
+#ifndef __LP64__
GLUE_NEW(Track, TrackObj_New, "Carbon.Qt")
GLUE_CONVERT(Track, TrackObj_Convert, "Carbon.Qt")
GLUE_NEW(Movie, MovieObj_New, "Carbon.Qt")
@@ -429,6 +432,7 @@
GLUE_CONVERT(UserData, UserDataObj_Convert, "Carbon.Qt")
GLUE_NEW(Media, MediaObj_New, "Carbon.Qt")
GLUE_CONVERT(Media, MediaObj_Convert, "Carbon.Qt")
+#endif /* !__LP64__ */
GLUE_NEW(Handle, ResObj_New, "Carbon.Res")
GLUE_CONVERT(Handle, ResObj_Convert, "Carbon.Res")