]>
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 INSTALLAPPS
= $TMPDIR / install -apps
146 RESOURCEDIR
= $PROGDIR / resources
148 SRCROOT
= $BUILDROOT / wxPython
-src- $VERSION
151 #----------------------------------------------------------------------
155 mkdir -p $INSTALLROOT
156 mkdir -p $INSTALLAPPS
160 mkdir -p $DMGAPPS / Docs
161 mkdir -p $DMGAPPS / Samples
167 #----------------------------------------------------------------------
170 if [ $skiptar != yes ]; then
171 echo Unarchiving tarball...
175 if [ $inplace = no
]; then
176 # make a build dir and cd to it.
177 cd wxPython
-src- $VERSION
183 # If building "inplace" then our build dir will be BUILDROOT,
184 # adjust the variables to find things that way.
190 echo "Using source tree: $WXDIR "
191 echo "Using build dir: $WXBLD "
193 #----------------------------------------------------------------------
196 # Configure wxWidgets
197 if [ $skipconfig != yes ]; then
201 --enable-monolithic \
206 --enable-debug_flag \
207 --enable-precomp = no \
214 # Build wxWidgets and wxPython
215 if [ $skipbuild != yes ]; then
217 # Make wxWidgets and some contribs
219 # For some reason Rez and DeRez have started locking up if run as
220 # root, figure out why, but in the meantime...
221 if [ " $UID " = "0" ]; then
223 if [ " $CHARTYPE " = "ansi" ]; then
224 su robind
-c "make lib/libwx_macd-2.5.3.r"
226 su robind
-c "make lib/libwx_macud-2.5.3.r"
231 make -C contrib
/ src
/ gizmos
232 make -C contrib
/ src
/ ogl CXXFLAGS
= "-DwxUSE_DEPRECATED=0"
233 make -C contrib
/ src
/ stc
238 UNICODE
= $PYUNICODEOPT \
241 WX_CONFIG
= " $WXBLD /wx-config --inplace" \
242 BUILD_BASE
= $WXBLD / wxPython \
246 #----------------------------------------------------------------------
248 if [ $skipinstall != yes ]; then
251 make prefix
= $INSTALLROOT$PREFIX install
252 make -C contrib
/ src
/ gizmos prefix
= $INSTALLROOT$PREFIX install
253 make -C contrib
/ src
/ ogl CXXFLAGS
= "-DwxUSE_DEPRECATED=0" prefix
= $INSTALLROOT / $PREFIX install
254 make -C contrib
/ src
/ stc prefix
= $INSTALLROOT$PREFIX install
257 # relink wx-config with a relative link
258 cd $INSTALLROOT$PREFIX / bin
260 ln -s ..
/ lib
/ wx
/ config
/* wx
-config
265 UNICODE
= $PYUNICODEOPT \
268 WX_CONFIG
= " $INSTALLROOT / $PREFIX /bin/wx-config --prefix= $INSTALLROOT / $PREFIX " \
269 BUILD_BASE
= $WXBLD / wxPython \
274 # Apple's Python (on Panther) sym-links the site-packages dir to
275 # /Library/Python/$PYVER so we need to move the files so they are
276 # installed in the physical location, not the virtual one.
277 if [ " $KIND " = "panther" ]; then
278 if [ -e $INSTALLROOT / Library
/ Python
/ $PYVER ]; then
279 rm -r $INSTALLROOT / Library
/ Python
/ $PYVER
281 mkdir -p $INSTALLROOT / Library
/ Python
/ $PYVER
282 mv $INSTALLROOT / $SITEPACKAGES /* $INSTALLROOT / Library
/ Python
/ $PYVER
283 rm -r $INSTALLROOT / System
284 SITEPACKAGES
=/ Library
/ Python
/ $PYVER
287 # install wxPython's tool scripts
288 mkdir -p $INSTALLROOT$BINPREFIX
289 cd $WXDIR / wxPython
/ scripts
290 python
$PYVER CreateMacScripts.py
$INSTALLROOT $BINPREFIX
293 # Remove the .pyc/.pyo files they just take up space and can be recreated
294 # during the install.
295 pushd $WXDIR / wxPython
296 $PYTHON $PROGDIR / ..
/ zappycfiles.py
$INSTALLROOT > / dev
/ null
299 # Set premissions for files in $INSTALLROOT
300 if [ " $UID " = "0" ]; then
301 chown
-R root
: admin
$INSTALLROOT
302 chmod -R g
+ w
$INSTALLROOT
306 if [ " $KIND " = "panther" ]; then
307 SITEPACKAGES
=/ Library
/ Python
/ $PYVER
309 PKGDIR
= `cat $INSTALLROOT $SITEPACKAGES /wx.pth`
313 #----------------------------------------------------------------------
315 # Make the Installer packages and disk image
316 if [ $skipdmg != yes ]; then
318 #-----------------------------------------------
319 # The main runtime installer package
321 # Make the welcome message
323 panther
) W_MSG
= "the Panther (OS X 10.3.x) version of" ;;
324 jaguar
) W_MSG
= "the Jaguar (OS X 10.2.x) version of" ;;
328 cat > $RESOURCEDIR / Welcome.txt
<<EOF
331 This Installer package will install the wxPython $CHARTYPE runtime $VERSION for $W_MSG MacPython-OSX $PYVER . This includes:
333 * The wxPython packages and modules
334 * The wxWidgets shared libraries and headers
335 * Some command line tool scripts, installed to /usr/local/bin.
337 You must install onto your current boot disk, eventhough the installer does not enforce this, otherwise things will not work.
339 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.
344 # make the preflight script
345 cat > $RESOURCEDIR / preflight
<<EOF
347 # Cleanup any old install of the wxPython package
348 rm -rf \ $2 $SITEPACKAGES /wxPython
349 rm -rf \ $2 $SITEPACKAGES /wx
350 rm -rf \ $2 $SITEPACKAGES / $PKGDIR
353 chmod + x
$RESOURCEDIR / preflight
355 # make the postflight script
356 cat > $RESOURCEDIR / postflight
<<EOF
358 # Compile the .py files in the wxPython pacakge
359 $PYTHON \ $2 $PYLIB /compileall.py \ $2 $SITEPACKAGES / $PKGDIR
360 $PYTHON -O \ $2 $PYLIB /compileall.py \ $2 $SITEPACKAGES / $PKGDIR
362 # and all of the wxPython pacakge should be group writable
363 chgrp -R admin \ $2 $SITEPACKAGES / $PKGDIR
364 chmod -R g+w \ $2 $SITEPACKAGES / $PKGDIR
368 chmod + x
$RESOURCEDIR / postflight
372 # Build the main Installer Package...
373 rm -rf wxPython
${SHORTVER} -osx- $CHARTYPE - $KIND .pkg
374 python
$PROGDIR / ..
/ buildpkg.py \
375 --Title = wxPython
${SHORTVER} -osx- $CHARTYPE - $KIND \
377 --Description = "wxPython $CHARTYPE runtime $VERSION for $W_MSG MacPython-OSX $PYVER " \
378 --NeedsAuthorization = "YES" \
380 --InstallOnly = "YES" \
384 mv wxPython
${SHORTVER} -osx- $CHARTYPE - $KIND .pkg
$DMGROOT
386 rm $RESOURCEDIR / postflight
387 rm $RESOURCEDIR / preflight
388 rm $RESOURCEDIR / Welcome.txt
391 #-----------------------------------------------
392 # Make a README to go on the disk image
393 cat > " $DMGROOT /README 1st.txt" <<EOF
396 This disk image contains the following items:
398 wxPython ${SHORTVER} -osx- $CHARTYPE - $VERSION - $KIND
400 This Installer contains the wxPython runtime, compiled on a
401 $KIND OS X system, using the $CHARTYPE build of the wxWidgets
402 library. It includes the Python modules and extension
403 modules, as well as the wxWidgets libraries.
405 It is possible to have more than one version of the runtime
406 installed at once if you wish. The most recently installed
407 version will be the default wxPython, but you can choose
408 another by setting the PYTHONPATH or by using the wxversion
409 module. For more details see:
410 http://wiki.wxpython.org/index.cgi/MultiVersionInstalls
413 uninstall_wxPython.py
415 A simple tool to help you manage your installed versions of
416 wxPython. It will allow you to choose from the currently
417 installed wxPython packages and to select one for
418 uninstallation. It is a text-mode tool so you can either run
419 it from a Terminal command line, or you can open it with
420 PythonLauncher and let it create a Terminal to run it in.
426 cp $PROGDIR / ..
/ uninstall_wxPython.py
$DMGROOT
429 #-----------------------------------------------
430 # Make a disk image to hold these files
431 dmgname
= wxPython
${SHORTVER} -osx- $CHARTYPE - $VERSION - $KIND -py $PYVER
432 $PROGDIR / ..
/ makedmg
$DMGROOT $DMGDIR $dmgname
434 echo Moving
$DMGDIR / $dmgname .dmg to
$DESTDIR
435 mv $DMGDIR / $dmgname .dmg
$DESTDIR
438 #---------------------------------------------------------------------------
439 # Now create app bundles for the demo, docs, and tools and make another
440 # disk image to hold it all.
441 #---------------------------------------------------------------------------
443 cat > " $DMGAPPS /README 1st.txt" <<EOF
446 On this disk image you will find Demo, Tools, Docs, and etc. for
447 wxPython $VERSION . Everything here is optional and you can drag them
448 out of the disk image and drop them wherever you want. You will need
449 to have an installed wxPython runtime to be able to use any of them.
452 wxPython Demo An application bundle version of the demo.
453 (This has it's own copy of the demo sources
456 XRCed An application for editing wxPython resource
459 PyCrust An application that provides an interactive
460 Python shell and also namespace inspectors.
464 Docs/wxDocsViewer An application that allows you to view the
465 wxWidgets documentation.
467 Docs/licence License files.
469 Docs/other A few readmes, change log, etc.
472 Samples/samples Several small sample applications that
473 demonstrate how to use wxPython.
475 Samples/demo A copy of the wxPython demo source code,
476 just open the folder and run demo.pyw.
481 # PyAlaMode An extension of PyCrust that includes source
482 # file editing capabilities.
486 if [ ! -e $TARBALLDIR / wxPython
-docs- $VERSION .
tar .gz
]; then
487 cat > " $DMGAPPS /Docs/Build ERROR.txt" <<EOF
489 The wxPython-docs tarball was not found when building this disk image!
495 tar xzvf
$TARBALLDIR / wxPython
-docs- $VERSION .
tar .gz
498 # Make an app to launch viewdocs.py
499 $PYTHONW $PROGDIR / ..
/ buildapp.py \
500 --builddir = $DMGAPPS / Docs \
501 --name = wxDocsViewer \
502 --mainprogram = $BUILDROOT / wxPython
- $VERSION / docs
/ viewdocs.py \
503 --iconfile = $PROGDIR / Info.icns \
506 cp $BUILDROOT / wxPython
- $VERSION / docs
/* .
zip $DMGAPPS / Docs
/ wxDocsViewer.app
/ Contents
/ Resources
508 cat > " $DMGAPPS /Docs/README 1st.txt" <<EOF
510 The wxDocsViewer application needs to be copied to your Desktop (or
511 someplace else you have write access to) before you can run it, so it
512 can cache some indexes within its bundle.
518 # license files, docs, etc.
520 cp -pR $SRCROOT / wxPython
/ licence .
521 cp -pR $SRCROOT / wxPython
/ docs .
528 if [ ! -e $TARBALLDIR / wxPython
-demo- $VERSION .
tar .gz
]; then
529 cat > " $DMGAPPS /Samples/Build ERROR.txt" <<EOF
531 The wxPython-demo tarball was not found when building this disk image!
534 cp " $DMGAPPS /Samples/Build ERROR.txt" $DMGAPPS
538 # Copy the demo and samples to the disk image from the tarball
539 pushd $DMGAPPS / Samples
540 tar xzvf
$TARBALLDIR / wxPython
-demo- $VERSION .
tar .gz
541 mv wxPython
- $VERSION /* .
542 rm -rf wxPython
- $VERSION
543 rm demo
/ b demo
/ .setup.sh
544 mv demo
/ demo.py demo
/ demo.pyw
547 # Make an app bundle to run the demo
548 $PYTHONW $PROGDIR / ..
/ buildapp.py \
549 --builddir = $DMGAPPS \
550 --name = "wxPython Demo" \
551 --mainprogram = $DMGAPPS / Samples
/ demo
/ demo.pyw \
552 --iconfile = $PROGDIR / RunDemo.icns \
554 cp -pR $DMGAPPS / Samples
/ demo
/* " $DMGAPPS /wxPython Demo.app/Contents/Resources"
558 # Make an app bundle to launch PyCrust
559 $PYTHONW $PROGDIR / ..
/ buildapp.py \
560 --builddir = $DMGAPPS \
562 --mainprogram = $INSTALLROOT$BINPREFIX / pycrust.py \
563 --iconfile = $PROGDIR / PieShell.icns \
566 ## TODO: PyAlaMode needs tweaked to be able to run from a bundle. It
567 ## needs to know to ignore command line parameters and etc...
569 # $PYTHONW $PROGDIR/../buildapp.py \
570 # --builddir=$DMGAPPS \
572 # --mainprogram=$INSTALLROOT$BINPREFIX/pyalamode.py \
573 # --iconfile=$PROGDIR/PieShell.icns \
576 # Make an app to launch XRCed
577 $PYTHONW $PROGDIR / ..
/ buildapp.py \
578 --builddir = $DMGAPPS \
580 --mainprogram = $INSTALLROOT$BINPREFIX / xrced.py \
581 --iconfile = $PROGDIR / XRCed.icns \
586 # and then finally make a disk image containing everything
587 dmgname
= wxPython
${SHORTVER} -osx-docs-demos- $VERSION
588 $PROGDIR / ..
/ makedmg
$DMGAPPS $DMGDIR $dmgname
590 echo Moving
$DMGDIR / $dmgname .dmg to
$DESTDIR
591 mv $DMGDIR / $dmgname .dmg
$DESTDIR
595 # Cleanup build/install dirs
596 if [ $skipclean != yes ]; then
597 echo "Cleaning up..."
600 echo "Cleanup is disabled. You should remove $TMPDIR when finished"