diff --git a/wxPython/config.py b/wxPython/config.py index 23e6fc9d98..089c9835e4 100644 --- a/wxPython/config.py +++ b/wxPython/config.py @@ -200,6 +200,10 @@ WXDLLVER = '%d%d' % (VER_MAJOR, VER_MINOR) WXPY_SRC = '.' # Assume we're in the source tree already, but allow the # user to change it, particularly for extension building. +ARCH = '' # If this is set, add an -arch XXX flag to cflags + # Only tested (and presumably, needed) for OS X universal + # binary builds created using lipo. + #---------------------------------------------------------------------- @@ -271,7 +275,7 @@ for flag in [ 'BUILD_ACTIVEX', 'BUILD_DLLWIDGET', # String options for option in ['WX_CONFIG', 'SYS_WX_CONFIG', 'WXDLLVER', 'BUILD_BASE', 'WXPORT', 'SWIG', 'CONTRIBS_INC', 'WXPY_SRC', 'FLAVOUR', - 'VER_FLAGS', + 'VER_FLAGS', 'ARCH', ]: for x in range(len(sys.argv)): if sys.argv[x].find(option) == 0: @@ -483,7 +487,10 @@ class wx_install_headers(distutils.command.install_headers.install_headers): return root = self.root - if root is None or WXPREFIX.startswith(root): + #print "WXPREFIX is %s, root is %s" % (WXPREFIX, root) + # hack for universal builds, which append i386/ppc + # to the root + if root is None or WXPREFIX.startswith(os.path.dirname(root)): root = '' for header, location in headers: install_dir = os.path.normpath(root + @@ -600,9 +607,9 @@ def adjustLFLAGS(lflags, libdirs, libs): # remove any flags for universal binaries, we'll get those from # distutils instead - return [flag for flag in newLFLAGS - if flag not in ['-isysroot', '-arch', 'ppc', 'i386'] and - not flag.startswith('/Developer') ] + return newLFLAGS #[flag for flag in newLFLAGS + # if flag not in ['-isysroot', '-arch', 'ppc', 'i386'] and + # not flag.startswith('/Developer') ] @@ -789,6 +796,14 @@ elif os.name == 'posix': GENDIR = 'mac' libs = ['stdc++'] NO_SCRIPTS = 1 + if not ARCH == "": + cflags.append("-arch") + cflags.append(ARCH) + lflags.append("-arch") + lflags.append(ARCH) + #if ARCH == "ppc": + # cflags.append("-isysroot") + # cflags.append("/Developer/SDKs/MacOSX10.3.9.sdk") else: diff --git a/wxPython/distrib/build_packages.sh b/wxPython/distrib/build_packages.sh index 24f6d226ca..10e9308b78 100755 --- a/wxPython/distrib/build_packages.sh +++ b/wxPython/distrib/build_packages.sh @@ -5,7 +5,7 @@ debug=no reswig=no all=no -if [ "$1" = "all" ]; then +if [ "$1" = all ]; then all=yes else PY_VERSION=$1 @@ -99,7 +99,7 @@ if [ "$OSTYPE" = "cygwin" ]; then $WXWIN/wxPython/distrib/makedemo $TOOLS/Python$PY_VERSION/python `cygpath -d $WXWIN/wxPython/distrib/make_installer_inno4.py` $UNICODE_FLAG -elif [ "$OSTYPE" = "darwin" ]; then +elif [ "${OSTYPE:0:6}" = "darwin" ]; then OSX_VERSION=`sw_vers -productVersion` echo "OS X Version: ${OSX_VERSION:0:4}" cd $WXWIN/wxPython diff --git a/wxPython/distrib/mac/wxPythonOSX/build b/wxPython/distrib/mac/wxPythonOSX/build index 2f3becd3c7..3ea302de45 100755 --- a/wxPython/distrib/mac/wxPythonOSX/build +++ b/wxPython/distrib/mac/wxPythonOSX/build @@ -276,7 +276,10 @@ if [ $skipbuild != yes ]; then export WXROOT export BUILDPREFIX=$PREFIX export INSTALLDIR=$INSTALLROOT$PREFIX - $WXDIR/distrib/scripts/mac/macbuild wxpython universal $CHARTYPE + $WXDIR/distrib/scripts/mac/macbuild-lipo wxpython $CHARTYPE + if [ $? != 0 ]; then + exit $? + fi else make $MAKEJOBS make $MAKEJOBS -C contrib/src/gizmos @@ -289,20 +292,60 @@ if [ $skipbuild != yes ]; then fi # Build wxPython + if [ $universal = yes ]; then + # build ppc, then i386, then lipo them together + ARCH=ppc + export CXX="g++-3.3 -DMAC_OS_X_VERSION_MAX_ALLOWED=1030" + export CC="gcc-3.3 -DMAC_OS_X_VERSION_MAX_ALLOWED=1030" + export MACOSX_DEPLOYMENT_TARGET=10.3 + mkdir -p $INSTALLROOT/$ARCH + mkdir -p $WXBLD/$ARCH + + echo "Building wxPython for PPC..." + cd $WXROOT/wxPython + $PYTHON setup.py \ + UNICODE=$PYUNICODEOPT \ + NO_SCRIPTS=1 \ + EP_ADD_OPTS=1 \ + WX_CONFIG="$INSTALLROOT/$PREFIX/bin/wx-config --prefix=$INSTALLROOT$PREFIX" \ + BUILD_BASE=$WXBLD/$ARCH/wxPython \ + ARCH="$ARCH" \ + build + + ARCH=i386 + export CXX="g++-4.0 -arch i386" + export CC="gcc-4.0 -arch i386" + export MACOSX_DEPLOYMENT_TARGET=10.4 + mkdir -p $INSTALLROOT/$ARCH + mkdir -p $WXBLD/$ARCH + + echo "Building wxPython for Intel..." + cd $WXROOT/wxPython $PYTHON setup.py \ UNICODE=$PYUNICODEOPT \ NO_SCRIPTS=1 \ EP_ADD_OPTS=1 \ + WX_CONFIG="$INSTALLROOT/$PREFIX/bin/wx-config --prefix=$INSTALLROOT$PREFIX" \ + BUILD_BASE=$WXBLD/$ARCH/wxPython \ + ARCH="$ARCH" \ + build + + else + cd $WXROOT/wxPython + $PYTHON setup.py \ + UNICODE=$PYUNICODEOPT \ + NO_SCRIPTS=1 \ + EP_ADD_OPTS=1 \ WX_CONFIG="$WXBLD_CONFIG --inplace" \ BUILD_BASE=$WXBLD/wxPython \ SWIG=$SWIGBIN \ USE_SWIG=$SWIGIT \ build + fi fi #---------------------------------------------------------------------- - if [ $skipinstall != yes ]; then # Install wxWidgets cd $WXBLD @@ -317,17 +360,51 @@ if [ $skipinstall != yes ]; then rm wx-config ln -s ../lib/wx/config/* wx-config - # and wxPython + if [ $universal == yes ]; then + ARCH=ppc + export CXX="g++-3.3 -DMAC_OS_X_VERSION_MAX_ALLOWED=1030" + export CC="gcc-3.3 -DMAC_OS_X_VERSION_MAX_ALLOWED=1030" + export MACOSX_DEPLOYMENT_TARGET=10.3 cd $WXROOT/wxPython $PYTHON setup.py \ UNICODE=$PYUNICODEOPT \ NO_SCRIPTS=1 \ EP_ADD_OPTS=1 \ WX_CONFIG="$INSTALLROOT$PREFIX/bin/wx-config --prefix=$INSTALLROOT$PREFIX" \ + BUILD_BASE=$WXBLD/$ARCH/wxPython \ + install \ + --root=$INSTALLROOT/$ARCH + + ARCH=i386 + export CXX="g++-4.0 -arch i386" + export CC="gcc-4.0 -arch i386" + export MACOSX_DEPLOYMENT_TARGET=10.4 + cd $WXROOT/wxPython + $PYTHON setup.py \ + UNICODE=$PYUNICODEOPT \ + NO_SCRIPTS=1 \ + EP_ADD_OPTS=1 \ + WX_CONFIG="$INSTALLROOT$PREFIX/bin/wx-config --prefix=$INSTALLROOT$PREFIX" \ + BUILD_BASE=$WXBLD/$ARCH/wxPython \ + install \ + --root=$INSTALLROOT/$ARCH + + echo "Lipoing $INSTALLROOT/ppc and $INSTALLROOT/i386..." + $PYTHON $WXROOT/distrib/scripts/mac/lipo-dir.py $INSTALLROOT/ppc $INSTALLROOT/i386 $INSTALLROOT + + rm -rf $INSTALLROOT/ppc $INSTALLROOT/i386 + + else + cd $WXROOT/wxPython + $PYTHON setup.py \ + UNICODE=$PYUNICODEOPT \ + NO_SCRIPTS=1 \ + EP_ADD_OPTS=1 \ + WX_CONFIG="$INSTALLROOT$PREFIX/bin/wx-config --prefix=$INSTALLROOT$PREFIX" \ BUILD_BASE=$WXBLD/wxPython \ install \ --root=$INSTALLROOT - + fi # Apple's Python Framework (such as what comes with Panther) # sym-links the site-packages dir in the framework to diff --git a/wxPython/setup.py b/wxPython/setup.py index 5d85aceadd..7cb4c2311e 100755 --- a/wxPython/setup.py +++ b/wxPython/setup.py @@ -574,6 +574,11 @@ if BUILD_GLCANVAS: gl_libs = libs + ['opengl32', 'glu32'] + makeLibName('gl') gl_lflags = lflags + if sys.platform[:6] == "darwin" and WXPORT == 'mac': + if not ARCH == "": + gl_lflags.append("-arch") + gl_lflags.append(ARCH) + ext = Extension('_glcanvas', swig_sources,