3 # build binary wxMacPython package and put it on a disk image
5 # usage: build [-s dir] [-d dir] [--cvs-update] [--force] [--debug]
7 # (C)opyright 2002 Frank Vercruesse
9 # Many modifications by Robin Dunn
15 progDir
="`dirname \"$0\"`"
17 defSrcPath
="/projects/wx"
18 defDstPath
="/projects/wx/wxPython/dist"
21 #version=`date +"%Y-%m-%d"`
22 version
=`cd $defSrcPath/wxPython; python$PYVER -c 'import setup;print setup.VERSION'`
26 wxWindowsInst
="$pkgRoot/usr/local"
27 wxPythonInst
="$pkgRoot/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER/site-packages"
29 pythonExec
="python$PYVER"
30 makePkgExec
="./makepkg"
31 makeDmgExec
="./makedmg"
35 echo `basename $0`: ERROR
: $
* 1>&2
36 echo usage
: `basename $0` '[-s dir] [-d dir] [--cvs-update] [--force] [--debug]' 1>&2
41 # probably not quite correct, but seems to work
42 echo "$1" | sed -e 's/\([^a-zA-z0-9.,--;_/]\)/\\\1/g'
47 echo "---------------------------------------------"
68 --cvs-update) update
=1;;
71 -s) shift; srcPath
="$1";;
72 -d) shift; dstPath
="$1";;
73 -*) usage
"bad argument $1";;
80 #-----------------------------------
81 msg check and prepare build directories
83 if ! test "$srcPath"; then
86 if ! test -d "$srcPath"; then
87 echo "no such directory: '$srcPath'" 1>&2
91 if ! test "$dstPath"; then
94 if ! test -d "$dstPath"; then
95 msgdo
mkdir -p -m 775 "$dstPath"
96 msgdo chown
${user}:staff
"$dstPath"
100 if test -e "$dstPath/$temp"; then
101 msgdo
rm -rf "$dstPath/$temp"
103 msgdo
mkdir -m 775 "$dstPath/$temp"
105 if test -e "$dstPath/$temp/$pkgRoot"; then
106 msgdo
rm -rf "$dstPath/$temp/$pkgRoot"
108 msgdo
mkdir -m 1775 "$dstPath/$temp/$pkgRoot"
109 msgdo chown root
:admin
"$dstPath/$temp/$pkgRoot"
111 if test -e "$dstPath/$temp/$dmgRoot"; then
112 msgdo
rm -rf "$dstPath/$temp/$dmgRoot"
114 msgdo
mkdir -p -m 775 "$dstPath/$temp/$dmgRoot"
115 msgdo chown
$user:staff
"$dstPath/$temp/$dmgRoot"
118 #-----------------------------------
121 msg Updating from CVS
123 msgdo cvs update
-dP -A
127 #-----------------------------------
128 msg configuring wxWindows
130 buildDir
="$srcPath/build-pkg"
131 dFlag
="--enable-debug_flag --enable-optimise"
133 buildDir
="$srcPath/build-pkg-debug"
134 dFlag
="--enable-debug"
136 if ! test -e "$buildDir"; then
140 if test -e "$buildDir"; then
143 msgdo
mkdir -m 775 "$buildDir"
145 msgdo ..
/configure
--with-mac --with-opengl --enable-precomp=no
$dFlag
149 echo wxWindows already configured
153 #-----------------------------------
154 msg building wxWindows
162 #-----------------------------------
163 msg installing wxWindows
164 msgdo
mkdir -p -m 1755 "$dstPath/$temp/$wxWindowsInst"
167 # install once to the package directory, and once to the
168 # local machine so the wxPython build will get the right wxMac
169 msgdo
make install "prefix=`quotemeta \"$dstPath/$temp/$wxWindowsInst\"`"
172 msgdo chown
-R root
:wheel
"$dstPath/$temp/$pkgRoot/usr"
176 #-----------------------------------
177 msg building wxPython
185 wxpBuildDir
="build-pkg-debug"
188 wxpBuildDir
="build-pkg"
190 bbFlag
="BUILD_BASE=$wxpBuildDir"
192 msgdo
cd "$srcPath/wxPython"
193 msgdo
$pythonExec setup.py build
'IN_CVS_TREE=1' $bbFlag $fFlag $dFlag
197 #-----------------------------------
198 msg installing wxPython
199 msgdo
mkdir -p -m 775 "$dstPath/$temp/$wxPythonInst"
200 msgdo
cd "$srcPath/wxPython"
201 msgdo
$pythonExec setup.py
install $bbFlag --install-lib="$dstPath/$temp/$wxPythonInst"
204 msgdo chown
-R root
:admin
"$dstPath/$temp/$pkgRoot/Library"
205 msgdo
chmod -R g
+w
"$dstPath/$temp/$pkgRoot/Library"
208 #-----------------------------------
209 msg copying additional wxPython files
210 msgdo
cp -pR "$srcPath/wxPython/samples" "$dstPath/$temp/$dmgRoot"
211 msgdo
cp -pR "$srcPath/wxPython/demo" "$dstPath/$temp/$dmgRoot"
212 msgdo
cp -pR "$srcPath/wxPython/licence" "$dstPath/$temp/$dmgRoot"
213 find "$dstPath/$temp/$dmgRoot" -name "CVS" -type d
-print0 | xargs -0 rm -rf
214 find "$dstPath/$temp/$dmgRoot" -name ".DS_Store" -type f
-print0 | xargs -0 rm
215 find "$dstPath/$temp/$dmgRoot" -name ".cvsignore" -type f
-print0 | xargs -0 rm
216 find "$dstPath/$temp/$dmgRoot" -name ".#*" -type f
-print0 | xargs -0 rm
217 find "$dstPath/$temp/$dmgRoot" -name "b" -type f
-print0 | xargs -0 rm
218 find "$dstPath/$temp/$dmgRoot" -name "*~*~" -type f
-print0 | xargs -0 rm
220 msgdo
cd "$srcPath/wxPython/scripts"
221 sFiles
=`$pythonExec CreateMacScripts.py`
223 msgdo
cp $f "$dstPath/$temp/$wxWindowsInst/bin"
227 msgdo chown
-R ${user}:staff
"$dstPath/$temp/$dmgRoot"
230 #-----------------------------------
231 msg making installer package
232 msgdo
cp -pR "$progDir/resources" "$dstPath/$temp"
233 msgdo
cp $progDir/$pkgName.info
$progDir/$pkgName-$version.info
235 echo "__WXDEBUG__ version." >> "$dstPath/$temp/resources/Welcome.txt"
236 echo "" >> "$dstPath/$temp/resources/Welcome.txt"
238 echo "Build date: `date`" >> "$dstPath/$temp/resources/Welcome.txt"
240 msgdo
"$makePkgExec" $dstPath/$temp/$pkgRoot $pkgName-$version.info
-d $dstPath/$temp/$dmgRoot -r $dstPath/$temp/resources
241 msgdo chown
-R ${user}:staff
$dstPath/$temp/$dmgRoot/$pkgName-$version.pkg
245 #-----------------------------------
246 msg making disk image
248 msgdo
"$makeDmgExec" $dstPath/$temp/$dmgRoot $dstPath/$temp $pkgName-$version
250 dmgName
="$pkgName-$version-debug"
252 dmgName
="$pkgName-$version"
254 msgdo
mv "$dstPath/$temp/$pkgName-$version.dmg" "$dstPath/$dmgName.dmg"
255 msgdo chown
${user}:staff
"$dstPath/$dmgName.dmg"
259 #-----------------------------------
261 msgdo chown
-R ${user}:staff
"$buildDir"
262 msgdo chown
-R ${user}:staff
"$srcPath/wxPython/$wxpBuildDir"
263 msgdo
rm $progDir/$pkgName-$version.info
264 msgdo
rm -rf "$dstPath/$temp"