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