Patch 1471883: --enable-universalsdk on Mac OS X

This commit is contained in:
Ronald Oussoren 2006-04-29 11:31:35 +00:00
parent f674939a2b
commit 988117fd63
7 changed files with 169 additions and 25 deletions

View File

@ -366,8 +366,8 @@ def _init_posix():
# MACOSX_DEPLOYMENT_TARGET: configure bases some choices on it so
# it needs to be compatible.
# If it isn't set we set it to the configure-time value
if sys.platform == 'darwin' and g.has_key('CONFIGURE_MACOSX_DEPLOYMENT_TARGET'):
cfg_target = g['CONFIGURE_MACOSX_DEPLOYMENT_TARGET']
if sys.platform == 'darwin' and g.has_key('MACOSX_DEPLOYMENT_TARGET'):
cfg_target = g['MACOSX_DEPLOYMENT_TARGET']
cur_target = os.getenv('MACOSX_DEPLOYMENT_TARGET', '')
if cur_target == '':
cur_target = cfg_target

View File

@ -108,13 +108,17 @@ EXE= @EXEEXT@
BUILDEXE= @BUILDEXEEXT@
# Short name and location for Mac OS X Python framework
UNIVERSALSDK=@UNIVERSALSDK@
PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
PYTHONFRAMEWORKDIR= @PYTHONFRAMEWORKDIR@
PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@
PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
# Deployment target selected during configure, to be checked
# by distutils
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
# by distutils. The export statement is needed to ensure that the
# deployment target is active during build.
MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
@EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
# Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
@ -377,8 +381,17 @@ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
$(RESSRCDIR)/version.plist \
$(RESSRCDIR)/English.lproj/InfoPlist.strings
$(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
@LIBTOOL_CRUFT@
if test "${UNIVERSALSDK}"; then \
$(CC) -o $(LDLIBRARY) -arch i386 -arch ppc -dynamiclib \
-isysroot "${UNIVERSALSDK}" \
-all_load $(LIBRARY) -Wl,-single_module \
-install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/Python \
-compatibility_version $(VERSION) \
-current_version $(VERSION); \
else \
libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
@LIBTOOL_CRUFT@ ;\
fi
$(INSTALL) -d -m $(DIRMODE) \
$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
$(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
@ -568,6 +581,19 @@ testall: all platform
-$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
# Run the unitests for both architectures in a Universal build on OSX
# Must be run on an Intel box.
testuniversal: all platform
if [ `arch` != 'i386' ];then \
echo "This can only be used on OSX/i386" ;\
exit 1 ;\
fi
-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
-$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
$(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E -tt $(TESTPROG) $(TESTOPTS) -uall
# Like testall, but with a single pass only
buildbottest: all platform
$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw

7
README
View File

@ -579,7 +579,12 @@ MacOSX: The tests will crash on both 10.1 and 10.2 with SEGV in
want to use any Aqua-based GUI toolkit (whether Tkinter, wxPython,
Carbon, Cocoa or anything else).
See Mac/OSX/README for more information on framework builds.
You may also want to try the configure option "--enable-universalsdk"
which builds Python as a universal binary with support for the
i386 and PPC architetures. This requires Xcode 2.1 or later to build.
See Mac/OSX/README for more information on framework and
universal builds.
Cygwin: With recent (relative to the time of writing, 2001-12-19)
Cygwin installations, there are problems with the interaction

57
configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh
# From configure.in Revision: 45387 .
# From configure.in Revision: 45392 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for python 2.5.
#
@ -312,7 +312,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION SOVERSION CONFIG_ARGS PYTHONFRAMEWORK PYTHONFRAMEWORKDIR PYTHONFRAMEWORKPREFIX PYTHONFRAMEWORKINSTALLDIR MACHDEP SGI_ABI EXTRAPLATDIR EXTRAMACHDEPPATH CONFIGURE_MACOSX_DEPLOYMENT_TARGET CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX MAINCC CPP EGREP BUILDEXEEXT LIBRARY LDLIBRARY DLLLIBRARY BLDLIBRARY LDLIBRARYDIR INSTSONAME RUNSHARED LINKCC RANLIB ac_ct_RANLIB AR SVNVERSION INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN OPT BASECFLAGS OTHER_LIBTOOL_OPT LIBTOOL_CRUFT SO LDSHARED BLDSHARED CCSHARED LINKFORSHARED CFLAGSFORSHARED SHLIBS USE_SIGNAL_MODULE SIGNAL_OBJS USE_THREAD_MODULE LDLAST THREADOBJ DLINCLDIR DYNLOADFILE MACHDEP_OBJS TRUE LIBOBJS HAVE_GETHOSTBYNAME_R_6_ARG HAVE_GETHOSTBYNAME_R_5_ARG HAVE_GETHOSTBYNAME_R_3_ARG HAVE_GETHOSTBYNAME_R HAVE_GETHOSTBYNAME LIBM LIBC UNICODE_OBJS THREADHEADERS SRCDIRS LTLIBOBJS'
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION SOVERSION CONFIG_ARGS UNIVERSALSDK PYTHONFRAMEWORK PYTHONFRAMEWORKDIR PYTHONFRAMEWORKPREFIX PYTHONFRAMEWORKINSTALLDIR MACHDEP SGI_ABI EXTRAPLATDIR EXTRAMACHDEPPATH CONFIGURE_MACOSX_DEPLOYMENT_TARGET EXPORT_MACOSX_DEPLOYMENT_TARGET CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX MAINCC CPP EGREP BUILDEXEEXT LIBRARY LDLIBRARY DLLLIBRARY BLDLIBRARY LDLIBRARYDIR INSTSONAME RUNSHARED LINKCC RANLIB ac_ct_RANLIB AR SVNVERSION INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN OPT BASECFLAGS OTHER_LIBTOOL_OPT LIBTOOL_CRUFT SO LDSHARED BLDSHARED CCSHARED LINKFORSHARED CFLAGSFORSHARED SHLIBS USE_SIGNAL_MODULE SIGNAL_OBJS USE_THREAD_MODULE LDLAST THREADOBJ DLINCLDIR DYNLOADFILE MACHDEP_OBJS TRUE LIBOBJS HAVE_GETHOSTBYNAME_R_6_ARG HAVE_GETHOSTBYNAME_R_5_ARG HAVE_GETHOSTBYNAME_R_3_ARG HAVE_GETHOSTBYNAME_R HAVE_GETHOSTBYNAME LIBM LIBC UNICODE_OBJS THREADHEADERS SRCDIRS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@ -845,6 +845,8 @@ if test -n "$ac_init_help"; then
Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-universalsdk[SDKDIR]
Build agains Mac OS X 10.4u SDK (ppc/i386)
--enable-framework[=INSTALLDIR]
Build (MacOSX|Darwin) framework
--enable-shared disable/enable building shared python library
@ -1400,6 +1402,33 @@ define_xopen_source=yes
CONFIG_ARGS="$ac_configure_args"
# Check whether --enable-universalsdk or --disable-universalsdk was given.
if test "${enable_universalsdk+set}" = set; then
enableval="$enable_universalsdk"
case $enableval in
yes)
enableval=/Developer/SDKs/MacOSX10.4u.sdk
;;
esac
case $enableval in
no)
UNIVERSALSDK=
enable_universalsdk=
;;
*)
UNIVERSALSDK=$enableval
;;
esac
else
UNIVERSALSDK=
enable_universalsdk=
fi;
# Check whether --enable-framework or --disable-framework was given.
if test "${enable_framework+set}" = set; then
enableval="$enable_framework"
@ -1617,7 +1646,9 @@ echo "${ECHO_T}$EXTRAPLATDIR" >&6
# it may influence the way we can build extensions, so distutils
# needs to check it
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
# checks for alternative programs
@ -3807,6 +3838,10 @@ echo "${ECHO_T}$ac_cv_no_strict_aliasing_ok" >&6
# is there any other compiler on Darwin besides gcc?
Darwin*)
BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
if test "${enable_universalsdk}"; then
BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
fi
;;
OSF*)
BASECFLAGS="$BASECFLAGS -mieee"
@ -10753,7 +10788,12 @@ esac
case $ac_sys_system/$ac_sys_release in
Darwin/[01567]\..*)
LIBTOOL_CRUFT="-framework System -lcc_dynamic -arch_only `arch`"
LIBTOOL_CRUFT="-framework System -lcc_dynamic"
if test "${enable_universalsdk}"; then
:
else
LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
fi
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Darwin/*)
@ -10888,9 +10928,16 @@ then
# Use -undefined dynamic_lookup whenever possible (10.3 and later).
# This allows an extension to be used in any Python
cur_target=`sw_vers -productVersion | sed 's/\(10\.[0-9]*\).*/\1/'`
if test ${cur_target} '>' 10.2; then
cur_target=10.3
fi
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
EXPORT_MACOSX_DEPLOYMENT_TARGET=''
if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2
then
if test "${enable_universalsdk}"; then
LDFLAGS="-arch i386 -arch ppc -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
fi
LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
BLDSHARED="$LDSHARED"
else
@ -20313,6 +20360,8 @@ presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
esac
# Check whether right shifting a negative integer extends the sign bit
# or fills with zeros (like the Cray J90, according to Tim Peters).
echo "$as_me:$LINENO: checking whether right shift extends the sign bit" >&5
@ -22395,6 +22444,7 @@ s,@LIBS@,$LIBS,;t t
s,@VERSION@,$VERSION,;t t
s,@SOVERSION@,$SOVERSION,;t t
s,@CONFIG_ARGS@,$CONFIG_ARGS,;t t
s,@UNIVERSALSDK@,$UNIVERSALSDK,;t t
s,@PYTHONFRAMEWORK@,$PYTHONFRAMEWORK,;t t
s,@PYTHONFRAMEWORKDIR@,$PYTHONFRAMEWORKDIR,;t t
s,@PYTHONFRAMEWORKPREFIX@,$PYTHONFRAMEWORKPREFIX,;t t
@ -22404,6 +22454,7 @@ s,@SGI_ABI@,$SGI_ABI,;t t
s,@EXTRAPLATDIR@,$EXTRAPLATDIR,;t t
s,@EXTRAMACHDEPPATH@,$EXTRAMACHDEPPATH,;t t
s,@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@,$CONFIGURE_MACOSX_DEPLOYMENT_TARGET,;t t
s,@EXPORT_MACOSX_DEPLOYMENT_TARGET@,$EXPORT_MACOSX_DEPLOYMENT_TARGET,;t t
s,@CC@,$CC,;t t
s,@CFLAGS@,$CFLAGS,;t t
s,@LDFLAGS@,$LDFLAGS,;t t

