]>
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 [apple|local] [command flags...]"
20 echo " apple Build for Apple's python in /usr/bin"
21 echo " local Build for a locally installed python in /usr/local/bin"
22 echo " (for example Jaguar's MacPython)"
24 echo "optional command flags:"
25 echo " skiptar Don't unpack the tarball"
26 echo " use_cvs Use the CVS workspace instead of a tarfile"
27 echo " skipconfig Don't run configure"
28 echo " skipbuild Don't build wxWindows or wxPython"
29 echo " skipinstall Don't do the installation step"
30 echo " skipdmg Don't make the package or diskimage"
31 echo " skipclean Don't do the cleanup at the end"
43 apple
) PYTHON
=/usr
/bin
/python
;;
44 local) PYTHON
=/usr
/local
/bin
/python
;;
54 use_cvs
) skiptar
=1; use_cvs
=1 ;;
55 skipconfig
) skipconfig
=1; skiptar
=1 ;;
56 skipbuild
) skipbuild
=1; skipconfig
=1; skiptar
=1 ;;
57 skipinstall
) skipinstall
=1 ;;
59 skipclean
) skipclean
=1 ;;
61 *) echo "Unknown flag \"${flag}\""
68 VERSION
=`$PYTHON -c "import setup;print setup.VERSION"`
69 PYVER
=`$PYTHON -c "import sys; print sys.version[:3]"`
70 PYPREFIX
=`$PYTHON -c "import sys; print sys.exec_prefix"`
71 SITEPACKAGES
=$PYPREFIX/lib
/python
$PYVER/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 \
160 --enable-precomp=no \
162 --with-libjpeg=builtin \
163 --with-libpng=builtin \
164 --with-libtiff=builtin \
165 --with-zlib=builtin \
171 # Build wxWindows and wxPython
172 if [ -z "$skipbuild" ]; then
174 # Make wxWindows and some contribs
176 make -C contrib
/src
/gizmos
177 make -C contrib
/src
/ogl CXXFLAGS
="-DwxUSE_DEPRECATED=0"
178 make -C contrib
/src
/stc
179 make -C contrib
/src
/xrc
181 if [ ! -e $WXDIR/include
/wx
/gizmos
]; then
182 # Make some links so the wxPython build can find all the headers it needs
183 pushd $WXDIR/include
/wx
184 ln -s ..
/..
/contrib
/include
/wx
/* .
192 WX_CONFIG
="$WXDIR/bld/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/bld" \
196 # Build wxrc (XRC resource tool)
197 cd $WXDIR/bld
/contrib
/utils
/wxrc
203 #----------------------------------------------------------------------
206 if [ -z "$skipinstall" ]; then
208 make prefix
=$INSTALLROOT$PREFIX install
209 make -C contrib
/src
/gizmos prefix
=$INSTALLROOT$PREFIX install
210 make -C contrib
/src
/ogl CXXFLAGS
="-DwxUSE_DEPRECATED=0" prefix
=$INSTALLROOT/$PREFIX install
211 make -C contrib
/src
/stc prefix
=$INSTALLROOT$PREFIX install
212 make -C contrib
/src
/xrc prefix
=$INSTALLROOT$PREFIX install
219 WX_CONFIG
="$INSTALLROOT/$PREFIX/bin/wx-config --prefix=$INSTALLROOT/$PREFIX" \
224 # install wxPython's tool scripts
225 mkdir -p $INSTALLROOT$BINPREFIX
226 cd $WXDIR/wxPython
/scripts
227 python
$PYVER CreateMacScripts.py
$INSTALLROOT $BINPREFIX
230 cp $WXDIR/bld
/contrib
/utils
/wxrc
/wxrc
$INSTALLROOT$BINPREFIX
233 # install the wxPython headers
235 cp -R include
$INSTALLROOT$PREFIX
236 mkdir -p $INSTALLROOT$PREFIX/include
/wx
/wxPython
/i_files
237 cp src
/*.i
$INSTALLROOT$PREFIX/include
/wx
/wxPython
/i_files
240 # TODO for $INSTALLROOT and $INSTALLDEVEL ?
241 #chown -R root:admin $INSTALLROOT
242 #chmod -R g+w $INSTALLROOT
247 #----------------------------------------------------------------------
249 # Make the Installer packages and disk image
250 if [ -z "$skipdmg" ]; then
252 # Remove the .pyc/.pyo files they just take up space and can be recreated
253 # during the install.
254 $PYTHON $PROGDIR/..
/zappycfiles.py
$INSTALLROOT
257 # Make the welcome message
259 apple
) W_MSG
="an Apple installed (Panther) version of" ;;
260 local) W_MSG
="a locally built version (or Jaguar version) of" ;;
262 cat > $RESOURCEDIR/Welcome.txt
<<EOF
265 This program will install wxPython $VERSION for $W_MSG MacPython-OSX $PYVER.
270 # make the preflight script
271 cat > $RESOURCEDIR/preflight
<<EOF
273 # Cleanup any old install of the wxPython package
274 rm -rf \$2$SITEPACKAGES/wxPython
275 rm -rf \$2$SITEPACKAGES/wx
278 chmod +x
$RESOURCEDIR/preflight
280 # make the postflight script
281 cat > $RESOURCEDIR/postflight
<<EOF
283 # Compile the .py files in the wxPython pacakge
284 $PYTHON \$2$SITEPACKAGES/../compileall.py \$2$SITEPACKAGES/wxPython
285 $PYTHON \$2$SITEPACKAGES/../compileall.py \$2$SITEPACKAGES/wx
286 $PYTHON -O \$2$SITEPACKAGES/../compileall.py \$2$SITEPACKAGES/wxPython
287 $PYTHON -O \$2$SITEPACKAGES/../compileall.py \$2$SITEPACKAGES/wx
290 # and the wxPython pacakge should be group writable
291 chgrp -R admin \$2$SITEPACKAGES/wxPython
292 chmod -R g+w \$2$SITEPACKAGES/wxPython
293 chgrp -R admin \$2$SITEPACKAGES/wx
294 chmod -R g+w \$2$SITEPACKAGES/wx
298 chmod +x
$RESOURCEDIR/postflight
302 # Finally, build the main Installer Package...
303 rm -rf wxPythonOSX
-$KIND.pkg
304 python
$PROGDIR/..
/buildpkg.py \
305 --Title=wxPythonOSX
-$KIND \
307 --Description="wxPython $VERSION for $W_MSG MacPython-OSX $PYVER" \
308 --NeedsAuthorization="YES" \
310 --InstallOnly="YES" \
314 mv wxPythonOSX
-$KIND.pkg
$DMGDIR/root
317 # # and the devel package
318 # rm -rf wxPythonOSX-devel.pkg
319 # python $PROGDIR/../buildpkg.py \
320 # --Title=wxPythonOSX-devel \
321 # --Version=$VERSION \
322 # --Description="Headers and such that allow you to link with the same wxMac that wxPython does" \
323 # --NeedsAuthorization="YES" \
324 # --Relocatable="NO" \
325 # --InstallOnly="YES" \
328 # mv wxPythonOSX-devel.pkg $DMGDIR/root
331 # Make a README.txt to go on the disk image
332 cat > $DMGDIR/root
/README.txt
<<EOF
335 On this disk image you will find the installer for the wxPython $VERSION for $W_MSG MacPython-OSX $PYVER. You must already have MacPython-OSX installed.
337 wxPython-$KIND.pkg The installer package. It contains the wxPython
338 extension modules, wxMac dynamic libraries and
339 headers, and some scripts for the command-line
342 Everything else here is optional and you can drag them out of the disk
343 image and drop them where ever you want.
345 docs/ A few readmes, change log, etc. The full
346 documentation is downloadable separately.
348 licence/ License docs.
350 demo/ A copy of the wxPython demo.
352 samples/ Several small sample applications that
353 demonstrate how to use wxPython.
359 # license files, docs, etc.
360 cp -pR $WXDIR/wxPython
/licence
$DMGDIR/root
361 rm -rf $WXDIR/wxPython
/docs
/xml
-raw
362 cp -pR $WXDIR/wxPython
/docs
$DMGDIR/root
363 rm -rf $DMGDIR/root
/docs
/bin
365 # Copy the demo and samples to the disk image
366 cp -pR $WXDIR/wxPython
/demo
$DMGDIR/root
367 cp -pR $WXDIR/wxPython
/samples
$DMGDIR/root
368 rm $DMGDIR/root
/demo
/b
371 # Make an app bundle to launch PyCrust
372 $PYTHONW $PROGDIR/..
/buildapp.py \
373 --builddir=$DMGDIR/root \
375 --mainprogram=$INSTALLROOT$BINPREFIX/pycrust.py \
376 --iconfile=$PROGDIR/PieShell.icns \
379 # Make an app to launch XRCed
380 $PYTHONW $PROGDIR/..
/buildapp.py \
381 --builddir=$DMGDIR/root \
383 --mainprogram=$INSTALLROOT$BINPREFIX/xrced.py \
384 --iconfile=$PROGDIR/XRCed.icns \
387 # Make an app bundle to run the demo
388 $PYTHONW $PROGDIR/..
/buildapp.py \
389 --builddir=$DMGDIR/root \
390 --name="wxPython Demo" \
391 --mainprogram=$DMGDIR/root
/demo
/demo.py \
392 --iconfile=$PROGDIR/RunDemo.icns \
394 cp -pR $DMGDIR/root
/demo
/* "$DMGDIR/root/wxPython Demo.app/Contents/Resources"
397 # and then finally make a disk image containing the packages and etc.
398 $PROGDIR/..
/makedmg
$DMGDIR/root
$DMGDIR wxPythonOSX
-$VERSION-$KIND-Py$PYVER
400 echo Moving
$DMGDIR/wxPythonOSX
-$VERSION-$KIND-Py$PYVER.dmg to
$DESTDIR
401 mv $DMGDIR/wxPythonOSX
-$VERSION-$KIND-Py$PYVER.dmg
$DESTDIR
405 # Cleanup build/install dirs
406 if [ -z "$skipclean" ]; then
407 echo "Cleaning up..."
410 echo "Cleanup is disabled. You should remove $TMPDIR when finished"