]>
Commit | Line | Data |
---|---|---|
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 | ||
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" | |
6ca312ba RD |
21 | #version=`date +"%Y-%m-%d"` |
22 | version=`cd $defSrcPath/wxPython; python$PYVER -c 'import setup;print setup.VERSION'` | |
23 | ||
8721cada RD |
24 | dmgRoot="dmg-root" |
25 | pkgRoot="pkg-root" | |
26 | wxWindowsInst="$pkgRoot/usr/local" | |
27 | wxPythonInst="$pkgRoot/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER/site-packages" | |
28 | ||
29 | pythonExec="python$PYVER" | |
30 | makePkgExec="./makepkg" | |
31 | makeDmgExec="./makedmg" | |
32 | ||
33 | ||
34 | usage() { | |
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 | ||
40 | quotemeta() { | |
41 | # probably not quite correct, but seems to work | |
42 | echo "$1" | sed -e 's/\([^a-zA-z0-9.,--;_/]\)/\\\1/g' | |
43 | } | |
44 | ||
45 | msg() | |
46 | { | |
47 | echo "---------------------------------------------" | |
48 | echo $@ | |
49 | } | |
50 | ||
51 | msgdo() { | |
52 | echo "--> " $@ | |
53 | $@ | |
54 | } | |
55 | ||
56 | ||
57 | user=$1 | |
58 | shift | |
59 | ||
60 | update= | |
61 | force= | |
62 | debug= | |
63 | srcPath= | |
64 | dstPath= | |
65 | ||
66 | while :; 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 | |
77 | done | |
78 | ||
79 | ||
80 | #----------------------------------- | |
81 | msg check and prepare build directories | |
82 | ||
83 | if ! test "$srcPath"; then | |
84 | srcPath=$defSrcPath | |
85 | fi | |
86 | if ! test -d "$srcPath"; then | |
87 | echo "no such directory: '$srcPath'" 1>&2 | |
88 | exit | |
89 | fi | |
90 | ||
91 | if ! test "$dstPath"; then | |
92 | dstPath=$defDstPath | |
93 | fi | |
94 | if ! test -d "$dstPath"; then | |
95 | msgdo mkdir -p -m 775 "$dstPath" | |
96 | msgdo chown ${user}:staff "$dstPath" | |
97 | fi | |
98 | ||
99 | temp="tmp$$" | |
100 | if test -e "$dstPath/$temp"; then | |
101 | msgdo rm -rf "$dstPath/$temp" | |
102 | fi | |
103 | msgdo mkdir -m 775 "$dstPath/$temp" | |
104 | ||
105 | if test -e "$dstPath/$temp/$pkgRoot"; then | |
106 | msgdo rm -rf "$dstPath/$temp/$pkgRoot" | |
107 | fi | |
108 | msgdo mkdir -m 1775 "$dstPath/$temp/$pkgRoot" | |
109 | msgdo chown root:admin "$dstPath/$temp/$pkgRoot" | |
110 | ||
111 | if test -e "$dstPath/$temp/$dmgRoot"; then | |
112 | msgdo rm -rf "$dstPath/$temp/$dmgRoot" | |
113 | fi | |
114 | msgdo mkdir -p -m 775 "$dstPath/$temp/$dmgRoot" | |
115 | msgdo chown $user:staff "$dstPath/$temp/$dmgRoot" | |
116 | ||
117 | ||
118 | #----------------------------------- | |
119 | # update cvs | |
120 | if [ $update ]; then | |
121 | msg Updating from CVS | |
122 | msgdo cd "$srcPath" | |
123 | msgdo cvs update -dP -A | |
124 | fi | |
125 | ||
126 | ||
127 | #----------------------------------- | |
128 | msg configuring wxWindows | |
129 | buildDir="$srcPath/build-pkg" | |
130 | dFlag= | |
131 | if [ $debug ]; then | |
132 | buildDir="$srcPath/build-pkg-debug" | |
133 | dFlag="--enable-debug" | |
134 | fi | |
135 | if ! test -e "$buildDir"; then | |
136 | force=1 | |
137 | fi | |
138 | if [ $force ]; then | |
139 | if test -e "$buildDir"; then | |
140 | rm -rf "$buildDir" | |
141 | fi | |
142 | msgdo mkdir -m 775 "$buildDir" | |
143 | msgdo cd "$buildDir" | |
144 | msgdo ../configure --with-mac --with-opengl $dFlag | |
145 | cd $curDir | |
146 | ||
147 | else | |
148 | echo wxWindows already configured | |
149 | fi | |
150 | ||
151 | ||
152 | #----------------------------------- | |
153 | msg building wxWindows | |
154 | msgdo cd $buildDir | |
155 | msgdo make | |
156 | cd $curDir | |
157 | ||
158 | ||
159 | #----------------------------------- | |
160 | msg installing wxWindows | |
161 | msgdo mkdir -p -m 755 "$dstPath/$temp/$wxWindowsInst" | |
162 | msgdo cd "$buildDir" | |
5f9dc1f1 RD |
163 | |
164 | # install once to the package directory, and once to the | |
165 | # local machine so the wxPython build will get the right wxMac | |
8721cada | 166 | msgdo make install "prefix=`quotemeta \"$dstPath/$temp/$wxWindowsInst\"`" |
5f9dc1f1 RD |
167 | msgdo make install |
168 | ||
8721cada RD |
169 | msgdo chown -R root:wheel "$dstPath/$temp/$pkgRoot/usr" |
170 | cd $curDir | |
171 | ||
172 | ||
173 | #----------------------------------- | |
174 | msg building wxPython | |
175 | if [ $force ]; then | |
176 | fFlag="--force" | |
177 | else | |
178 | fFlag= | |
179 | fi | |
180 | if [ $debug ]; then | |
181 | dFlag="--debug" | |
182 | wxpBuildDir="build-pkg-debug" | |
183 | else | |
184 | dFlag= | |
185 | wxpBuildDir="build-pkg" | |
186 | fi | |
187 | bbFlag="BUILD_BASE=$wxpBuildDir" | |
188 | ||
189 | msgdo cd "$srcPath/wxPython" | |
190 | msgdo $pythonExec setup.py build 'IN_CVS_TREE=1' $bbFlag $fFlag $dFlag | |
191 | cd $curDir | |
192 | ||
193 | ||
194 | #----------------------------------- | |
195 | msg installing wxPython | |
196 | msgdo mkdir -p -m 775 "$dstPath/$temp/$wxPythonInst" | |
197 | msgdo cd "$srcPath/wxPython" | |
198 | msgdo $pythonExec setup.py install $bbFlag --install-lib="$dstPath/$temp/$wxPythonInst" | |
199 | cd $curDir | |
200 | ||
201 | msgdo chown -R root:admin "$dstPath/$temp/$pkgRoot/Library" | |
202 | msgdo chmod -R g+w "$dstPath/$temp/$pkgRoot/Library" | |
203 | ||
204 | ||
205 | #----------------------------------- | |
206 | msg copying additional wxPython files | |
207 | msgdo cp -pR "$srcPath/wxPython/samples" "$dstPath/$temp/$dmgRoot" | |
208 | msgdo cp -pR "$srcPath/wxPython/demo" "$dstPath/$temp/$dmgRoot" | |
209 | msgdo cp -pR "$srcPath/wxPython/licence" "$dstPath/$temp/$dmgRoot" | |
210 | msgdo cp -pR "$srcPath/wxPython/tools" "$dstPath/$temp/$dmgRoot" | |
211 | find "$dstPath/$temp/$dmgRoot" -name "CVS" -type d -print0 | xargs -0 rm -rf | |
212 | find "$dstPath/$temp/$dmgRoot" -name ".DS_Store" -type f -print0 | xargs -0 rm | |
213 | find "$dstPath/$temp/$dmgRoot" -name ".cvsignore" -type f -print0 | xargs -0 rm | |
214 | find "$dstPath/$temp/$dmgRoot" -name ".#*" -type f -print0 | xargs -0 rm | |
215 | find "$dstPath/$temp/$dmgRoot" -name "b" -type f -print0 | xargs -0 rm | |
216 | find "$dstPath/$temp/$dmgRoot" -name "*~*~" -type f -print0 | xargs -0 rm | |
217 | msgdo chown -R ${user}:staff "$dstPath/$temp/$dmgRoot" | |
218 | ||
219 | ||
220 | #----------------------------------- | |
221 | msg making installer package | |
222 | msgdo cp -pR "$progDir/resources" "$dstPath/$temp" | |
223 | msgdo cp $progDir/$pkgName.info $progDir/$pkgName-$version.info | |
224 | if [ $debug ]; then | |
225 | echo "__WXDEBUG__ version." >> "$dstPath/$temp/resources/Welcome.txt" | |
226 | echo "" >> "$dstPath/$temp/resources/Welcome.txt" | |
227 | fi | |
228 | echo "Build date: `date`" >> "$dstPath/$temp/resources/Welcome.txt" | |
229 | msgdo cd "$progDir" | |
230 | msgdo "$makePkgExec" $dstPath/$temp/$pkgRoot $pkgName-$version.info -d $dstPath/$temp/$dmgRoot -r $dstPath/$temp/resources | |
231 | msgdo chown -R ${user}:staff $dstPath/$temp/$dmgRoot/$pkgName-$version.pkg | |
232 | cd $curDir | |
233 | ||
234 | ||
235 | #----------------------------------- | |
236 | msg making disk image | |
237 | msgdo cd "$progDir" | |
238 | msgdo "$makeDmgExec" $dstPath/$temp/$dmgRoot $dstPath/$temp $pkgName-$version | |
239 | if [ $debug ]; then | |
240 | dmgName="$pkgName-$version-debug" | |
241 | else | |
242 | dmgName="$pkgName-$version" | |
243 | fi | |
244 | msgdo mv "$dstPath/$temp/$pkgName-$version.dmg" "$dstPath/$dmgName.dmg" | |
245 | msgdo chown ${user}:staff "$dstPath/$dmgName.dmg" | |
246 | cd $curDir | |
247 | ||
248 | ||
249 | #----------------------------------- | |
250 | msg cleaning up | |
251 | msgdo chown -R ${user}:staff "$buildDir" | |
252 | msgdo chown -R ${user}:staff "$srcPath/wxPython/$wxpBuildDir" | |
253 | msgdo rm $progDir/$pkgName-$version.info | |
254 | msgdo rm -rf "$dstPath/$temp" |