]> git.saurik.com Git - wxWidgets.git/blob - wxPython/distrib/mac/_build
Scripts to make a installer package in a disk image for wxPython and
[wxWidgets.git] / wxPython / distrib / mac / _build
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
12 PYVER=2.2
13
14 curDir=`pwd`
15 progDir="`dirname \"$0\"`"
16
17 defSrcPath="/projects/wx"
18 defDstPath="/projects/wx/wxPython/dist"
19
20 pkgName="wxMacPython"
21 version=`date +"%Y-%m-%d"`
22 dmgRoot="dmg-root"
23 pkgRoot="pkg-root"
24 wxWindowsInst="$pkgRoot/usr/local"
25 wxPythonInst="$pkgRoot/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER/site-packages"
26
27 pythonExec="python$PYVER"
28 makePkgExec="./makepkg"
29 makeDmgExec="./makedmg"
30
31
32 usage() {
33 echo `basename $0`: ERROR: $* 1>&2
34 echo usage: `basename $0` '[-s dir] [-d dir] [--cvs-update] [--force] [--debug]' 1>&2
35 exit 1
36 }
37
38 quotemeta() {
39 # probably not quite correct, but seems to work
40 echo "$1" | sed -e 's/\([^a-zA-z0-9.,--;_/]\)/\\\1/g'
41 }
42
43 msg()
44 {
45 echo "---------------------------------------------"
46 echo $@
47 }
48
49 msgdo() {
50 echo "--> " $@
51 $@
52 }
53
54
55 user=$1
56 shift
57
58 update=
59 force=
60 debug=
61 srcPath=
62 dstPath=
63
64 while :; do
65 case "$1" in
66 --cvs-update) update=1;;
67 --force) force=1;;
68 --debug) debug=1;;
69 -s) shift; srcPath="$1";;
70 -d) shift; dstPath="$1";;
71 -*) usage "bad argument $1";;
72 *) break;;
73 esac
74 shift
75 done
76
77
78 #-----------------------------------
79 msg check and prepare build directories
80
81 if ! test "$srcPath"; then
82 srcPath=$defSrcPath
83 fi
84 if ! test -d "$srcPath"; then
85 echo "no such directory: '$srcPath'" 1>&2
86 exit
87 fi
88
89 if ! test "$dstPath"; then
90 dstPath=$defDstPath
91 fi
92 if ! test -d "$dstPath"; then
93 msgdo mkdir -p -m 775 "$dstPath"
94 msgdo chown ${user}:staff "$dstPath"
95 fi
96
97 temp="tmp$$"
98 if test -e "$dstPath/$temp"; then
99 msgdo rm -rf "$dstPath/$temp"
100 fi
101 msgdo mkdir -m 775 "$dstPath/$temp"
102
103 if test -e "$dstPath/$temp/$pkgRoot"; then
104 msgdo rm -rf "$dstPath/$temp/$pkgRoot"
105 fi
106 msgdo mkdir -m 1775 "$dstPath/$temp/$pkgRoot"
107 msgdo chown root:admin "$dstPath/$temp/$pkgRoot"
108
109 if test -e "$dstPath/$temp/$dmgRoot"; then
110 msgdo rm -rf "$dstPath/$temp/$dmgRoot"
111 fi
112 msgdo mkdir -p -m 775 "$dstPath/$temp/$dmgRoot"
113 msgdo chown $user:staff "$dstPath/$temp/$dmgRoot"
114
115
116 #-----------------------------------
117 # update cvs
118 if [ $update ]; then
119 msg Updating from CVS
120 msgdo cd "$srcPath"
121 msgdo cvs update -dP -A
122 fi
123
124
125 #-----------------------------------
126 msg configuring wxWindows
127 buildDir="$srcPath/build-pkg"
128 dFlag=
129 if [ $debug ]; then
130 buildDir="$srcPath/build-pkg-debug"
131 dFlag="--enable-debug"
132 fi
133 if ! test -e "$buildDir"; then
134 force=1
135 fi
136 if [ $force ]; then
137 if test -e "$buildDir"; then
138 rm -rf "$buildDir"
139 fi
140 msgdo mkdir -m 775 "$buildDir"
141 msgdo cd "$buildDir"
142 msgdo ../configure --with-mac --with-opengl $dFlag
143 cd $curDir
144
145 else
146 echo wxWindows already configured
147 fi
148
149
150 #-----------------------------------
151 msg building wxWindows
152 msgdo cd $buildDir
153 msgdo make
154 cd $curDir
155
156
157 #-----------------------------------
158 msg installing wxWindows
159 msgdo mkdir -p -m 755 "$dstPath/$temp/$wxWindowsInst"
160 msgdo cd "$buildDir"
161 msgdo make install "prefix=`quotemeta \"$dstPath/$temp/$wxWindowsInst\"`"
162 msgdo chown -R root:wheel "$dstPath/$temp/$pkgRoot/usr"
163 cd $curDir
164
165
166 #-----------------------------------
167 msg building wxPython
168 if [ $force ]; then
169 fFlag="--force"
170 else
171 fFlag=
172 fi
173 if [ $debug ]; then
174 dFlag="--debug"
175 wxpBuildDir="build-pkg-debug"
176 else
177 dFlag=
178 wxpBuildDir="build-pkg"
179 fi
180 bbFlag="BUILD_BASE=$wxpBuildDir"
181
182 msgdo cd "$srcPath/wxPython"
183 msgdo $pythonExec setup.py build 'IN_CVS_TREE=1' $bbFlag $fFlag $dFlag
184 cd $curDir
185
186
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"
192 cd $curDir
193
194 msgdo chown -R root:admin "$dstPath/$temp/$pkgRoot/Library"
195 msgdo chmod -R g+w "$dstPath/$temp/$pkgRoot/Library"
196
197
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"
211
212
213 #-----------------------------------
214 msg making installer package
215 msgdo cp -pR "$progDir/resources" "$dstPath/$temp"
216 msgdo cp $progDir/$pkgName.info $progDir/$pkgName-$version.info
217 if [ $debug ]; then
218 echo "__WXDEBUG__ version." >> "$dstPath/$temp/resources/Welcome.txt"
219 echo "" >> "$dstPath/$temp/resources/Welcome.txt"
220 fi
221 echo "Build date: `date`" >> "$dstPath/$temp/resources/Welcome.txt"
222 msgdo cd "$progDir"
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
225 cd $curDir
226
227
228 #-----------------------------------
229 msg making disk image
230 msgdo cd "$progDir"
231 msgdo "$makeDmgExec" $dstPath/$temp/$dmgRoot $dstPath/$temp $pkgName-$version
232 if [ $debug ]; then
233 dmgName="$pkgName-$version-debug"
234 else
235 dmgName="$pkgName-$version"
236 fi
237 msgdo mv "$dstPath/$temp/$pkgName-$version.dmg" "$dstPath/$dmgName.dmg"
238 msgdo chown ${user}:staff "$dstPath/$dmgName.dmg"
239 cd $curDir
240
241
242 #-----------------------------------
243 msg cleaning up
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"