]>
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: 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 [panther|jaguar] [command flags...]"
27 echo " panther Build for Apple's python in /usr/bin, such as on Panther"
28 echo " jaguar Build for a python in /usr/local/bin, such as on Jaguar"
30 echo "optional command flags:"
31 echo " skiptar Don't unpack the tarball"
32 echo " inplace Don't use the tarball, build from the CVS tree instead"
33 echo " (The Docs and Demo tarballs are still required for a full build.)"
34 echo " unicode Make a unicode build"
35 echo " skipconfig Don't run configure"
36 echo " skipbuild Don't build wxWidgets or wxPython"
37 echo " skipinstall Don't do the installation step"
38 echo " skipdmg Don't make the package or diskimage"
39 echo " skipclean Don't do the cleanup at the end"
51 panther
) PYTHON
=/ usr
/ bin
/ python
;;
52 jaguar
) PYTHON
=/ usr
/ local
/ bin
/ python
;;
69 skiptar
) skiptar
= yes ;;
70 skipconfig
) skipconfig
= yes ; skiptar
= yes ;;
71 skipbuild
) skipbuild
= yes ; skipconfig
= yes ; skiptar
= yes ;;
72 skipinstall
) skipinstall
= yes ;;
73 skipdmg
) skipdmg
= yes ;;
74 skipclean
) skipclean
= yes ;;
75 inplace
) inplace
= yes ; skiptar
= yes ;;
76 unicode
) unicode
= yes ;;
78 *) echo "Unknown flag \" ${flag} \" "
85 VERSION
= ` $PYTHON -c "import setup;print setup.VERSION"`
86 PYVER
= ` $PYTHON -c "import sys; print sys.version[:3]"`
87 PYPREFIX
= ` $PYTHON -c "import sys; print sys.exec_prefix"`
88 PYLIB
= $PYPREFIX / lib
/ python
$PYVER
89 SITEPACKAGES
= $PYLIB / site
-packages
90 SHORTVER
= `echo $VERSION | cut -c 1,2,3`
92 if [ $unicode == yes ]; then
94 UNICODEOPT
= --enable-unicode
98 UNICODEOPT
= --disable-unicode
103 if [ -z " $TARBALLDIR " ]; then
104 # this is a spot on my fileserver where the tarballs go, adjust
105 # as needed for where you put the wxPython tarball, or set
106 # TARBALLDIR before invoking this script...
107 TARBALLDIR
=/ stuff
/ Development
/ wxPython
/ dist
/ $VERSION
109 TARBALL
= $TARBALLDIR / wxPython
-src- $VERSION .
tar .gz
111 if [ ! -e $TARBALLDIR / wxPython
-demo- $VERSION .
tar .gz
]; then
112 echo "-------------------------------------------------------"
113 echo " WARNING: Demo tarball not found, will skip building "
114 echo " the Demo app bundle and etc."
115 echo " $TARBALLDIR /wxPython-demo- $VERSION .tar.gz"
116 echo "-------------------------------------------------------"
119 if [ ! -e $TARBALLDIR / wxPython
-docs- $VERSION .
tar .gz
]; then
120 echo "-------------------------------------------------------"
121 echo " WARNING: Docs tarball not found, will skip building "
122 echo " the the wxDocsViewer app bundle and etc."
123 echo " $TARBALLDIR /wxPython-docs- $VERSION .tar.gz"
124 echo "-------------------------------------------------------"
130 PREFIX
=/ usr
/ local
/ lib
/ wxPython
- $CHARTYPE - $VERSION
131 BINPREFIX
=/ usr
/ local
/ bin
133 WXROOT
= `dirname $PWD `
134 PROGDIR
= "`dirname \" $0 \" `"
135 TMPDIR
= $PWD / _build_dmg
137 BUILDROOT
= $TMPDIR / build
139 INSTALLROOT
= $TMPDIR / install -root
140 INSTALLCOMMON
= $TMPDIR / install -common
141 INSTALLAPPS
= $TMPDIR / install -apps
147 RESOURCEDIR
= $PROGDIR / resources
149 SRCROOT
= $BUILDROOT / wxPython
-src- $VERSION
152 #----------------------------------------------------------------------
156 mkdir -p $INSTALLROOT
157 mkdir -p $INSTALLCOMMON
158 mkdir -p $INSTALLAPPS
162 mkdir -p $DMGAPPS / Docs
163 mkdir -p $DMGAPPS / Samples
169 #----------------------------------------------------------------------
172 if [ $skiptar != yes ]; then
173 echo Unarchiving tarball...
177 if [ $inplace = no
]; then
178 # make a build dir and cd to it.
179 cd wxPython
-src- $VERSION
185 # If building "inplace" then our build dir will be BUILDROOT,
186 # adjust the variables to find things that way.
192 echo "Using source tree: $WXDIR "
193 echo "Using build dir: $WXBLD "
195 #----------------------------------------------------------------------
198 # Configure wxWidgets
199 if [ $skipconfig != yes ]; then
203 --enable-monolithic \
208 --enable-debug_flag \
209 --enable-precomp = no \
216 # Build wxWidgets and wxPython
217 if [ $skipbuild != yes ]; then
219 # Make wxWidgets and some contribs
221 # For some reason Rez and DeRez have started locking up if run as
222 # root, figure out why, but in the meantime...
223 if [ " $UID " = "0" ]; then
225 if [ " $CHARTYPE " = "ansi" ]; then
226 su robind
-c "make lib/libwx_macd-2.5.3.r"
228 su robind
-c "make lib/libwx_macud-2.5.3.r"
233 make -C contrib
/ src
/ gizmos
234 make -C contrib
/ src
/ ogl CXXFLAGS
= "-DwxUSE_DEPRECATED=0"
235 make -C contrib
/ src
/ stc
240 UNICODE
= $PYUNICODEOPT \
243 WX_CONFIG
= " $WXBLD /wx-config --inplace" \
244 BUILD_BASE
= $WXBLD / wxPython \
248 #----------------------------------------------------------------------
250 if [ $skipinstall != yes ]; then
253 make prefix
= $INSTALLROOT$PREFIX install
254 make -C contrib
/ src
/ gizmos prefix
= $INSTALLROOT$PREFIX install
255 make -C contrib
/ src
/ ogl CXXFLAGS
= "-DwxUSE_DEPRECATED=0" prefix
= $INSTALLROOT / $PREFIX install
256 make -C contrib
/ src
/ stc prefix
= $INSTALLROOT$PREFIX install
259 # relink wx-config with a relative link
260 cd $INSTALLROOT$PREFIX / bin
262 ln -s ..
/ lib
/ wx
/ config
/* wx
-config
267 UNICODE
= $PYUNICODEOPT \
270 WX_CONFIG
= " $INSTALLROOT / $PREFIX /bin/wx-config --prefix= $INSTALLROOT / $PREFIX " \
271 BUILD_BASE
= $WXBLD / wxPython \
276 # Apple's Python (on Panther) sym-links the site-packages dir to
277 # /Library/Python/$PYVER so we need to move the files so they are
278 # installed in the physical location, not the virtual one.
279 if [ " $KIND " = "panther" ]; then
280 if [ -e $INSTALLROOT / Library
/ Python
/ $PYVER ]; then
281 rm -r $INSTALLROOT / Library
/ Python
/ $PYVER
283 mkdir -p $INSTALLROOT / Library
/ Python
/ $PYVER
284 mv $INSTALLROOT / $SITEPACKAGES /* $INSTALLROOT / Library
/ Python
/ $PYVER
285 rm -r $INSTALLROOT / System
286 SITEPACKAGES
=/ Library
/ Python
/ $PYVER
289 # move the common files to $INSTALLCOMMON
290 mkdir -p $INSTALLCOMMON$SITEPACKAGES
291 mv $INSTALLROOT$SITEPACKAGES / wx.pth
$INSTALLCOMMON$SITEPACKAGES
292 mv $INSTALLROOT$SITEPACKAGES / wxversion.py
$INSTALLCOMMON$SITEPACKAGES
294 # install wxPython's tool scripts in COMMON too
295 mkdir -p $INSTALLCOMMON$BINPREFIX
296 cd $WXDIR / wxPython
/ scripts
297 python
$PYVER CreateMacScripts.py
$INSTALLCOMMON $BINPREFIX
300 # Remove the .pyc/.pyo files they just take up space and can be recreated
301 # during the install.
302 pushd $WXDIR / wxPython
303 $PYTHON $PROGDIR / ..
/ zappycfiles.py
$INSTALLROOT > / dev
/ null
306 # Set premissions for files in $INSTALLROOT and $INSTALLCOMMON
307 if [ " $UID " = "0" ]; then
308 chown
-R root
: admin
$INSTALLROOT $INSTALLCOMMON
309 chmod -R g
+ w
$INSTALLROOT $INSTALLCOMMON
313 if [ " $KIND " = "panther" ]; then
314 SITEPACKAGES
=/ Library
/ Python
/ $PYVER
316 PKGDIR
= `cat $INSTALLCOMMON $SITEPACKAGES /wx.pth`
320 #----------------------------------------------------------------------
322 # Make the Installer packages and disk image
323 if [ $skipdmg != yes ]; then
325 #-----------------------------------------------
326 # The main runtime installer package
328 # Make the welcome message
330 panther
) W_MSG
= "the Panther (OS X 10.3.x) version of" ;;
331 jaguar
) W_MSG
= "the Jaguar (OS X 10.2.x) version of" ;;
335 cat > $RESOURCEDIR / Welcome.txt
<<EOF
338 This Installer package will install the wxPython $CHARTYPE runtime $VERSION for $W_MSG MacPython-OSX $PYVER . This includes:
340 * The wxPython packages and modules
341 * The wxWidgets shared libraries and headers
343 You must install onto your current boot disk, eventhough the installer does not enforce this, otherwise things will not work.
345 You can install more than one version of the wxPython runtime if you desire. You also need to install one instance of the wxPython-common package, which will determine which of the installed runtimes will be the default.
350 # make the preflight script
351 cat > $RESOURCEDIR / preflight
<<EOF
353 # Cleanup any old install of the wxPython package
354 rm -rf \ $2 $SITEPACKAGES /wxPython
355 rm -rf \ $2 $SITEPACKAGES /wx
356 rm -rf \ $2 $SITEPACKAGES / $PKGDIR
359 chmod + x
$RESOURCEDIR / preflight
361 # make the postflight script
362 cat > $RESOURCEDIR / postflight
<<EOF
364 # Compile the .py files in the wxPython pacakge
365 $PYTHON \ $2 $PYLIB /compileall.py \ $2 $SITEPACKAGES / $PKGDIR
366 $PYTHON -O \ $2 $PYLIB /compileall.py \ $2 $SITEPACKAGES / $PKGDIR
368 # and all of the wxPython pacakge should be group writable
369 chgrp -R admin \ $2 $SITEPACKAGES / $PKGDIR
370 chmod -R g+w \ $2 $SITEPACKAGES / $PKGDIR
374 chmod + x
$RESOURCEDIR / postflight
378 # Build the main Installer Package...
379 rm -rf wxPython
${SHORTVER} -osx- $CHARTYPE - $KIND .pkg
380 python
$PROGDIR / ..
/ buildpkg.py \
381 --Title = wxPython
${SHORTVER} -osx- $CHARTYPE - $KIND \
383 --Description = "wxPython $CHARTYPE runtime $VERSION for $W_MSG MacPython-OSX $PYVER " \
384 --NeedsAuthorization = "YES" \
386 --InstallOnly = "YES" \
390 mv wxPython
${SHORTVER} -osx- $CHARTYPE - $KIND .pkg
$DMGROOT
392 rm $RESOURCEDIR / postflight
393 rm $RESOURCEDIR / preflight
394 rm $RESOURCEDIR / Welcome.txt
397 #-----------------------------------------------
398 # The common files package
400 # Make the welcome message
401 cat > $RESOURCEDIR / Welcome.txt
<<EOF
404 This package contains the common files that are shared between versions of the wxPython runtime. This includes some command line scripts installed to /usr/local/bin as well as a Python .pth file for site-packages that will determine which version of the installed runtimes is the default version.
408 # Build the common Installer Package...
409 rm -rf wxPython
-common-osx- $KIND .pkg
410 python
$PROGDIR / ..
/ buildpkg.py \
411 --Title = wxPython
-common-osx- $KIND \
413 --Description = "Common files for the wxPython runtime ( $CHARTYPE - $VERSION )" \
414 --NeedsAuthorization = "YES" \
416 --InstallOnly = "YES" \
420 mv wxPython
-common-osx- $KIND .pkg
$DMGROOT
422 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 is the main component of the wxPython runtime. It
436 includes the Python modules and extension modules, as well as
437 the wxWidgets libraries. It is possible to have more than one
438 version of the runtime installed at once if you wish, See
439 http://wkik.wxpython.org/index.cgi/MultiVersionInstalls
440 for details on how to choose which version is installed.
443 wxPython-common-osx- $CHARTYPE - $VERSION - $KIND
445 This is the common files for the runtime that are shared
446 between all versions of the runtime. You need to have one of
447 these installed and it will determine which of the runtimes is
448 the default one that is imported with "import wx", so it
449 should match the version and character type of one of the
450 installed runtimes. If you are wanting to have only one
451 wxPython installed then be sure to install both of the
452 packages in this disk image.
454 uninstall_wxPython.py
456 A simple tool to help you manage your installed versions of
457 wxPython. It will allow you to choose from the currently
458 installed wxPython packages and to select one for
459 uninstallation. It is a text-mode tool so you can either run
460 it from a Terminal command line, or you can open it with
461 PythonLauncher and let it create a Terminal to run it in.
467 cp $PROGDIR / ..
/ uninstall_wxPython.py
$DMGROOT
470 #-----------------------------------------------
471 # Make a disk image to hold these files
472 dmgname
= wxPython
${SHORTVER} -osx- $CHARTYPE - $VERSION - $KIND -py $PYVER
473 $PROGDIR / ..
/ makedmg
$DMGROOT $DMGDIR $dmgname
475 echo Moving
$DMGDIR / $dmgname .dmg to
$DESTDIR
476 mv $DMGDIR / $dmgname .dmg
$DESTDIR
479 #---------------------------------------------------------------------------
480 # Now create app bundles for the demo, docs, and tools and make another
481 # disk image to hold it all.
482 #---------------------------------------------------------------------------
484 cat > " $DMGAPPS /README 1st.txt" <<EOF
487 On this disk image you will find Demo, Tools, Docs, and etc. for
488 wxPython $VERSION . Everything here is optional and you can drag them
489 out of the disk image and drop them wherever you want. You will need
490 to have an installed wxPython runtime to be able to use any of them.
493 wxPython Demo An application bundle version of the demo.
494 (This has it's own copy of the demo sources
497 XRCed An application for editing wxPython resource
500 PyCrust An application that provides an interactive
501 Python shell and also namespace inspectors.
505 Docs/wxDocsViewer An application that allows you to view the
506 wxWidgets documentation.
508 Docs/licence License files.
510 Docs/other A few readmes, change log, etc.
513 Samples/samples Several small sample applications that
514 demonstrate how to use wxPython.
516 Samples/demo A copy of the wxPython demo source code,
517 just open the folder and run demo.pyw.
522 # PyAlaMode An extension of PyCrust that includes source
523 # file editing capabilities.
527 if [ ! -e $TARBALLDIR / wxPython
-docs- $VERSION .
tar .gz
]; then
528 cat > " $DMGAPPS /Docs/Build ERROR.txt" <<EOF
530 The wxPython-docs tarball was not found when building this disk image!
536 tar xzvf
$TARBALLDIR / wxPython
-docs- $VERSION .
tar .gz
539 # Make an app to launch viewdocs.py
540 $PYTHONW $PROGDIR / ..
/ buildapp.py \
541 --builddir = $DMGAPPS / Docs \
542 --name = wxDocsViewer \
543 --mainprogram = $BUILDROOT / wxPython
- $VERSION / docs
/ viewdocs.py \
544 --iconfile = $PROGDIR / Info.icns \
547 cp $BUILDROOT / wxPython
- $VERSION / docs
/* .
zip $DMGAPPS / Docs
/ wxDocsViewer.app
/ Contents
/ Resources
549 cat > " $DMGAPPS /Docs/README 1st.txt" <<EOF
551 The wxDocsViewer application needs to be copied to your Desktop (or
552 someplace else you have write access to) before you can run it, so it
553 can cache some indexes within its bundle.
559 # license files, docs, etc.
561 cp -pR $SRCROOT / wxPython
/ licence .
562 cp -pR $SRCROOT / wxPython
/ docs .
569 if [ ! -e $TARBALLDIR / wxPython
-demo- $VERSION .
tar .gz
]; then
570 cat > " $DMGAPPS /Samples/Build ERROR.txt" <<EOF
572 The wxPython-demo tarball was not found when building this disk image!
575 cp " $DMGAPPS /Samples/Build ERROR.txt" $DMGAPPS
579 # Copy the demo and samples to the disk image from the tarball
580 pushd $DMGAPPS / Samples
581 tar xzvf
$TARBALLDIR / wxPython
-demo- $VERSION .
tar .gz
582 mv wxPython
- $VERSION /* .
583 rm -rf wxPython
- $VERSION
584 rm demo
/ b demo
/ .setup.sh
585 mv demo
/ demo.py demo
/ demo.pyw
588 # Make an app bundle to run the demo
589 $PYTHONW $PROGDIR / ..
/ buildapp.py \
590 --builddir = $DMGAPPS \
591 --name = "wxPython Demo" \
592 --mainprogram = $DMGAPPS / Samples
/ demo
/ demo.pyw \
593 --iconfile = $PROGDIR / RunDemo.icns \
595 cp -pR $DMGAPPS / Samples
/ demo
/* " $DMGAPPS /wxPython Demo.app/Contents/Resources"
599 # Make an app bundle to launch PyCrust
600 $PYTHONW $PROGDIR / ..
/ buildapp.py \
601 --builddir = $DMGAPPS \
603 --mainprogram = $INSTALLCOMMON$BINPREFIX / pycrust.py \
604 --iconfile = $PROGDIR / PieShell.icns \
608 # $PYTHONW $PROGDIR/../buildapp.py \
609 # --builddir=$DMGAPPS \
611 # --mainprogram=$INSTALLCOMMON$BINPREFIX/pyalamode.py \
612 # --iconfile=$PROGDIR/PieShell.icns \
615 # Make an app to launch XRCed
616 $PYTHONW $PROGDIR / ..
/ buildapp.py \
617 --builddir = $DMGAPPS \
619 --mainprogram = $INSTALLCOMMON$BINPREFIX / xrced.py \
620 --iconfile = $PROGDIR / XRCed.icns \
625 # and then finally make a disk image containing everything
626 dmgname
= wxPython
${SHORTVER} -osx-docs-demos- $VERSION
627 $PROGDIR / ..
/ makedmg
$DMGAPPS $DMGDIR $dmgname
629 echo Moving
$DMGDIR / $dmgname .dmg to
$DESTDIR
630 mv $DMGDIR / $dmgname .dmg
$DESTDIR
634 # Cleanup build/install dirs
635 if [ $skipclean != yes ]; then
636 echo "Cleaning up..."
639 echo "Cleanup is disabled. You should remove $TMPDIR when finished"