View File

@ -60,6 +60,29 @@ define_xopen_source=yes
AC_SUBST(CONFIG_ARGS)
CONFIG_ARGS="$ac_configure_args"
AC_ARG_ENABLE(universalsdk,
AC_HELP_STRING(--enable-universalsdk@<:@SDKDIR@:>@, Build agains Mac OS X 10.4u SDK (ppc/i386)),
[
case $enableval in
yes)
enableval=/Developer/SDKs/MacOSX10.4u.sdk
;;
esac
case $enableval in
no)
UNIVERSALSDK=
enable_universalsdk=
;;
*)
UNIVERSALSDK=$enableval
;;
esac
],[
UNIVERSALSDK=
enable_universalsdk=
])
AC_SUBST(UNIVERSALSDK)
dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
AC_ARG_ENABLE(framework,
AC_HELP_STRING(--enable-framework@<:@=INSTALLDIR@:>@, Build (MacOSX|Darwin) framework),
@ -258,7 +281,9 @@ AC_MSG_RESULT($EXTRAPLATDIR)
# it may influence the way we can build extensions, so distutils
# needs to check it
AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
# checks for alternative programs
@ -740,6 +765,10 @@ yes)
# is there any other compiler on Darwin besides gcc?
Darwin*)
BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
if test "${enable_universalsdk}"; then
BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
fi
;;
OSF*)
BASECFLAGS="$BASECFLAGS -mieee"
@ -1263,7 +1292,12 @@ esac
AC_SUBST(LIBTOOL_CRUFT)
case $ac_sys_system/$ac_sys_release in
Darwin/@<:@01567@:>@\..*)
LIBTOOL_CRUFT="-framework System -lcc_dynamic -arch_only `arch`"
LIBTOOL_CRUFT="-framework System -lcc_dynamic"
if test "${enable_universalsdk}"; then
:
else
LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
fi
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Darwin/*)
@ -1386,9 +1420,16 @@ then
# Use -undefined dynamic_lookup whenever possible (10.3 and later).
# This allows an extension to be used in any Python
cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
if test ${cur_target} '>' 10.2; then
cur_target=10.3
fi
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
EXPORT_MACOSX_DEPLOYMENT_TARGET=''
if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2
then
if test "${enable_universalsdk}"; then
LDFLAGS="-arch i386 -arch ppc -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
fi
LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
BLDSHARED="$LDSHARED"
else
@ -2873,6 +2914,23 @@ fi
# check for endianness
AC_C_BIGENDIAN
AH_VERBATIM([WORDS_BIGENDIAN],
[
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX).
The block below does compile-time checking for endianness on platforms
that use GCC and therefore allows compiling fat binaries on OSX by using
'-arch ppc -arch i386' as the compile flags. The phrasing was choosen
such that the configure-result is used on systems that don't use GCC.
*/
#ifdef __BIG_ENDIAN__
#define WORDS_BIGENDIAN 1
#else
#ifndef __LITTLE_ENDIAN__
#undef WORDS_BIGENDIAN
#endif
#endif])
# Check whether right shifting a negative integer extends the sign bit
# or fills with zeros (like the Cray J90, according to Tim Peters).

