]>
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`
89 # TODO: enable selecting unicode or ansi builds, then set this accordingly...
94 if [ -z "$TARBALLDIR" ]; then
95 # this is a spot on my fileserver where the tarballs go, adjust
96 # as needed for where you put the wxPython tarball, or set
97 # TARBALLDIR before invoking this script...
98 TARBALLDIR
=/stuff
/Development
/wxPython
/dist
/$VERSION
100 TARBALL
=$TARBALLDIR/wxPython
-src-$VERSION.
tar.gz
102 if [ ! -e $TARBALLDIR/wxPython
-demo-$VERSION.
tar.gz
]; then
103 echo "-------------------------------------------------------"
104 echo " WARNING: Demo tarball not found, will skip building "
105 echo " the Demo app bundle and etc."
106 echo " $TARBALLDIR/wxPython-demo-$VERSION.tar.gz"
107 echo "-------------------------------------------------------"
110 if [ ! -e $TARBALLDIR/wxPython
-docs-$VERSION.
tar.gz
]; then
111 echo "-------------------------------------------------------"
112 echo " WARNING: Docs tarball not found, will skip building "
113 echo " the the wxDocsViewer app bundle and etc."
114 echo " $TARBALLDIR/wxPython-docs-$VERSION.tar.gz"
115 echo "-------------------------------------------------------"
121 PREFIX
=/usr
/local
/lib
/wxPython
-$VERSION
122 BINPREFIX
=/usr
/local
/bin
124 WXROOT
=`dirname $PWD`
125 PROGDIR
="`dirname \"$0\"`"
126 TMPDIR
=$PWD/_build_dmg
128 BUILDROOT
=$TMPDIR/build
129 INSTALLROOT
=$TMPDIR/install
130 INSTALLDEVEL
=$TMPDIR/install-devel
132 RESOURCEDIR
=$PROGDIR/resources
134 SRCROOT
=$BUILDROOT/wxPython
-src-$VERSION
137 #----------------------------------------------------------------------
141 mkdir -p $INSTALLROOT
142 #mkdir -p $INSTALLDEVEL
144 mkdir -p $DMGDIR/root
/Apps
145 mkdir -p $DMGDIR/root
/Docs
146 mkdir -p $DMGDIR/root
/Samples
152 #----------------------------------------------------------------------
155 if [ $skiptar != yes ]; then
156 echo Unarchiving tarball...
160 if [ $inplace = no
]; then
161 # make a build dir and cd to it.
162 cd wxPython
-src-$VERSION
168 # If building "inplace" then our build dir will be BUILDROOT,
169 # adjust the variables to find things that way.
175 echo "Using source tree: $WXDIR"
176 echo "Using build dir: $WXBLD"
178 #----------------------------------------------------------------------
181 # Configure wxWidgets
182 if [ $skipconfig != yes ]; then
186 --enable-monolithic \
191 --enable-debug_flag \
192 --enable-precomp=no \
195 ## --with-libjpeg=builtin \
196 ## --with-libpng=builtin \
197 ## --with-libtiff=builtin \
198 ## --with-zlib=builtin \
202 # Build wxWidgets and wxPython
203 if [ $skipbuild != yes ]; then
205 # Make wxWidgets and some contribs
207 # For some reason Rez and DeRez have started locking up if run as root...
209 su robind
-c "make lib/libwx_macd-2.5.3.r"
212 make -C contrib
/src
/gizmos
213 make -C contrib
/src
/ogl CXXFLAGS
="-DwxUSE_DEPRECATED=0"
214 make -C contrib
/src
/stc
221 WX_CONFIG
="$WXBLD/wx-config --inplace" \
222 BUILD_BASE
=$WXBLD/wxPython \
226 #----------------------------------------------------------------------
228 if [ $skipinstall != yes ]; then
231 make prefix
=$INSTALLROOT$PREFIX install
232 make -C contrib
/src
/gizmos prefix
=$INSTALLROOT$PREFIX install
233 make -C contrib
/src
/ogl CXXFLAGS
="-DwxUSE_DEPRECATED=0" prefix
=$INSTALLROOT/$PREFIX install
234 make -C contrib
/src
/stc prefix
=$INSTALLROOT$PREFIX install
237 # relink wx-config with a relative link
238 cd $INSTALLROOT$PREFIX/bin
240 ln -s ..
/lib
/wx
/config
/* wx
-config
247 WX_CONFIG
="$INSTALLROOT/$PREFIX/bin/wx-config --prefix=$INSTALLROOT/$PREFIX" \
248 BUILD_BASE
=$WXBLD/wxPython \
253 # Apple's Python (on Panther) sym-links the site-packages dir to
254 # /Library/Python/$PYVER so we need to move the files so they are
255 # installed in the physical location, not the virtual one.
256 if [ "$KIND" = "panther" ]; then
257 if [ -e $INSTALLROOT/Library
/Python
/$PYVER ]; then
258 rm -r $INSTALLROOT/Library
/Python
/$PYVER
260 mkdir -p $INSTALLROOT/Library
/Python
/$PYVER
261 mv $INSTALLROOT/$SITEPACKAGES/* $INSTALLROOT/Library
/Python
/$PYVER
262 rm -r $INSTALLROOT/System
263 SITEPACKAGES
=/Library
/Python
/$PYVER
267 # install wxPython's tool scripts
268 mkdir -p $INSTALLROOT$BINPREFIX
269 cd $WXDIR/wxPython
/scripts
270 python
$PYVER CreateMacScripts.py
$INSTALLROOT $BINPREFIX
273 # Set premissions for files in $INSTALLROOT
274 if [ "$UID" = "0" ]; then
275 chown
-R root
:admin
$INSTALLROOT
276 chmod -R g
+w
$INSTALLROOT
280 PKGDIR
=`cat $INSTALLROOT/Library/Python/$PYVER/wx.pth`
284 #----------------------------------------------------------------------
286 # Make the Installer packages and disk image
287 if [ $skipdmg != yes ]; then
289 # Remove the .pyc/.pyo files they just take up space and can be recreated
290 # during the install.
291 $PYTHON $PROGDIR/..
/zappycfiles.py
$INSTALLROOT > /dev
/null
294 # Make the welcome message
296 panther
) W_MSG
="the Panther (OS X 10.3.x) version of" ;;
297 jaguar
) W_MSG
="the Jaguar (OS X 10.2.x) version of" ;;
299 cat > $RESOURCEDIR/Welcome.txt
<<EOF
302 This program will install wxPython $VERSION for $W_MSG MacPython-OSX $PYVER.
304 You must install onto your current boot disk, even though the installer does not enforce this, otherwise things will not work.
309 # make the preflight script
310 cat > $RESOURCEDIR/preflight
<<EOF
312 # Cleanup any old install of the wxPython package
313 rm -rf \$2$SITEPACKAGES/wxPython
314 rm -rf \$2$SITEPACKAGES/wx
315 rm -rf \$2$SITEPACKAGES/$PKGDIR
318 chmod +x
$RESOURCEDIR/preflight
320 # make the postflight script
321 cat > $RESOURCEDIR/postflight
<<EOF
323 # Compile the .py files in the wxPython pacakge
324 $PYTHON \$2$PYLIB/compileall.py \$2$SITEPACKAGES/$PKGDIR
325 $PYTHON -O \$2$PYLIB/compileall.py \$2$SITEPACKAGES/$PKGDIR
328 # and all of the wxPython pacakge should be group writable
329 chgrp -R admin \$2$SITEPACKAGES/$PKGDIR
330 chmod -R g+w \$2$SITEPACKAGES/$PKGDIR
334 chmod +x
$RESOURCEDIR/postflight
338 # Build the main Installer Package...
339 rm -rf wxPython
${SHORTVER}-osx-$CHARTYPE-$KIND.pkg
340 python
$PROGDIR/..
/buildpkg.py \
341 --Title=wxPython
${SHORTVER}-osx-$CHARTYPE-$KIND \
343 --Description="wxPython $VERSION for $W_MSG MacPython-OSX $PYVER" \
344 --NeedsAuthorization="YES" \
346 --InstallOnly="YES" \
350 mv wxPython
${SHORTVER}-osx-$CHARTYPE-$KIND.pkg
$DMGDIR/root
354 # Make a README.txt to go on the disk image
355 cat > "$DMGDIR/root/README 1st.txt" <<EOF
358 On this disk image you will find the installer for wxPython $VERSION for $W_MSG MacPython-OSX $PYVER. MacPython-OSX is not included.
360 wxPython${SHORTVER}-osx-$CHARTYPE-$KIND.pkg The installer package.
361 It contains the wxPython extension modules,
362 wxMac dynamic libraries and headers, and some
363 scripts for the command-line tools.
365 Everything else here is optional and you can drag them out of the disk
366 image and drop them wherever you want. You do need to install the above
367 package before you can use any of the items below.
370 Apps/wxPython Demo An application bundle version of the demo.
371 (This has it's own copy of the sources within
374 Apps/XRCed An application for editing wxPython resource
377 Apps/PyCrust An application that provides an interactive
378 Python shell and also namespace inspectors.
382 Docs/wxDocsViewer An application that allows you to view the
383 wxWidgets documentation.
385 Docs/licence License files.
387 Docs/other A few readmes, change log, etc.
390 Samples/samples Several small sample applications that
391 demonstrate how to use wxPython.
393 Samples/demo A copy of the wxPython demo source code,
394 just open the folder and run demo.pyw.
399 # PyAlaMode An extension of PyCrust that includes source
400 # file editing capabilities.
404 if [ ! -e $TARBALLDIR/wxPython
-docs-$VERSION.
tar.gz
]; then
405 cat > "$DMGDIR/root/Docs/Build ERROR.txt" <<EOF
407 The wxPython-docs tarball was not found when building this disk image!
413 tar xzvf
$TARBALLDIR/wxPython
-docs-$VERSION.
tar.gz
416 # Make an app to launch viewdocs.py
417 $PYTHONW $PROGDIR/..
/buildapp.py \
418 --builddir=$DMGDIR/root
/Docs \
419 --name=wxDocsViewer \
420 --mainprogram=$BUILDROOT/wxPython
-$VERSION/docs
/viewdocs.py \
421 --iconfile=$PROGDIR/Info.icns \
424 cp $BUILDROOT/wxPython
-$VERSION/docs
/*.
zip $DMGDIR/root
/Docs
/wxDocsViewer.app
/Contents
/Resources
426 cat > "$DMGDIR/root/Docs/README 1st.txt" <<EOF
428 The wxDocsViewer application needs to be copied to your Desktop (or
429 someplace else you have write access to) before you can run it, so it
430 can cache some indexes within its bundle.
436 # license files, docs, etc.
437 pushd $DMGDIR/root
/Docs
438 cp -pR $SRCROOT/wxPython
/licence .
439 cp -pR $SRCROOT/wxPython
/docs .
446 if [ ! -e $TARBALLDIR/wxPython
-demo-$VERSION.
tar.gz
]; then
447 cat > "$DMGDIR/root/Samples/Build ERROR.txt" <<EOF
449 The wxPython-demo tarball was not found when building this disk image!
452 cp "$DMGDIR/root/Samples/Build ERROR.txt" $DMGDIR/root
/Apps
456 # Copy the demo and samples to the disk image from the tarball
457 pushd $DMGDIR/root
/Samples
458 tar xzvf
$TARBALLDIR/wxPython
-demo-$VERSION.
tar.gz
459 mv wxPython
-$VERSION/* .
460 rm -rf wxPython
-$VERSION
461 rm demo
/b demo
/.setup.sh
462 mv demo
/demo.py demo
/demo.pyw
465 # Make an app bundle to run the demo
466 $PYTHONW $PROGDIR/..
/buildapp.py \
467 --builddir=$DMGDIR/root
/Apps \
468 --name="wxPython Demo" \
469 --mainprogram=$DMGDIR/root
/Samples
/demo
/demo.pyw \
470 --iconfile=$PROGDIR/RunDemo.icns \
472 cp -pR $DMGDIR/root
/Samples
/demo
/* "$DMGDIR/root/Apps/wxPython Demo.app/Contents/Resources"
476 # Make an app bundle to launch PyCrust
477 $PYTHONW $PROGDIR/..
/buildapp.py \
478 --builddir=$DMGDIR/root
/Apps \
480 --mainprogram=$INSTALLROOT$BINPREFIX/pycrust.py \
481 --iconfile=$PROGDIR/PieShell.icns \
485 # $PYTHONW $PROGDIR/../buildapp.py \
486 # --builddir=$DMGDIR/root \
488 # --mainprogram=$INSTALLROOT$BINPREFIX/pyalamode.py \
489 # --iconfile=$PROGDIR/PieShell.icns \
492 # Make an app to launch XRCed
493 $PYTHONW $PROGDIR/..
/buildapp.py \
494 --builddir=$DMGDIR/root
/Apps \
496 --mainprogram=$INSTALLROOT$BINPREFIX/xrced.py \
497 --iconfile=$PROGDIR/XRCed.icns \
502 # and then finally make a disk image containing the packages and etc.
503 $PROGDIR/..
/makedmg
$DMGDIR/root
$DMGDIR wxPython
${SHORTVER}-osx-$CHARTYPE-$VERSION-$KIND-py$PYVER
505 echo Moving
$DMGDIR/wxPython
${SHORTVER}-osx-$CHARTYPE-$VERSION-$KIND-py$PYVER.dmg to
$DESTDIR
506 mv $DMGDIR/wxPython
${SHORTVER}-osx-$CHARTYPE-$VERSION-$KIND-py$PYVER.dmg
$DESTDIR
510 # Cleanup build/install dirs
511 if [ $skipclean != yes ]; then
512 echo "Cleaning up..."
515 echo "Cleanup is disabled. You should remove $TMPDIR when finished"