Merge build script updates from 2.8 branch.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52924 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
54
distrib/scripts/mac/lipo-dir.py
Normal file
54
distrib/scripts/mac/lipo-dir.py
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
import os, sys, shutil
|
||||||
|
|
||||||
|
outputdir = "."
|
||||||
|
ppc_basedir = "."
|
||||||
|
intel_basedir = "."
|
||||||
|
|
||||||
|
def lipo_walker(data, dirname, names):
|
||||||
|
global outputdir
|
||||||
|
global ppc_basedir
|
||||||
|
global intel_basedir
|
||||||
|
|
||||||
|
for name in names:
|
||||||
|
fullpath = os.path.join(dirname, name)
|
||||||
|
intel_fullpath = fullpath.replace(ppc_basedir, intel_basedir)
|
||||||
|
outputfile = fullpath.replace(ppc_basedir, outputdir)
|
||||||
|
outdir = os.path.dirname(outputfile)
|
||||||
|
if not os.path.exists(outdir):
|
||||||
|
os.makedirs(outdir)
|
||||||
|
|
||||||
|
# this call will only succeed if the file is a binary that can
|
||||||
|
# be lipoed.
|
||||||
|
if not os.path.islink(fullpath) and os.system("lipo -info %s" % fullpath) == 0:
|
||||||
|
if os.system("lipo -output %s -create %s %s" % (outputfile, fullpath, intel_fullpath)) == 0:
|
||||||
|
print "Successfully created %s" % outputfile
|
||||||
|
else:
|
||||||
|
if os.path.islink(fullpath):
|
||||||
|
linkto = os.readlink(fullpath)
|
||||||
|
|
||||||
|
if linkto.startswith(ppc_basedir):
|
||||||
|
linkto = linkto.replace(ppc_basedir, outputdir)
|
||||||
|
elif linkto.startswith(intel_basedir):
|
||||||
|
linkto = linkto.replace(intel_basedir, outputdir)
|
||||||
|
|
||||||
|
os.symlink(linkto, outputfile)
|
||||||
|
|
||||||
|
elif not os.path.isdir(fullpath):
|
||||||
|
shutil.copy(fullpath, outputfile)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
if len(sys.argv) < 4:
|
||||||
|
print "Usage: %s <ppcdir> <inteldir> <outputdir>"
|
||||||
|
print ""
|
||||||
|
print "Takes a directory containing a Mac ppc application, and a directory"
|
||||||
|
print "containing a Mac intel application, and merges them into a universal"
|
||||||
|
print "binary."
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
ppc_basedir = sys.argv[1]
|
||||||
|
intel_basedir = sys.argv[2]
|
||||||
|
outputdir = sys.argv[3]
|
||||||
|
|
||||||
|
os.path.walk(ppc_basedir, lipo_walker, None)
|
||||||
|
|
@@ -18,7 +18,7 @@ for i in "$@"; do
|
|||||||
carbon) PORT="mac" ;;
|
carbon) PORT="mac" ;;
|
||||||
cocoa) PORT="cocoa" ;;
|
cocoa) PORT="cocoa" ;;
|
||||||
static) STATIC=1 ;;
|
static) STATIC=1 ;;
|
||||||
*)
|
*)
|
||||||
usage
|
usage
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
|
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
# you need to change this if you run from outside this dir.
|
# you need to change this if you run from outside this dir.
|
||||||
if [ "$WXROOT" = "" ]; then
|
if [ "$WXROOT" = "" ]; then
|
||||||
WXROOT=../../..
|
scriptDir="$(cd $(dirname $0);pwd)"
|
||||||
|
WXROOT=$scriptDir/../../..
|
||||||
fi
|
fi
|
||||||
|
|
||||||
. $WXROOT/distrib/scripts/includes/configure_build.inc
|
. $WXROOT/distrib/scripts/includes/configure_build.inc
|
||||||
@@ -13,11 +14,18 @@ fi
|
|||||||
# configure-based build scripts, which is why this looks a little empty.
|
# configure-based build scripts, which is why this looks a little empty.
|
||||||
|
|
||||||
if [ "$UNIVERSAL" = "1" ]; then
|
if [ "$UNIVERSAL" = "1" ]; then
|
||||||
OTHER_OPTS="--enable-universal_binary "
|
OTHER_OPTS="$OTHER_OPTS --enable-universal_binary --with-libjpeg=builtin --with-libpng=builtin"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
mkdir -p builds
|
||||||
|
cd builds
|
||||||
do_build
|
do_build
|
||||||
|
|
||||||
make prefix=$INSTALLDIR install
|
make prefix=$INSTALLDIR install
|
||||||
|
|
||||||
cd $OLDDIR
|
if [ "$WXPYTHON" == "1" ]; then
|
||||||
|
make -C contrib/src/gizmos prefix=$INSTALLDIR install
|
||||||
|
make -C contrib/src/stc prefix=$INSTALLDIR install
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $OLDDIR
|
@@ -2,60 +2,53 @@
|
|||||||
|
|
||||||
# you need to change this if you run from outside this dir.
|
# you need to change this if you run from outside this dir.
|
||||||
if [ "$WXROOT" = "" ]; then
|
if [ "$WXROOT" = "" ]; then
|
||||||
WXROOT=../../..
|
scriptDir="$(cd $(dirname $0);pwd)"
|
||||||
|
WXROOT=$scriptDir/../../..
|
||||||
fi
|
fi
|
||||||
|
|
||||||
. $WXROOT/distrib/scripts/includes/configure_build.inc
|
. $WXROOT/distrib/scripts/includes/configure_build.inc
|
||||||
|
|
||||||
. $WXROOT/distrib/scripts/mac/mac_options.inc
|
. $WXROOT/distrib/scripts/mac/mac_options.inc
|
||||||
|
|
||||||
DIR="bld-ppc"
|
OTHER_OPTS="$OTHER_OPTS --disable-precomp-headers"
|
||||||
|
|
||||||
export CXX="g++-3.3 -arch ppc"
|
do_lipo_build(){
|
||||||
export CC="gcc-3.3 -arch ppc"
|
DIR="bld-$1"
|
||||||
mkdir -p $DIR
|
|
||||||
cd $DIR
|
if [ "$1" = "ppc" ]; then
|
||||||
do_build
|
export CXX="g++-3.3 -arch ppc -DMAC_OS_X_VERSION_MAX_ALLOWED=1040"
|
||||||
cd ..
|
export CC="gcc-3.3 -arch ppc -DMAC_OS_X_VERSION_MAX_ALLOWED=1040"
|
||||||
|
export MACOSX_DEPLOYMENT_TARGET=10.3
|
||||||
|
else
|
||||||
|
export CXX="g++-4.0 -arch i386"
|
||||||
|
export CC="gcc-4.0 -arch i386"
|
||||||
|
export MACOSX_DEPLOYMENT_TARGET=10.4
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p $DIR
|
||||||
|
cd $DIR
|
||||||
|
do_build
|
||||||
|
|
||||||
# Do another build, but with i386 this time
|
mkdir -p $INSTALLDIR/$1
|
||||||
DIR="bld-i386"
|
|
||||||
|
make prefix=$INSTALLDIR/$1 install
|
||||||
|
|
||||||
export CXX="g++-4.0 -arch i386"
|
if [ "$WXPYTHON" == "1" ]; then
|
||||||
export CC="gcc-4.0 -arch i386"
|
make -C contrib/src/gizmos prefix=$INSTALLDIR/$1 install
|
||||||
mkdir -p $DIR
|
make -C contrib/src/stc prefix=$INSTALLDIR/$1 install
|
||||||
cd $DIR
|
fi
|
||||||
do_build
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
# Copy over everything, then remove files we need to replace with lipo'd versions
|
cd ..
|
||||||
mkdir -p bld
|
}
|
||||||
cp -R bld-i386/* bld
|
|
||||||
cp -R bld-i386/.pch bld/.pch
|
|
||||||
rm bld/lib/*.dylib
|
|
||||||
|
|
||||||
# lipo the files, but make sure not to run it on symbolic links
|
do_lipo_build "ppc"
|
||||||
for item in `cd bld-i386/lib; ls *.dylib`
|
do_lipo_build "i386"
|
||||||
do
|
|
||||||
if [ -f bld-i386/lib/$item -a ! -L bld-i386/lib/$item ]; then
|
|
||||||
lipo -create bld-i386/lib/$item bld-ppc/lib/$item -output bld/lib/$item
|
|
||||||
else
|
|
||||||
cp -R bld-i386/lib/$item bld/lib
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# make install hacks - the copy operations mess up the timestamps and thus
|
python $WXROOT/distrib/scripts/mac/lipo-dir.py $INSTALLDIR/ppc $INSTALLDIR/i386 $INSTALLDIR
|
||||||
# cause make to erroneously think that the libraries need rebuilt
|
|
||||||
touch bld/.pch/wxprec_monodll/wx/*.gch
|
|
||||||
touch bld/.pch/wxprec_gldll/wx/*.gch
|
|
||||||
touch bld/*.o
|
|
||||||
touch bld/lib/*
|
|
||||||
|
|
||||||
# one more hack - inplace wx-config has a hardcoded path in it - we need to
|
rm -rf $INSTALLDIR/ppc $INSTALLDIR/i386
|
||||||
# change that path from bld-i386 to just bld in case someone wants to build things
|
python -c "import os; fname = os.path.abspath('$INSTALLDIR/bin/wx-config'); data = open(fname).read(); data = data.replace('ppc/', ''); open(fname, 'w').write(data)"
|
||||||
# in tree. (wxPython does this, for example)
|
|
||||||
python -c "import os; fname = os.path.abspath('bld/wx-config'); data = open(fname).read(); data = data.replace('bld-i386', 'bld'); open(fname, 'w').write(data)"
|
|
||||||
|
|
||||||
cd bld
|
|
||||||
make prefix=$INSTALLDIR install
|
|
||||||
|
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
Reference in New Issue
Block a user