View File

@ -846,9 +846,22 @@
/* Define to profile with the Pentium timestamp counter */
#undef WITH_TSC
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX).
The block below does compile-time checking for endianness on platforms
that use GCC and therefore allows compiling fat binaries on OSX by using
'-arch ppc -arch i386' as the compile flags. The phrasing was choosen
such that the configure-result is used on systems that don't use GCC.
*/
#ifdef __BIG_ENDIAN__
#define WORDS_BIGENDIAN 1
#else
#ifndef __LITTLE_ENDIAN__
#undef WORDS_BIGENDIAN
#endif
#endif
/* Define to 1 if on AIX 3.
System headers sometimes define this.

View File

@ -913,20 +913,11 @@ class PyBuildExt(build_ext):
#
# More information on Expat can be found at www.libexpat.org.
#
if sys.byteorder == "little":
xmlbo = "1234"
else:
xmlbo = "4321"
expatinc = os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')
define_macros = [
('XML_NS', '1'),
('XML_DTD', '1'),
('BYTEORDER', xmlbo),
('XML_CONTEXT_BYTES','1024'),
]
for feature_macro in ['HAVE_MEMMOVE', 'HAVE_BCOPY']:
if config_h_vars.has_key(feature_macro):
define_macros.append((feature_macro, '1'))
('HAVE_EXPAT_CONFIG_H', '1'),
]
exts.append(Extension('pyexpat',
define_macros = define_macros,
include_dirs = [expatinc],