]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/distrib/mac/wxPythonOSX/build
2 #----------------------------------------------------------------------
3 # Build wxMac and wxPythonOSX from the tarball and then make an
4 # Installer package out of it.
8 spectemplate
= distrib
/ wxPythonFull.spec.
in
10 if [ ! -d wxPython
-o ! -e ${spectemplate} ]; then
11 echo "Please run this script from the root wxPython directory."
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 "-------------------------------------------------------"
22 #----------------------------------------------------------------------
27 echo "Usage: $0 PYVER [jaguar|panther] [command flags...]"
29 echo " PYVER Python version to use to do the build"
31 echo " panther Build for Apple's python in /usr/bin, such as on Panther"
32 echo " jaguar Build for a python in /usr/local/bin, such as on Jaguar"
34 echo "optional command flags:"
35 echo " skiptar Don't unpack the tarball"
36 echo " inplace Don't use the tarball, build from the CVS tree instead"
37 echo " (The Docs and Demo tarballs are still required for a full build.)"
38 echo " reswig Regenerate SWIG wrappers"
39 echo " universal Generate Universal wxWidgets binary (requires Universal Python "
40 echo " to general Universal wxPython)."
41 echo " unicode Make a unicode build"
42 echo " skipconfig Don't run configure"
43 echo " skipbuild Don't build wxWidgets or wxPython"
44 echo " skipinstall Don't do the installation step"
45 echo " skipdmg Don't make the package or diskimage"
46 echo " skipclean Don't do the cleanup at the end"
57 if which python
$PYVER && which pythonw
$PYVER ; then
58 PYTHON
= `which python $PYVER `
59 PYTHONW
= `which pythonw $PYVER `
67 panther
) TAG
= macosx10.3
;;
68 jaguar
) TAG
= macosx10.2
;;
87 skiptar
) skiptar
= yes ;;
88 skipconfig
) skipconfig
= yes ; skiptar
= yes ;;
89 skipbuild
) skipbuild
= yes ; skipconfig
= yes ; skiptar
= yes ;;
90 skipinstall
) skipinstall
= yes ;;
91 skipdmg
) skipdmg
= yes ;;
92 skipclean
) skipclean
= yes ;;
93 inplace
) inplace
= yes ; skiptar
= yes ;;
94 unicode
) unicode
= yes ;;
96 universal
) universal
= yes ;;
97 *) echo "Unknown flag \" ${flag} \" "
104 VERSION
= ` $PYTHON -c "import setup;print setup.VERSION"`
105 SHORTVER
= `echo $VERSION | cut -c 1,2,3`
106 PYPREFIX
= ` $PYTHON -c "import sys; print sys.exec_prefix"`
107 PYLIB
= $PYPREFIX / lib
/ python
$PYVER
108 SITEPACKAGES
= $PYLIB / site
-packages
110 if [ $unicode == yes ]; then
112 UNICODEOPT
= --enable-unicode
116 UNICODEOPT
= --disable-unicode
121 # Test if the python we are using is the System installed framework
122 # or one that was installed by the user. This changes where the
123 # site-packages (or its alias) is located in the installer tree.
125 if [ -e / Library
/ Python
/ $PYVER ] && [ `dirname $PYTHON ` == "/usr/bin" ]; then
131 if [ -z " $TARBALLDIR " ]; then
132 # this is a spot on my fileserver where the tarballs go, adjust
133 # as needed for where you put the wxPython tarball, or set
134 # TARBALLDIR before invoking this script...
135 TARBALLDIR
=/ stuff
/ Development
/ wxPython
/ dist
/ $VERSION
137 TARBALL
= $TARBALLDIR / wxPython
-src- $VERSION .
tar .gz
139 if [ ! -e $TARBALLDIR / wxPython
-demo- $VERSION .
tar .gz
]; then
140 echo "-------------------------------------------------------"
141 echo " WARNING: Demo tarball not found, will skip building "
142 echo " the Demo app bundle and etc."
143 echo " $TARBALLDIR /wxPython-demo- $VERSION .tar.gz"
144 echo "-------------------------------------------------------"
147 if [ ! -e $TARBALLDIR / wxPython
-docs- $VERSION .
tar .gz
]; then
148 echo "-------------------------------------------------------"
149 echo " WARNING: Docs tarball not found, will skip building "
150 echo " the the wxDocsViewer app bundle and etc."
151 echo " $TARBALLDIR /wxPython-docs- $VERSION .tar.gz"
152 echo "-------------------------------------------------------"
158 PREFIX
=/ usr
/ local
/ lib
/ wxPython
- $CHARTYPE - $VERSION
159 BINPREFIX
=/ usr
/ local
/ bin
161 SWIGBIN
=/ opt
/ swig
/ bin
/ swig
162 WXROOT
= `dirname $PWD `
163 PROGDIR
= "`dirname \" $0 \" `"
164 TMPDIR
= $PWD / _build_dmg
166 BUILDROOT
= $TMPDIR / build
168 INSTALLROOT
= $TMPDIR / install -root
169 INSTALLAPPS
= $TMPDIR / install -apps
175 RESOURCEDIR
= $PROGDIR / resources
177 SRCROOT
= $BUILDROOT / wxPython
-src- $VERSION
180 #----------------------------------------------------------------------
184 mkdir -p $INSTALLROOT
185 mkdir -p $INSTALLAPPS
189 mkdir -p $DMGAPPS / Docs
190 mkdir -p $DMGAPPS / Samples
192 if [ ! -d $DESTDIR ]; then
199 #----------------------------------------------------------------------
202 if [ $skiptar != yes ]; then
203 echo Unarchiving tarball...
207 if [ $inplace = no
]; then
208 # make a build dir and cd to it.
209 cd wxPython
-src- $VERSION
216 # If building "inplace" then our build dir will be off of the
217 # WXROOT like normal, adjust the variables to find things that
219 WXBLD
= $WXROOT / build
- $CHARTYPE
226 echo "Using wx root dir: $WXROOT "
227 echo "Using build dir: $WXBLD "
228 echo "Using source tree: $WXDIR "
230 #----------------------------------------------------------------------
232 if [ $KIND = panther
]; then
233 OTHER_CFG_OPTS
= --enable-mediactrl
237 if [ $universal = yes ]; then
238 UNIVOPT
= --enable-universal_binary
240 # Configure wxWidgets
241 if [ $skipconfig != yes ]; then
245 --enable-monolithic \
250 --enable-debug_flag \
251 --enable-precomp = no \
253 --disable-debugreport \
254 --disable-precompiled-headers \
255 $UNICODEOPT $UNIVOPT $OTHER_CFG_OPTS
259 # Build wxWidgets and wxPython
260 if [ $skipbuild != yes ]; then
262 # Make wxWidgets and some contribs
264 # # For some reason Rez and DeRez have started locking up if run via
265 # # an ssh terminal. Figure out why, but in the meantime...
266 # if [ "$CHARTYPE" = "ansi" ]; then
267 # echo cp /projects/wx2.5/bld/lib/libwx_macd-2.5.?.r* lib
268 # cp /projects/wx2.5/bld/lib/libwx_macd-2.5.?.r* lib
270 # echo cp /projects/wx2.5/bld-unicode/lib/libwx_macud-2.5.?.r* lib
271 # cp /projects/wx2.5/bld-unicode/lib/libwx_macud-2.5.?.r* lib
273 # touch lib/libwx*.r*
276 make $MAKEJOBS -C contrib
/ src
/ animate
277 make $MAKEJOBS -C contrib
/ src
/ gizmos
278 make $MAKEJOBS -C contrib
/ src
/ stc
281 if [ $reswig = yes ]; then
288 UNICODE
= $PYUNICODEOPT \
291 WX_CONFIG
= " $WXBLD /wx-config --inplace" \
292 BUILD_BASE
= $WXBLD / wxPython \
298 #----------------------------------------------------------------------
300 if [ $skipinstall != yes ]; then
303 make prefix
= $INSTALLROOT$PREFIX install
304 make -C contrib
/ src
/ animate prefix
= $INSTALLROOT$PREFIX install
305 make -C contrib
/ src
/ gizmos prefix
= $INSTALLROOT$PREFIX install
306 make -C contrib
/ src
/ stc prefix
= $INSTALLROOT$PREFIX install
309 # relink wx-config with a relative link
310 cd $INSTALLROOT$PREFIX / bin
312 ln -s ..
/ lib
/ wx
/ config
/* wx
-config
317 UNICODE
= $PYUNICODEOPT \
320 WX_CONFIG
= " $INSTALLROOT / $PREFIX /bin/wx-config --prefix= $INSTALLROOT / $PREFIX " \
321 BUILD_BASE
= $WXBLD / wxPython \
326 # Apple's Python Framework (such as what comes with Panther)
327 # sym-links the site-packages dir in the framework to
328 # /Library/Python/$PYVER so we need to move the files so they are
329 # installed in the physical location, not the virtual one.
330 if [ $APPLE_PYTHON == yes ]; then
331 if [ -e $INSTALLROOT / Library
/ Python
/ $PYVER ]; then
332 rm -r $INSTALLROOT / Library
/ Python
/ $PYVER
334 mkdir -p $INSTALLROOT / Library
/ Python
/ $PYVER
335 mv $INSTALLROOT / $SITEPACKAGES /* $INSTALLROOT / Library
/ Python
/ $PYVER
336 rm -r $INSTALLROOT / System
337 SITEPACKAGES
=/ Library
/ Python
/ $PYVER
340 # install wxPython's tool scripts
341 mkdir -p $INSTALLROOT$BINPREFIX
342 cd $WXROOT / wxPython
/ scripts
343 python
$PYVER CreateMacScripts.py
$INSTALLROOT $BINPREFIX
346 # Remove the .pyc/.pyo files they just take up space and can be recreated
347 # during the install.
348 pushd $WXROOT / wxPython
349 $PYTHON $PROGDIR / ..
/ zappycfiles.py
$INSTALLROOT > / dev
/ null
352 # Set premissions for files in $INSTALLROOT
353 if [ " $UID " = "0" ]; then
354 chown
-R root
: admin
$INSTALLROOT
355 chmod -R g
+ w
$INSTALLROOT
359 if [ $APPLE_PYTHON == yes ]; then
360 SITEPACKAGES
=/ Library
/ Python
/ $PYVER
362 PKGDIR
= `cat $INSTALLROOT $SITEPACKAGES /wx.pth`
366 #----------------------------------------------------------------------
368 # Make the Installer packages and disk image
369 if [ $skipdmg != yes ]; then
371 #-----------------------------------------------
372 # The main runtime installer package
374 # Make the welcome message
376 panther
) W_MSG
= "the Panther (OS X 10.3.x) version of" ;;
377 jaguar
) W_MSG
= "the Jaguar (OS X 10.2.x) version of" ;;
381 cat > $RESOURCEDIR / Welcome.txt
<<EOF
384 This Installer package will install the wxPython $CHARTYPE runtime $VERSION for $W_MSG MacPython-OSX $PYVER . This includes:
386 * The wxPython packages and modules
387 * The wxWidgets shared libraries and headers
388 * Some command line tool scripts, installed to /usr/local/bin.
390 You must install onto your current boot disk, eventhough the installer does not enforce this, otherwise things will not work.
392 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.
397 # make the preflight script
398 cat > $RESOURCEDIR / preflight
<<EOF
400 # Cleanup any old install of the wxPython package
401 rm -rf \ $2 $SITEPACKAGES /wxPython
402 rm -rf \ $2 $SITEPACKAGES /wx
403 rm -rf \ $2 $SITEPACKAGES / $PKGDIR
406 chmod + x
$RESOURCEDIR / preflight
408 # make the postflight script
409 cat > $RESOURCEDIR / postflight
<<EOF
411 # Compile the .py files in the wxPython pacakge
412 $PYTHON \ $2 $PYLIB /compileall.py \ $2 $SITEPACKAGES / $PKGDIR
413 $PYTHON -O \ $2 $PYLIB /compileall.py \ $2 $SITEPACKAGES / $PKGDIR
415 # and all of the wxPython pacakge should be group writable
416 chgrp -R admin \ $2 $SITEPACKAGES / $PKGDIR
417 chmod -R g+w \ $2 $SITEPACKAGES / $PKGDIR
421 chmod + x
$RESOURCEDIR / postflight
425 # Build the main Installer Package...
426 PKGNAME
= wxPython
${SHORTVER} -osx- $CHARTYPE - $KIND
427 if [ $PYVER != 2.3 ]; then
428 PKGNAME
= wxPython
${SHORTVER} -osx- $CHARTYPE - $KIND -py $PYVER
431 $PYTHON $PROGDIR / ..
/ buildpkg.py \
434 --Description = "wxPython $CHARTYPE runtime $VERSION for $W_MSG MacPython-OSX $PYVER " \
435 --NeedsAuthorization = "YES" \
437 --InstallOnly = "YES" \
441 mv $PKGNAME .pkg
$DMGROOT / $PKGNAME .pkg
443 rm $RESOURCEDIR / postflight
444 rm $RESOURCEDIR / preflight
445 rm $RESOURCEDIR / Welcome.txt
448 #-----------------------------------------------
449 # Make a README to go on the disk image
450 cat > " $DMGROOT /README 1st.txt" <<EOF
453 This disk image contains the following items:
455 wxPython ${SHORTVER} -osx- $CHARTYPE - $VERSION - $KIND
457 This Installer contains the wxPython runtime, compiled on a
458 $KIND OS X system, using the $CHARTYPE build of the wxWidgets
459 library. It includes the Python modules and extension
460 modules, as well as the wxWidgets libraries.
462 It is possible to have more than one version of the runtime
463 installed at once if you wish. The most recently installed
464 version will be the default wxPython, but you can choose
465 another by setting the PYTHONPATH or by using the wxversion
466 module. For more details see:
467 http://wiki.wxpython.org/index.cgi/MultiVersionInstalls
470 uninstall_wxPython.py
472 A simple tool to help you manage your installed versions of
473 wxPython. It will allow you to choose from the currently
474 installed wxPython packages and to select one for
475 uninstallation. It is a text-mode tool so you can either run
476 it from a Terminal command line, or you can open it with
477 PythonLauncher and let it create a Terminal to run it in.
479 NOTE: If you have versions prior to 2.5.3.1 installed, please
480 do run this uninstall tool to remove the older version.
486 cp $PROGDIR / ..
/ uninstall_wxPython.py
$DMGROOT
489 #-----------------------------------------------
490 # Make a disk image to hold these files
491 dmgname
= wxPython
${SHORTVER} -osx- $CHARTYPE - $VERSION - $TAG -py $PYVER
492 $PROGDIR / ..
/ makedmg
$DMGROOT $DMGDIR $dmgname
494 echo Moving
$DMGDIR / $dmgname .dmg to
$DESTDIR
495 mv $DMGDIR / $dmgname .dmg
$DESTDIR / $dmgname .dmg
498 #---------------------------------------------------------------------------
499 # Now create app bundles for the demo, docs, and tools and make another
500 # disk image to hold it all.
501 #---------------------------------------------------------------------------
503 cat > " $DMGAPPS /README 1st.txt" <<EOF
506 On this disk image you will find Demo, Tools, Docs, and etc. for
507 wxPython $VERSION . Everything here is optional and you can drag them
508 out of the disk image and drop them wherever you want. You will need
509 to have an installed wxPython runtime to be able to use any of them.
512 wxPython Demo An application bundle version of the demo.
513 (This has it's own copy of the demo sources
516 XRCed An application for editing wxPython resource
519 PyCrust An application that provides an interactive
520 Python shell and also namespace inspectors.
524 Docs/wxDocsViewer An application that allows you to view the
525 wxWidgets documentation.
527 Docs/licence License files.
529 Docs/other A few readmes, change log, etc.
532 Samples/samples Several small sample applications that
533 demonstrate how to use wxPython.
535 Samples/demo A copy of the wxPython demo source code,
536 just open the folder and run demo.pyw.
541 # PyAlaMode An extension of PyCrust that includes source
542 # file editing capabilities.
546 if [ ! -e $TARBALLDIR / wxPython
-docs- $VERSION .
tar .gz
]; then
547 cat > " $DMGAPPS /Docs/Build ERROR.txt" <<EOF
549 The wxPython-docs tarball was not found when building this disk image!
555 tar xzvf
$TARBALLDIR / wxPython
-docs- $VERSION .
tar .gz
558 # Make an app to launch viewdocs.py
559 $PYTHONW $PROGDIR / ..
/ buildapp.py \
560 --builddir = $DMGAPPS / Docs \
561 --name = wxDocsViewer \
562 --mainprogram = $BUILDROOT / wxPython
- $VERSION / docs
/ viewdocs.py \
563 --iconfile = $PROGDIR / Info.icns \
566 cp $BUILDROOT / wxPython
- $VERSION / docs
/* .
zip $DMGAPPS / Docs
/ wxDocsViewer.app
/ Contents
/ Resources
568 cat > " $DMGAPPS /Docs/README 1st.txt" <<EOF
570 The wxDocsViewer application needs to be copied to your Desktop (or
571 someplace else you have write access to) before you can run it, so it
572 can cache some indexes within its bundle.
578 # license files, docs, etc.
580 cp -pR $SRCROOT / wxPython
/ licence .
581 cp -pR $SRCROOT / wxPython
/ docs .
588 if [ ! -e $TARBALLDIR / wxPython
-demo- $VERSION .
tar .gz
]; then
589 cat > " $DMGAPPS /Samples/Build ERROR.txt" <<EOF
591 The wxPython- $VERSION -demo tarball was not found when building this disk image!
594 cp " $DMGAPPS /Samples/Build ERROR.txt" $DMGAPPS
598 # Copy the demo and samples to the disk image from the tarball
599 pushd $DMGAPPS / Samples
600 tar xzvf
$TARBALLDIR / wxPython
-demo- $VERSION .
tar .gz
601 mv wxPython
- $VERSION /* .
602 rm -rf wxPython
- $VERSION
603 rm demo
/ b demo
/ .setup.sh
604 mv demo
/ demo.py demo
/ demo.pyw
607 # Make an app bundle to run the demo
608 $PYTHONW $PROGDIR / ..
/ buildapp.py \
609 --builddir = $DMGAPPS \
610 --name = "wxPython Demo" \
611 --mainprogram = $DMGAPPS / Samples
/ demo
/ demo.pyw \
612 --iconfile = $PROGDIR / RunDemo.icns \
614 cp -pR $DMGAPPS / Samples
/ demo
/* " $DMGAPPS /wxPython Demo.app/Contents/Resources"
618 # Make an app bundle to launch PyCrust
619 $PYTHONW $PROGDIR / ..
/ buildapp.py \
620 --builddir = $DMGAPPS \
622 --mainprogram = $INSTALLROOT$BINPREFIX / pycrust.py \
623 --iconfile = $PROGDIR / PieShell.icns \
626 ## TODO: PyAlaMode needs tweaked to be able to run from a bundle. It
627 ## needs to know to ignore command line parameters and etc...
629 # $PYTHONW $PROGDIR/../buildapp.py \
630 # --builddir=$DMGAPPS \
632 # --mainprogram=$INSTALLROOT$BINPREFIX/pyalamode.py \
633 # --iconfile=$PROGDIR/PieShell.icns \
636 # Make an app to launch XRCed
637 $PYTHONW $PROGDIR / ..
/ buildapp.py \
638 --builddir = $DMGAPPS \
640 --mainprogram = $INSTALLROOT$BINPREFIX / xrced.py \
641 --iconfile = $PROGDIR / XRCed.icns \
646 # and then finally make a disk image containing everything
647 dmgname
= wxPython
${SHORTVER} -osx-docs-demos- $VERSION - $TAG -py $PYVER
648 $PROGDIR / ..
/ makedmg
$DMGAPPS $DMGDIR $dmgname
650 echo Moving
$DMGDIR / $dmgname .dmg to
$DESTDIR
651 mv $DMGDIR / $dmgname .dmg
$DESTDIR / $dmgname .dmg
655 # Cleanup build/install dirs
656 if [ $skipclean != yes ]; then
657 echo "Cleaning up..."
660 echo "Cleanup is disabled. You should remove $TMPDIR when finished"