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"
161 msgdo
make install "prefix=`quotemeta \"$dstPath/$temp/$wxWindowsInst\"`"
162 msgdo chown
-R root
:wheel
"$dstPath/$temp/$pkgRoot/usr"
166 #-----------------------------------
167 msg building wxPython
175 wxpBuildDir
="build-pkg-debug"
178 wxpBuildDir
="build-pkg"
180 bbFlag
="BUILD_BASE=$wxpBuildDir"
182 msgdo
cd "$srcPath/wxPython"
183 msgdo
$pythonExec setup.py build
'IN_CVS_TREE=1' $bbFlag $fFlag $dFlag
187 #-----------------------------------
188 msg installing wxPython
189 msgdo
mkdir -p -m 775 "$dstPath/$temp/$wxPythonInst"
190 msgdo
cd "$srcPath/wxPython"
191 msgdo
$pythonExec setup.py
install $bbFlag --install-lib="$dstPath/$temp/$wxPythonInst"
194 msgdo chown
-R root
:admin
"$dstPath/$temp/$pkgRoot/Library"
195 msgdo
chmod -R g
+w
"$dstPath/$temp/$pkgRoot/Library"
198 #-----------------------------------
199 msg copying additional wxPython files
200 msgdo
cp -pR "$srcPath/wxPython/samples" "$dstPath/$temp/$dmgRoot"
201 msgdo
cp -pR "$srcPath/wxPython/demo" "$dstPath/$temp/$dmgRoot"
202 msgdo
cp -pR "$srcPath/wxPython/licence" "$dstPath/$temp/$dmgRoot"
203 msgdo
cp -pR "$srcPath/wxPython/tools" "$dstPath/$temp/$dmgRoot"
204 find "$dstPath/$temp/$dmgRoot" -name "CVS" -type d
-print0 | xargs -0 rm -rf
205 find "$dstPath/$temp/$dmgRoot" -name ".DS_Store" -type f
-print0 | xargs -0 rm
206 find "$dstPath/$temp/$dmgRoot" -name ".cvsignore" -type f
-print0 | xargs -0 rm
207 find "$dstPath/$temp/$dmgRoot" -name ".#*" -type f
-print0 | xargs -0 rm
208 find "$dstPath/$temp/$dmgRoot" -name "b" -type f
-print0 | xargs -0 rm
209 find "$dstPath/$temp/$dmgRoot" -name "*~*~" -type f
-print0 | xargs -0 rm
210 msgdo chown
-R ${user}:staff
"$dstPath/$temp/$dmgRoot"
213 #-----------------------------------
214 msg making installer package
215 msgdo
cp -pR "$progDir/resources" "$dstPath/$temp"
216 msgdo
cp $progDir/$pkgName.info
$progDir/$pkgName-$version.info
218 echo "__WXDEBUG__ version." >> "$dstPath/$temp/resources/Welcome.txt"
219 echo "" >> "$dstPath/$temp/resources/Welcome.txt"
221 echo "Build date: `date`" >> "$dstPath/$temp/resources/Welcome.txt"
223 msgdo
"$makePkgExec" $dstPath/$temp/$pkgRoot $pkgName-$version.info
-d $dstPath/$temp/$dmgRoot -r $dstPath/$temp/resources
224 msgdo chown
-R ${user}:staff
$dstPath/$temp/$dmgRoot/$pkgName-$version.pkg
228 #-----------------------------------
229 msg making disk image
231 msgdo
"$makeDmgExec" $dstPath/$temp/$dmgRoot $dstPath/$temp $pkgName-$version
233 dmgName
="$pkgName-$version-debug"
235 dmgName
="$pkgName-$version"
237 msgdo
mv "$dstPath/$temp/$pkgName-$version.dmg" "$dstPath/$dmgName.dmg"
238 msgdo chown
${user}:staff
"$dstPath/$dmgName.dmg"
242 #-----------------------------------
244 msgdo chown
-R ${user}:staff
"$buildDir"
245 msgdo chown
-R ${user}:staff
"$srcPath/wxPython/$wxpBuildDir"
246 msgdo
rm $progDir/$pkgName-$version.info
247 msgdo
rm -rf "$dstPath/$temp"