]>
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.
6 spectemplate
= distrib
/ wxPythonFull.spec.
in
8 if [ ! -d wxPython
-o ! -e ${spectemplate} ]; then
9 echo "Please run this script from the root wxPython directory."
13 if [ " $UID " != "0" ]; then
14 echo "-------------------------------------------------------"
15 echo " WARNING: I will be unable to change ownership of files"
16 echo " unless this script is run as root or via sudo"
17 echo "-------------------------------------------------------"
20 #----------------------------------------------------------------------
25 echo "Usage: $0 PYVER [jaguar|panther] [command flags...]"
27 echo " PYVER Python version to use to do the build"
29 echo " panther Build for Apple's python in /usr/bin, such as on Panther"
30 echo " jaguar Build for a python in /usr/local/bin, such as on Jaguar"
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 " unicode Make a unicode build"
37 echo " skipconfig Don't run configure"
38 echo " skipbuild Don't build wxWidgets or wxPython"
39 echo " skipinstall Don't do the installation step"
40 echo " skipdmg Don't make the package or diskimage"
41 echo " skipclean Don't do the cleanup at the end"
52 if which python
$PYVER && which pythonw
$PYVER ; then
53 PYTHON
= `which python $PYVER `
54 PYTHONW
= `which pythonw $PYVER `
62 panther
) TAG
= macosx10.3
;;
63 jaguar
) TAG
= macosx10.2
;;
80 skiptar
) skiptar
= yes ;;
81 skipconfig
) skipconfig
= yes ; skiptar
= yes ;;
82 skipbuild
) skipbuild
= yes ; skipconfig
= yes ; skiptar
= yes ;;
83 skipinstall
) skipinstall
= yes ;;
84 skipdmg
) skipdmg
= yes ;;
85 skipclean
) skipclean
= yes ;;
86 inplace
) inplace
= yes ; skiptar
= yes ;;
87 unicode
) unicode
= yes ;;
89 *) echo "Unknown flag \" ${flag} \" "
96 VERSION
= ` $PYTHON -c "import setup;print setup.VERSION"`
97 SHORTVER
= `echo $VERSION | cut -c 1,2,3`
98 PYPREFIX
= ` $PYTHON -c "import sys; print sys.exec_prefix"`
99 PYLIB
= $PYPREFIX / lib
/ python
$PYVER
100 SITEPACKAGES
= $PYLIB / site
-packages
102 if [ $unicode == yes ]; then
104 UNICODEOPT
= --enable-unicode
108 UNICODEOPT
= --disable-unicode
113 # Test if the python we are using is the System installed framework
114 # or one that was installed by the user. This changes where the
115 # site-packages (or its alias) is located in the installer tree.
117 if [ -e / Library
/ Python
/ $PYVER ] && [ `dirname $PYTHON ` == "/usr/bin" ]; then
123 if [ -z " $TARBALLDIR " ]; then
124 # this is a spot on my fileserver where the tarballs go, adjust
125 # as needed for where you put the wxPython tarball, or set
126 # TARBALLDIR before invoking this script...
127 TARBALLDIR
=/ stuff
/ Development
/ wxPython
/ dist
/ $VERSION
129 TARBALL
= $TARBALLDIR / wxPython
-src- $VERSION .
tar .gz
131 if [ ! -e $TARBALLDIR / wxPython
-demo- $VERSION .
tar .gz
]; then
132 echo "-------------------------------------------------------"
133 echo " WARNING: Demo tarball not found, will skip building "
134 echo " the Demo app bundle and etc."
135 echo " $TARBALLDIR /wxPython-demo- $VERSION .tar.gz"
136 echo "-------------------------------------------------------"
139 if [ ! -e $TARBALLDIR / wxPython
-docs- $VERSION .
tar .gz
]; then
140 echo "-------------------------------------------------------"
141 echo " WARNING: Docs tarball not found, will skip building "
142 echo " the the wxDocsViewer app bundle and etc."
143 echo " $TARBALLDIR /wxPython-docs- $VERSION .tar.gz"
144 echo "-------------------------------------------------------"
150 PREFIX
=/ usr
/ local
/ lib
/ wxPython
- $CHARTYPE - $VERSION
151 BINPREFIX
=/ usr
/ local
/ bin
153 WXROOT
= `dirname $PWD `
154 PROGDIR
= "`dirname \" $0 \" `"
155 TMPDIR
= $PWD / _build_dmg
157 BUILDROOT
= $TMPDIR / build
159 INSTALLROOT
= $TMPDIR / install -root
160 INSTALLAPPS
= $TMPDIR / install -apps
166 RESOURCEDIR
= $PROGDIR / resources
168 SRCROOT
= $BUILDROOT / wxPython
-src- $VERSION
171 #----------------------------------------------------------------------
175 mkdir -p $INSTALLROOT
176 mkdir -p $INSTALLAPPS
180 mkdir -p $DMGAPPS / Docs
181 mkdir -p $DMGAPPS / Samples
187 #----------------------------------------------------------------------
190 if [ $skiptar != yes ]; then
191 echo Unarchiving tarball...
195 if [ $inplace = no
]; then
196 # make a build dir and cd to it.
197 cd wxPython
-src- $VERSION
204 # If building "inplace" then our build dir will be off of the
205 # WXROOT like normal, adjust the variables to find things that
207 WXBLD
= $WXROOT / build
- $CHARTYPE
214 echo "Using wx root dir: $WXROOT "
215 echo "Using build dir: $WXBLD "
216 echo "Using source tree: $WXDIR "
218 #----------------------------------------------------------------------
220 if [ $KIND = panther
]; then
221 OTHER_CFG_OPTS
= --enable-mediactrl
224 # Configure wxWidgets
225 if [ $skipconfig != yes ]; then
229 --enable-monolithic \
234 --enable-debug_flag \
235 --enable-precomp = no \
237 --disable-debugreport \
238 $UNICODEOPT $OTHER_CFG_OPTS
242 # Build wxWidgets and wxPython
243 if [ $skipbuild != yes ]; then
245 # Make wxWidgets and some contribs
247 # For some reason Rez and DeRez have started locking up if run via
248 # an ssh terminal. Figure out why, but in the meantime...
249 if [ " $CHARTYPE " = "ansi" ]; then
250 echo cp / projects
/ wx2.5
/ bld
/ lib
/ libwx_macd
-2 .5.?.r
* lib
251 cp / projects
/ wx2.5
/ bld
/ lib
/ libwx_macd
-2 .5.?.r
* lib
253 echo cp / projects
/ wx2.5
/ bld
-unicode / lib
/ libwx_macud
-2 .5.?.r
* lib
254 cp / projects
/ wx2.5
/ bld
-unicode / lib
/ libwx_macud
-2 .5.?.r
* lib
259 make $MAKEJOBS -C contrib
/ src
/ gizmos
260 make $MAKEJOBS -C contrib
/ src
/ ogl CXXFLAGS
= "-DwxUSE_DEPRECATED=0"
261 make $MAKEJOBS -C contrib
/ src
/ stc
266 UNICODE
= $PYUNICODEOPT \
269 WX_CONFIG
= " $WXBLD /wx-config --inplace" \
270 BUILD_BASE
= $WXBLD / wxPython \
274 #----------------------------------------------------------------------
276 if [ $skipinstall != yes ]; then
279 make prefix
= $INSTALLROOT$PREFIX install
280 make -C contrib
/ src
/ gizmos prefix
= $INSTALLROOT$PREFIX install
281 make -C contrib
/ src
/ ogl CXXFLAGS
= "-DwxUSE_DEPRECATED=0" prefix
= $INSTALLROOT / $PREFIX install
282 make -C contrib
/ src
/ stc prefix
= $INSTALLROOT$PREFIX install
285 # relink wx-config with a relative link
286 cd $INSTALLROOT$PREFIX / bin
288 ln -s ..
/ lib
/ wx
/ config
/* wx
-config
293 UNICODE
= $PYUNICODEOPT \
296 WX_CONFIG
= " $INSTALLROOT / $PREFIX /bin/wx-config --prefix= $INSTALLROOT / $PREFIX " \
297 BUILD_BASE
= $WXBLD / wxPython \
302 # Apple's Python Framework (such as what comes with Panther)
303 # sym-links the site-packages dir in the framework to
304 # /Library/Python/$PYVER so we need to move the files so they are
305 # installed in the physical location, not the virtual one.
306 if [ $APPLE_PYTHON == yes ]; then
307 if [ -e $INSTALLROOT / Library
/ Python
/ $PYVER ]; then
308 rm -r $INSTALLROOT / Library
/ Python
/ $PYVER
310 mkdir -p $INSTALLROOT / Library
/ Python
/ $PYVER
311 mv $INSTALLROOT / $SITEPACKAGES /* $INSTALLROOT / Library
/ Python
/ $PYVER
312 rm -r $INSTALLROOT / System
313 SITEPACKAGES
=/ Library
/ Python
/ $PYVER
316 # install wxPython's tool scripts
317 mkdir -p $INSTALLROOT$BINPREFIX
318 cd $WXROOT / wxPython
/ scripts
319 python
$PYVER CreateMacScripts.py
$INSTALLROOT $BINPREFIX
322 # Remove the .pyc/.pyo files they just take up space and can be recreated
323 # during the install.
324 pushd $WXROOT / wxPython
325 $PYTHON $PROGDIR / ..
/ zappycfiles.py
$INSTALLROOT > / dev
/ null
328 # Set premissions for files in $INSTALLROOT
329 if [ " $UID " = "0" ]; then
330 chown
-R root
: admin
$INSTALLROOT
331 chmod -R g
+ w
$INSTALLROOT
335 if [ $APPLE_PYTHON == yes ]; then
336 SITEPACKAGES
=/ Library
/ Python
/ $PYVER
338 PKGDIR
= `cat $INSTALLROOT $SITEPACKAGES /wx.pth`
342 #----------------------------------------------------------------------
344 # Make the Installer packages and disk image
345 if [ $skipdmg != yes ]; then
347 #-----------------------------------------------
348 # The main runtime installer package
350 # Make the welcome message
352 panther
) W_MSG
= "the Panther (OS X 10.3.x) version of" ;;
353 jaguar
) W_MSG
= "the Jaguar (OS X 10.2.x) version of" ;;
357 cat > $RESOURCEDIR / Welcome.txt
<<EOF
360 This Installer package will install the wxPython $CHARTYPE runtime $VERSION for $W_MSG MacPython-OSX $PYVER . This includes:
362 * The wxPython packages and modules
363 * The wxWidgets shared libraries and headers
364 * Some command line tool scripts, installed to /usr/local/bin.
366 You must install onto your current boot disk, eventhough the installer does not enforce this, otherwise things will not work.
368 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.
373 # make the preflight script
374 cat > $RESOURCEDIR / preflight
<<EOF
376 # Cleanup any old install of the wxPython package
377 rm -rf \ $2 $SITEPACKAGES /wxPython
378 rm -rf \ $2 $SITEPACKAGES /wx
379 rm -rf \ $2 $SITEPACKAGES / $PKGDIR
382 chmod + x
$RESOURCEDIR / preflight
384 # make the postflight script
385 cat > $RESOURCEDIR / postflight
<<EOF
387 # Compile the .py files in the wxPython pacakge
388 $PYTHON \ $2 $PYLIB /compileall.py \ $2 $SITEPACKAGES / $PKGDIR
389 $PYTHON -O \ $2 $PYLIB /compileall.py \ $2 $SITEPACKAGES / $PKGDIR
391 # and all of the wxPython pacakge should be group writable
392 chgrp -R admin \ $2 $SITEPACKAGES / $PKGDIR
393 chmod -R g+w \ $2 $SITEPACKAGES / $PKGDIR
397 chmod + x
$RESOURCEDIR / postflight
401 # Build the main Installer Package...
402 rm -rf wxPython
${SHORTVER} -osx- $CHARTYPE - $KIND .pkg
403 python
$PROGDIR / ..
/ buildpkg.py \
404 --Title = wxPython
${SHORTVER} -osx- $CHARTYPE - $KIND \
406 --Description = "wxPython $CHARTYPE runtime $VERSION for $W_MSG MacPython-OSX $PYVER " \
407 --NeedsAuthorization = "YES" \
409 --InstallOnly = "YES" \
413 mv wxPython
${SHORTVER} -osx- $CHARTYPE - $KIND .pkg
$DMGROOT
415 rm $RESOURCEDIR / postflight
416 rm $RESOURCEDIR / preflight
417 rm $RESOURCEDIR / Welcome.txt
420 #-----------------------------------------------
421 # Make a README to go on the disk image
422 cat > " $DMGROOT /README 1st.txt" <<EOF
425 This disk image contains the following items:
427 wxPython ${SHORTVER} -osx- $CHARTYPE - $VERSION - $KIND
429 This Installer contains the wxPython runtime, compiled on a
430 $KIND OS X system, using the $CHARTYPE build of the wxWidgets
431 library. It includes the Python modules and extension
432 modules, as well as the wxWidgets libraries.
434 It is possible to have more than one version of the runtime
435 installed at once if you wish. The most recently installed
436 version will be the default wxPython, but you can choose
437 another by setting the PYTHONPATH or by using the wxversion
438 module. For more details see:
439 http://wiki.wxpython.org/index.cgi/MultiVersionInstalls
442 uninstall_wxPython.py
444 A simple tool to help you manage your installed versions of
445 wxPython. It will allow you to choose from the currently
446 installed wxPython packages and to select one for
447 uninstallation. It is a text-mode tool so you can either run
448 it from a Terminal command line, or you can open it with
449 PythonLauncher and let it create a Terminal to run it in.
451 NOTE: If you have versions prior to 2.5.3.1 installed, please
452 do run this uninstall tool to remove the older version.
458 cp $PROGDIR / ..
/ uninstall_wxPython.py
$DMGROOT
461 #-----------------------------------------------
462 # Make a disk image to hold these files
463 dmgname
= wxPython
${SHORTVER} -osx- $CHARTYPE - $VERSION - $TAG -py $PYVER
464 $PROGDIR / ..
/ makedmg
$DMGROOT $DMGDIR $dmgname
466 echo Moving
$DMGDIR / $dmgname .dmg to
$DESTDIR
467 mv $DMGDIR / $dmgname .dmg
$DESTDIR
470 #---------------------------------------------------------------------------
471 # Now create app bundles for the demo, docs, and tools and make another
472 # disk image to hold it all.
473 #---------------------------------------------------------------------------
475 cat > " $DMGAPPS /README 1st.txt" <<EOF
478 On this disk image you will find Demo, Tools, Docs, and etc. for
479 wxPython $VERSION . Everything here is optional and you can drag them
480 out of the disk image and drop them wherever you want. You will need
481 to have an installed wxPython runtime to be able to use any of them.
484 wxPython Demo An application bundle version of the demo.
485 (This has it's own copy of the demo sources
488 XRCed An application for editing wxPython resource
491 PyCrust An application that provides an interactive
492 Python shell and also namespace inspectors.
496 Docs/wxDocsViewer An application that allows you to view the
497 wxWidgets documentation.
499 Docs/licence License files.
501 Docs/other A few readmes, change log, etc.
504 Samples/samples Several small sample applications that
505 demonstrate how to use wxPython.
507 Samples/demo A copy of the wxPython demo source code,
508 just open the folder and run demo.pyw.
513 # PyAlaMode An extension of PyCrust that includes source
514 # file editing capabilities.
518 if [ ! -e $TARBALLDIR / wxPython
-docs- $VERSION .
tar .gz
]; then
519 cat > " $DMGAPPS /Docs/Build ERROR.txt" <<EOF
521 The wxPython-docs tarball was not found when building this disk image!
527 tar xzvf
$TARBALLDIR / wxPython
-docs- $VERSION .
tar .gz
530 # Make an app to launch viewdocs.py
531 $PYTHONW $PROGDIR / ..
/ buildapp.py \
532 --builddir = $DMGAPPS / Docs \
533 --name = wxDocsViewer \
534 --mainprogram = $BUILDROOT / wxPython
- $VERSION / docs
/ viewdocs.py \
535 --iconfile = $PROGDIR / Info.icns \
538 cp $BUILDROOT / wxPython
- $VERSION / docs
/* .
zip $DMGAPPS / Docs
/ wxDocsViewer.app
/ Contents
/ Resources
540 cat > " $DMGAPPS /Docs/README 1st.txt" <<EOF
542 The wxDocsViewer application needs to be copied to your Desktop (or
543 someplace else you have write access to) before you can run it, so it
544 can cache some indexes within its bundle.
550 # license files, docs, etc.
552 cp -pR $SRCROOT / wxPython
/ licence .
553 cp -pR $SRCROOT / wxPython
/ docs .
560 if [ ! -e $TARBALLDIR / wxPython
-demo- $VERSION .
tar .gz
]; then
561 cat > " $DMGAPPS /Samples/Build ERROR.txt" <<EOF
563 The wxPython-demo tarball was not found when building this disk image!
566 cp " $DMGAPPS /Samples/Build ERROR.txt" $DMGAPPS
570 # Copy the demo and samples to the disk image from the tarball
571 pushd $DMGAPPS / Samples
572 tar xzvf
$TARBALLDIR / wxPython
-demo- $VERSION .
tar .gz
573 mv wxPython
- $VERSION /* .
574 rm -rf wxPython
- $VERSION
575 rm demo
/ b demo
/ .setup.sh
576 mv demo
/ demo.py demo
/ demo.pyw
579 # Make an app bundle to run the demo
580 $PYTHONW $PROGDIR / ..
/ buildapp.py \
581 --builddir = $DMGAPPS \
582 --name = "wxPython Demo" \
583 --mainprogram = $DMGAPPS / Samples
/ demo
/ demo.pyw \
584 --iconfile = $PROGDIR / RunDemo.icns \
586 cp -pR $DMGAPPS / Samples
/ demo
/* " $DMGAPPS /wxPython Demo.app/Contents/Resources"
590 # Make an app bundle to launch PyCrust
591 $PYTHONW $PROGDIR / ..
/ buildapp.py \
592 --builddir = $DMGAPPS \
594 --mainprogram = $INSTALLROOT$BINPREFIX / pycrust.py \
595 --iconfile = $PROGDIR / PieShell.icns \
598 ## TODO: PyAlaMode needs tweaked to be able to run from a bundle. It
599 ## needs to know to ignore command line parameters and etc...
601 # $PYTHONW $PROGDIR/../buildapp.py \
602 # --builddir=$DMGAPPS \
604 # --mainprogram=$INSTALLROOT$BINPREFIX/pyalamode.py \
605 # --iconfile=$PROGDIR/PieShell.icns \
608 # Make an app to launch XRCed
609 $PYTHONW $PROGDIR / ..
/ buildapp.py \
610 --builddir = $DMGAPPS \
612 --mainprogram = $INSTALLROOT$BINPREFIX / xrced.py \
613 --iconfile = $PROGDIR / XRCed.icns \
618 # and then finally make a disk image containing everything
619 dmgname
= wxPython
${SHORTVER} -osx-docs-demos- $VERSION - $TAG
620 $PROGDIR / ..
/ makedmg
$DMGAPPS $DMGDIR $dmgname
622 echo Moving
$DMGDIR / $dmgname .dmg to
$DESTDIR
623 mv $DMGDIR / $dmgname .dmg
$DESTDIR
627 # Cleanup build/install dirs
628 if [ $skipclean != yes ]; then
629 echo "Cleaning up..."
632 echo "Cleanup is disabled. You should remove $TMPDIR when finished"