]>
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
102 if [ " $HOSTNAME " = "bigmac.alldunn.com" ]; then
106 if [ -z " $TARBALLDIR " ]; then
107 # this is a spot on my fileserver where the tarballs go, adjust
108 # as needed for where you put the wxPython tarball, or set
109 # TARBALLDIR before invoking this script...
110 TARBALLDIR
=/ stuff
/ Development
/ wxPython
/ dist
/ $VERSION
112 TARBALL
= $TARBALLDIR / wxPython
-src- $VERSION .
tar .gz
114 if [ ! -e $TARBALLDIR / wxPython
-demo- $VERSION .
tar .gz
]; then
115 echo "-------------------------------------------------------"
116 echo " WARNING: Demo tarball not found, will skip building "
117 echo " the Demo app bundle and etc."
118 echo " $TARBALLDIR /wxPython-demo- $VERSION .tar.gz"
119 echo "-------------------------------------------------------"
122 if [ ! -e $TARBALLDIR / wxPython
-docs- $VERSION .
tar .gz
]; then
123 echo "-------------------------------------------------------"
124 echo " WARNING: Docs tarball not found, will skip building "
125 echo " the the wxDocsViewer app bundle and etc."
126 echo " $TARBALLDIR /wxPython-docs- $VERSION .tar.gz"
127 echo "-------------------------------------------------------"
133 PREFIX
=/ usr
/ local
/ lib
/ wxPython
- $CHARTYPE - $VERSION
134 BINPREFIX
=/ usr
/ local
/ bin
136 WXROOT
= `dirname $PWD `
137 PROGDIR
= "`dirname \" $0 \" `"
138 TMPDIR
= $PWD / _build_dmg
140 BUILDROOT
= $TMPDIR / build
142 INSTALLROOT
= $TMPDIR / install -root
143 INSTALLAPPS
= $TMPDIR / install -apps
149 RESOURCEDIR
= $PROGDIR / resources
151 SRCROOT
= $BUILDROOT / wxPython
-src- $VERSION
154 #----------------------------------------------------------------------
158 mkdir -p $INSTALLROOT
159 mkdir -p $INSTALLAPPS
163 mkdir -p $DMGAPPS / Docs
164 mkdir -p $DMGAPPS / Samples
170 #----------------------------------------------------------------------
173 if [ $skiptar != yes ]; then
174 echo Unarchiving tarball...
178 if [ $inplace = no
]; then
179 # make a build dir and cd to it.
180 cd wxPython
-src- $VERSION
187 # If building "inplace" then our build dir will be off of the
188 # WXROOT like normal, adjust the variables to find things that
190 WXBLD
= $WXROOT / build
- $CHARTYPE
197 echo "Using wx root dir: $WXROOT "
198 echo "Using build dir: $WXBLD "
199 echo "Using source tree: $WXDIR "
201 #----------------------------------------------------------------------
204 # Configure wxWidgets
205 if [ $skipconfig != yes ]; then
209 --enable-monolithic \
214 --enable-debug_flag \
215 --enable-precomp = no \
222 # Build wxWidgets and wxPython
223 if [ $skipbuild != yes ]; then
225 # Make wxWidgets and some contribs
227 # For some reason Rez and DeRez have started locking up if run as
228 # root, figure out why, but in the meantime...
229 if [ " $UID " = "0" ]; then
231 if [ " $CHARTYPE " = "ansi" ]; then
232 su robind
-c "make lib/libwx_macd-2.5.3.r"
234 su robind
-c "make lib/libwx_macud-2.5.3.r"
239 make $MAKEJOBS -C contrib
/ src
/ gizmos
240 make $MAKEJOBS -C contrib
/ src
/ ogl CXXFLAGS
= "-DwxUSE_DEPRECATED=0"
241 make $MAKEJOBS -C contrib
/ src
/ stc
246 UNICODE
= $PYUNICODEOPT \
249 WX_CONFIG
= " $WXBLD /wx-config --inplace" \
250 BUILD_BASE
= $WXBLD / wxPython \
254 #----------------------------------------------------------------------
256 if [ $skipinstall != yes ]; then
259 make prefix
= $INSTALLROOT$PREFIX install
260 make -C contrib
/ src
/ gizmos prefix
= $INSTALLROOT$PREFIX install
261 make -C contrib
/ src
/ ogl CXXFLAGS
= "-DwxUSE_DEPRECATED=0" prefix
= $INSTALLROOT / $PREFIX install
262 make -C contrib
/ src
/ stc prefix
= $INSTALLROOT$PREFIX install
265 # relink wx-config with a relative link
266 cd $INSTALLROOT$PREFIX / bin
268 ln -s ..
/ lib
/ wx
/ config
/* wx
-config
273 UNICODE
= $PYUNICODEOPT \
276 WX_CONFIG
= " $INSTALLROOT / $PREFIX /bin/wx-config --prefix= $INSTALLROOT / $PREFIX " \
277 BUILD_BASE
= $WXBLD / wxPython \
282 # Apple's Python (on Panther) sym-links the site-packages dir to
283 # /Library/Python/$PYVER so we need to move the files so they are
284 # installed in the physical location, not the virtual one.
285 if [ " $KIND " = "panther" ]; then
286 if [ -e $INSTALLROOT / Library
/ Python
/ $PYVER ]; then
287 rm -r $INSTALLROOT / Library
/ Python
/ $PYVER
289 mkdir -p $INSTALLROOT / Library
/ Python
/ $PYVER
290 mv $INSTALLROOT / $SITEPACKAGES /* $INSTALLROOT / Library
/ Python
/ $PYVER
291 rm -r $INSTALLROOT / System
292 SITEPACKAGES
=/ Library
/ Python
/ $PYVER
295 # install wxPython's tool scripts
296 mkdir -p $INSTALLROOT$BINPREFIX
297 cd $WXROOT / wxPython
/ scripts
298 python
$PYVER CreateMacScripts.py
$INSTALLROOT $BINPREFIX
301 # Remove the .pyc/.pyo files they just take up space and can be recreated
302 # during the install.
303 pushd $WXROOT / wxPython
304 $PYTHON $PROGDIR / ..
/ zappycfiles.py
$INSTALLROOT > / dev
/ null
307 # Set premissions for files in $INSTALLROOT
308 if [ " $UID " = "0" ]; then
309 chown
-R root
: admin
$INSTALLROOT
310 chmod -R g
+ w
$INSTALLROOT
314 if [ " $KIND " = "panther" ]; then
315 SITEPACKAGES
=/ Library
/ Python
/ $PYVER
317 PKGDIR
= `cat $INSTALLROOT $SITEPACKAGES /wx.pth`
321 #----------------------------------------------------------------------
323 # Make the Installer packages and disk image
324 if [ $skipdmg != yes ]; then
326 #-----------------------------------------------
327 # The main runtime installer package
329 # Make the welcome message
331 panther
) W_MSG
= "the Panther (OS X 10.3.x) version of" ;;
332 jaguar
) W_MSG
= "the Jaguar (OS X 10.2.x) version of" ;;
336 cat > $RESOURCEDIR / Welcome.txt
<<EOF
339 This Installer package will install the wxPython $CHARTYPE runtime $VERSION for $W_MSG MacPython-OSX $PYVER . This includes:
341 * The wxPython packages and modules
342 * The wxWidgets shared libraries and headers
343 * Some command line tool scripts, installed to /usr/local/bin.
345 You must install onto your current boot disk, eventhough the installer does not enforce this, otherwise things will not work.
347 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.
352 # make the preflight script
353 cat > $RESOURCEDIR / preflight
<<EOF
355 # Cleanup any old install of the wxPython package
356 rm -rf \ $2 $SITEPACKAGES /wxPython
357 rm -rf \ $2 $SITEPACKAGES /wx
358 rm -rf \ $2 $SITEPACKAGES / $PKGDIR
361 chmod + x
$RESOURCEDIR / preflight
363 # make the postflight script
364 cat > $RESOURCEDIR / postflight
<<EOF
366 # Compile the .py files in the wxPython pacakge
367 $PYTHON \ $2 $PYLIB /compileall.py \ $2 $SITEPACKAGES / $PKGDIR
368 $PYTHON -O \ $2 $PYLIB /compileall.py \ $2 $SITEPACKAGES / $PKGDIR
370 # and all of the wxPython pacakge should be group writable
371 chgrp -R admin \ $2 $SITEPACKAGES / $PKGDIR
372 chmod -R g+w \ $2 $SITEPACKAGES / $PKGDIR
376 chmod + x
$RESOURCEDIR / postflight
380 # Build the main Installer Package...
381 rm -rf wxPython
${SHORTVER} -osx- $CHARTYPE - $KIND .pkg
382 python
$PROGDIR / ..
/ buildpkg.py \
383 --Title = wxPython
${SHORTVER} -osx- $CHARTYPE - $KIND \
385 --Description = "wxPython $CHARTYPE runtime $VERSION for $W_MSG MacPython-OSX $PYVER " \
386 --NeedsAuthorization = "YES" \
388 --InstallOnly = "YES" \
392 mv wxPython
${SHORTVER} -osx- $CHARTYPE - $KIND .pkg
$DMGROOT
394 rm $RESOURCEDIR / postflight
395 rm $RESOURCEDIR / preflight
396 rm $RESOURCEDIR / Welcome.txt
399 #-----------------------------------------------
400 # Make a README to go on the disk image
401 cat > " $DMGROOT /README 1st.txt" <<EOF
404 This disk image contains the following items:
406 wxPython ${SHORTVER} -osx- $CHARTYPE - $VERSION - $KIND
408 This Installer contains the wxPython runtime, compiled on a
409 $KIND OS X system, using the $CHARTYPE build of the wxWidgets
410 library. It includes the Python modules and extension
411 modules, as well as the wxWidgets libraries.
413 It is possible to have more than one version of the runtime
414 installed at once if you wish. The most recently installed
415 version will be the default wxPython, but you can choose
416 another by setting the PYTHONPATH or by using the wxversion
417 module. For more details see:
418 http://wiki.wxpython.org/index.cgi/MultiVersionInstalls
421 uninstall_wxPython.py
423 A simple tool to help you manage your installed versions of
424 wxPython. It will allow you to choose from the currently
425 installed wxPython packages and to select one for
426 uninstallation. It is a text-mode tool so you can either run
427 it from a Terminal command line, or you can open it with
428 PythonLauncher and let it create a Terminal to run it in.
430 NOTE: If you have versions prior to 2.5.3.1 installed, please
431 do run this uninstall tool to remove the older version.
437 cp $PROGDIR / ..
/ uninstall_wxPython.py
$DMGROOT
440 #-----------------------------------------------
441 # Make a disk image to hold these files
442 dmgname
= wxPython
${SHORTVER} -osx- $CHARTYPE - $VERSION - $KIND -py $PYVER
443 $PROGDIR / ..
/ makedmg
$DMGROOT $DMGDIR $dmgname
445 echo Moving
$DMGDIR / $dmgname .dmg to
$DESTDIR
446 mv $DMGDIR / $dmgname .dmg
$DESTDIR
449 #---------------------------------------------------------------------------
450 # Now create app bundles for the demo, docs, and tools and make another
451 # disk image to hold it all.
452 #---------------------------------------------------------------------------
454 cat > " $DMGAPPS /README 1st.txt" <<EOF
457 On this disk image you will find Demo, Tools, Docs, and etc. for
458 wxPython $VERSION . Everything here is optional and you can drag them
459 out of the disk image and drop them wherever you want. You will need
460 to have an installed wxPython runtime to be able to use any of them.
463 wxPython Demo An application bundle version of the demo.
464 (This has it's own copy of the demo sources
467 XRCed An application for editing wxPython resource
470 PyCrust An application that provides an interactive
471 Python shell and also namespace inspectors.
475 Docs/wxDocsViewer An application that allows you to view the
476 wxWidgets documentation.
478 Docs/licence License files.
480 Docs/other A few readmes, change log, etc.
483 Samples/samples Several small sample applications that
484 demonstrate how to use wxPython.
486 Samples/demo A copy of the wxPython demo source code,
487 just open the folder and run demo.pyw.
492 # PyAlaMode An extension of PyCrust that includes source
493 # file editing capabilities.
497 if [ ! -e $TARBALLDIR / wxPython
-docs- $VERSION .
tar .gz
]; then
498 cat > " $DMGAPPS /Docs/Build ERROR.txt" <<EOF
500 The wxPython-docs tarball was not found when building this disk image!
506 tar xzvf
$TARBALLDIR / wxPython
-docs- $VERSION .
tar .gz
509 # Make an app to launch viewdocs.py
510 $PYTHONW $PROGDIR / ..
/ buildapp.py \
511 --builddir = $DMGAPPS / Docs \
512 --name = wxDocsViewer \
513 --mainprogram = $BUILDROOT / wxPython
- $VERSION / docs
/ viewdocs.py \
514 --iconfile = $PROGDIR / Info.icns \
517 cp $BUILDROOT / wxPython
- $VERSION / docs
/* .
zip $DMGAPPS / Docs
/ wxDocsViewer.app
/ Contents
/ Resources
519 cat > " $DMGAPPS /Docs/README 1st.txt" <<EOF
521 The wxDocsViewer application needs to be copied to your Desktop (or
522 someplace else you have write access to) before you can run it, so it
523 can cache some indexes within its bundle.
529 # license files, docs, etc.
531 cp -pR $SRCROOT / wxPython
/ licence .
532 cp -pR $SRCROOT / wxPython
/ docs .
539 if [ ! -e $TARBALLDIR / wxPython
-demo- $VERSION .
tar .gz
]; then
540 cat > " $DMGAPPS /Samples/Build ERROR.txt" <<EOF
542 The wxPython-demo tarball was not found when building this disk image!
545 cp " $DMGAPPS /Samples/Build ERROR.txt" $DMGAPPS
549 # Copy the demo and samples to the disk image from the tarball
550 pushd $DMGAPPS / Samples
551 tar xzvf
$TARBALLDIR / wxPython
-demo- $VERSION .
tar .gz
552 mv wxPython
- $VERSION /* .
553 rm -rf wxPython
- $VERSION
554 rm demo
/ b demo
/ .setup.sh
555 mv demo
/ demo.py demo
/ demo.pyw
558 # Make an app bundle to run the demo
559 $PYTHONW $PROGDIR / ..
/ buildapp.py \
560 --builddir = $DMGAPPS \
561 --name = "wxPython Demo" \
562 --mainprogram = $DMGAPPS / Samples
/ demo
/ demo.pyw \
563 --iconfile = $PROGDIR / RunDemo.icns \
565 cp -pR $DMGAPPS / Samples
/ demo
/* " $DMGAPPS /wxPython Demo.app/Contents/Resources"
569 # Make an app bundle to launch PyCrust
570 $PYTHONW $PROGDIR / ..
/ buildapp.py \
571 --builddir = $DMGAPPS \
573 --mainprogram = $INSTALLROOT$BINPREFIX / pycrust.py \
574 --iconfile = $PROGDIR / PieShell.icns \
577 ## TODO: PyAlaMode needs tweaked to be able to run from a bundle. It
578 ## needs to know to ignore command line parameters and etc...
580 # $PYTHONW $PROGDIR/../buildapp.py \
581 # --builddir=$DMGAPPS \
583 # --mainprogram=$INSTALLROOT$BINPREFIX/pyalamode.py \
584 # --iconfile=$PROGDIR/PieShell.icns \
587 # Make an app to launch XRCed
588 $PYTHONW $PROGDIR / ..
/ buildapp.py \
589 --builddir = $DMGAPPS \
591 --mainprogram = $INSTALLROOT$BINPREFIX / xrced.py \
592 --iconfile = $PROGDIR / XRCed.icns \
597 # and then finally make a disk image containing everything
598 dmgname
= wxPython
${SHORTVER} -osx-docs-demos- $VERSION
599 $PROGDIR / ..
/ makedmg
$DMGAPPS $DMGDIR $dmgname
601 echo Moving
$DMGDIR / $dmgname .dmg to
$DESTDIR
602 mv $DMGDIR / $dmgname .dmg
$DESTDIR
606 # Cleanup build/install dirs
607 if [ $skipclean != yes ]; then
608 echo "Cleaning up..."
611 echo "Cleanup is disabled. You should remove $TMPDIR when finished"