]>
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 " unicode Make a unicode build"
39 echo " skipconfig Don't run configure"
40 echo " skipbuild Don't build wxWidgets or wxPython"
41 echo " skipinstall Don't do the installation step"
42 echo " skipdmg Don't make the package or diskimage"
43 echo " skipclean Don't do the cleanup at the end"
54 if which python
$PYVER && which pythonw
$PYVER ; then
55 PYTHON
= `which python $PYVER `
56 PYTHONW
= `which pythonw $PYVER `
64 panther
) TAG
= macosx10.3
;;
65 jaguar
) TAG
= macosx10.2
;;
82 skiptar
) skiptar
= yes ;;
83 skipconfig
) skipconfig
= yes ; skiptar
= yes ;;
84 skipbuild
) skipbuild
= yes ; skipconfig
= yes ; skiptar
= yes ;;
85 skipinstall
) skipinstall
= yes ;;
86 skipdmg
) skipdmg
= yes ;;
87 skipclean
) skipclean
= yes ;;
88 inplace
) inplace
= yes ; skiptar
= yes ;;
89 unicode
) unicode
= yes ;;
91 *) echo "Unknown flag \" ${flag} \" "
98 VERSION
= ` $PYTHON -c "import setup;print setup.VERSION"`
99 SHORTVER
= `echo $VERSION | cut -c 1,2,3`
100 PYPREFIX
= ` $PYTHON -c "import sys; print sys.exec_prefix"`
101 PYLIB
= $PYPREFIX / lib
/ python
$PYVER
102 SITEPACKAGES
= $PYLIB / site
-packages
104 if [ $unicode == yes ]; then
106 UNICODEOPT
= --enable-unicode
110 UNICODEOPT
= --disable-unicode
115 # Test if the python we are using is the System installed framework
116 # or one that was installed by the user. This changes where the
117 # site-packages (or its alias) is located in the installer tree.
119 if [ -e / Library
/ Python
/ $PYVER ] && [ `dirname $PYTHON ` == "/usr/bin" ]; then
125 if [ -z " $TARBALLDIR " ]; then
126 # this is a spot on my fileserver where the tarballs go, adjust
127 # as needed for where you put the wxPython tarball, or set
128 # TARBALLDIR before invoking this script...
129 TARBALLDIR
=/ stuff
/ Development
/ wxPython
/ dist
/ $VERSION
131 TARBALL
= $TARBALLDIR / wxPython
-src- $VERSION .
tar .gz
133 if [ ! -e $TARBALLDIR / wxPython
-demo- $VERSION .
tar .gz
]; then
134 echo "-------------------------------------------------------"
135 echo " WARNING: Demo tarball not found, will skip building "
136 echo " the Demo app bundle and etc."
137 echo " $TARBALLDIR /wxPython-demo- $VERSION .tar.gz"
138 echo "-------------------------------------------------------"
141 if [ ! -e $TARBALLDIR / wxPython
-docs- $VERSION .
tar .gz
]; then
142 echo "-------------------------------------------------------"
143 echo " WARNING: Docs tarball not found, will skip building "
144 echo " the the wxDocsViewer app bundle and etc."
145 echo " $TARBALLDIR /wxPython-docs- $VERSION .tar.gz"
146 echo "-------------------------------------------------------"
152 PREFIX
=/ usr
/ local
/ lib
/ wxPython
- $CHARTYPE - $VERSION
153 BINPREFIX
=/ usr
/ local
/ bin
155 WXROOT
= `dirname $PWD `
156 PROGDIR
= "`dirname \" $0 \" `"
157 TMPDIR
= $PWD / _build_dmg
159 BUILDROOT
= $TMPDIR / build
161 INSTALLROOT
= $TMPDIR / install -root
162 INSTALLAPPS
= $TMPDIR / install -apps
168 RESOURCEDIR
= $PROGDIR / resources
170 SRCROOT
= $BUILDROOT / wxPython
-src- $VERSION
173 #----------------------------------------------------------------------
177 mkdir -p $INSTALLROOT
178 mkdir -p $INSTALLAPPS
182 mkdir -p $DMGAPPS / Docs
183 mkdir -p $DMGAPPS / Samples
189 #----------------------------------------------------------------------
192 if [ $skiptar != yes ]; then
193 echo Unarchiving tarball...
197 if [ $inplace = no
]; then
198 # make a build dir and cd to it.
199 cd wxPython
-src- $VERSION
206 # If building "inplace" then our build dir will be off of the
207 # WXROOT like normal, adjust the variables to find things that
209 WXBLD
= $WXROOT / build
- $CHARTYPE
216 echo "Using wx root dir: $WXROOT "
217 echo "Using build dir: $WXBLD "
218 echo "Using source tree: $WXDIR "
220 #----------------------------------------------------------------------
222 if [ $KIND = panther
]; then
223 OTHER_CFG_OPTS
= --enable-mediactrl
226 # Configure wxWidgets
227 if [ $skipconfig != yes ]; then
231 --enable-monolithic \
236 --enable-debug_flag \
237 --enable-precomp = no \
239 --disable-debugreport \
240 $UNICODEOPT $OTHER_CFG_OPTS
244 # Build wxWidgets and wxPython
245 if [ $skipbuild != yes ]; then
247 # Make wxWidgets and some contribs
249 # # For some reason Rez and DeRez have started locking up if run via
250 # # an ssh terminal. Figure out why, but in the meantime...
251 # if [ "$CHARTYPE" = "ansi" ]; then
252 # echo cp /projects/wx2.5/bld/lib/libwx_macd-2.5.?.r* lib
253 # cp /projects/wx2.5/bld/lib/libwx_macd-2.5.?.r* lib
255 # echo cp /projects/wx2.5/bld-unicode/lib/libwx_macud-2.5.?.r* lib
256 # cp /projects/wx2.5/bld-unicode/lib/libwx_macud-2.5.?.r* lib
258 # touch lib/libwx*.r*
261 make $MAKEJOBS -C contrib
/ src
/ animate
262 make $MAKEJOBS -C contrib
/ src
/ gizmos
263 make $MAKEJOBS -C contrib
/ src
/ stc
268 UNICODE
= $PYUNICODEOPT \
271 WX_CONFIG
= " $WXBLD /wx-config --inplace" \
272 BUILD_BASE
= $WXBLD / wxPython \
276 #----------------------------------------------------------------------
278 if [ $skipinstall != yes ]; then
281 make prefix
= $INSTALLROOT$PREFIX install
282 make -C contrib
/ src
/ animate prefix
= $INSTALLROOT$PREFIX install
283 make -C contrib
/ src
/ gizmos prefix
= $INSTALLROOT$PREFIX install
284 make -C contrib
/ src
/ stc prefix
= $INSTALLROOT$PREFIX install
287 # relink wx-config with a relative link
288 cd $INSTALLROOT$PREFIX / bin
290 ln -s ..
/ lib
/ wx
/ config
/* wx
-config
295 UNICODE
= $PYUNICODEOPT \
298 WX_CONFIG
= " $INSTALLROOT / $PREFIX /bin/wx-config --prefix= $INSTALLROOT / $PREFIX " \
299 BUILD_BASE
= $WXBLD / wxPython \
304 # Apple's Python Framework (such as what comes with Panther)
305 # sym-links the site-packages dir in the framework to
306 # /Library/Python/$PYVER so we need to move the files so they are
307 # installed in the physical location, not the virtual one.
308 if [ $APPLE_PYTHON == yes ]; then
309 if [ -e $INSTALLROOT / Library
/ Python
/ $PYVER ]; then
310 rm -r $INSTALLROOT / Library
/ Python
/ $PYVER
312 mkdir -p $INSTALLROOT / Library
/ Python
/ $PYVER
313 mv $INSTALLROOT / $SITEPACKAGES /* $INSTALLROOT / Library
/ Python
/ $PYVER
314 rm -r $INSTALLROOT / System
315 SITEPACKAGES
=/ Library
/ Python
/ $PYVER
318 # install wxPython's tool scripts
319 mkdir -p $INSTALLROOT$BINPREFIX
320 cd $WXROOT / wxPython
/ scripts
321 python
$PYVER CreateMacScripts.py
$INSTALLROOT $BINPREFIX
324 # Remove the .pyc/.pyo files they just take up space and can be recreated
325 # during the install.
326 pushd $WXROOT / wxPython
327 $PYTHON $PROGDIR / ..
/ zappycfiles.py
$INSTALLROOT > / dev
/ null
330 # Set premissions for files in $INSTALLROOT
331 if [ " $UID " = "0" ]; then
332 chown
-R root
: admin
$INSTALLROOT
333 chmod -R g
+ w
$INSTALLROOT
337 if [ $APPLE_PYTHON == yes ]; then
338 SITEPACKAGES
=/ Library
/ Python
/ $PYVER
340 PKGDIR
= `cat $INSTALLROOT $SITEPACKAGES /wx.pth`
344 #----------------------------------------------------------------------
346 # Make the Installer packages and disk image
347 if [ $skipdmg != yes ]; then
349 #-----------------------------------------------
350 # The main runtime installer package
352 # Make the welcome message
354 panther
) W_MSG
= "the Panther (OS X 10.3.x) version of" ;;
355 jaguar
) W_MSG
= "the Jaguar (OS X 10.2.x) version of" ;;
359 cat > $RESOURCEDIR / Welcome.txt
<<EOF
362 This Installer package will install the wxPython $CHARTYPE runtime $VERSION for $W_MSG MacPython-OSX $PYVER . This includes:
364 * The wxPython packages and modules
365 * The wxWidgets shared libraries and headers
366 * Some command line tool scripts, installed to /usr/local/bin.
368 You must install onto your current boot disk, eventhough the installer does not enforce this, otherwise things will not work.
370 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.
375 # make the preflight script
376 cat > $RESOURCEDIR / preflight
<<EOF
378 # Cleanup any old install of the wxPython package
379 rm -rf \ $2 $SITEPACKAGES /wxPython
380 rm -rf \ $2 $SITEPACKAGES /wx
381 rm -rf \ $2 $SITEPACKAGES / $PKGDIR
384 chmod + x
$RESOURCEDIR / preflight
386 # make the postflight script
387 cat > $RESOURCEDIR / postflight
<<EOF
389 # Compile the .py files in the wxPython pacakge
390 $PYTHON \ $2 $PYLIB /compileall.py \ $2 $SITEPACKAGES / $PKGDIR
391 $PYTHON -O \ $2 $PYLIB /compileall.py \ $2 $SITEPACKAGES / $PKGDIR
393 # and all of the wxPython pacakge should be group writable
394 chgrp -R admin \ $2 $SITEPACKAGES / $PKGDIR
395 chmod -R g+w \ $2 $SITEPACKAGES / $PKGDIR
399 chmod + x
$RESOURCEDIR / postflight
403 # Build the main Installer Package...
404 PKGNAME
= wxPython
${SHORTVER} -osx- $CHARTYPE - $KIND
405 if [ $PYVER != 2.3 ]; then
406 PKGNAME
= wxPython
${SHORTVER} -osx- $CHARTYPE - $KIND -py $PYVER
409 $PYTHON $PROGDIR / ..
/ buildpkg.py \
412 --Description = "wxPython $CHARTYPE runtime $VERSION for $W_MSG MacPython-OSX $PYVER " \
413 --NeedsAuthorization = "YES" \
415 --InstallOnly = "YES" \
419 mv $PKGNAME .pkg
$DMGROOT
421 rm $RESOURCEDIR / postflight
422 rm $RESOURCEDIR / preflight
423 rm $RESOURCEDIR / Welcome.txt
426 #-----------------------------------------------
427 # Make a README to go on the disk image
428 cat > " $DMGROOT /README 1st.txt" <<EOF
431 This disk image contains the following items:
433 wxPython ${SHORTVER} -osx- $CHARTYPE - $VERSION - $KIND
435 This Installer contains the wxPython runtime, compiled on a
436 $KIND OS X system, using the $CHARTYPE build of the wxWidgets
437 library. It includes the Python modules and extension
438 modules, as well as the wxWidgets libraries.
440 It is possible to have more than one version of the runtime
441 installed at once if you wish. The most recently installed
442 version will be the default wxPython, but you can choose
443 another by setting the PYTHONPATH or by using the wxversion
444 module. For more details see:
445 http://wiki.wxpython.org/index.cgi/MultiVersionInstalls
448 uninstall_wxPython.py
450 A simple tool to help you manage your installed versions of
451 wxPython. It will allow you to choose from the currently
452 installed wxPython packages and to select one for
453 uninstallation. It is a text-mode tool so you can either run
454 it from a Terminal command line, or you can open it with
455 PythonLauncher and let it create a Terminal to run it in.
457 NOTE: If you have versions prior to 2.5.3.1 installed, please
458 do run this uninstall tool to remove the older version.
464 cp $PROGDIR / ..
/ uninstall_wxPython.py
$DMGROOT
467 #-----------------------------------------------
468 # Make a disk image to hold these files
469 dmgname
= wxPython
${SHORTVER} -osx- $CHARTYPE - $VERSION - $TAG -py $PYVER
470 $PROGDIR / ..
/ makedmg
$DMGROOT $DMGDIR $dmgname
472 echo Moving
$DMGDIR / $dmgname .dmg to
$DESTDIR
473 mv $DMGDIR / $dmgname .dmg
$DESTDIR
476 #---------------------------------------------------------------------------
477 # Now create app bundles for the demo, docs, and tools and make another
478 # disk image to hold it all.
479 #---------------------------------------------------------------------------
481 cat > " $DMGAPPS /README 1st.txt" <<EOF
484 On this disk image you will find Demo, Tools, Docs, and etc. for
485 wxPython $VERSION . Everything here is optional and you can drag them
486 out of the disk image and drop them wherever you want. You will need
487 to have an installed wxPython runtime to be able to use any of them.
490 wxPython Demo An application bundle version of the demo.
491 (This has it's own copy of the demo sources
494 XRCed An application for editing wxPython resource
497 PyCrust An application that provides an interactive
498 Python shell and also namespace inspectors.
502 Docs/wxDocsViewer An application that allows you to view the
503 wxWidgets documentation.
505 Docs/licence License files.
507 Docs/other A few readmes, change log, etc.
510 Samples/samples Several small sample applications that
511 demonstrate how to use wxPython.
513 Samples/demo A copy of the wxPython demo source code,
514 just open the folder and run demo.pyw.
519 # PyAlaMode An extension of PyCrust that includes source
520 # file editing capabilities.
524 if [ ! -e $TARBALLDIR / wxPython
-docs- $VERSION .
tar .gz
]; then
525 cat > " $DMGAPPS /Docs/Build ERROR.txt" <<EOF
527 The wxPython-docs tarball was not found when building this disk image!
533 tar xzvf
$TARBALLDIR / wxPython
-docs- $VERSION .
tar .gz
536 # Make an app to launch viewdocs.py
537 $PYTHONW $PROGDIR / ..
/ buildapp.py \
538 --builddir = $DMGAPPS / Docs \
539 --name = wxDocsViewer \
540 --mainprogram = $BUILDROOT / wxPython
- $VERSION / docs
/ viewdocs.py \
541 --iconfile = $PROGDIR / Info.icns \
544 cp $BUILDROOT / wxPython
- $VERSION / docs
/* .
zip $DMGAPPS / Docs
/ wxDocsViewer.app
/ Contents
/ Resources
546 cat > " $DMGAPPS /Docs/README 1st.txt" <<EOF
548 The wxDocsViewer application needs to be copied to your Desktop (or
549 someplace else you have write access to) before you can run it, so it
550 can cache some indexes within its bundle.
556 # license files, docs, etc.
558 cp -pR $SRCROOT / wxPython
/ licence .
559 cp -pR $SRCROOT / wxPython
/ docs .
566 if [ ! -e $TARBALLDIR / wxPython
-demo- $VERSION .
tar .gz
]; then
567 cat > " $DMGAPPS /Samples/Build ERROR.txt" <<EOF
569 The wxPython-demo tarball was not found when building this disk image!
572 cp " $DMGAPPS /Samples/Build ERROR.txt" $DMGAPPS
576 # Copy the demo and samples to the disk image from the tarball
577 pushd $DMGAPPS / Samples
578 tar xzvf
$TARBALLDIR / wxPython
-demo- $VERSION .
tar .gz
579 mv wxPython
- $VERSION /* .
580 rm -rf wxPython
- $VERSION
581 rm demo
/ b demo
/ .setup.sh
582 mv demo
/ demo.py demo
/ demo.pyw
585 # Make an app bundle to run the demo
586 $PYTHONW $PROGDIR / ..
/ buildapp.py \
587 --builddir = $DMGAPPS \
588 --name = "wxPython Demo" \
589 --mainprogram = $DMGAPPS / Samples
/ demo
/ demo.pyw \
590 --iconfile = $PROGDIR / RunDemo.icns \
592 cp -pR $DMGAPPS / Samples
/ demo
/* " $DMGAPPS /wxPython Demo.app/Contents/Resources"
596 # Make an app bundle to launch PyCrust
597 $PYTHONW $PROGDIR / ..
/ buildapp.py \
598 --builddir = $DMGAPPS \
600 --mainprogram = $INSTALLROOT$BINPREFIX / pycrust.py \
601 --iconfile = $PROGDIR / PieShell.icns \
604 ## TODO: PyAlaMode needs tweaked to be able to run from a bundle. It
605 ## needs to know to ignore command line parameters and etc...
607 # $PYTHONW $PROGDIR/../buildapp.py \
608 # --builddir=$DMGAPPS \
610 # --mainprogram=$INSTALLROOT$BINPREFIX/pyalamode.py \
611 # --iconfile=$PROGDIR/PieShell.icns \
614 # Make an app to launch XRCed
615 $PYTHONW $PROGDIR / ..
/ buildapp.py \
616 --builddir = $DMGAPPS \
618 --mainprogram = $INSTALLROOT$BINPREFIX / xrced.py \
619 --iconfile = $PROGDIR / XRCed.icns \
624 # and then finally make a disk image containing everything
625 dmgname
= wxPython
${SHORTVER} -osx-docs-demos- $VERSION - $TAG -py $PYVER
626 $PROGDIR / ..
/ makedmg
$DMGAPPS $DMGDIR $dmgname
628 echo Moving
$DMGDIR / $dmgname .dmg to
$DESTDIR
629 mv $DMGDIR / $dmgname .dmg
$DESTDIR
633 # Cleanup build/install dirs
634 if [ $skipclean != yes ]; then
635 echo "Cleaning up..."
638 echo "Cleanup is disabled. You should remove $TMPDIR when finished"