]> git.saurik.com Git - wxWidgets.git/blame - wxPython/distrib/mac/_build
call wxApp::OnExit() when wxExit() is called and don't do wxLogError from it (replace...
[wxWidgets.git] / wxPython / distrib / mac / _build
CommitLineData
8721cada
RD
1#!/bin/sh -e
2#
3# build binary wxMacPython package and put it on a disk image
4#
5# usage: build [-s dir] [-d dir] [--cvs-update] [--force] [--debug]
6#
7# (C)opyright 2002 Frank Vercruesse
8#
9# Many modifications by Robin Dunn
10
11
12PYVER=2.2
13
14curDir=`pwd`
15progDir="`dirname \"$0\"`"
16
17defSrcPath="/projects/wx"
18defDstPath="/projects/wx/wxPython/dist"
19
eb0f373c 20pkgName="wxPythonOSX"
6ca312ba
RD
21#version=`date +"%Y-%m-%d"`
22version=`cd $defSrcPath/wxPython; python$PYVER -c 'import setup;print setup.VERSION'`
23
8721cada
RD
24dmgRoot="dmg-root"
25pkgRoot="pkg-root"
26wxWindowsInst="$pkgRoot/usr/local"
27wxPythonInst="$pkgRoot/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER/site-packages"
28
29pythonExec="python$PYVER"
30makePkgExec="./makepkg"
31makeDmgExec="./makedmg"
32
33
34usage() {
35 echo `basename $0`: ERROR: $* 1>&2
36 echo usage: `basename $0` '[-s dir] [-d dir] [--cvs-update] [--force] [--debug]' 1>&2
37 exit 1
38}
39
40quotemeta() {
41 # probably not quite correct, but seems to work
42 echo "$1" | sed -e 's/\([^a-zA-z0-9.,--;_/]\)/\\\1/g'
43}
44
45msg()
46{
47 echo "---------------------------------------------"
48 echo $@
49}
50
51msgdo() {
52 echo "--> " $@
53 $@
54}
55
56
57user=$1
58shift
59
60update=
61force=
62debug=
63srcPath=
64dstPath=
65
66while :; do
67 case "$1" in
68 --cvs-update) update=1;;
69 --force) force=1;;
70 --debug) debug=1;;
71 -s) shift; srcPath="$1";;
72 -d) shift; dstPath="$1";;
73 -*) usage "bad argument $1";;
74 *) break;;
75 esac
76 shift
77done
78
79
80#-----------------------------------
81msg check and prepare build directories
82
83if ! test "$srcPath"; then
84 srcPath=$defSrcPath
85fi
86if ! test -d "$srcPath"; then
87 echo "no such directory: '$srcPath'" 1>&2
88 exit
89fi
90
91if ! test "$dstPath"; then
92 dstPath=$defDstPath
93fi
94if ! test -d "$dstPath"; then
95 msgdo mkdir -p -m 775 "$dstPath"
96 msgdo chown ${user}:staff "$dstPath"
97fi
98
99temp="tmp$$"
100if test -e "$dstPath/$temp"; then
101 msgdo rm -rf "$dstPath/$temp"
102fi
103msgdo mkdir -m 775 "$dstPath/$temp"
104
105if test -e "$dstPath/$temp/$pkgRoot"; then
106 msgdo rm -rf "$dstPath/$temp/$pkgRoot"
107fi
108msgdo mkdir -m 1775 "$dstPath/$temp/$pkgRoot"
109msgdo chown root:admin "$dstPath/$temp/$pkgRoot"
110
111if test -e "$dstPath/$temp/$dmgRoot"; then
112 msgdo rm -rf "$dstPath/$temp/$dmgRoot"
113fi
114msgdo mkdir -p -m 775 "$dstPath/$temp/$dmgRoot"
115msgdo chown $user:staff "$dstPath/$temp/$dmgRoot"
116
117
118#-----------------------------------
119# update cvs
120if [ $update ]; then
121 msg Updating from CVS
122 msgdo cd "$srcPath"
123 msgdo cvs update -dP -A
124fi
125
126
127#-----------------------------------
128msg configuring wxWindows
849b176b 129
8721cada 130buildDir="$srcPath/build-pkg"
849b176b 131dFlag="--enable-debug_flag --enable-optimise"
8721cada
RD
132if [ $debug ]; then
133 buildDir="$srcPath/build-pkg-debug"
134 dFlag="--enable-debug"
135fi
136if ! test -e "$buildDir"; then
137 force=1
138fi
139if [ $force ]; then
140 if test -e "$buildDir"; then
141 rm -rf "$buildDir"
142 fi
143 msgdo mkdir -m 775 "$buildDir"
144 msgdo cd "$buildDir"
9c6b4824 145 msgdo ../configure --with-mac --with-opengl --enable-precomp=no $dFlag
8721cada
RD
146 cd $curDir
147
148else
149 echo wxWindows already configured
150fi
151
152
153#-----------------------------------
154msg building wxWindows
155msgdo cd $buildDir
156msgdo make
9c6b4824
RD
157msgdo cd ../locale
158msgdo make allmo
8721cada
RD
159cd $curDir
160
161
162#-----------------------------------
163msg installing wxWindows
9c6b4824 164msgdo mkdir -p -m 1755 "$dstPath/$temp/$wxWindowsInst"
8721cada 165msgdo cd "$buildDir"
5f9dc1f1
RD
166
167# install once to the package directory, and once to the
168# local machine so the wxPython build will get the right wxMac
8721cada 169msgdo make install "prefix=`quotemeta \"$dstPath/$temp/$wxWindowsInst\"`"
5f9dc1f1
RD
170msgdo make install
171
8721cada
RD
172msgdo chown -R root:wheel "$dstPath/$temp/$pkgRoot/usr"
173cd $curDir
174
175
176#-----------------------------------
177msg building wxPython
178if [ $force ]; then
179 fFlag="--force"
180else
181 fFlag=
182fi
183if [ $debug ]; then
184 dFlag="--debug"
185 wxpBuildDir="build-pkg-debug"
186else
187 dFlag=
188 wxpBuildDir="build-pkg"
189fi
190bbFlag="BUILD_BASE=$wxpBuildDir"
191
192msgdo cd "$srcPath/wxPython"
193msgdo $pythonExec setup.py build 'IN_CVS_TREE=1' $bbFlag $fFlag $dFlag
194cd $curDir
195
196
197#-----------------------------------
198msg installing wxPython
199msgdo mkdir -p -m 775 "$dstPath/$temp/$wxPythonInst"
200msgdo cd "$srcPath/wxPython"
201msgdo $pythonExec setup.py install $bbFlag --install-lib="$dstPath/$temp/$wxPythonInst"
202cd $curDir
203
204msgdo chown -R root:admin "$dstPath/$temp/$pkgRoot/Library"
205msgdo chmod -R g+w "$dstPath/$temp/$pkgRoot/Library"
206
207
208#-----------------------------------
209msg copying additional wxPython files
210msgdo cp -pR "$srcPath/wxPython/samples" "$dstPath/$temp/$dmgRoot"
211msgdo cp -pR "$srcPath/wxPython/demo" "$dstPath/$temp/$dmgRoot"
212msgdo cp -pR "$srcPath/wxPython/licence" "$dstPath/$temp/$dmgRoot"
8721cada
RD
213find "$dstPath/$temp/$dmgRoot" -name "CVS" -type d -print0 | xargs -0 rm -rf
214find "$dstPath/$temp/$dmgRoot" -name ".DS_Store" -type f -print0 | xargs -0 rm
215find "$dstPath/$temp/$dmgRoot" -name ".cvsignore" -type f -print0 | xargs -0 rm
216find "$dstPath/$temp/$dmgRoot" -name ".#*" -type f -print0 | xargs -0 rm
217find "$dstPath/$temp/$dmgRoot" -name "b" -type f -print0 | xargs -0 rm
218find "$dstPath/$temp/$dmgRoot" -name "*~*~" -type f -print0 | xargs -0 rm
9c6b4824
RD
219
220msgdo cd "$srcPath/wxPython/scripts"
221sFiles=`$pythonExec CreateMacScripts.py`
222for f in $sFiles; do
223 msgdo cp $f "$dstPath/$temp/$wxWindowsInst/bin"
224done
225cd $curDir
226
8721cada
RD
227msgdo chown -R ${user}:staff "$dstPath/$temp/$dmgRoot"
228
229
230#-----------------------------------
231msg making installer package
232msgdo cp -pR "$progDir/resources" "$dstPath/$temp"
233msgdo cp $progDir/$pkgName.info $progDir/$pkgName-$version.info
234if [ $debug ]; then
235 echo "__WXDEBUG__ version." >> "$dstPath/$temp/resources/Welcome.txt"
236 echo "" >> "$dstPath/$temp/resources/Welcome.txt"
237fi
238echo "Build date: `date`" >> "$dstPath/$temp/resources/Welcome.txt"
239msgdo cd "$progDir"
240msgdo "$makePkgExec" $dstPath/$temp/$pkgRoot $pkgName-$version.info -d $dstPath/$temp/$dmgRoot -r $dstPath/$temp/resources
241msgdo chown -R ${user}:staff $dstPath/$temp/$dmgRoot/$pkgName-$version.pkg
242cd $curDir
243
244
245#-----------------------------------
246msg making disk image
247msgdo cd "$progDir"
248msgdo "$makeDmgExec" $dstPath/$temp/$dmgRoot $dstPath/$temp $pkgName-$version
249if [ $debug ]; then
250 dmgName="$pkgName-$version-debug"
251else
252 dmgName="$pkgName-$version"
253fi
254msgdo mv "$dstPath/$temp/$pkgName-$version.dmg" "$dstPath/$dmgName.dmg"
255msgdo chown ${user}:staff "$dstPath/$dmgName.dmg"
256cd $curDir
257
258
259#-----------------------------------
260msg cleaning up
261msgdo chown -R ${user}:staff "$buildDir"
262msgdo chown -R ${user}:staff "$srcPath/wxPython/$wxpBuildDir"
263msgdo rm $progDir/$pkgName-$version.info
264msgdo rm -rf "$dstPath/$temp"