]>
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 " skipconfig Don't run configure"
33 echo " skipbuild Don't build wxWidgets or wxPython"
34 echo " skipinstall Don't do the installation step"
35 echo " skipdmg Don't make the package or diskimage"
36 echo " skipclean Don't do the cleanup at the end"
48 panther
) PYTHON
=/usr
/bin
/python
;;
49 jaguar
) PYTHON
=/usr
/local
/bin
/python
;;
59 skipconfig
) skipconfig
=1; skiptar
=1 ;;
60 skipbuild
) skipbuild
=1; skipconfig
=1; skiptar
=1 ;;
61 skipinstall
) skipinstall
=1 ;;
63 skipclean
) skipclean
=1 ;;
65 *) echo "Unknown flag \"${flag}\""
72 VERSION
=`$PYTHON -c "import setup;print setup.VERSION"`
73 PYVER
=`$PYTHON -c "import sys; print sys.version[:3]"`
74 PYPREFIX
=`$PYTHON -c "import sys; print sys.exec_prefix"`
75 PYLIB
=$PYPREFIX/lib
/python
$PYVER
76 SITEPACKAGES
=$PYLIB/site
-packages
78 if [ -z "$TARBALLDIR" ]; then
80 # this is a spot on my fileserver where the tarballs go, adjust
81 # as needed for where you put the wxPython tarball...
82 TARBALLDIR
=/stuff
/Development
/wxPython
/dist
/$VERSION
85 TARBALL
=$TARBALLDIR/wxPythonSrc
-$VERSION.
tar.gz
87 PREFIX
=/usr
/local
/lib
/wxPython
-$VERSION
88 BINPREFIX
=/usr
/local
/bin
91 PROGDIR
="`dirname \"$0\"`"
92 TMPDIR
=$PWD/_build_dmg
94 BUILDROOT
=$TMPDIR/build
95 INSTALLROOT
=$TMPDIR/install
96 INSTALLDEVEL
=$TMPDIR/install-devel
98 RESOURCEDIR
=$PROGDIR/resources
100 SRCROOT
=$BUILDROOT/wxPythonSrc
-$VERSION
103 #----------------------------------------------------------------------
107 mkdir -p $INSTALLROOT
108 #mkdir -p $INSTALLDEVEL
110 mkdir -p $DMGDIR/root
/Apps
111 mkdir -p $DMGDIR/root
/Docs
112 mkdir -p $DMGDIR/root
/Samples
118 #----------------------------------------------------------------------
121 if [ -z "$skiptar" ]; then
122 echo Unarchiving tarball...
126 cd wxPythonSrc
-$VERSION
131 #----------------------------------------------------------------------
134 # Configure wxWidgets
135 if [ -z "$skipconfig" ]; then
139 --disable-monolithic \
144 --enable-precomp=no \
147 ## --enable-optimise \
148 ## --with-libjpeg=builtin \
149 ## --with-libpng=builtin \
150 ## --with-libtiff=builtin \
151 ## --with-zlib=builtin \
155 # Build wxWidgets and wxPython
156 if [ -z "$skipbuild" ]; then
158 # Make wxWidgets and some contribs
160 make -C contrib
/src
/gizmos
161 make -C contrib
/src
/ogl CXXFLAGS
="-DwxUSE_DEPRECATED=0"
162 make -C contrib
/src
/stc
163 make -C contrib
/src
/xrc
165 # if [ ! -e $WXDIR/include/wx/gizmos ]; then
166 # # Make some links so the wxPython build can find all the headers it needs
167 # pushd $WXDIR/include/wx
168 # ln -s ../../contrib/include/wx/* .
176 WX_CONFIG
="$WXDIR/bld/wx-config --inplace" \
180 # Build wxrc (XRC resource tool)
181 cd $WXDIR/bld
/contrib
/utils
/wxrc
187 #----------------------------------------------------------------------
189 if [ -z "$skipinstall" ]; then
192 make prefix
=$INSTALLROOT$PREFIX install
193 make -C contrib
/src
/gizmos prefix
=$INSTALLROOT$PREFIX install
194 make -C contrib
/src
/ogl CXXFLAGS
="-DwxUSE_DEPRECATED=0" prefix
=$INSTALLROOT/$PREFIX install
195 make -C contrib
/src
/stc prefix
=$INSTALLROOT$PREFIX install
196 make -C contrib
/src
/xrc prefix
=$INSTALLROOT$PREFIX install
203 WX_CONFIG
="$INSTALLROOT/$PREFIX/bin/wx-config --prefix=$INSTALLROOT/$PREFIX" \
208 # Apple's Python (on Panther) sym-links the site-packages dir to
209 # /Library/Python/$PYVER so we need to move the files so they are
210 # installed in the physical location, not the virtual one.
211 if [ "$KIND" = "panther" ]; then
212 mkdir -p $INSTALLROOT/Library
/Python
/$PYVER
213 mv $INSTALLROOT/$SITEPACKAGES/* $INSTALLROOT/Library
/Python
/$PYVER
214 rm -r $INSTALLROOT/System
215 SITEPACKAGES
=/Library
/Python
/$PYVER
219 # install wxPython's tool scripts
220 mkdir -p $INSTALLROOT$BINPREFIX
221 cd $WXDIR/wxPython
/scripts
222 python
$PYVER CreateMacScripts.py
$INSTALLROOT $BINPREFIX
226 cp $WXDIR/bld
/contrib
/utils
/wxrc
/wxrc
$INSTALLROOT$BINPREFIX
229 # Set premissions for files in $INSTALLROOT
230 if [ "$UID" = "0" ]; then
231 chown
-R root
:admin
$INSTALLROOT
232 chmod -R g
+w
$INSTALLROOT
238 #----------------------------------------------------------------------
240 # Make the Installer packages and disk image
241 if [ -z "$skipdmg" ]; then
243 # Remove the .pyc/.pyo files they just take up space and can be recreated
244 # during the install.
245 $PYTHON $PROGDIR/..
/zappycfiles.py
$INSTALLROOT
248 # Make the welcome message
250 panther
) W_MSG
="the Panther (OS X 10.3.x) version of" ;;
251 jaguar
) W_MSG
="the Jaguar (OS X 10.2.x) version of" ;;
253 cat > $RESOURCEDIR/Welcome.txt
<<EOF
256 This program will install wxPython $VERSION for $W_MSG MacPython-OSX $PYVER.
258 You must install onto your current boot disk, even though the installer does not enforce this, otherwise things will not work.
263 # make the preflight script
264 cat > $RESOURCEDIR/preflight
<<EOF
266 # Cleanup any old install of the wxPython package
267 rm -rf \$2$SITEPACKAGES/wxPython
268 rm -rf \$2$SITEPACKAGES/wx
271 chmod +x
$RESOURCEDIR/preflight
273 # make the postflight script
274 cat > $RESOURCEDIR/postflight
<<EOF
276 # Compile the .py files in the wxPython pacakge
277 $PYTHON \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wxPython
278 $PYTHON \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wx
279 $PYTHON -O \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wxPython
280 $PYTHON -O \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wx
283 # and all of the wxPython pacakge should be group writable
284 chgrp -R admin \$2$SITEPACKAGES/wxPython
285 chmod -R g+w \$2$SITEPACKAGES/wxPython
286 chgrp -R admin \$2$SITEPACKAGES/wx
287 chmod -R g+w \$2$SITEPACKAGES/wx
291 chmod +x
$RESOURCEDIR/postflight
295 # Build the main Installer Package...
296 rm -rf wxPythonOSX
-$KIND.pkg
297 python
$PROGDIR/..
/buildpkg.py \
298 --Title=wxPythonOSX
-$KIND \
300 --Description="wxPython $VERSION for $W_MSG MacPython-OSX $PYVER" \
301 --NeedsAuthorization="YES" \
303 --InstallOnly="YES" \
307 mv wxPythonOSX
-$KIND.pkg
$DMGDIR/root
311 # Make a README.txt to go on the disk image
312 cat > "$DMGDIR/root/README 1st.txt" <<EOF
315 On this disk image you will find the installer for wxPython $VERSION for $W_MSG MacPython-OSX $PYVER. MacPython-OSX is not included.
317 wxPython-$KIND.pkg The installer package. It contains the wxPython
318 extension modules, wxMac dynamic libraries and
319 headers, and some scripts for the command-line
322 Everything else here is optional and you can drag them out of the disk
323 image and drop them whereever you want. You do need to install the above
324 package before you can use any of the items below.
327 Apps/wxPython Demo An application bundle version of the demo.
328 (This has it's own copy of the sources within
331 Apps/XRCed An application for editing wxPython resource
334 Apps/PyCrust An application that provides an interactive
335 Python shell and also namespace inspectors.
339 Docs/wxDocsViewer An application that allows you to view the
340 wxWidgets documentation.
342 Docs/licence License files.
344 Docs/other A few readmes, change log, etc.
347 Samples/samples Several small sample applications that
348 demonstrate how to use wxPython.
350 Samples/demo A copy of the wxPython demo source code,
351 just open the folder and run demo.pyw.
356 # PyAlaMode An extension of PyCrust that includes source
357 # file editing capabilities.
362 tar xzvf
$TARBALLDIR/wxPythonDocs
-$VERSION.
tar.gz
365 # Make an app to launch viewdocs.py
366 $PYTHONW $PROGDIR/..
/buildapp.py \
367 --builddir=$DMGDIR/root
/Docs \
368 --name=wxDocsViewer \
369 --mainprogram=$BUILDROOT/wxPython
-$VERSION/docs
/viewdocs.py \
370 --iconfile=$PROGDIR/Info.icns \
373 cp $BUILDROOT/wxPython
-$VERSION/docs
/*.
zip $DMGDIR/root
/Docs
/wxDocsViewer.app
/Contents
/Resources
375 cat > "$DMGDIR/root/Docs/README 1st.txt" <<EOF
377 The wxDocsViewer application needs to be copied to your Desktop (or
378 someplace else you have write access to) before you can run it, so it
379 can cache some indexes within its bundle.
383 # license files, docs, etc.
384 pushd $DMGDIR/root
/Docs
385 cp -pR $SRCROOT/wxPython
/licence .
386 cp -pR $SRCROOT/wxPython
/docs .
392 # Copy the demo and samples to the disk image from the tarball
393 pushd $DMGDIR/root
/Samples
394 tar xzvf
$TARBALLDIR/wxPythonDemo
-$VERSION.
tar.gz
395 mv wxPython
-$VERSION/* .
396 rm -rf wxPython
-$VERSION
397 rm demo
/b demo
/.setup.sh
398 mv demo
/demo.py demo
/demo.pyw
402 # Make an app bundle to launch PyCrust
403 $PYTHONW $PROGDIR/..
/buildapp.py \
404 --builddir=$DMGDIR/root
/Apps \
406 --mainprogram=$INSTALLROOT$BINPREFIX/pycrust.py \
407 --iconfile=$PROGDIR/PieShell.icns \
411 # $PYTHONW $PROGDIR/../buildapp.py \
412 # --builddir=$DMGDIR/root \
414 # --mainprogram=$INSTALLROOT$BINPREFIX/pyalamode.py \
415 # --iconfile=$PROGDIR/PieShell.icns \
418 # Make an app to launch XRCed
419 $PYTHONW $PROGDIR/..
/buildapp.py \
420 --builddir=$DMGDIR/root
/Apps \
422 --mainprogram=$INSTALLROOT$BINPREFIX/xrced.py \
423 --iconfile=$PROGDIR/XRCed.icns \
426 # Make an app bundle to run the demo
427 $PYTHONW $PROGDIR/..
/buildapp.py \
428 --builddir=$DMGDIR/root
/Apps \
429 --name="wxPython Demo" \
430 --mainprogram=$DMGDIR/root
/Samples
/demo
/demo.pyw \
431 --iconfile=$PROGDIR/RunDemo.icns \
433 cp -pR $DMGDIR/root
/Samples
/demo
/* "$DMGDIR/root/Apps/wxPython Demo.app/Contents/Resources"
436 # and then finally make a disk image containing the packages and etc.
437 $PROGDIR/..
/makedmg
$DMGDIR/root
$DMGDIR wxPythonOSX
-$VERSION-$KIND-Py$PYVER
439 echo Moving
$DMGDIR/wxPythonOSX
-$VERSION-$KIND-Py$PYVER.dmg to
$DESTDIR
440 mv $DMGDIR/wxPythonOSX
-$VERSION-$KIND-Py$PYVER.dmg
$DESTDIR
444 # Cleanup build/install dirs
445 if [ -z "$skipclean" ]; then
446 echo "Cleaning up..."
449 echo "Cleanup is disabled. You should remove $TMPDIR when finished"