wxWidgets/wxPython/distrib/mac/_build
Robin Dunn eb0f373c99 Fixes and other changes to the demo and some library modules so they
work better (or at all) on wxMac


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16500 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2002-08-13 23:59:08 +00:00

255 lines
6.2 KiB
Bash
Executable File

#!/bin/sh -e
#
# build binary wxMacPython package and put it on a disk image
#
# usage: build [-s dir] [-d dir] [--cvs-update] [--force] [--debug]
#
# (C)opyright 2002 Frank Vercruesse
#
# Many modifications by Robin Dunn
PYVER=2.2
curDir=`pwd`
progDir="`dirname \"$0\"`"
defSrcPath="/projects/wx"
defDstPath="/projects/wx/wxPython/dist"
pkgName="wxPythonOSX"
#version=`date +"%Y-%m-%d"`
version=`cd $defSrcPath/wxPython; python$PYVER -c 'import setup;print setup.VERSION'`
dmgRoot="dmg-root"
pkgRoot="pkg-root"
wxWindowsInst="$pkgRoot/usr/local"
wxPythonInst="$pkgRoot/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER/site-packages"
pythonExec="python$PYVER"
makePkgExec="./makepkg"
makeDmgExec="./makedmg"
usage() {
echo `basename $0`: ERROR: $* 1>&2
echo usage: `basename $0` '[-s dir] [-d dir] [--cvs-update] [--force] [--debug]' 1>&2
exit 1
}
quotemeta() {
# probably not quite correct, but seems to work
echo "$1" | sed -e 's/\([^a-zA-z0-9.,--;_/]\)/\\\1/g'
}
msg()
{
echo "---------------------------------------------"
echo $@
}
msgdo() {
echo "--> " $@
$@
}
user=$1
shift
update=
force=
debug=
srcPath=
dstPath=
while :; do
case "$1" in
--cvs-update) update=1;;
--force) force=1;;
--debug) debug=1;;
-s) shift; srcPath="$1";;
-d) shift; dstPath="$1";;
-*) usage "bad argument $1";;
*) break;;
esac
shift
done
#-----------------------------------
msg check and prepare build directories
if ! test "$srcPath"; then
srcPath=$defSrcPath
fi
if ! test -d "$srcPath"; then
echo "no such directory: '$srcPath'" 1>&2
exit
fi
if ! test "$dstPath"; then
dstPath=$defDstPath
fi
if ! test -d "$dstPath"; then
msgdo mkdir -p -m 775 "$dstPath"
msgdo chown ${user}:staff "$dstPath"
fi
temp="tmp$$"
if test -e "$dstPath/$temp"; then
msgdo rm -rf "$dstPath/$temp"
fi
msgdo mkdir -m 775 "$dstPath/$temp"
if test -e "$dstPath/$temp/$pkgRoot"; then
msgdo rm -rf "$dstPath/$temp/$pkgRoot"
fi
msgdo mkdir -m 1775 "$dstPath/$temp/$pkgRoot"
msgdo chown root:admin "$dstPath/$temp/$pkgRoot"
if test -e "$dstPath/$temp/$dmgRoot"; then
msgdo rm -rf "$dstPath/$temp/$dmgRoot"
fi
msgdo mkdir -p -m 775 "$dstPath/$temp/$dmgRoot"
msgdo chown $user:staff "$dstPath/$temp/$dmgRoot"
#-----------------------------------
# update cvs
if [ $update ]; then
msg Updating from CVS
msgdo cd "$srcPath"
msgdo cvs update -dP -A
fi
#-----------------------------------
msg configuring wxWindows
buildDir="$srcPath/build-pkg"
dFlag=
if [ $debug ]; then
buildDir="$srcPath/build-pkg-debug"
dFlag="--enable-debug"
fi
if ! test -e "$buildDir"; then
force=1
fi
if [ $force ]; then
if test -e "$buildDir"; then
rm -rf "$buildDir"
fi
msgdo mkdir -m 775 "$buildDir"
msgdo cd "$buildDir"
msgdo ../configure --with-mac --with-opengl $dFlag
cd $curDir
else
echo wxWindows already configured
fi
#-----------------------------------
msg building wxWindows
msgdo cd $buildDir
msgdo make
cd $curDir
#-----------------------------------
msg installing wxWindows
msgdo mkdir -p -m 755 "$dstPath/$temp/$wxWindowsInst"
msgdo cd "$buildDir"
# install once to the package directory, and once to the
# local machine so the wxPython build will get the right wxMac
msgdo make install "prefix=`quotemeta \"$dstPath/$temp/$wxWindowsInst\"`"
msgdo make install
msgdo chown -R root:wheel "$dstPath/$temp/$pkgRoot/usr"
cd $curDir
#-----------------------------------
msg building wxPython
if [ $force ]; then
fFlag="--force"
else
fFlag=
fi
if [ $debug ]; then
dFlag="--debug"
wxpBuildDir="build-pkg-debug"
else
dFlag=
wxpBuildDir="build-pkg"
fi
bbFlag="BUILD_BASE=$wxpBuildDir"
msgdo cd "$srcPath/wxPython"
msgdo $pythonExec setup.py build 'IN_CVS_TREE=1' $bbFlag $fFlag $dFlag
cd $curDir
#-----------------------------------
msg installing wxPython
msgdo mkdir -p -m 775 "$dstPath/$temp/$wxPythonInst"
msgdo cd "$srcPath/wxPython"
msgdo $pythonExec setup.py install $bbFlag --install-lib="$dstPath/$temp/$wxPythonInst"
cd $curDir
msgdo chown -R root:admin "$dstPath/$temp/$pkgRoot/Library"
msgdo chmod -R g+w "$dstPath/$temp/$pkgRoot/Library"
#-----------------------------------
msg copying additional wxPython files
msgdo cp -pR "$srcPath/wxPython/samples" "$dstPath/$temp/$dmgRoot"
msgdo cp -pR "$srcPath/wxPython/demo" "$dstPath/$temp/$dmgRoot"
msgdo cp -pR "$srcPath/wxPython/licence" "$dstPath/$temp/$dmgRoot"
msgdo cp -pR "$srcPath/wxPython/tools" "$dstPath/$temp/$dmgRoot"
find "$dstPath/$temp/$dmgRoot" -name "CVS" -type d -print0 | xargs -0 rm -rf
find "$dstPath/$temp/$dmgRoot" -name ".DS_Store" -type f -print0 | xargs -0 rm
find "$dstPath/$temp/$dmgRoot" -name ".cvsignore" -type f -print0 | xargs -0 rm
find "$dstPath/$temp/$dmgRoot" -name ".#*" -type f -print0 | xargs -0 rm
find "$dstPath/$temp/$dmgRoot" -name "b" -type f -print0 | xargs -0 rm
find "$dstPath/$temp/$dmgRoot" -name "*~*~" -type f -print0 | xargs -0 rm
msgdo chown -R ${user}:staff "$dstPath/$temp/$dmgRoot"
#-----------------------------------
msg making installer package
msgdo cp -pR "$progDir/resources" "$dstPath/$temp"
msgdo cp $progDir/$pkgName.info $progDir/$pkgName-$version.info
if [ $debug ]; then
echo "__WXDEBUG__ version." >> "$dstPath/$temp/resources/Welcome.txt"
echo "" >> "$dstPath/$temp/resources/Welcome.txt"
fi
echo "Build date: `date`" >> "$dstPath/$temp/resources/Welcome.txt"
msgdo cd "$progDir"
msgdo "$makePkgExec" $dstPath/$temp/$pkgRoot $pkgName-$version.info -d $dstPath/$temp/$dmgRoot -r $dstPath/$temp/resources
msgdo chown -R ${user}:staff $dstPath/$temp/$dmgRoot/$pkgName-$version.pkg
cd $curDir
#-----------------------------------
msg making disk image
msgdo cd "$progDir"
msgdo "$makeDmgExec" $dstPath/$temp/$dmgRoot $dstPath/$temp $pkgName-$version
if [ $debug ]; then
dmgName="$pkgName-$version-debug"
else
dmgName="$pkgName-$version"
fi
msgdo mv "$dstPath/$temp/$pkgName-$version.dmg" "$dstPath/$dmgName.dmg"
msgdo chown ${user}:staff "$dstPath/$dmgName.dmg"
cd $curDir
#-----------------------------------
msg cleaning up
msgdo chown -R ${user}:staff "$buildDir"
msgdo chown -R ${user}:staff "$srcPath/wxPython/$wxpBuildDir"
msgdo rm $progDir/$pkgName-$version.info
msgdo rm -rf "$dstPath/$temp"