]>
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 root...
222 if [ " $UID " = "0" ]; then
224 su robind
-c "make lib/libwx_macd-2.5.3.r"
228 make -C contrib
/ src
/ gizmos
229 make -C contrib
/ src
/ ogl CXXFLAGS
= "-DwxUSE_DEPRECATED=0"
230 make -C contrib
/ src
/ stc
235 UNICODE
= $PYUNICODEOPT \
238 WX_CONFIG
= " $WXBLD /wx-config --inplace" \
239 BUILD_BASE
= $WXBLD / wxPython \
243 #----------------------------------------------------------------------
245 if [ $skipinstall != yes ]; then
248 make prefix
= $INSTALLROOT$PREFIX install
249 make -C contrib
/ src
/ gizmos prefix
= $INSTALLROOT$PREFIX install
250 make -C contrib
/ src
/ ogl CXXFLAGS
= "-DwxUSE_DEPRECATED=0" prefix
= $INSTALLROOT / $PREFIX install
251 make -C contrib
/ src
/ stc prefix
= $INSTALLROOT$PREFIX install
254 # relink wx-config with a relative link
255 cd $INSTALLROOT$PREFIX / bin
257 ln -s ..
/ lib
/ wx
/ config
/* wx
-config
262 UNICODE
= $PYUNICODEOPT \
265 WX_CONFIG
= " $INSTALLROOT / $PREFIX /bin/wx-config --prefix= $INSTALLROOT / $PREFIX " \
266 BUILD_BASE
= $WXBLD / wxPython \
271 # Apple's Python (on Panther) sym-links the site-packages dir to
272 # /Library/Python/$PYVER so we need to move the files so they are
273 # installed in the physical location, not the virtual one.
274 if [ " $KIND " = "panther" ]; then
275 if [ -e $INSTALLROOT / Library
/ Python
/ $PYVER ]; then
276 rm -r $INSTALLROOT / Library
/ Python
/ $PYVER
278 mkdir -p $INSTALLROOT / Library
/ Python
/ $PYVER
279 mv $INSTALLROOT / $SITEPACKAGES /* $INSTALLROOT / Library
/ Python
/ $PYVER
280 rm -r $INSTALLROOT / System
281 SITEPACKAGES
=/ Library
/ Python
/ $PYVER
284 # move the common files to $INSTALLCOMMON
285 mkdir -p $INSTALLCOMMON$SITEPACKAGES
286 mv $INSTALLROOT$SITEPACKAGES / wx.pth
$INSTALLCOMMON$SITEPACKAGES
287 mv $INSTALLROOT$SITEPACKAGES / wxversion.py
$INSTALLCOMMON$SITEPACKAGES
289 # install wxPython's tool scripts in COMMON too
290 mkdir -p $INSTALLCOMMON$BINPREFIX
291 cd $WXDIR / wxPython
/ scripts
292 python
$PYVER CreateMacScripts.py
$INSTALLCOMMON $BINPREFIX
295 # Remove the .pyc/.pyo files they just take up space and can be recreated
296 # during the install.
297 pushd $WXDIR / wxPython
298 $PYTHON $PROGDIR / ..
/ zappycfiles.py
$INSTALLROOT > / dev
/ null
301 # Set premissions for files in $INSTALLROOT and $INSTALLCOMMON
302 if [ " $UID " = "0" ]; then
303 chown
-R root
: admin
$INSTALLROOT $INSTALLCOMMON
304 chmod -R g
+ w
$INSTALLROOT $INSTALLCOMMON
308 if [ " $KIND " = "panther" ]; then
309 SITEPACKAGES
=/ Library
/ Python
/ $PYVER
311 PKGDIR
= `cat $INSTALLCOMMON $SITEPACKAGES /wx.pth`
315 #----------------------------------------------------------------------
317 # Make the Installer packages and disk image
318 if [ $skipdmg != yes ]; then
320 #-----------------------------------------------
321 # The main runtime installer package
323 # Make the welcome message
325 panther
) W_MSG
= "the Panther (OS X 10.3.x) version of" ;;
326 jaguar
) W_MSG
= "the Jaguar (OS X 10.2.x) version of" ;;
330 cat > $RESOURCEDIR / Welcome.txt
<<EOF
333 This Installer package will install the wxPython $CHARTYPE runtime $VERSION for $W_MSG MacPython-OSX $PYVER . This includes:
335 * The wxPython packages and modules
336 * The wxWidgets shared libraries and headers
338 You must install onto your current boot disk, eventhough the installer does not enforce this, otherwise things will not work.
340 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.
345 # make the preflight script
346 cat > $RESOURCEDIR / preflight
<<EOF
348 # Cleanup any old install of the wxPython package
349 rm -rf \ $2 $SITEPACKAGES /wxPython
350 rm -rf \ $2 $SITEPACKAGES /wx
351 rm -rf \ $2 $SITEPACKAGES / $PKGDIR
354 chmod + x
$RESOURCEDIR / preflight
356 # make the postflight script
357 cat > $RESOURCEDIR / postflight
<<EOF
359 # Compile the .py files in the wxPython pacakge
360 $PYTHON \ $2 $PYLIB /compileall.py \ $2 $SITEPACKAGES / $PKGDIR
361 $PYTHON -O \ $2 $PYLIB /compileall.py \ $2 $SITEPACKAGES / $PKGDIR
363 # and all of the wxPython pacakge should be group writable
364 chgrp -R admin \ $2 $SITEPACKAGES / $PKGDIR
365 chmod -R g+w \ $2 $SITEPACKAGES / $PKGDIR
369 chmod + x
$RESOURCEDIR / postflight
373 # Build the main Installer Package...
374 rm -rf wxPython
${SHORTVER} -osx- $CHARTYPE - $KIND .pkg
375 python
$PROGDIR / ..
/ buildpkg.py \
376 --Title = wxPython
${SHORTVER} -osx- $CHARTYPE - $KIND \
378 --Description = "wxPython $CHARTYPE runtime $VERSION for $W_MSG MacPython-OSX $PYVER " \
379 --NeedsAuthorization = "YES" \
381 --InstallOnly = "YES" \
385 mv wxPython
${SHORTVER} -osx- $CHARTYPE - $KIND .pkg
$DMGROOT
387 rm $RESOURCEDIR / postflight
388 rm $RESOURCEDIR / preflight
389 rm $RESOURCEDIR / Welcome.txt
392 #-----------------------------------------------
393 # The common files package
395 # Make the welcome message
396 cat > $RESOURCEDIR / Welcome.txt
<<EOF
399 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.
403 # Build the common Installer Package...
404 rm -rf wxPython
-common-osx- $KIND .pkg
405 python
$PROGDIR / ..
/ buildpkg.py \
406 --Title = wxPython
-common-osx- $KIND \
408 --Description = "Common files for the wxPython runtime ( $CHARTYPE - $VERSION )" \
409 --NeedsAuthorization = "YES" \
411 --InstallOnly = "YES" \
415 mv wxPython
-common-osx- $KIND .pkg
$DMGROOT
417 rm $RESOURCEDIR / Welcome.txt
421 #-----------------------------------------------
422 # Make a README to go on the disk image
423 cat > " $DMGROOT /README 1st.txt" <<EOF
426 This disk image contains the following items:
428 wxPython ${SHORTVER} -osx- $CHARTYPE - $VERSION - $KIND
430 This is the main component of the wxPython runtime. It
431 includes the Python modules and extension modules, as well as
432 the wxWidgets libraries. It is possible to have more than one
433 version of the runtime installed at once if you wish, See
434 http://wkik.wxpython.org/index.cgi/MultiVersionInstalls
435 for details on how to choose which version is installed.
438 wxPython-common-osx- $CHARTYPE - $VERSION - $KIND
440 This is the common files for the runtime that are shared
441 between all versions of the runtime. You need to have one of
442 these installed and it will determine which of the runtimes is
443 the default one that is imported with "import wx", so it
444 should match the version and character type of one of the
445 installed runtimes. If you are wanting to have only one
446 wxPython installed then be sure to install both of the
447 packages in this disk image.
449 uninstall_wxPython.py
451 A simple tool to help you manage your installed versions of
452 wxPython. It will allow you to choose from the currently
453 installed wxPython packages and to select one for
454 uninstallation. It is a text-mode tool so you can either run
455 it from a Terminal command line, or you can open it with
456 PythonLauncher and let it create a Terminal to run it in.
462 cp $PROGDIR / ..
/ uninstall_wxPython.py
$DMGROOT
465 #-----------------------------------------------
466 # Make a disk image to hold these files
467 dmgname
= wxPython
${SHORTVER} -osx- $CHARTYPE - $VERSION - $KIND -py $PYVER
468 $PROGDIR / ..
/ makedmg
$DMGROOT $DMGDIR $dmgname
470 echo Moving
$DMGDIR / $dmgname .dmg to
$DESTDIR
471 mv $DMGDIR / $dmgname .dmg
$DESTDIR
474 #---------------------------------------------------------------------------
475 # Now create app bundles for the demo, docs, and tools and make another
476 # disk image to hold it all.
477 #---------------------------------------------------------------------------
479 cat > " $DMGAPPS /README 1st.txt" <<EOF
482 On this disk image you will find Demo, Tools, Docs, and etc. for
483 wxPython $VERSION . Everything here is optional and you can drag them
484 out of the disk image and drop them wherever you want. You will need
485 to have an installed wxPython runtime to be able to use any of them.
488 wxPython Demo An application bundle version of the demo.
489 (This has it's own copy of the demo sources
492 XRCed An application for editing wxPython resource
495 PyCrust An application that provides an interactive
496 Python shell and also namespace inspectors.
500 Docs/wxDocsViewer An application that allows you to view the
501 wxWidgets documentation.
503 Docs/licence License files.
505 Docs/other A few readmes, change log, etc.
508 Samples/samples Several small sample applications that
509 demonstrate how to use wxPython.
511 Samples/demo A copy of the wxPython demo source code,
512 just open the folder and run demo.pyw.
517 # PyAlaMode An extension of PyCrust that includes source
518 # file editing capabilities.
522 if [ ! -e $TARBALLDIR / wxPython
-docs- $VERSION .
tar .gz
]; then
523 cat > " $DMGAPPS /Docs/Build ERROR.txt" <<EOF
525 The wxPython-docs tarball was not found when building this disk image!
531 tar xzvf
$TARBALLDIR / wxPython
-docs- $VERSION .
tar .gz
534 # Make an app to launch viewdocs.py
535 $PYTHONW $PROGDIR / ..
/ buildapp.py \
536 --builddir = $DMGAPPS / Docs \
537 --name = wxDocsViewer \
538 --mainprogram = $BUILDROOT / wxPython
- $VERSION / docs
/ viewdocs.py \
539 --iconfile = $PROGDIR / Info.icns \
542 cp $BUILDROOT / wxPython
- $VERSION / docs
/* .
zip $DMGAPPS / Docs
/ wxDocsViewer.app
/ Contents
/ Resources
544 cat > " $DMGAPPS /Docs/README 1st.txt" <<EOF
546 The wxDocsViewer application needs to be copied to your Desktop (or
547 someplace else you have write access to) before you can run it, so it
548 can cache some indexes within its bundle.
554 # license files, docs, etc.
556 cp -pR $SRCROOT / wxPython
/ licence .
557 cp -pR $SRCROOT / wxPython
/ docs .
564 if [ ! -e $TARBALLDIR / wxPython
-demo- $VERSION .
tar .gz
]; then
565 cat > " $DMGAPPS /Samples/Build ERROR.txt" <<EOF
567 The wxPython-demo tarball was not found when building this disk image!
570 cp " $DMGAPPS /Samples/Build ERROR.txt" $DMGAPPS
574 # Copy the demo and samples to the disk image from the tarball
575 pushd $DMGAPPS / Samples
576 tar xzvf
$TARBALLDIR / wxPython
-demo- $VERSION .
tar .gz
577 mv wxPython
- $VERSION /* .
578 rm -rf wxPython
- $VERSION
579 rm demo
/ b demo
/ .setup.sh
580 mv demo
/ demo.py demo
/ demo.pyw
583 # Make an app bundle to run the demo
584 $PYTHONW $PROGDIR / ..
/ buildapp.py \
585 --builddir = $DMGAPPS \
586 --name = "wxPython Demo" \
587 --mainprogram = $DMGAPPS / Samples
/ demo
/ demo.pyw \
588 --iconfile = $PROGDIR / RunDemo.icns \
590 cp -pR $DMGAPPS / Samples
/ demo
/* " $DMGAPPS /wxPython Demo.app/Contents/Resources"
594 # Make an app bundle to launch PyCrust
595 $PYTHONW $PROGDIR / ..
/ buildapp.py \
596 --builddir = $DMGAPPS \
598 --mainprogram = $INSTALLCOMMON$BINPREFIX / pycrust.py \
599 --iconfile = $PROGDIR / PieShell.icns \
603 # $PYTHONW $PROGDIR/../buildapp.py \
604 # --builddir=$DMGAPPS \
606 # --mainprogram=$INSTALLCOMMON$BINPREFIX/pyalamode.py \
607 # --iconfile=$PROGDIR/PieShell.icns \
610 # Make an app to launch XRCed
611 $PYTHONW $PROGDIR / ..
/ buildapp.py \
612 --builddir = $DMGAPPS \
614 --mainprogram = $INSTALLCOMMON$BINPREFIX / xrced.py \
615 --iconfile = $PROGDIR / XRCed.icns \
620 # and then finally make a disk image containing everything
621 dmgname
= wxPython
${SHORTVER} -osx-docs-demos- $VERSION
622 $PROGDIR / ..
/ makedmg
$DMGAPPS $DMGDIR $dmgname
624 echo Moving
$DMGDIR / $dmgname .dmg to
$DESTDIR
625 mv $DMGDIR / $dmgname .dmg
$DESTDIR
629 # Cleanup build/install dirs
630 if [ $skipclean != yes ]; then
631 echo "Cleaning up..."
634 echo "Cleanup is disabled. You should remove $TMPDIR when finished"