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"`
24 wxWindowsInst
="$pkgRoot/usr/local"
25 wxPythonInst
="$pkgRoot/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER/site-packages"
27 pythonExec
="python$PYVER"
28 makePkgExec
="./makepkg"
29 makeDmgExec
="./makedmg"
33 echo `basename $0`: ERROR
: $
* 1>&2
34 echo usage
: `basename $0` '[-s dir] [-d dir] [--cvs-update] [--force] [--debug]' 1>&2
39 # probably not quite correct, but seems to work
40 echo "$1" | sed -e 's/\([^a-zA-z0-9.,--;_/]\)/\\\1/g'
45 echo "---------------------------------------------"
66 --cvs-update) update
=1;;
69 -s) shift; srcPath
="$1";;
70 -d) shift; dstPath
="$1";;
71 -*) usage
"bad argument $1";;
78 #-----------------------------------
79 msg check and prepare build directories
81 if ! test "$srcPath"; then
84 if ! test -d "$srcPath"; then
85 echo "no such directory: '$srcPath'" 1>&2
89 if ! test "$dstPath"; then
92 if ! test -d "$dstPath"; then
93 msgdo
mkdir -p -m 775 "$dstPath"
94 msgdo chown
${user}:staff
"$dstPath"
98 if test -e "$dstPath/$temp"; then
99 msgdo
rm -rf "$dstPath/$temp"
101 msgdo
mkdir -m 775 "$dstPath/$temp"
103 if test -e "$dstPath/$temp/$pkgRoot"; then
104 msgdo
rm -rf "$dstPath/$temp/$pkgRoot"
106 msgdo
mkdir -m 1775 "$dstPath/$temp/$pkgRoot"
107 msgdo chown root
:admin
"$dstPath/$temp/$pkgRoot"
109 if test -e "$dstPath/$temp/$dmgRoot"; then
110 msgdo
rm -rf "$dstPath/$temp/$dmgRoot"
112 msgdo
mkdir -p -m 775 "$dstPath/$temp/$dmgRoot"
113 msgdo chown
$user:staff
"$dstPath/$temp/$dmgRoot"
116 #-----------------------------------
119 msg Updating from CVS
121 msgdo cvs update
-dP -A
125 #-----------------------------------
126 msg configuring wxWindows
127 buildDir
="$srcPath/build-pkg"
130 buildDir
="$srcPath/build-pkg-debug"
131 dFlag
="--enable-debug"
133 if ! test -e "$buildDir"; then
137 if test -e "$buildDir"; then
140 msgdo
mkdir -m 775 "$buildDir"
142 msgdo ..
/configure
--with-mac --with-opengl $dFlag
146 echo wxWindows already configured
150 #-----------------------------------
151 msg building wxWindows
157 #-----------------------------------
158 msg installing wxWindows
159 msgdo
mkdir -p -m 755 "$dstPath/$temp/$wxWindowsInst"
162 # install once to the package directory, and once to the
163 # local machine so the wxPython build will get the right wxMac
164 msgdo
make install "prefix=`quotemeta \"$dstPath/$temp/$wxWindowsInst\"`"
167 msgdo chown
-R root
:wheel
"$dstPath/$temp/$pkgRoot/usr"
171 #-----------------------------------
172 msg building wxPython
180 wxpBuildDir
="build-pkg-debug"
183 wxpBuildDir
="build-pkg"
185 bbFlag
="BUILD_BASE=$wxpBuildDir"
187 msgdo
cd "$srcPath/wxPython"
188 msgdo
$pythonExec setup.py build
'IN_CVS_TREE=1' $bbFlag $fFlag $dFlag
192 #-----------------------------------
193 msg installing wxPython
194 msgdo
mkdir -p -m 775 "$dstPath/$temp/$wxPythonInst"
195 msgdo
cd "$srcPath/wxPython"
196 msgdo
$pythonExec setup.py
install $bbFlag --install-lib="$dstPath/$temp/$wxPythonInst"
199 msgdo chown
-R root
:admin
"$dstPath/$temp/$pkgRoot/Library"
200 msgdo
chmod -R g
+w
"$dstPath/$temp/$pkgRoot/Library"
203 #-----------------------------------
204 msg copying additional wxPython files
205 msgdo
cp -pR "$srcPath/wxPython/samples" "$dstPath/$temp/$dmgRoot"
206 msgdo
cp -pR "$srcPath/wxPython/demo" "$dstPath/$temp/$dmgRoot"
207 msgdo
cp -pR "$srcPath/wxPython/licence" "$dstPath/$temp/$dmgRoot"
208 msgdo
cp -pR "$srcPath/wxPython/tools" "$dstPath/$temp/$dmgRoot"
209 find "$dstPath/$temp/$dmgRoot" -name "CVS" -type d
-print0 | xargs -0 rm -rf
210 find "$dstPath/$temp/$dmgRoot" -name ".DS_Store" -type f
-print0 | xargs -0 rm
211 find "$dstPath/$temp/$dmgRoot" -name ".cvsignore" -type f
-print0 | xargs -0 rm
212 find "$dstPath/$temp/$dmgRoot" -name ".#*" -type f
-print0 | xargs -0 rm
213 find "$dstPath/$temp/$dmgRoot" -name "b" -type f
-print0 | xargs -0 rm
214 find "$dstPath/$temp/$dmgRoot" -name "*~*~" -type f
-print0 | xargs -0 rm
215 msgdo chown
-R ${user}:staff
"$dstPath/$temp/$dmgRoot"
218 #-----------------------------------
219 msg making installer package
220 msgdo
cp -pR "$progDir/resources" "$dstPath/$temp"
221 msgdo
cp $progDir/$pkgName.info
$progDir/$pkgName-$version.info
223 echo "__WXDEBUG__ version." >> "$dstPath/$temp/resources/Welcome.txt"
224 echo "" >> "$dstPath/$temp/resources/Welcome.txt"
226 echo "Build date: `date`" >> "$dstPath/$temp/resources/Welcome.txt"
228 msgdo
"$makePkgExec" $dstPath/$temp/$pkgRoot $pkgName-$version.info
-d $dstPath/$temp/$dmgRoot -r $dstPath/$temp/resources
229 msgdo chown
-R ${user}:staff
$dstPath/$temp/$dmgRoot/$pkgName-$version.pkg
233 #-----------------------------------
234 msg making disk image
236 msgdo
"$makeDmgExec" $dstPath/$temp/$dmgRoot $dstPath/$temp $pkgName-$version
238 dmgName
="$pkgName-$version-debug"
240 dmgName
="$pkgName-$version"
242 msgdo
mv "$dstPath/$temp/$pkgName-$version.dmg" "$dstPath/$dmgName.dmg"
243 msgdo chown
${user}:staff
"$dstPath/$dmgName.dmg"
247 #-----------------------------------
249 msgdo chown
-R ${user}:staff
"$buildDir"
250 msgdo chown
-R ${user}:staff
"$srcPath/wxPython/$wxpBuildDir"
251 msgdo
rm $progDir/$pkgName-$version.info
252 msgdo
rm -rf "$dstPath/$temp"