]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/distrib/mac/wxPythonOSX/build
bb766cb256940af25cc16edd6f6c7658fa6f97b4
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 #----------------------------------------------------------------------
18 echo "Usage: $0 [panther|jaguar] [command flags...]"
20 echo " panther Build for Apple's python in /usr/bin, such as on Panther"
21 echo " jaguar Build for a python in /usr/local/bin, such as on Jaguar"
23 echo "optional command flags:"
24 echo " skiptar Don't unpack the tarball"
25 echo " use_cvs Use the CVS workspace instead of a tarfile"
26 echo " skipconfig Don't run configure"
27 echo " skipbuild Don't build wxWidgets or wxPython"
28 echo " skipinstall Don't do the installation step"
29 echo " skipdmg Don't make the package or diskimage"
30 echo " skipclean Don't do the cleanup at the end"
42 panther
) PYTHON
=/usr
/bin
/python
;;
43 jaguar
) PYTHON
=/usr
/local
/bin
/python
;;
53 use_cvs
) skiptar
=1; use_cvs
=1 ;;
54 skipconfig
) skipconfig
=1; skiptar
=1 ;;
55 skipbuild
) skipbuild
=1; skipconfig
=1; skiptar
=1 ;;
56 skipinstall
) skipinstall
=1 ;;
58 skipclean
) skipclean
=1 ;;
60 *) echo "Unknown flag \"${flag}\""
67 VERSION
=`$PYTHON -c "import setup;print setup.VERSION"`
68 PYVER
=`$PYTHON -c "import sys; print sys.version[:3]"`
69 PYPREFIX
=`$PYTHON -c "import sys; print sys.exec_prefix"`
70 PYLIB
=$PYPREFIX/lib
/python
$PYVER
71 SITEPACKAGES
=$PYLIB/site
-packages
73 TARBALLDIR
=/stuff
/Development
/wxPython
/dist
/$VERSION
74 TARBALL
=$TARBALLDIR/wxPythonSrc
-$VERSION.
tar.gz
76 PREFIX
=/usr
/lib
/wxPython
-$VERSION
80 PROGDIR
="`dirname \"$0\"`"
81 TMPDIR
=$PWD/_build_dmg
83 BUILDROOT
=$TMPDIR/build
84 INSTALLROOT
=$TMPDIR/install
85 INSTALLDEVEL
=$TMPDIR/install-devel
87 RESOURCEDIR
=$PROGDIR/resources
89 SRCROOT
=$BUILDROOT/wxPythonSrc
-$VERSION
92 #----------------------------------------------------------------------
97 #mkdir -p $INSTALLDEVEL
99 mkdir -p $DMGDIR/root
/Apps
100 mkdir -p $DMGDIR/root
/Docs
101 mkdir -p $DMGDIR/root
/Samples
107 #----------------------------------------------------------------------
110 if [ -z "$skiptar" ]; then
111 echo Unarchiving tarball...
115 if [ "$use_cvs" = 1 ]; then
116 # copy the cvs workspace, except for build dirs
118 mkdir -p wxPythonSrc
-$VERSION
120 echo Finding updated files...
121 if [ -e .last_copy
]; then
122 FEXPR
="-cnewer .last_copy"
125 find $WXROOT $FEXPR -print \
126 | grep -v $WXROOT/bld \
127 | grep -v wxPython
/build \
128 | grep -v wxPython
/_build \
131 | cut
-b ${#MEASURE}- > filelist
133 for x
in `cat filelist`; do
134 if [ -d "$WXROOT/$x" ]; then
135 mkdir -p "wxPythonSrc-$VERSION/$x"
138 cp -p "$WXROOT/$x" "wxPythonSrc-$VERSION/$x"
146 cd wxPythonSrc
-$VERSION
151 #----------------------------------------------------------------------
154 # Configure wxWidgets
155 if [ -z "$skipconfig" ]; then
159 --disable-monolithic \
164 --enable-precomp=no \
167 ## --enable-optimise \
168 ## --with-libjpeg=builtin \
169 ## --with-libpng=builtin \
170 ## --with-libtiff=builtin \
171 ## --with-zlib=builtin \
175 # Build wxWidgets and wxPython
176 if [ -z "$skipbuild" ]; then
178 # Make wxWidgets and some contribs
180 make -C contrib
/src
/gizmos
181 make -C contrib
/src
/ogl CXXFLAGS
="-DwxUSE_DEPRECATED=0"
182 make -C contrib
/src
/stc
183 make -C contrib
/src
/xrc
185 if [ ! -e $WXDIR/include
/wx
/gizmos
]; then
186 # Make some links so the wxPython build can find all the headers it needs
187 pushd $WXDIR/include
/wx
188 ln -s ..
/..
/contrib
/include
/wx
/* .
196 WX_CONFIG
="$WXDIR/bld/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/bld" \
200 # Build wxrc (XRC resource tool)
201 cd $WXDIR/bld
/contrib
/utils
/wxrc
207 #----------------------------------------------------------------------
209 if [ -z "$skipinstall" ]; then
212 make prefix
=$INSTALLROOT$PREFIX install
213 make -C contrib
/src
/gizmos prefix
=$INSTALLROOT$PREFIX install
214 make -C contrib
/src
/ogl CXXFLAGS
="-DwxUSE_DEPRECATED=0" prefix
=$INSTALLROOT/$PREFIX install
215 make -C contrib
/src
/stc prefix
=$INSTALLROOT$PREFIX install
216 make -C contrib
/src
/xrc prefix
=$INSTALLROOT$PREFIX install
223 WX_CONFIG
="$INSTALLROOT/$PREFIX/bin/wx-config --prefix=$INSTALLROOT/$PREFIX" \
228 # Apple's Python (on Panther) sym-links the site-packages dir to
229 # /Library/Python/$PYVER so we need to move the files so they are
230 # installed in the physical location, not the virtual one.
231 if [ "$KIND" = "panther" ]; then
232 mkdir -p $INSTALLROOT/Library
/Python
/$PYVER
233 mv $INSTALLROOT/$SITEPACKAGES/* $INSTALLROOT/Library
/Python
/$PYVER
234 rm -r $INSTALLROOT/System
235 SITEPACKAGES
=/Library
/Python
/$PYVER
239 # install wxPython's tool scripts
240 mkdir -p $INSTALLROOT$BINPREFIX
241 cd $WXDIR/wxPython
/scripts
242 python
$PYVER CreateMacScripts.py
$INSTALLROOT $BINPREFIX
246 cp $WXDIR/bld
/contrib
/utils
/wxrc
/wxrc
$INSTALLROOT$BINPREFIX
249 # # install the wxPython headers
251 # cp -R include $INSTALLROOT$PREFIX
252 # mkdir -p $INSTALLROOT$PREFIX/include/wx/wxPython/i_files
253 # cp src/*.i $INSTALLROOT$PREFIX/include/wx/wxPython/i_files
256 # Set premissions for files in $INSTALLROOT
257 chown
-R root
:admin
$INSTALLROOT
258 chmod -R g
+w
$INSTALLROOT
263 #----------------------------------------------------------------------
265 # Make the Installer packages and disk image
266 if [ -z "$skipdmg" ]; then
268 # Remove the .pyc/.pyo files they just take up space and can be recreated
269 # during the install.
270 $PYTHON $PROGDIR/..
/zappycfiles.py
$INSTALLROOT
273 # Make the welcome message
275 panther
) W_MSG
="the Panther (OS X 10.3.x) version of" ;;
276 jaguar
) W_MSG
="the Jaguar (OS X 10.2.x) version of" ;;
278 cat > $RESOURCEDIR/Welcome.txt
<<EOF
281 This program will install wxPython $VERSION for $W_MSG MacPython-OSX $PYVER.
283 You must install onto your current boot disk, even though the installer does not enforce this, otherwise things will not work.
288 # make the preflight script
289 cat > $RESOURCEDIR/preflight
<<EOF
291 # Cleanup any old install of the wxPython package
292 rm -rf \$2$SITEPACKAGES/wxPython
293 rm -rf \$2$SITEPACKAGES/wx
296 chmod +x
$RESOURCEDIR/preflight
298 # make the postflight script
299 cat > $RESOURCEDIR/postflight
<<EOF
301 # Compile the .py files in the wxPython pacakge
302 $PYTHON \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wxPython
303 $PYTHON \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wx
304 $PYTHON -O \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wxPython
305 $PYTHON -O \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wx
308 # and all of the wxPython pacakge should be group writable
309 chgrp -R admin \$2$SITEPACKAGES/wxPython
310 chmod -R g+w \$2$SITEPACKAGES/wxPython
311 chgrp -R admin \$2$SITEPACKAGES/wx
312 chmod -R g+w \$2$SITEPACKAGES/wx
316 chmod +x
$RESOURCEDIR/postflight
320 # Build the main Installer Package...
321 rm -rf wxPythonOSX
-$KIND.pkg
322 python
$PROGDIR/..
/buildpkg.py \
323 --Title=wxPythonOSX
-$KIND \
325 --Description="wxPython $VERSION for $W_MSG MacPython-OSX $PYVER" \
326 --NeedsAuthorization="YES" \
328 --InstallOnly="YES" \
332 mv wxPythonOSX
-$KIND.pkg
$DMGDIR/root
336 # Make a README.txt to go on the disk image
337 cat > "$DMGDIR/root/README 1st.txt" <<EOF
340 On this disk image you will find the installer for wxPython $VERSION for $W_MSG MacPython-OSX $PYVER. MacPython-OSX is not included.
342 wxPython-$KIND.pkg The installer package. It contains the wxPython
343 extension modules, wxMac dynamic libraries and
344 headers, and some scripts for the command-line
347 Everything else here is optional and you can drag them out of the disk
348 image and drop them whereever you want. You do need to install the above
349 package before you can use any of the items below.
352 Apps/wxPython Demo An application bundle version of the demo.
353 (This has it's own copy of the sources within
356 Apps/XRCed An application for editing wxPython resource
359 Apps/PyCrust An application that provides an interactive
360 Python shell and also namespace inspectors.
364 Docs/wxDocsViewer An application that allows you to view the
365 wxWidgets documentation.
367 Docs/licence License files.
369 Docs/other A few readmes, change log, etc.
372 Samples/samples Several small sample applications that
373 demonstrate how to use wxPython.
375 Samples/demo A copy of the wxPython demo source code,
376 just open the folder and run demo.pyw.
381 # PyAlaMode An extension of PyCrust that includes source
382 # file editing capabilities.
387 tar xzvf
$TARBALLDIR/wxPythonDocs
-$VERSION.
tar.gz
390 # Make an app to launch viewdocs.py
391 $PYTHONW $PROGDIR/..
/buildapp.py \
392 --builddir=$DMGDIR/root
/Docs \
393 --name=wxDocsViewer \
394 --mainprogram=$BUILDROOT/wxPython
-$VERSION/docs
/viewdocs.py \
395 --iconfile=$PROGDIR/Info.icns \
398 cp $BUILDROOT/wxPython
-$VERSION/docs
/*.
zip $DMGDIR/root
/Docs
/wxDocsViewer.app
/Contents
/Resources
400 cat > "$DMGDIR/root/Docs/README 1st.txt" <<EOF
402 The wxDocsViewer application needs to be copied to your Desktop (or
403 someplace else you have write access to) before you can run it, so it
404 can cache some indexes within its bundle.
408 # license files, docs, etc.
409 pushd $DMGDIR/root
/Docs
410 cp -pR $SRCROOT/wxPython
/licence .
411 cp -pR $SRCROOT/wxPython
/docs .
417 # Copy the demo and samples to the disk image from the tarball
418 pushd $DMGDIR/root
/Samples
419 tar xzvf
$TARBALLDIR/wxPythonDemo
-$VERSION.
tar.gz
420 mv wxPython
-$VERSION/* .
421 rm -rf wxPython
-$VERSION
422 rm demo
/b demo
/.setup.sh
423 mv demo
/demo.py demo
/demo.pyw
427 # Make an app bundle to launch PyCrust
428 $PYTHONW $PROGDIR/..
/buildapp.py \
429 --builddir=$DMGDIR/root
/Apps \
431 --mainprogram=$INSTALLROOT$BINPREFIX/pycrust.py \
432 --iconfile=$PROGDIR/PieShell.icns \
436 # $PYTHONW $PROGDIR/../buildapp.py \
437 # --builddir=$DMGDIR/root \
439 # --mainprogram=$INSTALLROOT$BINPREFIX/pyalamode.py \
440 # --iconfile=$PROGDIR/PieShell.icns \
443 # Make an app to launch XRCed
444 $PYTHONW $PROGDIR/..
/buildapp.py \
445 --builddir=$DMGDIR/root
/Apps \
447 --mainprogram=$INSTALLROOT$BINPREFIX/xrced.py \
448 --iconfile=$PROGDIR/XRCed.icns \
451 # Make an app bundle to run the demo
452 $PYTHONW $PROGDIR/..
/buildapp.py \
453 --builddir=$DMGDIR/root
/Apps \
454 --name="wxPython Demo" \
455 --mainprogram=$DMGDIR/root
/Samples
/demo
/demo.pyw \
456 --iconfile=$PROGDIR/RunDemo.icns \
458 cp -pR $DMGDIR/root
/Samples
/demo
/* "$DMGDIR/root/Apps/wxPython Demo.app/Contents/Resources"
461 # and then finally make a disk image containing the packages and etc.
462 $PROGDIR/..
/makedmg
$DMGDIR/root
$DMGDIR wxPythonOSX
-$VERSION-$KIND-Py$PYVER
464 echo Moving
$DMGDIR/wxPythonOSX
-$VERSION-$KIND-Py$PYVER.dmg to
$DESTDIR
465 mv $DMGDIR/wxPythonOSX
-$VERSION-$KIND-Py$PYVER.dmg
$DESTDIR
469 # Cleanup build/install dirs
470 if [ -z "$skipclean" ]; then
471 echo "Cleaning up..."
474 echo "Cleanup is disabled. You should remove $TMPDIR when finished"