From 3d23c9b7d9977707bfe9d83d1b30cb5147126b3c Mon Sep 17 00:00:00 2001 From: Kevin Ollivier Date: Wed, 3 May 2006 04:36:17 +0000 Subject: [PATCH] Initial implementation of wxWidgets build scripts for Mac and Unix. To run tests, just run dobuilds in mac and unix dirs. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38996 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- distrib/scripts/includes/configure_build.inc | 63 +++++++++++++++++++ distrib/scripts/mac/dobuilds | 44 +++++++++++++ distrib/scripts/mac/mac_options.inc | 30 +++++++++ distrib/scripts/mac/macbuild | 29 +++++++++ distrib/scripts/mac/macbuild-lipo | 66 ++++++++++++++++++++ distrib/scripts/unix/dobuilds | 44 +++++++++++++ distrib/scripts/unix/unixbuild | 47 ++++++++++++++ 7 files changed, 323 insertions(+) create mode 100644 distrib/scripts/includes/configure_build.inc create mode 100755 distrib/scripts/mac/dobuilds create mode 100644 distrib/scripts/mac/mac_options.inc create mode 100755 distrib/scripts/mac/macbuild create mode 100755 distrib/scripts/mac/macbuild-lipo create mode 100755 distrib/scripts/unix/dobuilds create mode 100755 distrib/scripts/unix/unixbuild diff --git a/distrib/scripts/includes/configure_build.inc b/distrib/scripts/includes/configure_build.inc new file mode 100644 index 0000000000..a754d9a036 --- /dev/null +++ b/distrib/scripts/includes/configure_build.inc @@ -0,0 +1,63 @@ + +if [ "$INSTALLDIR" = "" ]; then + INSTALLDIR=$BUILDDIR/install + mkdir -p $INSTALLDIR +fi + +# wxPython needs this option so that it can build extensions that store the +# right install_name (e.g. /usr/local/lib) even if the files aren't actually +# in /usr/local/lib at the time they're being linked against +# we do this by setting the "official" prefix at build time, and later +if [ "$BUILDPREFIX" = "" ]; then + BUILDPREFIX=$INSTALLDIR +fi + + +DEBUG_OPTS="--enable-debug" + +UNICODE_OPTS="--enable-unicode" + +ANSI_OPTS="--enable-ansi" + +WXPYTHON_OPTS="--enable-monolithic \ + --with-opengl \ + --enable-sound \ + --enable-display \ + --enable-geometry \ + --enable-debug_flag \ + --enable-optimise \ + --disable-debugreport " + + +do_build(){ + OPTS="" + if [ "$WXPYTHON" == "1" ]; then + OPTS="$WXPYTHON_OPTS" + fi + + if [ "$DEBUG" == "1" ]; then + OPTS="$OPTS $DEBUG_OPTS " + fi + + if [ "$UNICODE" == "1" ]; then + OPTS="$OPTS $UNICODE_OPTS " + fi + + + + if [ "$STATIC" == "1" ]; then + OPTS="$OPTS --enable-static" + fi + + OPTS="$OPTS $OTHER_OPTS" + + $WXROOT/configure --prefix=$BUILDPREFIX $OPTS + make + + # build the libs wxPython needs + if [ "$WXPYTHON" == "1" ]; then + make -C contrib/src/animate + make -C contrib/src/gizmos + make -C contrib/src/stc + fi +} \ No newline at end of file diff --git a/distrib/scripts/mac/dobuilds b/distrib/scripts/mac/dobuilds new file mode 100755 index 0000000000..51552768ad --- /dev/null +++ b/distrib/scripts/mac/dobuilds @@ -0,0 +1,44 @@ +#!/bin/sh + +HOMEDIR="$PWD" + +BUILDDIR_ROOT="$PWD/builds" + +BUILDDIR_CARBON="$BUILDDIR_ROOT/carbon" +BUILDDIR_COCOA="$BUILDDIR_ROOT/cocoa" + +mkdir -p $BUILDDIR_CARBON +mkdir -p $BUILDDIR_COCOA + +cd $BUILDDIR_CARBON +BUILDDIR=$BUILDDIR_CARBON + +export WXROOT="$HOMEDIR/../../.." +export INSTALLDIR="$BUILDDIR/install-ansi" +$HOMEDIR/macbuild + +export INSTALLDIR="$BUILDDIR/install-unicode" +$HOMEDIR/macbuild unicode + +export INSTALLDIR="$BUILDDIR/install-static-ansi" +$HOMEDIR/macbuild static + +export INSTALLDIR="$BUILDDIR/install-static-unicode" +$HOMEDIR/macbuild static unicode + +cd $BUILDDIR_COCOA +BUILDDIR=$BUILDDIR_COCOA + +export INSTALLDIR="$BUILDDIR/install-ansi" +$HOMEDIR/macbuild cocoa + +export INSTALLDIR="$BUILDDIR/install-unicode" +$HOMEDIR/macbuild cocoa unicode + +export INSTALLDIR="$BUILDDIR/install-static-ansi" +$HOMEDIR/macbuild cocoa static + +export INSTALLDIR="$BUILDDIR/install-static-unicode" +$HOMEDIR/macbuild cocoa static unicode + +cd $HOMEDIR \ No newline at end of file diff --git a/distrib/scripts/mac/mac_options.inc b/distrib/scripts/mac/mac_options.inc new file mode 100644 index 0000000000..629f969dd9 --- /dev/null +++ b/distrib/scripts/mac/mac_options.inc @@ -0,0 +1,30 @@ + +UNIVERSAL=0 +WXPYTHON=0 +UNICODE=0 +DEBUG=0 +CARBON=1 +COCOA=0 +STATIC=0 + +# Process command line options. +for i in "$@"; do + case "$i" in + unicode) UNICODE=1 ;; + ansi) UNICODE=0 ;; + debug) DEBUG=1 ;; + wxpython) WXPYTHON=1 ;; + universal) UNIVERSAL=1 ;; + carbon) CARBON=1 ;; + cocoa) COCOA=1 ;; + static) STATIC=1 ;; + *) + usage + exit + ;; + esac +done + +if [ "$COCOA" = "1" ]; then + OTHER_OPTS="--with-cocoa " +fi \ No newline at end of file diff --git a/distrib/scripts/mac/macbuild b/distrib/scripts/mac/macbuild new file mode 100755 index 0000000000..91d32cf02c --- /dev/null +++ b/distrib/scripts/mac/macbuild @@ -0,0 +1,29 @@ +#!/bin/sh + +# you need to change this if you run from outside this dir. +if [ "$WXROOT" = "" ]; then + WXROOT=../../.. +fi + +. $WXROOT/distrib/scripts/includes/configure_build.inc + +. $WXROOT/distrib/scripts/mac/mac_options.inc + +# most of this script is shared with other Mac-based and other +# configure-based build scripts, which is why this looks a little empty. + +if [ "$UNIVERSAL" = "1" ]; then + OTHER_OPTS="--enable-universal_binary " +fi + +do_build + +make prefix=$INSTALLDIR install + +if [ "$WXPYTHON" == "1" ]; then + make -C contrib/src/animate prefix=$INSTALLDIR install + make -C contrib/src/gizmos prefix=$INSTALLDIR install + make -C contrib/src/stc prefix=$INSTALLDIR install +fi + +cd $OLDDIR \ No newline at end of file diff --git a/distrib/scripts/mac/macbuild-lipo b/distrib/scripts/mac/macbuild-lipo new file mode 100755 index 0000000000..ab48db42bd --- /dev/null +++ b/distrib/scripts/mac/macbuild-lipo @@ -0,0 +1,66 @@ +#!/bin/sh + +# you need to change this if you run from outside this dir. +if [ "$WXROOT" = "" ]; then + WXROOT=../../.. +fi + +. $WXROOT/distrib/scripts/includes/configure_build.inc + +. $WXROOT/distrib/scripts/mac/mac_options.inc + +DIR="bld-ppc" + +export CXX="g++-3.3 -arch ppc" +export CC="gcc-3.3 -arch ppc" +mkdir -p $DIR +cd $DIR +do_build +cd .. + +# Do another build, but with i386 this time +DIR="bld-i386" + +export CXX="g++-4.0 -arch i386" +export CC="gcc-4.0 -arch i386" +mkdir -p $DIR +cd $DIR +do_build +cd .. + +# Copy over everything, then remove files we need to replace with lipo'd versions +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 +for item in `cd bld-i386/lib; ls *.dylib` +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 +# 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 +# change that path from bld-i386 to just bld in case someone wants to build things +# 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 [ "$WXPYTHON" == "1" ]; then + make -C contrib/src/animate prefix=$INSTALLDIR install + make -C contrib/src/gizmos prefix=$INSTALLDIR install + make -C contrib/src/stc prefix=$INSTALLDIR install +fi \ No newline at end of file diff --git a/distrib/scripts/unix/dobuilds b/distrib/scripts/unix/dobuilds new file mode 100755 index 0000000000..51552768ad --- /dev/null +++ b/distrib/scripts/unix/dobuilds @@ -0,0 +1,44 @@ +#!/bin/sh + +HOMEDIR="$PWD" + +BUILDDIR_ROOT="$PWD/builds" + +BUILDDIR_CARBON="$BUILDDIR_ROOT/carbon" +BUILDDIR_COCOA="$BUILDDIR_ROOT/cocoa" + +mkdir -p $BUILDDIR_CARBON +mkdir -p $BUILDDIR_COCOA + +cd $BUILDDIR_CARBON +BUILDDIR=$BUILDDIR_CARBON + +export WXROOT="$HOMEDIR/../../.." +export INSTALLDIR="$BUILDDIR/install-ansi" +$HOMEDIR/macbuild + +export INSTALLDIR="$BUILDDIR/install-unicode" +$HOMEDIR/macbuild unicode + +export INSTALLDIR="$BUILDDIR/install-static-ansi" +$HOMEDIR/macbuild static + +export INSTALLDIR="$BUILDDIR/install-static-unicode" +$HOMEDIR/macbuild static unicode + +cd $BUILDDIR_COCOA +BUILDDIR=$BUILDDIR_COCOA + +export INSTALLDIR="$BUILDDIR/install-ansi" +$HOMEDIR/macbuild cocoa + +export INSTALLDIR="$BUILDDIR/install-unicode" +$HOMEDIR/macbuild cocoa unicode + +export INSTALLDIR="$BUILDDIR/install-static-ansi" +$HOMEDIR/macbuild cocoa static + +export INSTALLDIR="$BUILDDIR/install-static-unicode" +$HOMEDIR/macbuild cocoa static unicode + +cd $HOMEDIR \ No newline at end of file diff --git a/distrib/scripts/unix/unixbuild b/distrib/scripts/unix/unixbuild new file mode 100755 index 0000000000..c80b9eba66 --- /dev/null +++ b/distrib/scripts/unix/unixbuild @@ -0,0 +1,47 @@ +#!/bin/sh + +# you need to change this if you run from outside this dir. +if [ "$WXROOT" = "" ]; then + WXROOT=../../.. +fi + +. $WXROOT/distrib/scripts/includes/configure_build.inc + +WXPYTHON=0 +UNICODE=0 +DEBUG=0 +STATIC=0 +PORT="" + +# Process command line options. +for i in "$@"; do + case "$i" in + unicode) UNICODE=1 ;; + ansi) UNICODE=0 ;; + debug) DEBUG=1 ;; + wxpython) WXPYTHON=1 ;; + gtk2) PORT="gtk2" ;; + gtk) PORT="gtk" ;; + x11) PORT="x11" ;; + motif) PORT="motif" ;; + static) STATIC=1 ;; + *) + usage + exit + ;; + esac +done + +OTHER_OPTS="--with-$PORT " + +do_build + +make prefix=$INSTALLDIR install + +if [ "$WXPYTHON" == "1" ]; then + make -C contrib/src/animate prefix=$INSTALLDIR install + make -C contrib/src/gizmos prefix=$INSTALLDIR install + make -C contrib/src/stc prefix=$INSTALLDIR install +fi + +cd $OLDDIR \ No newline at end of file -- 2.45.2