]>
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 #----------------------------------------------------------------------
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 wxWindows 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 SRCDIR
=/stuff
/Development
/wxPython
/dist
/$VERSION
74 TARBALL
=$SRCDIR/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
92 #----------------------------------------------------------------------
97 #mkdir -p $INSTALLDEVEL
104 #----------------------------------------------------------------------
107 if [ -z "$skiptar" ]; then
108 echo Unarchiving tarball...
112 if [ "$use_cvs" = 1 ]; then
113 # copy the cvs workspace, except for build dirs
115 mkdir -p wxPythonSrc
-$VERSION
117 echo Finding updated files...
118 if [ -e .last_copy
]; then
119 FEXPR
="-cnewer .last_copy"
122 find $WXROOT $FEXPR -print \
123 | grep -v $WXROOT/bld \
124 | grep -v wxPython
/build \
125 | grep -v wxPython
/_build \
128 | cut
-b ${#MEASURE}- > filelist
130 for x
in `cat filelist`; do
131 if [ -d "$WXROOT/$x" ]; then
132 mkdir -p "wxPythonSrc-$VERSION/$x"
135 cp -p "$WXROOT/$x" "wxPythonSrc-$VERSION/$x"
143 cd wxPythonSrc
-$VERSION
148 #----------------------------------------------------------------------
151 # Configure wxWindows
152 if [ -z "$skipconfig" ]; then
156 --disable-monolithic \
162 --enable-precomp=no \
164 --with-libjpeg=builtin \
165 --with-libpng=builtin \
166 --with-libtiff=builtin \
167 --with-zlib=builtin \
173 # Build wxWindows and wxPython
174 if [ -z "$skipbuild" ]; then
176 # Make wxWindows and some contribs
178 make -C contrib
/src
/gizmos
179 make -C contrib
/src
/ogl CXXFLAGS
="-DwxUSE_DEPRECATED=0"
180 make -C contrib
/src
/stc
181 make -C contrib
/src
/xrc
183 if [ ! -e $WXDIR/include
/wx
/gizmos
]; then
184 # Make some links so the wxPython build can find all the headers it needs
185 pushd $WXDIR/include
/wx
186 ln -s ..
/..
/contrib
/include
/wx
/* .
194 WX_CONFIG
="$WXDIR/bld/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/bld" \
198 # Build wxrc (XRC resource tool)
199 cd $WXDIR/bld
/contrib
/utils
/wxrc
205 #----------------------------------------------------------------------
207 if [ -z "$skipinstall" ]; then
210 make prefix
=$INSTALLROOT$PREFIX install
211 make -C contrib
/src
/gizmos prefix
=$INSTALLROOT$PREFIX install
212 make -C contrib
/src
/ogl CXXFLAGS
="-DwxUSE_DEPRECATED=0" prefix
=$INSTALLROOT/$PREFIX install
213 make -C contrib
/src
/stc prefix
=$INSTALLROOT$PREFIX install
214 make -C contrib
/src
/xrc prefix
=$INSTALLROOT$PREFIX install
221 WX_CONFIG
="$INSTALLROOT/$PREFIX/bin/wx-config --prefix=$INSTALLROOT/$PREFIX" \
226 # Apple's Python (on Panther) sym-links the site-packages dir to
227 # /Library/Python/$PYVER so we need to move the files so they are
228 # installed in the physical location, not the virtual one.
229 if [ "$KIND" = "panther" ]; then
230 mkdir -p $INSTALLROOT/Library
/Python
/$PYVER
231 mv $INSTALLROOT/$SITEPACKAGES/* $INSTALLROOT/Library
/Python
/$PYVER
232 rm -r $INSTALLROOT/System
233 SITEPACKAGES
=/Library
/Python
/$PYVER
237 # install wxPython's tool scripts
238 mkdir -p $INSTALLROOT$BINPREFIX
239 cd $WXDIR/wxPython
/scripts
240 python
$PYVER CreateMacScripts.py
$INSTALLROOT $BINPREFIX
244 cp $WXDIR/bld
/contrib
/utils
/wxrc
/wxrc
$INSTALLROOT$BINPREFIX
247 # install the wxPython headers
249 cp -R include
$INSTALLROOT$PREFIX
250 mkdir -p $INSTALLROOT$PREFIX/include
/wx
/wxPython
/i_files
251 cp src
/*.i
$INSTALLROOT$PREFIX/include
/wx
/wxPython
/i_files
254 # Set premissions for files in $INSTALLROOT
255 chown
-R root
:admin
$INSTALLROOT
256 chmod -R g
+w
$INSTALLROOT
261 #----------------------------------------------------------------------
263 # Make the Installer packages and disk image
264 if [ -z "$skipdmg" ]; then
266 # Remove the .pyc/.pyo files they just take up space and can be recreated
267 # during the install.
268 $PYTHON $PROGDIR/..
/zappycfiles.py
$INSTALLROOT
271 # Make the welcome message
273 panther
) W_MSG
="the Panther (OS X 10.3.x) version of" ;;
274 jaguar
) W_MSG
="the Jaguar (OS X 10.2.x) version of" ;;
276 cat > $RESOURCEDIR/Welcome.txt
<<EOF
279 This program will install wxPython $VERSION for $W_MSG MacPython-OSX $PYVER.
281 You must install onto your current boot disk, even though the installer does not enforce this, otherwise things will not work.
286 # make the preflight script
287 cat > $RESOURCEDIR/preflight
<<EOF
289 # Cleanup any old install of the wxPython package
290 rm -rf \$2$SITEPACKAGES/wxPython
291 rm -rf \$2$SITEPACKAGES/wx
294 chmod +x
$RESOURCEDIR/preflight
296 # make the postflight script
297 cat > $RESOURCEDIR/postflight
<<EOF
299 # Compile the .py files in the wxPython pacakge
300 $PYTHON \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wxPython
301 $PYTHON \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wx
302 $PYTHON -O \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wxPython
303 $PYTHON -O \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wx
306 # and all of the wxPython pacakge should be group writable
307 chgrp -R admin \$2$SITEPACKAGES/wxPython
308 chmod -R g+w \$2$SITEPACKAGES/wxPython
309 chgrp -R admin \$2$SITEPACKAGES/wx
310 chmod -R g+w \$2$SITEPACKAGES/wx
314 chmod +x
$RESOURCEDIR/postflight
318 # Build the main Installer Package...
319 rm -rf wxPythonOSX
-$KIND.pkg
320 python
$PROGDIR/..
/buildpkg.py \
321 --Title=wxPythonOSX
-$KIND \
323 --Description="wxPython $VERSION for $W_MSG MacPython-OSX $PYVER" \
324 --NeedsAuthorization="YES" \
326 --InstallOnly="YES" \
330 mv wxPythonOSX
-$KIND.pkg
$DMGDIR/root
334 # Make a README.txt to go on the disk image
335 cat > "$DMGDIR/root/README 1st.txt" <<EOF
338 On this disk image you will find the installer for wxPython $VERSION for $W_MSG MacPython-OSX $PYVER. MacPython-OSX is not included.
340 wxPython-$KIND.pkg The installer package. It contains the wxPython
341 extension modules, wxMac dynamic libraries and
342 headers, and some scripts for the command-line
345 Everything else here is optional and you can drag them out of the disk
346 image and drop them whereever you want. You do need to install the above
347 package before you can use any of the items below.
349 docs/ A few readmes, change log, etc. The full
350 documentation is downloadable separately.
352 licence/ License docs.
354 demo/ A copy of the wxPython demo source code,
355 just open the folder and run demo.py.
357 samples/ Several small sample applications that
358 demonstrate how to use wxPython.
360 wxPython Demo An application bundle version of the demo.
361 (This has it's own copy of the sources within
364 XRCed An application for editing wxPython resource
367 PyCrust An application that provides an interactive
368 Python shell and also namespace inspectors.
373 # PyAlaMode An extension of PyCrust that includes source
374 # file editing capabilities.
377 # license files, docs, etc.
378 cp -pR $WXDIR/wxPython
/licence
$DMGDIR/root
379 rm -rf $WXDIR/wxPython
/docs
/xml
-raw
380 cp -pR $WXDIR/wxPython
/docs
$DMGDIR/root
381 rm -rf $DMGDIR/root
/docs
/bin
383 # Copy the demo and samples to the disk image
384 cp -pR $WXDIR/wxPython
/demo
$DMGDIR/root
385 cp -pR $WXDIR/wxPython
/samples
$DMGDIR/root
386 rm $DMGDIR/root
/demo
/b
389 # Make an app bundle to launch PyCrust
390 $PYTHONW $PROGDIR/..
/buildapp.py \
391 --builddir=$DMGDIR/root \
393 --mainprogram=$INSTALLROOT$BINPREFIX/pycrust.py \
394 --iconfile=$PROGDIR/PieShell.icns \
398 # $PYTHONW $PROGDIR/../buildapp.py \
399 # --builddir=$DMGDIR/root \
401 # --mainprogram=$INSTALLROOT$BINPREFIX/pyalamode.py \
402 # --iconfile=$PROGDIR/PieShell.icns \
405 # Make an app to launch XRCed
406 $PYTHONW $PROGDIR/..
/buildapp.py \
407 --builddir=$DMGDIR/root \
409 --mainprogram=$INSTALLROOT$BINPREFIX/xrced.py \
410 --iconfile=$PROGDIR/XRCed.icns \
413 # Make an app bundle to run the demo
414 $PYTHONW $PROGDIR/..
/buildapp.py \
415 --builddir=$DMGDIR/root \
416 --name="wxPython Demo" \
417 --mainprogram=$DMGDIR/root
/demo
/demo.py \
418 --iconfile=$PROGDIR/RunDemo.icns \
420 cp -pR $DMGDIR/root
/demo
/* "$DMGDIR/root/wxPython Demo.app/Contents/Resources"
423 # and then finally make a disk image containing the packages and etc.
424 $PROGDIR/..
/makedmg
$DMGDIR/root
$DMGDIR wxPythonOSX
-$VERSION-$KIND-Py$PYVER
426 echo Moving
$DMGDIR/wxPythonOSX
-$VERSION-$KIND-Py$PYVER.dmg to
$DESTDIR
427 mv $DMGDIR/wxPythonOSX
-$VERSION-$KIND-Py$PYVER.dmg
$DESTDIR
431 # Cleanup build/install dirs
432 if [ -z "$skipclean" ]; then
433 echo "Cleaning up..."
436 echo "Cleanup is disabled. You should remove $TMPDIR when finished"