]> git.saurik.com Git - wxWidgets.git/blame - wxPython/distrib/mac/wxPythonOSX/build
Update from Frank with fixes for running on wxMSW 2.7
[wxWidgets.git] / wxPython / distrib / mac / wxPythonOSX / build
CommitLineData
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
0f475e8a 6#set -o xtrace
48e7d325 7
1e4a197e
RD
8spectemplate=distrib/wxPythonFull.spec.in
9
10if [ ! -d wxPython -o ! -e ${spectemplate} ]; then
11 echo "Please run this script from the root wxPython directory."
12 exit 1
13fi
14
81de4ba3 15if [ "$UID" != "0" ]; then
132ae51e 16 echo "-------------------------------------------------------"
c451eded 17 echo " WARNING: I will be unable to change ownership of files"
132ae51e
RD
18 echo " unless this script is run as root or via sudo"
19 echo "-------------------------------------------------------"
20fi
21
1e4a197e
RD
22#----------------------------------------------------------------------
23# Check Parameters
24
25function usage {
26 echo ""
0f475e8a 27 echo "Usage: $0 PYVER [command flags...]"
c451eded 28 echo ""
0f475e8a
RD
29 echo " PYVER Python version to use to do the build. A"
30 echo " matching python\$PYVER must be found on the PATH"
46456f61
RD
31 echo ""
32 echo "optional command flags:"
1e4a197e 33 echo " skiptar Don't unpack the tarball"
81de4ba3
RD
34 echo " inplace Don't use the tarball, build from the CVS tree instead"
35 echo " (The Docs and Demo tarballs are still required for a full build.)"
e61e5964
KO
36 echo " reswig Regenerate SWIG wrappers"
37 echo " universal Generate Universal wxWidgets binary (requires Universal Python "
38 echo " to general Universal wxPython)."
85245f48 39 echo " unicode Make a unicode build"
1e4a197e 40 echo " skipconfig Don't run configure"
b42b447c 41 echo " skipbuild Don't build wxWidgets or wxPython"
1e4a197e
RD
42 echo " skipinstall Don't do the installation step"
43 echo " skipdmg Don't make the package or diskimage"
44 echo " skipclean Don't do the cleanup at the end"
46456f61 45 echo ""
1e4a197e
RD
46}
47
48
c451eded 49PYVER=$1
0f475e8a 50if [ "$PYVER" != "" ] && which python$PYVER && which pythonw$PYVER; then
c451eded
RD
51 PYTHON=`which python$PYVER`
52 PYTHONW=`which pythonw$PYVER`
53else
54 usage;
55 exit 1
56fi
57
0f475e8a 58shift
1e4a197e 59
81de4ba3
RD
60skiptar=no
61skipconfig=no
62skipbuild=no
63skipinstall=no
64skipdmg=no
65skipclean=no
66inplace=no
85245f48 67unicode=no
0f475e8a 68debug=no
e61e5964
KO
69reswig=no
70universal=no
1e4a197e
RD
71
72for flag in $*; do
73 case ${flag} in
81de4ba3
RD
74 skiptar) skiptar=yes ;;
75 skipconfig) skipconfig=yes; skiptar=yes ;;
76 skipbuild) skipbuild=yes; skipconfig=yes; skiptar=yes ;;
77 skipinstall) skipinstall=yes ;;
0f475e8a 78 skipdmg) skipdmg=yes ;;
81de4ba3
RD
79 skipclean) skipclean=yes ;;
80 inplace) inplace=yes; skiptar=yes ;;
85245f48 81 unicode) unicode=yes ;;
0f475e8a
RD
82 ansi) unicode=no ;;
83 debug) debug=yes ;;
e61e5964
KO
84 reswig) reswig=yes ;;
85 universal) universal=yes ;;
1e4a197e
RD
86 *) echo "Unknown flag \"${flag}\""
87 usage
88 exit 1
89 esac
90done
91
92
0f475e8a
RD
93
94OSX_VERSION=`sw_vers -productVersion`
95OSX_VERSION=${OSX_VERSION:0:4}
96
97case $OSX_VERSION in
98 10.4) TAG=macosx10.4 ;;
99 10.3) TAG=macosx10.3 ;;
100 10.2) TAG=macosx10.2 ;;
101 *) usage; exit 1 ;;
102esac
103
104if [ $universal = yes ]; then
105 TAG=universal10.4
106fi
107
108
109
46456f61 110VERSION=`$PYTHON -c "import setup;print setup.VERSION"`
c451eded 111SHORTVER=`echo $VERSION | cut -c 1,2,3`
46456f61 112PYPREFIX=`$PYTHON -c "import sys; print sys.exec_prefix"`
c6387bc1
RD
113PYLIB=$PYPREFIX/lib/python$PYVER
114SITEPACKAGES=$PYLIB/site-packages
81de4ba3 115
85245f48
RD
116if [ $unicode == yes ]; then
117 CHARTYPE=unicode
118 UNICODEOPT=--enable-unicode
119 PYUNICODEOPT=1
120else
121 CHARTYPE=ansi
122 UNICODEOPT=--disable-unicode
123 PYUNICODEOPT=0
124fi
bceb17b2 125
0f475e8a
RD
126if [ $debug == yes ]; then
127 DEBUG_FLAG=--enable-debug
128 PYDEBUGOPT=--debug
129else
130 DEBUG_FLAG=--enable-debug_flag
131 PYDEBUGOPT=
132fi
133
c451eded
RD
134
135# Test if the python we are using is the System installed framework
136# or one that was installed by the user. This changes where the
137# site-packages (or its alias) is located in the installer tree.
138APPLE_PYTHON=no
139if [ -e /Library/Python/$PYVER ] && [ `dirname $PYTHON` == "/usr/bin" ]; then
140 APPLE_PYTHON=yes
141fi
142
eae9a172 143
81de4ba3 144
132ae51e 145if [ -z "$TARBALLDIR" ]; then
81de4ba3
RD
146 # this is a spot on my fileserver where the tarballs go, adjust
147 # as needed for where you put the wxPython tarball, or set
148 # TARBALLDIR before invoking this script...
132ae51e
RD
149 TARBALLDIR=/stuff/Development/wxPython/dist/$VERSION
150fi
bf158fe6 151TARBALL=$TARBALLDIR/wxPython-src-$VERSION.tar.bz2
1e4a197e 152
bf158fe6 153if [ ! -e $TARBALLDIR/wxPython-demo-$VERSION.tar.bz2 ]; then
81de4ba3
RD
154 echo "-------------------------------------------------------"
155 echo " WARNING: Demo tarball not found, will skip building "
156 echo " the Demo app bundle and etc."
bf158fe6 157 echo " $TARBALLDIR/wxPython-demo-$VERSION.tar.bz2"
81de4ba3
RD
158 echo "-------------------------------------------------------"
159fi
160
bf158fe6 161if [ ! -e $TARBALLDIR/wxPython-docs-$VERSION.tar.bz2 ]; then
81de4ba3
RD
162 echo "-------------------------------------------------------"
163 echo " WARNING: Docs tarball not found, will skip building "
164 echo " the the wxDocsViewer app bundle and etc."
bf158fe6 165 echo " $TARBALLDIR/wxPython-docs-$VERSION.tar.bz2"
81de4ba3
RD
166 echo "-------------------------------------------------------"
167fi
168
169
170
171
85245f48 172PREFIX=/usr/local/lib/wxPython-$CHARTYPE-$VERSION
132ae51e 173BINPREFIX=/usr/local/bin
1e4a197e 174
e61e5964 175SWIGBIN=/opt/swig/bin/swig
46456f61 176WXROOT=`dirname $PWD`
1e4a197e
RD
177PROGDIR="`dirname \"$0\"`"
178TMPDIR=$PWD/_build_dmg
179
180BUILDROOT=$TMPDIR/build
85245f48
RD
181
182INSTALLROOT=$TMPDIR/install-root
85245f48
RD
183INSTALLAPPS=$TMPDIR/install-apps
184
1e4a197e 185DMGDIR=$TMPDIR/dmg
85245f48
RD
186DMGROOT=$DMGDIR/root
187DMGAPPS=$DMGDIR/apps
188
1e4a197e
RD
189RESOURCEDIR=$PROGDIR/resources
190DESTDIR=$PWD/dist
28d1454a 191SRCROOT=$BUILDROOT/wxPython-src-$VERSION
1e4a197e
RD
192
193
194#----------------------------------------------------------------------
195# Setup builddirs
196
197mkdir -p $BUILDROOT
198mkdir -p $INSTALLROOT
85245f48
RD
199mkdir -p $INSTALLAPPS
200
1e4a197e 201rm -rf $DMGDIR
85245f48
RD
202mkdir -p $DMGROOT
203mkdir -p $DMGAPPS/Docs
204mkdir -p $DMGAPPS/Samples
b42b447c 205
ae4e0c7a
KO
206if [ ! -d $DESTDIR ]; then
207 mkdir $DESTDIR
208fi
1e4a197e
RD
209
210pushd $BUILDROOT
211
212
213#----------------------------------------------------------------------
214# Unpack the tarball
215
81de4ba3 216if [ $skiptar != yes ]; then
46456f61 217 echo Unarchiving tarball...
bf158fe6 218 tar xjf $TARBALL
1e4a197e
RD
219fi
220
81de4ba3
RD
221if [ $inplace = no ]; then
222 # make a build dir and cd to it.
28d1454a 223 cd wxPython-src-$VERSION
81de4ba3
RD
224 WXDIR=`pwd`
225 mkdir -p $WXDIR/bld
226 cd $WXDIR/bld
227 WXBLD=$WXDIR/bld
228else
61074746
RD
229
230 # If building "inplace" then our build dir will be off of the
231 # WXROOT like normal, adjust the variables to find things that
232 # way.
233 WXBLD=$WXROOT/build-$CHARTYPE
234 mkdir -p $WXBLD
235 cd $WXBLD
236 WXDIR=..
81de4ba3 237 SRCROOT=$WXROOT
81de4ba3
RD
238fi
239
61074746 240echo "Using wx root dir: $WXROOT"
81de4ba3 241echo "Using build dir: $WXBLD"
61074746 242echo "Using source tree: $WXDIR"
1e4a197e
RD
243
244#----------------------------------------------------------------------
245
0f475e8a 246if [ $OSX_VERSION = 10.3 -o $OSX_VERSION = 10.4 ]; then
52e82b22
RD
247 OTHER_CFG_OPTS=--enable-mediactrl
248fi
1e4a197e 249
b42b447c 250# Configure wxWidgets
0f475e8a 251if [ $skipconfig != yes -a $universal != yes ]; then
81de4ba3 252 $WXDIR/configure \
46456f61
RD
253 --prefix=$PREFIX \
254 --with-mac \
eac928f0 255 --enable-monolithic \
1e4a197e 256 --with-opengl \
ec656cfe
RD
257 --enable-sound \
258 --enable-display \
e2f7f062 259 --enable-geometry \
0f475e8a 260 $DEBUG_FLAG \
46456f61 261 --enable-precomp=no \
28d1454a 262 --enable-optimise \
8c1a4666 263 --disable-debugreport \
e61e5964 264 --disable-precompiled-headers \
0f475e8a 265 $UNICODEOPT $OTHER_CFG_OPTS
e2f7f062 266
1e4a197e
RD
267fi
268
b42b447c 269# Build wxWidgets and wxPython
81de4ba3 270if [ $skipbuild != yes ]; then
1e4a197e 271
b42b447c 272 # Make wxWidgets and some contribs
0f475e8a
RD
273 WXBLD_CONFIG="$WXBLD/wx-config"
274 if [ $universal = yes ]; then
275 export WXROOT
276 export BUILDPREFIX=$PREFIX
277 export INSTALLDIR=$INSTALLROOT$PREFIX
278 $WXDIR/distrib/scripts/mac/macbuild wxpython universal $CHARTYPE
279 else
280 make $MAKEJOBS
281 make $MAKEJOBS -C contrib/src/animate
282 make $MAKEJOBS -C contrib/src/gizmos
283 make $MAKEJOBS -C contrib/src/stc
284 fi
285
286 SWIGIT=0
287 if [ $reswig = yes ]; then
288 SWIGIT=1
289 fi
e61e5964 290
46456f61 291 # Build wxPython
61074746 292 cd $WXROOT/wxPython
46456f61 293 $PYTHON setup.py \
85245f48 294 UNICODE=$PYUNICODEOPT \
46456f61 295 NO_SCRIPTS=1 \
28d1454a 296 EP_ADD_OPTS=1 \
0f475e8a 297 WX_CONFIG="$WXBLD_CONFIG --inplace" \
81de4ba3 298 BUILD_BASE=$WXBLD/wxPython \
e61e5964
KO
299 SWIG=$SWIGBIN \
300 USE_SWIG=$SWIGIT \
1e4a197e 301 build
1e4a197e
RD
302fi
303
304#----------------------------------------------------------------------
1e4a197e 305
81de4ba3 306if [ $skipinstall != yes ]; then
b42b447c 307 # Install wxWidgets
81de4ba3 308 cd $WXBLD
0f475e8a
RD
309 if [ $universal != yes ]; then
310 make prefix=$INSTALLROOT$PREFIX install
311 make -C contrib/src/animate prefix=$INSTALLROOT$PREFIX install
312 make -C contrib/src/gizmos prefix=$INSTALLROOT$PREFIX install
313 make -C contrib/src/stc prefix=$INSTALLROOT$PREFIX install
314 fi
1e4a197e 315
28d1454a
RD
316 # relink wx-config with a relative link
317 cd $INSTALLROOT$PREFIX/bin
318 rm wx-config
319 ln -s ../lib/wx/config/* wx-config
320
1e4a197e 321 # and wxPython
61074746 322 cd $WXROOT/wxPython
46456f61 323 $PYTHON setup.py \
85245f48 324 UNICODE=$PYUNICODEOPT \
46456f61 325 NO_SCRIPTS=1 \
28d1454a 326 EP_ADD_OPTS=1 \
0f475e8a 327 WX_CONFIG="$INSTALLROOT$PREFIX/bin/wx-config --prefix=$INSTALLROOT$PREFIX" \
81de4ba3 328 BUILD_BASE=$WXBLD/wxPython \
1e4a197e
RD
329 install \
330 --root=$INSTALLROOT
331
46456f61 332
c451eded
RD
333 # Apple's Python Framework (such as what comes with Panther)
334 # sym-links the site-packages dir in the framework to
c6387bc1
RD
335 # /Library/Python/$PYVER so we need to move the files so they are
336 # installed in the physical location, not the virtual one.
c451eded 337 if [ $APPLE_PYTHON == yes ]; then
81de4ba3
RD
338 if [ -e $INSTALLROOT/Library/Python/$PYVER ]; then
339 rm -r $INSTALLROOT/Library/Python/$PYVER
340 fi
c6387bc1
RD
341 mkdir -p $INSTALLROOT/Library/Python/$PYVER
342 mv $INSTALLROOT/$SITEPACKAGES/* $INSTALLROOT/Library/Python/$PYVER
343 rm -r $INSTALLROOT/System
344 SITEPACKAGES=/Library/Python/$PYVER
345 fi
346
79db03c9
RD
347 # install wxPython's tool scripts
348 mkdir -p $INSTALLROOT$BINPREFIX
61074746 349 cd $WXROOT/wxPython/scripts
79db03c9 350 python$PYVER CreateMacScripts.py $INSTALLROOT $BINPREFIX
85245f48 351
1e4a197e 352
85245f48
RD
353 # Remove the .pyc/.pyo files they just take up space and can be recreated
354 # during the install.
61074746 355 pushd $WXROOT/wxPython
85245f48
RD
356 $PYTHON $PROGDIR/../zappycfiles.py $INSTALLROOT > /dev/null
357 popd
c6387bc1 358
79db03c9 359 # Set premissions for files in $INSTALLROOT
132ae51e 360 if [ "$UID" = "0" ]; then
79db03c9
RD
361 chown -R root:admin $INSTALLROOT
362 chmod -R g+w $INSTALLROOT
132ae51e 363 fi
1e4a197e
RD
364fi
365
c451eded 366if [ $APPLE_PYTHON == yes ]; then
85245f48
RD
367 SITEPACKAGES=/Library/Python/$PYVER
368fi
79db03c9 369PKGDIR=`cat $INSTALLROOT$SITEPACKAGES/wx.pth`
28d1454a 370
1e4a197e
RD
371popd
372
373#----------------------------------------------------------------------
374
375# Make the Installer packages and disk image
81de4ba3 376if [ $skipdmg != yes ]; then
1e4a197e 377
85245f48
RD
378 #-----------------------------------------------
379 # The main runtime installer package
1e4a197e
RD
380
381 # Make the welcome message
0f475e8a
RD
382 case $OSX_VERSION in
383 10.4) W_MSG="the Tiger (OS X 10.4.x Intel) version of" ;;
384 10.3) W_MSG="the Panther (OS X 10.3.x) version of" ;;
385 10.2) W_MSG="the Jaguar (OS X 10.2.x) version of" ;;
46456f61 386 esac
0f475e8a
RD
387
388 if [ $universal == yes ]; then
389 W_MSG="the Universal (OS X 10.4.x and above) version of"
390 fi
85245f48
RD
391
392
1e4a197e
RD
393 cat > $RESOURCEDIR/Welcome.txt <<EOF
394Welcome!
395
85245f48 396This Installer package will install the wxPython $CHARTYPE runtime $VERSION for $W_MSG MacPython-OSX $PYVER. This includes:
1e4a197e 397
85245f48
RD
398 * The wxPython packages and modules
399 * The wxWidgets shared libraries and headers
79db03c9 400 * Some command line tool scripts, installed to /usr/local/bin.
85245f48
RD
401
402You must install onto your current boot disk, eventhough the installer does not enforce this, otherwise things will not work.
403
79db03c9 404You can install more than one version of the wxPython runtime if you desire. The most recently installed version will be the default wxPython, but you can choose another by setting the PYTHONPATH or by using the wxversion module. See http://wiki.wxpython.org/index.cgi/MultiVersionInstalls for more details.
c6387bc1 405
1e4a197e
RD
406Build date: `date`
407EOF
408
409 # make the preflight script
410 cat > $RESOURCEDIR/preflight <<EOF
411#!/bin/sh
412# Cleanup any old install of the wxPython package
413rm -rf \$2$SITEPACKAGES/wxPython
46456f61 414rm -rf \$2$SITEPACKAGES/wx
28d1454a 415rm -rf \$2$SITEPACKAGES/$PKGDIR
1e4a197e
RD
416exit 0
417EOF
418 chmod +x $RESOURCEDIR/preflight
419
420 # make the postflight script
421 cat > $RESOURCEDIR/postflight <<EOF
422#!/bin/sh -e
423# Compile the .py files in the wxPython pacakge
28d1454a
RD
424$PYTHON \$2$PYLIB/compileall.py \$2$SITEPACKAGES/$PKGDIR
425$PYTHON -O \$2$PYLIB/compileall.py \$2$SITEPACKAGES/$PKGDIR
1e4a197e 426
c6387bc1 427# and all of the wxPython pacakge should be group writable
28d1454a
RD
428chgrp -R admin \$2$SITEPACKAGES/$PKGDIR
429chmod -R g+w \$2$SITEPACKAGES/$PKGDIR
1e4a197e
RD
430
431exit 0
432EOF
433 chmod +x $RESOURCEDIR/postflight
434
85245f48 435
1e4a197e 436
c6387bc1 437 # Build the main Installer Package...
0f475e8a 438 PKGNAME=wxPython${SHORTVER}-osx-$CHARTYPE-$TAG
48e7d325 439 if [ $PYVER != 2.3 ]; then
0f475e8a 440 PKGNAME=wxPython${SHORTVER}-osx-$CHARTYPE-$TAG-py$PYVER
48e7d325
RD
441 fi
442 rm -rf $PKGNAME.pkg
443 $PYTHON $PROGDIR/../buildpkg.py \
444 --Title=$PKGNAME \
1e4a197e 445 --Version=$VERSION \
85245f48 446 --Description="wxPython $CHARTYPE runtime $VERSION for $W_MSG MacPython-OSX $PYVER" \
1e4a197e
RD
447 --NeedsAuthorization="YES" \
448 --Relocatable="NO" \
449 --InstallOnly="YES" \
450 $INSTALLROOT \
451 $RESOURCEDIR
452
02b800ce 453 mv $PKGNAME.pkg $DMGROOT/$PKGNAME.pkg
1e4a197e 454
85245f48
RD
455 rm $RESOURCEDIR/postflight
456 rm $RESOURCEDIR/preflight
457 rm $RESOURCEDIR/Welcome.txt
1e4a197e 458
1e4a197e 459
85245f48
RD
460 #-----------------------------------------------
461 # Make a README to go on the disk image
462 cat > "$DMGROOT/README 1st.txt" <<EOF
46456f61
RD
463Welcome to wxPython!
464
85245f48
RD
465This disk image contains the following items:
466
467 wxPython${SHORTVER}-osx-$CHARTYPE-$VERSION-$KIND
468
79db03c9
RD
469 This Installer contains the wxPython runtime, compiled on a
470 $KIND OS X system, using the $CHARTYPE build of the wxWidgets
471 library. It includes the Python modules and extension
472 modules, as well as the wxWidgets libraries.
46456f61 473
79db03c9
RD
474 It is possible to have more than one version of the runtime
475 installed at once if you wish. The most recently installed
476 version will be the default wxPython, but you can choose
477 another by setting the PYTHONPATH or by using the wxversion
478 module. For more details see:
479 http://wiki.wxpython.org/index.cgi/MultiVersionInstalls
85245f48 480
85245f48
RD
481
482 uninstall_wxPython.py
483
484 A simple tool to help you manage your installed versions of
485 wxPython. It will allow you to choose from the currently
486 installed wxPython packages and to select one for
487 uninstallation. It is a text-mode tool so you can either run
488 it from a Terminal command line, or you can open it with
489 PythonLauncher and let it create a Terminal to run it in.
490
61074746
RD
491 NOTE: If you have versions prior to 2.5.3.1 installed, please
492 do run this uninstall tool to remove the older version.
493
85245f48
RD
494EOF
495
496
497
498 cp $PROGDIR/../uninstall_wxPython.py $DMGROOT
499
500
501 #-----------------------------------------------
502 # Make a disk image to hold these files
c451eded 503 dmgname=wxPython${SHORTVER}-osx-$CHARTYPE-$VERSION-$TAG-py$PYVER
85245f48
RD
504 $PROGDIR/../makedmg $DMGROOT $DMGDIR $dmgname
505
506 echo Moving $DMGDIR/$dmgname.dmg to $DESTDIR
ae4e0c7a 507 mv $DMGDIR/$dmgname.dmg $DESTDIR/$dmgname.dmg
85245f48
RD
508
509
510#---------------------------------------------------------------------------
511# Now create app bundles for the demo, docs, and tools and make another
512# disk image to hold it all.
513#---------------------------------------------------------------------------
514
515 cat > "$DMGAPPS/README 1st.txt" <<EOF
516Welcome to wxPython!
1e4a197e 517
85245f48
RD
518On this disk image you will find Demo, Tools, Docs, and etc. for
519wxPython $VERSION. Everything here is optional and you can drag them
520out of the disk image and drop them wherever you want. You will need
521to have an installed wxPython runtime to be able to use any of them.
1e4a197e 522
46456f61 523
85245f48
RD
524 wxPython Demo An application bundle version of the demo.
525 (This has it's own copy of the demo sources
526 within the bundle.)
c6387bc1 527
85245f48 528 XRCed An application for editing wxPython resource
c6387bc1
RD
529 files (XRC files.)
530
85245f48 531 PyCrust An application that provides an interactive
c6387bc1
RD
532 Python shell and also namespace inspectors.
533
b42b447c
RD
534
535
81de4ba3 536 Docs/wxDocsViewer An application that allows you to view the
dcb1fb69 537 wxWidgets documentation.
b42b447c
RD
538
539 Docs/licence License files.
540
81de4ba3 541 Docs/other A few readmes, change log, etc.
b42b447c
RD
542
543
81de4ba3 544 Samples/samples Several small sample applications that
b42b447c
RD
545 demonstrate how to use wxPython.
546
81de4ba3 547 Samples/demo A copy of the wxPython demo source code,
b42b447c
RD
548 just open the folder and run demo.pyw.
549
1e4a197e
RD
550Happy Hacking!
551EOF
552
81de4ba3 553# PyAlaMode An extension of PyCrust that includes source
c6387bc1
RD
554# file editing capabilities.
555
1e4a197e 556
b42b447c 557 # wxDocs
bf158fe6 558 if [ ! -e $TARBALLDIR/wxPython-docs-$VERSION.tar.bz2 ]; then
85245f48 559 cat > "$DMGAPPS/Docs/Build ERROR.txt" <<EOF
dcb1fb69 560
28d1454a 561The wxPython-docs tarball was not found when building this disk image!
81de4ba3
RD
562
563EOF
564
565 else
566 pushd $BUILDROOT
bf158fe6 567 tar xjvf $TARBALLDIR/wxPython-docs-$VERSION.tar.bz2
81de4ba3 568 popd
dcb1fb69 569
81de4ba3
RD
570 # Make an app to launch viewdocs.py
571 $PYTHONW $PROGDIR/../buildapp.py \
85245f48 572 --builddir=$DMGAPPS/Docs \
81de4ba3
RD
573 --name=wxDocsViewer \
574 --mainprogram=$BUILDROOT/wxPython-$VERSION/docs/viewdocs.py \
575 --iconfile=$PROGDIR/Info.icns \
576 build
dcb1fb69 577
85245f48 578 cp $BUILDROOT/wxPython-$VERSION/docs/*.zip $DMGAPPS/Docs/wxDocsViewer.app/Contents/Resources
81de4ba3 579
85245f48 580 cat > "$DMGAPPS/Docs/README 1st.txt" <<EOF
dcb1fb69
RD
581
582The wxDocsViewer application needs to be copied to your Desktop (or
583someplace else you have write access to) before you can run it, so it
584can cache some indexes within its bundle.
585
586EOF
46456f61 587
81de4ba3
RD
588 fi
589
b42b447c 590 # license files, docs, etc.
85245f48 591 pushd $DMGAPPS/Docs
b42b447c
RD
592 cp -pR $SRCROOT/wxPython/licence .
593 cp -pR $SRCROOT/wxPython/docs .
594 rm -rf docs/bin
595 rm -rf docs/xml-raw
596 mv docs other
597 popd
81de4ba3
RD
598
599
bf158fe6 600 if [ ! -e $TARBALLDIR/wxPython-demo-$VERSION.tar.bz2 ]; then
85245f48 601 cat > "$DMGAPPS/Samples/Build ERROR.txt" <<EOF
81de4ba3 602
02b800ce 603The wxPython-$VERSION-demo tarball was not found when building this disk image!
81de4ba3
RD
604
605EOF
85245f48 606 cp "$DMGAPPS/Samples/Build ERROR.txt" $DMGAPPS
81de4ba3
RD
607
608 else
609
610 # Copy the demo and samples to the disk image from the tarball
85245f48 611 pushd $DMGAPPS/Samples
bf158fe6 612 tar xjvf $TARBALLDIR/wxPython-demo-$VERSION.tar.bz2
81de4ba3
RD
613 mv wxPython-$VERSION/* .
614 rm -rf wxPython-$VERSION
0f475e8a 615 rm -f demo/b demo/.setup.sh
81de4ba3
RD
616 mv demo/demo.py demo/demo.pyw
617 popd
618
619 # Make an app bundle to run the demo
620 $PYTHONW $PROGDIR/../buildapp.py \
85245f48 621 --builddir=$DMGAPPS \
81de4ba3 622 --name="wxPython Demo" \
85245f48 623 --mainprogram=$DMGAPPS/Samples/demo/demo.pyw \
81de4ba3
RD
624 --iconfile=$PROGDIR/RunDemo.icns \
625 build
85245f48 626 cp -pR $DMGAPPS/Samples/demo/* "$DMGAPPS/wxPython Demo.app/Contents/Resources"
81de4ba3
RD
627 fi
628
b42b447c 629
46456f61
RD
630 # Make an app bundle to launch PyCrust
631 $PYTHONW $PROGDIR/../buildapp.py \
85245f48 632 --builddir=$DMGAPPS \
46456f61 633 --name=PyCrust \
79db03c9 634 --mainprogram=$INSTALLROOT$BINPREFIX/pycrust.py \
46456f61
RD
635 --iconfile=$PROGDIR/PieShell.icns \
636 build
637
79db03c9
RD
638## TODO: PyAlaMode needs tweaked to be able to run from a bundle. It
639## needs to know to ignore command line parameters and etc...
85245f48
RD
640# # and PyAlaMode
641# $PYTHONW $PROGDIR/../buildapp.py \
642# --builddir=$DMGAPPS \
643# --name=PyAlaMode \
79db03c9 644# --mainprogram=$INSTALLROOT$BINPREFIX/pyalamode.py \
85245f48
RD
645# --iconfile=$PROGDIR/PieShell.icns \
646# build
c6387bc1 647
46456f61
RD
648 # Make an app to launch XRCed
649 $PYTHONW $PROGDIR/../buildapp.py \
85245f48 650 --builddir=$DMGAPPS \
46456f61 651 --name=XRCed \
79db03c9 652 --mainprogram=$INSTALLROOT$BINPREFIX/xrced.py \
46456f61
RD
653 --iconfile=$PROGDIR/XRCed.icns \
654 build
655
81de4ba3 656
1e4a197e 657
85245f48 658 # and then finally make a disk image containing everything
48e7d325 659 dmgname=wxPython${SHORTVER}-osx-docs-demos-$VERSION-$TAG-py$PYVER
85245f48 660 $PROGDIR/../makedmg $DMGAPPS $DMGDIR $dmgname
1e4a197e 661
85245f48 662 echo Moving $DMGDIR/$dmgname.dmg to $DESTDIR
ae4e0c7a 663 mv $DMGDIR/$dmgname.dmg $DESTDIR/$dmgname.dmg
1e4a197e
RD
664fi
665
666
667# Cleanup build/install dirs
81de4ba3 668if [ $skipclean != yes ]; then
1e4a197e
RD
669 echo "Cleaning up..."
670 rm -rf $TMPDIR
671else
672 echo "Cleanup is disabled. You should remove $TMPDIR when finished"
673fi
674
0f475e8a 675exit 0