]>
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 " skipconfig Don't run configure"
35 echo " skipbuild Don't build wxWidgets or wxPython"
36 echo " skipinstall Don't do the installation step"
37 echo " skipdmg Don't make the package or diskimage"
38 echo " skipclean Don't do the cleanup at the end"
50 panther
) PYTHON
=/usr
/bin
/python
;;
51 jaguar
) PYTHON
=/usr
/local
/bin
/python
;;
67 skiptar
) skiptar
=yes ;;
68 skipconfig
) skipconfig
=yes; skiptar
=yes ;;
69 skipbuild
) skipbuild
=yes; skipconfig
=yes; skiptar
=yes ;;
70 skipinstall
) skipinstall
=yes ;;
71 skipdmg
) skipdmg
=yes ;;
72 skipclean
) skipclean
=yes ;;
73 inplace
) inplace
=yes; skiptar
=yes ;;
75 *) echo "Unknown flag \"${flag}\""
82 VERSION
=`$PYTHON -c "import setup;print setup.VERSION"`
83 PYVER
=`$PYTHON -c "import sys; print sys.version[:3]"`
84 PYPREFIX
=`$PYTHON -c "import sys; print sys.exec_prefix"`
85 PYLIB
=$PYPREFIX/lib
/python
$PYVER
86 SITEPACKAGES
=$PYLIB/site
-packages
87 SHORTVER
=`echo $VERSION | cut -c 1,2,3`
90 if [ -z "$TARBALLDIR" ]; then
91 # this is a spot on my fileserver where the tarballs go, adjust
92 # as needed for where you put the wxPython tarball, or set
93 # TARBALLDIR before invoking this script...
94 TARBALLDIR
=/stuff
/Development
/wxPython
/dist
/$VERSION
96 TARBALL
=$TARBALLDIR/wxPython
-src-$VERSION.
tar.gz
98 if [ ! -e $TARBALLDIR/wxPython
-demo-$VERSION.
tar.gz
]; then
99 echo "-------------------------------------------------------"
100 echo " WARNING: Demo tarball not found, will skip building "
101 echo " the Demo app bundle and etc."
102 echo " $TARBALLDIR/wxPython-demo-$VERSION.tar.gz"
103 echo "-------------------------------------------------------"
106 if [ ! -e $TARBALLDIR/wxPython
-docs-$VERSION.
tar.gz
]; then
107 echo "-------------------------------------------------------"
108 echo " WARNING: Docs tarball not found, will skip building "
109 echo " the the wxDocsViewer app bundle and etc."
110 echo " $TARBALLDIR/wxPython-docs-$VERSION.tar.gz"
111 echo "-------------------------------------------------------"
117 PREFIX
=/usr
/local
/lib
/wxPython
-$VERSION
118 BINPREFIX
=/usr
/local
/bin
120 WXROOT
=`dirname $PWD`
121 PROGDIR
="`dirname \"$0\"`"
122 TMPDIR
=$PWD/_build_dmg
124 BUILDROOT
=$TMPDIR/build
125 INSTALLROOT
=$TMPDIR/install
126 INSTALLDEVEL
=$TMPDIR/install-devel
128 RESOURCEDIR
=$PROGDIR/resources
130 SRCROOT
=$BUILDROOT/wxPython
-src-$VERSION
133 #----------------------------------------------------------------------
137 mkdir -p $INSTALLROOT
138 #mkdir -p $INSTALLDEVEL
140 mkdir -p $DMGDIR/root
/Apps
141 mkdir -p $DMGDIR/root
/Docs
142 mkdir -p $DMGDIR/root
/Samples
148 #----------------------------------------------------------------------
151 if [ $skiptar != yes ]; then
152 echo Unarchiving tarball...
156 if [ $inplace = no
]; then
157 # make a build dir and cd to it.
158 cd wxPython
-src-$VERSION
164 # If building "inplace" then our build dir will be BUILDROOT,
165 # adjust the variables to find things that way.
171 echo "Using source tree: $WXDIR"
172 echo "Using build dir: $WXBLD"
174 #----------------------------------------------------------------------
177 # Configure wxWidgets
178 if [ $skipconfig != yes ]; then
182 --enable-monolithic \
187 --enable-debug_flag \
188 --enable-precomp=no \
191 ## --with-libjpeg=builtin \
192 ## --with-libpng=builtin \
193 ## --with-libtiff=builtin \
194 ## --with-zlib=builtin \
198 # Build wxWidgets and wxPython
199 if [ $skipbuild != yes ]; then
201 # Make wxWidgets and some contribs
203 # For some reason Rez and DeRez have started locking up if run as root...
205 su robind
-c "make lib/libwx_macd-2.5.3.r"
208 make -C contrib
/src
/gizmos
209 make -C contrib
/src
/ogl CXXFLAGS
="-DwxUSE_DEPRECATED=0"
210 make -C contrib
/src
/stc
217 WX_CONFIG
="$WXBLD/wx-config --inplace" \
218 BUILD_BASE
=$WXBLD/wxPython \
222 #----------------------------------------------------------------------
224 if [ $skipinstall != yes ]; then
227 make prefix
=$INSTALLROOT$PREFIX install
228 make -C contrib
/src
/gizmos prefix
=$INSTALLROOT$PREFIX install
229 make -C contrib
/src
/ogl CXXFLAGS
="-DwxUSE_DEPRECATED=0" prefix
=$INSTALLROOT/$PREFIX install
230 make -C contrib
/src
/stc prefix
=$INSTALLROOT$PREFIX install
233 # relink wx-config with a relative link
234 cd $INSTALLROOT$PREFIX/bin
236 ln -s ..
/lib
/wx
/config
/* wx
-config
243 WX_CONFIG
="$INSTALLROOT/$PREFIX/bin/wx-config --prefix=$INSTALLROOT/$PREFIX" \
244 BUILD_BASE
=$WXBLD/wxPython \
249 # Apple's Python (on Panther) sym-links the site-packages dir to
250 # /Library/Python/$PYVER so we need to move the files so they are
251 # installed in the physical location, not the virtual one.
252 if [ "$KIND" = "panther" ]; then
253 if [ -e $INSTALLROOT/Library
/Python
/$PYVER ]; then
254 rm -r $INSTALLROOT/Library
/Python
/$PYVER
256 mkdir -p $INSTALLROOT/Library
/Python
/$PYVER
257 mv $INSTALLROOT/$SITEPACKAGES/* $INSTALLROOT/Library
/Python
/$PYVER
258 rm -r $INSTALLROOT/System
259 SITEPACKAGES
=/Library
/Python
/$PYVER
263 # install wxPython's tool scripts
264 mkdir -p $INSTALLROOT$BINPREFIX
265 cd $WXDIR/wxPython
/scripts
266 python
$PYVER CreateMacScripts.py
$INSTALLROOT $BINPREFIX
269 # Set premissions for files in $INSTALLROOT
270 if [ "$UID" = "0" ]; then
271 chown
-R root
:admin
$INSTALLROOT
272 chmod -R g
+w
$INSTALLROOT
276 PKGDIR
=`cat $INSTALLROOT/Library/Python/$PYVER/wx.pth`
280 #----------------------------------------------------------------------
282 # Make the Installer packages and disk image
283 if [ $skipdmg != yes ]; then
285 # Remove the .pyc/.pyo files they just take up space and can be recreated
286 # during the install.
287 $PYTHON $PROGDIR/..
/zappycfiles.py
$INSTALLROOT > /dev
/null
290 # Make the welcome message
292 panther
) W_MSG
="the Panther (OS X 10.3.x) version of" ;;
293 jaguar
) W_MSG
="the Jaguar (OS X 10.2.x) version of" ;;
295 cat > $RESOURCEDIR/Welcome.txt
<<EOF
298 This program will install wxPython $VERSION for $W_MSG MacPython-OSX $PYVER.
300 You must install onto your current boot disk, even though the installer does not enforce this, otherwise things will not work.
305 # make the preflight script
306 cat > $RESOURCEDIR/preflight
<<EOF
308 # Cleanup any old install of the wxPython package
309 rm -rf \$2$SITEPACKAGES/wxPython
310 rm -rf \$2$SITEPACKAGES/wx
311 rm -rf \$2$SITEPACKAGES/$PKGDIR
314 chmod +x
$RESOURCEDIR/preflight
316 # make the postflight script
317 cat > $RESOURCEDIR/postflight
<<EOF
319 # Compile the .py files in the wxPython pacakge
320 $PYTHON \$2$PYLIB/compileall.py \$2$SITEPACKAGES/$PKGDIR
321 $PYTHON -O \$2$PYLIB/compileall.py \$2$SITEPACKAGES/$PKGDIR
324 # and all of the wxPython pacakge should be group writable
325 chgrp -R admin \$2$SITEPACKAGES/$PKGDIR
326 chmod -R g+w \$2$SITEPACKAGES/$PKGDIR
330 chmod +x
$RESOURCEDIR/postflight
334 # Build the main Installer Package...
335 rm -rf wxPython
${SHORTVER}-osx-$KIND.pkg
336 python
$PROGDIR/..
/buildpkg.py \
337 --Title=wxPython
${SHORTVER}-osx-$KIND \
339 --Description="wxPython $VERSION for $W_MSG MacPython-OSX $PYVER" \
340 --NeedsAuthorization="YES" \
342 --InstallOnly="YES" \
346 mv wxPython
${SHORTVER}-osx-$KIND.pkg
$DMGDIR/root
350 # Make a README.txt to go on the disk image
351 cat > "$DMGDIR/root/README 1st.txt" <<EOF
354 On this disk image you will find the installer for wxPython $VERSION for $W_MSG MacPython-OSX $PYVER. MacPython-OSX is not included.
356 wxPython${SHORTVER}-osx-$KIND.pkg The installer package. It contains the wxPython
357 extension modules, wxMac dynamic libraries and
358 headers, and some scripts for the command-line
361 Everything else here is optional and you can drag them out of the disk
362 image and drop them wherever you want. You do need to install the above
363 package before you can use any of the items below.
366 Apps/wxPython Demo An application bundle version of the demo.
367 (This has it's own copy of the sources within
370 Apps/XRCed An application for editing wxPython resource
373 Apps/PyCrust An application that provides an interactive
374 Python shell and also namespace inspectors.
378 Docs/wxDocsViewer An application that allows you to view the
379 wxWidgets documentation.
381 Docs/licence License files.
383 Docs/other A few readmes, change log, etc.
386 Samples/samples Several small sample applications that
387 demonstrate how to use wxPython.
389 Samples/demo A copy of the wxPython demo source code,
390 just open the folder and run demo.pyw.
395 # PyAlaMode An extension of PyCrust that includes source
396 # file editing capabilities.
400 if [ ! -e $TARBALLDIR/wxPython
-docs-$VERSION.
tar.gz
]; then
401 cat > "$DMGDIR/root/Docs/Build ERROR.txt" <<EOF
403 The wxPython-docs tarball was not found when building this disk image!
409 tar xzvf
$TARBALLDIR/wxPython
-docs-$VERSION.
tar.gz
412 # Make an app to launch viewdocs.py
413 $PYTHONW $PROGDIR/..
/buildapp.py \
414 --builddir=$DMGDIR/root
/Docs \
415 --name=wxDocsViewer \
416 --mainprogram=$BUILDROOT/wxPython
-$VERSION/docs
/viewdocs.py \
417 --iconfile=$PROGDIR/Info.icns \
420 cp $BUILDROOT/wxPython
-$VERSION/docs
/*.
zip $DMGDIR/root
/Docs
/wxDocsViewer.app
/Contents
/Resources
422 cat > "$DMGDIR/root/Docs/README 1st.txt" <<EOF
424 The wxDocsViewer application needs to be copied to your Desktop (or
425 someplace else you have write access to) before you can run it, so it
426 can cache some indexes within its bundle.
432 # license files, docs, etc.
433 pushd $DMGDIR/root
/Docs
434 cp -pR $SRCROOT/wxPython
/licence .
435 cp -pR $SRCROOT/wxPython
/docs .
442 if [ ! -e $TARBALLDIR/wxPython
-demo-$VERSION.
tar.gz
]; then
443 cat > "$DMGDIR/root/Samples/Build ERROR.txt" <<EOF
445 The wxPython-demo tarball was not found when building this disk image!
448 cp "$DMGDIR/root/Samples/Build ERROR.txt" $DMGDIR/root
/Apps
452 # Copy the demo and samples to the disk image from the tarball
453 pushd $DMGDIR/root
/Samples
454 tar xzvf
$TARBALLDIR/wxPython
-demo-$VERSION.
tar.gz
455 mv wxPython
-$VERSION/* .
456 rm -rf wxPython
-$VERSION
457 rm demo
/b demo
/.setup.sh
458 mv demo
/demo.py demo
/demo.pyw
461 # Make an app bundle to run the demo
462 $PYTHONW $PROGDIR/..
/buildapp.py \
463 --builddir=$DMGDIR/root
/Apps \
464 --name="wxPython Demo" \
465 --mainprogram=$DMGDIR/root
/Samples
/demo
/demo.pyw \
466 --iconfile=$PROGDIR/RunDemo.icns \
468 cp -pR $DMGDIR/root
/Samples
/demo
/* "$DMGDIR/root/Apps/wxPython Demo.app/Contents/Resources"
472 # Make an app bundle to launch PyCrust
473 $PYTHONW $PROGDIR/..
/buildapp.py \
474 --builddir=$DMGDIR/root
/Apps \
476 --mainprogram=$INSTALLROOT$BINPREFIX/pycrust.py \
477 --iconfile=$PROGDIR/PieShell.icns \
481 # $PYTHONW $PROGDIR/../buildapp.py \
482 # --builddir=$DMGDIR/root \
484 # --mainprogram=$INSTALLROOT$BINPREFIX/pyalamode.py \
485 # --iconfile=$PROGDIR/PieShell.icns \
488 # Make an app to launch XRCed
489 $PYTHONW $PROGDIR/..
/buildapp.py \
490 --builddir=$DMGDIR/root
/Apps \
492 --mainprogram=$INSTALLROOT$BINPREFIX/xrced.py \
493 --iconfile=$PROGDIR/XRCed.icns \
498 # and then finally make a disk image containing the packages and etc.
499 $PROGDIR/..
/makedmg
$DMGDIR/root
$DMGDIR wxPython
${SHORTVER}-osx-$VERSION-$KIND-py$PYVER
501 echo Moving
$DMGDIR/wxPython
${SHORTVER}-osx-$VERSION-$KIND-py$PYVER.dmg to
$DESTDIR
502 mv $DMGDIR/wxPython
${SHORTVER}-osx-$VERSION-$KIND-py$PYVER.dmg
$DESTDIR
506 # Cleanup build/install dirs
507 if [ $skipclean != yes ]; then
508 echo "Cleaning up..."
511 echo "Cleanup is disabled. You should remove $TMPDIR when finished"