]>
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" | |
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" | |
5f9dc1f1 RD |
161 | |
162 | # install once to the package directory, and once to the | |
163 | # local machine so the wxPython build will get the right wxMac | |
8721cada | 164 | msgdo make install "prefix=`quotemeta \"$dstPath/$temp/$wxWindowsInst\"`" |
5f9dc1f1 RD |
165 | msgdo make install |
166 | ||
8721cada RD |
167 | msgdo chown -R root:wheel "$dstPath/$temp/$pkgRoot/usr" |
168 | cd $curDir | |
169 | ||
170 | ||
171 | #----------------------------------- | |
172 | msg building wxPython | |
173 | if [ $force ]; then | |
174 | fFlag="--force" | |
175 | else | |
176 | fFlag= | |
177 | fi | |
178 | if [ $debug ]; then | |
179 | dFlag="--debug" | |
180 | wxpBuildDir="build-pkg-debug" | |
181 | else | |
182 | dFlag= | |
183 | wxpBuildDir="build-pkg" | |
184 | fi | |
185 | bbFlag="BUILD_BASE=$wxpBuildDir" | |
186 | ||
187 | msgdo cd "$srcPath/wxPython" | |
188 | msgdo $pythonExec setup.py build 'IN_CVS_TREE=1' $bbFlag $fFlag $dFlag | |
189 | cd $curDir | |
190 | ||
191 | ||
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" | |
197 | cd $curDir | |
198 | ||
199 | msgdo chown -R root:admin "$dstPath/$temp/$pkgRoot/Library" | |
200 | msgdo chmod -R g+w "$dstPath/$temp/$pkgRoot/Library" | |
201 | ||
202 | ||
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" | |
216 | ||
217 | ||
218 | #----------------------------------- | |
219 | msg making installer package | |
220 | msgdo cp -pR "$progDir/resources" "$dstPath/$temp" | |
221 | msgdo cp $progDir/$pkgName.info $progDir/$pkgName-$version.info | |
222 | if [ $debug ]; then | |
223 | echo "__WXDEBUG__ version." >> "$dstPath/$temp/resources/Welcome.txt" | |
224 | echo "" >> "$dstPath/$temp/resources/Welcome.txt" | |
225 | fi | |
226 | echo "Build date: `date`" >> "$dstPath/$temp/resources/Welcome.txt" | |
227 | msgdo cd "$progDir" | |
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 | |
230 | cd $curDir | |
231 | ||
232 | ||
233 | #----------------------------------- | |
234 | msg making disk image | |
235 | msgdo cd "$progDir" | |
236 | msgdo "$makeDmgExec" $dstPath/$temp/$dmgRoot $dstPath/$temp $pkgName-$version | |
237 | if [ $debug ]; then | |
238 | dmgName="$pkgName-$version-debug" | |
239 | else | |
240 | dmgName="$pkgName-$version" | |
241 | fi | |
242 | msgdo mv "$dstPath/$temp/$pkgName-$version.dmg" "$dstPath/$dmgName.dmg" | |
243 | msgdo chown ${user}:staff "$dstPath/$dmgName.dmg" | |
244 | cd $curDir | |
245 | ||
246 | ||
247 | #----------------------------------- | |
248 | msg cleaning up | |
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" |