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