]>
Commit | Line | Data |
---|---|---|
1e4a197e RD |
1 | #!/bin/sh -e |
2 | #---------------------------------------------------------------------- | |
3 | # Build wxMac and wxPythonOSX from the tarball and then make an | |
4 | # Installer package out of it. | |
5 | ||
6 | spectemplate=distrib/wxPythonFull.spec.in | |
7 | ||
8 | if [ ! -d wxPython -o ! -e ${spectemplate} ]; then | |
9 | echo "Please run this script from the root wxPython directory." | |
10 | exit 1 | |
11 | fi | |
12 | ||
13 | #---------------------------------------------------------------------- | |
14 | # Check Parameters | |
15 | ||
16 | function usage { | |
17 | echo "" | |
dd35b09a | 18 | echo "Usage: $0 [panther|jaguar] [command flags...]" |
1e4a197e | 19 | echo "" |
c6387bc1 RD |
20 | echo " panther Build for Apple's python in /usr/bin, such as on Panther" |
21 | echo " jaguar Build for a python in /usr/local/bin, such as on Jaguar" | |
46456f61 RD |
22 | echo "" |
23 | echo "optional command flags:" | |
1e4a197e RD |
24 | echo " skiptar Don't unpack the tarball" |
25 | echo " use_cvs Use the CVS workspace instead of a tarfile" | |
26 | echo " skipconfig Don't run configure" | |
b42b447c | 27 | echo " skipbuild Don't build wxWidgets or wxPython" |
1e4a197e RD |
28 | echo " skipinstall Don't do the installation step" |
29 | echo " skipdmg Don't make the package or diskimage" | |
30 | echo " skipclean Don't do the cleanup at the end" | |
46456f61 | 31 | echo "" |
1e4a197e RD |
32 | } |
33 | ||
34 | ||
46456f61 | 35 | if [ $# -lt 1 ]; then |
1e4a197e RD |
36 | usage |
37 | exit 1 | |
38 | fi | |
39 | ||
46456f61 RD |
40 | KIND=$1 |
41 | case $KIND in | |
c6387bc1 RD |
42 | panther) PYTHON=/usr/bin/python ;; |
43 | jaguar) PYTHON=/usr/local/bin/python ;; | |
44 | *) usage; exit 1 ;; | |
46456f61 RD |
45 | esac |
46 | PYTHONW=${PYTHON}w | |
47 | shift | |
1e4a197e RD |
48 | |
49 | ||
50 | for flag in $*; do | |
51 | case ${flag} in | |
52 | skiptar) skiptar=1 ;; | |
53 | use_cvs) skiptar=1; use_cvs=1 ;; | |
54 | skipconfig) skipconfig=1; skiptar=1 ;; | |
55 | skipbuild) skipbuild=1; skipconfig=1; skiptar=1 ;; | |
56 | skipinstall) skipinstall=1 ;; | |
57 | skipdmg) skipdmg=1 ;; | |
58 | skipclean) skipclean=1 ;; | |
59 | ||
60 | *) echo "Unknown flag \"${flag}\"" | |
61 | usage | |
62 | exit 1 | |
63 | esac | |
64 | done | |
65 | ||
66 | ||
46456f61 RD |
67 | VERSION=`$PYTHON -c "import setup;print setup.VERSION"` |
68 | PYVER=`$PYTHON -c "import sys; print sys.version[:3]"` | |
69 | PYPREFIX=`$PYTHON -c "import sys; print sys.exec_prefix"` | |
c6387bc1 RD |
70 | PYLIB=$PYPREFIX/lib/python$PYVER |
71 | SITEPACKAGES=$PYLIB/site-packages | |
46456f61 | 72 | |
b42b447c RD |
73 | TARBALLDIR=/stuff/Development/wxPython/dist/$VERSION |
74 | TARBALL=$TARBALLDIR/wxPythonSrc-$VERSION.tar.gz | |
1e4a197e | 75 | |
46456f61 RD |
76 | PREFIX=/usr/lib/wxPython-$VERSION |
77 | BINPREFIX=/usr/bin | |
1e4a197e | 78 | |
46456f61 | 79 | WXROOT=`dirname $PWD` |
1e4a197e RD |
80 | PROGDIR="`dirname \"$0\"`" |
81 | TMPDIR=$PWD/_build_dmg | |
82 | ||
83 | BUILDROOT=$TMPDIR/build | |
84 | INSTALLROOT=$TMPDIR/install | |
85 | INSTALLDEVEL=$TMPDIR/install-devel | |
86 | DMGDIR=$TMPDIR/dmg | |
87 | RESOURCEDIR=$PROGDIR/resources | |
88 | DESTDIR=$PWD/dist | |
b42b447c | 89 | SRCROOT=$BUILDROOT/wxPythonSrc-$VERSION |
1e4a197e RD |
90 | |
91 | ||
92 | #---------------------------------------------------------------------- | |
93 | # Setup builddirs | |
94 | ||
95 | mkdir -p $BUILDROOT | |
96 | mkdir -p $INSTALLROOT | |
46456f61 | 97 | #mkdir -p $INSTALLDEVEL |
1e4a197e | 98 | rm -rf $DMGDIR |
b42b447c RD |
99 | mkdir -p $DMGDIR/root/Apps |
100 | mkdir -p $DMGDIR/root/Docs | |
101 | mkdir -p $DMGDIR/root/Samples | |
102 | ||
1e4a197e RD |
103 | |
104 | pushd $BUILDROOT | |
105 | ||
106 | ||
107 | #---------------------------------------------------------------------- | |
108 | # Unpack the tarball | |
109 | ||
110 | if [ -z "$skiptar" ]; then | |
46456f61 RD |
111 | echo Unarchiving tarball... |
112 | tar xzf $TARBALL | |
1e4a197e RD |
113 | fi |
114 | ||
115 | if [ "$use_cvs" = 1 ]; then | |
116 | # copy the cvs workspace, except for build dirs | |
117 | ||
118 | mkdir -p wxPythonSrc-$VERSION | |
119 | ||
120 | echo Finding updated files... | |
121 | if [ -e .last_copy ]; then | |
122 | FEXPR="-cnewer .last_copy" | |
123 | fi | |
46456f61 RD |
124 | MEASURE=$WXROOT// |
125 | find $WXROOT $FEXPR -print \ | |
126 | | grep -v $WXROOT/bld \ | |
1e4a197e RD |
127 | | grep -v wxPython/build \ |
128 | | grep -v wxPython/_build \ | |
129 | | grep -v CVS \ | |
46456f61 RD |
130 | | grep -v .pyc \ |
131 | | cut -b ${#MEASURE}- > filelist | |
1e4a197e RD |
132 | |
133 | for x in `cat filelist`; do | |
46456f61 | 134 | if [ -d "$WXROOT/$x" ]; then |
1e4a197e RD |
135 | mkdir -p "wxPythonSrc-$VERSION/$x" |
136 | else | |
137 | echo $x | |
46456f61 | 138 | cp -p "$WXROOT/$x" "wxPythonSrc-$VERSION/$x" |
1e4a197e RD |
139 | fi |
140 | done | |
141 | ||
142 | touch .last_copy | |
143 | fi | |
144 | ||
145 | ||
146 | cd wxPythonSrc-$VERSION | |
147 | WXDIR=`pwd` | |
46456f61 RD |
148 | mkdir -p $WXDIR/bld |
149 | cd $WXDIR/bld | |
1e4a197e RD |
150 | |
151 | #---------------------------------------------------------------------- | |
152 | ||
153 | ||
b42b447c | 154 | # Configure wxWidgets |
1e4a197e | 155 | if [ -z "$skipconfig" ]; then |
46456f61 RD |
156 | ../configure \ |
157 | --prefix=$PREFIX \ | |
158 | --with-mac \ | |
159 | --disable-monolithic \ | |
1e4a197e | 160 | --with-opengl \ |
1e4a197e RD |
161 | --enable-geometry \ |
162 | --enable-optimise \ | |
ec656cfe RD |
163 | --enable-sound \ |
164 | --enable-display \ | |
46456f61 RD |
165 | --enable-precomp=no \ |
166 | \ | |
1e4a197e RD |
167 | --with-libjpeg=builtin \ |
168 | --with-libpng=builtin \ | |
169 | --with-libtiff=builtin \ | |
46456f61 RD |
170 | --with-zlib=builtin \ |
171 | \ | |
172 | --enable-debug_flag | |
1e4a197e RD |
173 | |
174 | fi | |
175 | ||
b42b447c | 176 | # Build wxWidgets and wxPython |
1e4a197e | 177 | if [ -z "$skipbuild" ]; then |
1e4a197e | 178 | |
b42b447c | 179 | # Make wxWidgets and some contribs |
46456f61 RD |
180 | make |
181 | make -C contrib/src/gizmos | |
182 | make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" | |
183 | make -C contrib/src/stc | |
184 | make -C contrib/src/xrc | |
185 | ||
186 | if [ ! -e $WXDIR/include/wx/gizmos ]; then | |
187 | # Make some links so the wxPython build can find all the headers it needs | |
188 | pushd $WXDIR/include/wx | |
189 | ln -s ../../contrib/include/wx/* . | |
190 | popd | |
191 | fi | |
192 | ||
193 | # Build wxPython | |
1e4a197e | 194 | cd $WXDIR/wxPython |
46456f61 RD |
195 | $PYTHON setup.py \ |
196 | NO_SCRIPTS=1 \ | |
197 | WX_CONFIG="$WXDIR/bld/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/bld" \ | |
1e4a197e RD |
198 | build |
199 | ||
200 | ||
46456f61 RD |
201 | # Build wxrc (XRC resource tool) |
202 | cd $WXDIR/bld/contrib/utils/wxrc | |
203 | make | |
1e4a197e RD |
204 | strip wxrc |
205 | ||
206 | fi | |
207 | ||
208 | #---------------------------------------------------------------------- | |
1e4a197e RD |
209 | |
210 | if [ -z "$skipinstall" ]; then | |
b42b447c | 211 | # Install wxWidgets |
46456f61 RD |
212 | cd $WXDIR/bld |
213 | make prefix=$INSTALLROOT$PREFIX install | |
214 | make -C contrib/src/gizmos prefix=$INSTALLROOT$PREFIX install | |
215 | make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" prefix=$INSTALLROOT/$PREFIX install | |
216 | make -C contrib/src/stc prefix=$INSTALLROOT$PREFIX install | |
217 | make -C contrib/src/xrc prefix=$INSTALLROOT$PREFIX install | |
1e4a197e RD |
218 | |
219 | ||
220 | # and wxPython | |
221 | cd $WXDIR/wxPython | |
46456f61 RD |
222 | $PYTHON setup.py \ |
223 | NO_SCRIPTS=1 \ | |
224 | WX_CONFIG="$INSTALLROOT/$PREFIX/bin/wx-config --prefix=$INSTALLROOT/$PREFIX" \ | |
1e4a197e RD |
225 | install \ |
226 | --root=$INSTALLROOT | |
227 | ||
46456f61 | 228 | |
c6387bc1 RD |
229 | # Apple's Python (on Panther) sym-links the site-packages dir to |
230 | # /Library/Python/$PYVER so we need to move the files so they are | |
231 | # installed in the physical location, not the virtual one. | |
232 | if [ "$KIND" = "panther" ]; then | |
233 | mkdir -p $INSTALLROOT/Library/Python/$PYVER | |
234 | mv $INSTALLROOT/$SITEPACKAGES/* $INSTALLROOT/Library/Python/$PYVER | |
235 | rm -r $INSTALLROOT/System | |
236 | SITEPACKAGES=/Library/Python/$PYVER | |
237 | fi | |
238 | ||
239 | ||
1e4a197e | 240 | # install wxPython's tool scripts |
46456f61 | 241 | mkdir -p $INSTALLROOT$BINPREFIX |
1e4a197e | 242 | cd $WXDIR/wxPython/scripts |
46456f61 | 243 | python$PYVER CreateMacScripts.py $INSTALLROOT $BINPREFIX |
1e4a197e | 244 | |
c6387bc1 | 245 | |
1e4a197e | 246 | # Install wxrc |
46456f61 | 247 | cp $WXDIR/bld/contrib/utils/wxrc/wxrc $INSTALLROOT$BINPREFIX |
1e4a197e RD |
248 | |
249 | ||
46456f61 RD |
250 | # install the wxPython headers |
251 | cd $WXDIR/wxPython | |
252 | cp -R include $INSTALLROOT$PREFIX | |
253 | mkdir -p $INSTALLROOT$PREFIX/include/wx/wxPython/i_files | |
254 | cp src/*.i $INSTALLROOT$PREFIX/include/wx/wxPython/i_files | |
255 | ||
1e4a197e | 256 | |
c6387bc1 | 257 | # Set premissions for files in $INSTALLROOT |
7a72b62e RD |
258 | chown -R root:admin $INSTALLROOT |
259 | chmod -R g+w $INSTALLROOT | |
1e4a197e RD |
260 | fi |
261 | ||
262 | popd | |
263 | ||
264 | #---------------------------------------------------------------------- | |
265 | ||
266 | # Make the Installer packages and disk image | |
267 | if [ -z "$skipdmg" ]; then | |
268 | ||
269 | # Remove the .pyc/.pyo files they just take up space and can be recreated | |
270 | # during the install. | |
46456f61 | 271 | $PYTHON $PROGDIR/../zappycfiles.py $INSTALLROOT |
1e4a197e RD |
272 | |
273 | ||
274 | # Make the welcome message | |
46456f61 | 275 | case $KIND in |
c6387bc1 RD |
276 | panther) W_MSG="the Panther (OS X 10.3.x) version of" ;; |
277 | jaguar) W_MSG="the Jaguar (OS X 10.2.x) version of" ;; | |
46456f61 | 278 | esac |
1e4a197e RD |
279 | cat > $RESOURCEDIR/Welcome.txt <<EOF |
280 | Welcome! | |
281 | ||
46456f61 | 282 | This program will install wxPython $VERSION for $W_MSG MacPython-OSX $PYVER. |
1e4a197e | 283 | |
c6387bc1 RD |
284 | You must install onto your current boot disk, even though the installer does not enforce this, otherwise things will not work. |
285 | ||
1e4a197e RD |
286 | Build date: `date` |
287 | EOF | |
288 | ||
289 | # make the preflight script | |
290 | cat > $RESOURCEDIR/preflight <<EOF | |
291 | #!/bin/sh | |
292 | # Cleanup any old install of the wxPython package | |
293 | rm -rf \$2$SITEPACKAGES/wxPython | |
46456f61 | 294 | rm -rf \$2$SITEPACKAGES/wx |
1e4a197e RD |
295 | exit 0 |
296 | EOF | |
297 | chmod +x $RESOURCEDIR/preflight | |
298 | ||
299 | # make the postflight script | |
300 | cat > $RESOURCEDIR/postflight <<EOF | |
301 | #!/bin/sh -e | |
302 | # Compile the .py files in the wxPython pacakge | |
c6387bc1 RD |
303 | $PYTHON \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wxPython |
304 | $PYTHON \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wx | |
305 | $PYTHON -O \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wxPython | |
306 | $PYTHON -O \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wx | |
1e4a197e | 307 | |
1e4a197e | 308 | |
c6387bc1 | 309 | # and all of the wxPython pacakge should be group writable |
1e4a197e | 310 | chgrp -R admin \$2$SITEPACKAGES/wxPython |
1e4a197e | 311 | chmod -R g+w \$2$SITEPACKAGES/wxPython |
46456f61 RD |
312 | chgrp -R admin \$2$SITEPACKAGES/wx |
313 | chmod -R g+w \$2$SITEPACKAGES/wx | |
1e4a197e RD |
314 | |
315 | exit 0 | |
316 | EOF | |
317 | chmod +x $RESOURCEDIR/postflight | |
318 | ||
319 | ||
320 | ||
c6387bc1 | 321 | # Build the main Installer Package... |
46456f61 | 322 | rm -rf wxPythonOSX-$KIND.pkg |
1e4a197e | 323 | python $PROGDIR/../buildpkg.py \ |
46456f61 | 324 | --Title=wxPythonOSX-$KIND \ |
1e4a197e | 325 | --Version=$VERSION \ |
46456f61 | 326 | --Description="wxPython $VERSION for $W_MSG MacPython-OSX $PYVER" \ |
1e4a197e RD |
327 | --NeedsAuthorization="YES" \ |
328 | --Relocatable="NO" \ | |
329 | --InstallOnly="YES" \ | |
330 | $INSTALLROOT \ | |
331 | $RESOURCEDIR | |
332 | ||
46456f61 | 333 | mv wxPythonOSX-$KIND.pkg $DMGDIR/root |
1e4a197e RD |
334 | |
335 | ||
1e4a197e RD |
336 | |
337 | # Make a README.txt to go on the disk image | |
c6387bc1 | 338 | cat > "$DMGDIR/root/README 1st.txt" <<EOF |
46456f61 RD |
339 | Welcome to wxPython! |
340 | ||
c6387bc1 | 341 | On this disk image you will find the installer for wxPython $VERSION for $W_MSG MacPython-OSX $PYVER. MacPython-OSX is not included. |
46456f61 RD |
342 | |
343 | wxPython-$KIND.pkg The installer package. It contains the wxPython | |
344 | extension modules, wxMac dynamic libraries and | |
345 | headers, and some scripts for the command-line | |
346 | tools. | |
1e4a197e | 347 | |
46456f61 | 348 | Everything else here is optional and you can drag them out of the disk |
c6387bc1 RD |
349 | image and drop them whereever you want. You do need to install the above |
350 | package before you can use any of the items below. | |
1e4a197e | 351 | |
46456f61 | 352 | |
b42b447c | 353 | Apps/wxPython Demo An application bundle version of the demo. |
c6387bc1 RD |
354 | (This has it's own copy of the sources within |
355 | the bundle.) | |
356 | ||
b42b447c | 357 | Apps/XRCed An application for editing wxPython resource |
c6387bc1 RD |
358 | files (XRC files.) |
359 | ||
b42b447c | 360 | Apps/PyCrust An application that provides an interactive |
c6387bc1 RD |
361 | Python shell and also namespace inspectors. |
362 | ||
b42b447c RD |
363 | |
364 | ||
365 | Docs/wxDocs A folder containing the wxWidgets documentation | |
366 | bundled in .zip files, and a small wxPython | |
367 | application that can be used to view the docs. | |
368 | Just run viewer.pyw. | |
369 | ||
370 | Docs/licence License files. | |
371 | ||
372 | Docs/other A few readmes, change log, etc. The full | |
373 | documentation is downloadable separately. | |
374 | ||
375 | ||
376 | Samples/samples Several small sample applications that | |
377 | demonstrate how to use wxPython. | |
378 | ||
379 | Samples/demo A copy of the wxPython demo source code, | |
380 | just open the folder and run demo.pyw. | |
381 | ||
1e4a197e RD |
382 | Happy Hacking! |
383 | EOF | |
384 | ||
c6387bc1 RD |
385 | # PyAlaMode An extension of PyCrust that includes source |
386 | # file editing capabilities. | |
387 | ||
1e4a197e | 388 | |
b42b447c RD |
389 | # wxDocs |
390 | pushd $DMGDIR/root/Docs | |
391 | tar xzvf $TARBALLDIR/wxPythonDocs-$VERSION.tar.gz | |
392 | mv wxPython-$VERSION/docs wxDocs | |
393 | rm -r wxPython-$VERSION | |
394 | mv wxDocs/viewdocs.py wxDocs/viewdocs.pyw | |
46456f61 | 395 | |
b42b447c RD |
396 | # license files, docs, etc. |
397 | cp -pR $SRCROOT/wxPython/licence . | |
398 | cp -pR $SRCROOT/wxPython/docs . | |
399 | rm -rf docs/bin | |
400 | rm -rf docs/xml-raw | |
401 | mv docs other | |
402 | popd | |
46456f61 | 403 | |
b42b447c RD |
404 | # Copy the demo and samples to the disk image from the tarball |
405 | pushd $DMGDIR/root/Samples | |
406 | tar xzvf $TARBALLDIR/wxPythonDemo-$VERSION.tar.gz | |
407 | mv wxPython-$VERSION/* . | |
408 | rm -rf wxPython-$VERSION | |
409 | rm demo/b demo/.setup.sh | |
410 | mv demo/demo.py demo/demo.pyw | |
411 | popd | |
412 | ||
413 | ||
46456f61 RD |
414 | # Make an app bundle to launch PyCrust |
415 | $PYTHONW $PROGDIR/../buildapp.py \ | |
b42b447c | 416 | --builddir=$DMGDIR/root/Apps \ |
46456f61 RD |
417 | --name=PyCrust \ |
418 | --mainprogram=$INSTALLROOT$BINPREFIX/pycrust.py \ | |
419 | --iconfile=$PROGDIR/PieShell.icns \ | |
420 | build | |
421 | ||
c6387bc1 RD |
422 | # # and PyAlaMode |
423 | # $PYTHONW $PROGDIR/../buildapp.py \ | |
424 | # --builddir=$DMGDIR/root \ | |
425 | # --name=PyAlaMode \ | |
426 | # --mainprogram=$INSTALLROOT$BINPREFIX/pyalamode.py \ | |
427 | # --iconfile=$PROGDIR/PieShell.icns \ | |
428 | # build | |
429 | ||
46456f61 RD |
430 | # Make an app to launch XRCed |
431 | $PYTHONW $PROGDIR/../buildapp.py \ | |
b42b447c | 432 | --builddir=$DMGDIR/root/Apps \ |
46456f61 RD |
433 | --name=XRCed \ |
434 | --mainprogram=$INSTALLROOT$BINPREFIX/xrced.py \ | |
435 | --iconfile=$PROGDIR/XRCed.icns \ | |
436 | build | |
437 | ||
438 | # Make an app bundle to run the demo | |
439 | $PYTHONW $PROGDIR/../buildapp.py \ | |
b42b447c | 440 | --builddir=$DMGDIR/root/Apps \ |
46456f61 | 441 | --name="wxPython Demo" \ |
b42b447c | 442 | --mainprogram=$DMGDIR/root/Samples/demo/demo.pyw \ |
46456f61 RD |
443 | --iconfile=$PROGDIR/RunDemo.icns \ |
444 | build | |
b42b447c | 445 | cp -pR $DMGDIR/root/Samples/demo/* "$DMGDIR/root/Apps/wxPython Demo.app/Contents/Resources" |
46456f61 | 446 | |
1e4a197e RD |
447 | |
448 | # and then finally make a disk image containing the packages and etc. | |
46456f61 | 449 | $PROGDIR/../makedmg $DMGDIR/root $DMGDIR wxPythonOSX-$VERSION-$KIND-Py$PYVER |
1e4a197e | 450 | |
46456f61 RD |
451 | echo Moving $DMGDIR/wxPythonOSX-$VERSION-$KIND-Py$PYVER.dmg to $DESTDIR |
452 | mv $DMGDIR/wxPythonOSX-$VERSION-$KIND-Py$PYVER.dmg $DESTDIR | |
1e4a197e RD |
453 | fi |
454 | ||
455 | ||
456 | # Cleanup build/install dirs | |
457 | if [ -z "$skipclean" ]; then | |
458 | echo "Cleaning up..." | |
459 | rm -rf $TMPDIR | |
460 | else | |
461 | echo "Cleanup is disabled. You should remove $TMPDIR when finished" | |
462 | fi | |
463 |