]>
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 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 \
165 --enable-precomp=no \
167 --with-libjpeg=builtin \
168 --with-libpng=builtin \
169 --with-libtiff=builtin \
170 --with-zlib=builtin \
176 # Build wxWidgets and wxPython
177 if [ -z "$skipbuild" ]; then
179 # Make wxWidgets and some contribs
181 make -C contrib
/src
/gizmos
182 make -C contrib
/src
/ogl CXXFLAGS
="-DwxUSE_DEPRECATED=0"
183 make -C contrib
/src
/stc
184 make -C contrib
/src
/xrc
186 if [ ! -e $WXDIR/include
/wx
/gizmos
]; then
187 # Make some links so the wxPython build can find all the headers it needs
188 pushd $WXDIR/include
/wx
189 ln -s ..
/..
/contrib
/include
/wx
/* .
197 WX_CONFIG
="$WXDIR/bld/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/bld" \
201 # Build wxrc (XRC resource tool)
202 cd $WXDIR/bld
/contrib
/utils
/wxrc
208 #----------------------------------------------------------------------
210 if [ -z "$skipinstall" ]; then
213 make prefix
=$INSTALLROOT$PREFIX install
214 make -C contrib
/src
/gizmos prefix
=$INSTALLROOT$PREFIX install
215 make -C contrib
/src
/ogl CXXFLAGS
="-DwxUSE_DEPRECATED=0" prefix
=$INSTALLROOT/$PREFIX install
216 make -C contrib
/src
/stc prefix
=$INSTALLROOT$PREFIX install
217 make -C contrib
/src
/xrc prefix
=$INSTALLROOT$PREFIX install
224 WX_CONFIG
="$INSTALLROOT/$PREFIX/bin/wx-config --prefix=$INSTALLROOT/$PREFIX" \
229 # Apple's Python (on Panther) sym-links the site-packages dir to
230 # /Library/Python/$PYVER so we need to move the files so they are
231 # installed in the physical location, not the virtual one.
232 if [ "$KIND" = "panther" ]; then
233 mkdir -p $INSTALLROOT/Library
/Python
/$PYVER
234 mv $INSTALLROOT/$SITEPACKAGES/* $INSTALLROOT/Library
/Python
/$PYVER
235 rm -r $INSTALLROOT/System
236 SITEPACKAGES
=/Library
/Python
/$PYVER
240 # install wxPython's tool scripts
241 mkdir -p $INSTALLROOT$BINPREFIX
242 cd $WXDIR/wxPython
/scripts
243 python
$PYVER CreateMacScripts.py
$INSTALLROOT $BINPREFIX
247 cp $WXDIR/bld
/contrib
/utils
/wxrc
/wxrc
$INSTALLROOT$BINPREFIX
250 # install the wxPython headers
252 cp -R include
$INSTALLROOT$PREFIX
253 mkdir -p $INSTALLROOT$PREFIX/include
/wx
/wxPython
/i_files
254 cp src
/*.i
$INSTALLROOT$PREFIX/include
/wx
/wxPython
/i_files
257 # Set premissions for files in $INSTALLROOT
258 chown
-R root
:admin
$INSTALLROOT
259 chmod -R g
+w
$INSTALLROOT
264 #----------------------------------------------------------------------
266 # Make the Installer packages and disk image
267 if [ -z "$skipdmg" ]; then
269 # Remove the .pyc/.pyo files they just take up space and can be recreated
270 # during the install.
271 $PYTHON $PROGDIR/..
/zappycfiles.py
$INSTALLROOT
274 # Make the welcome message
276 panther
) W_MSG
="the Panther (OS X 10.3.x) version of" ;;
277 jaguar
) W_MSG
="the Jaguar (OS X 10.2.x) version of" ;;
279 cat > $RESOURCEDIR/Welcome.txt
<<EOF
282 This program will install wxPython $VERSION for $W_MSG MacPython-OSX $PYVER.
284 You must install onto your current boot disk, even though the installer does not enforce this, otherwise things will not work.
289 # make the preflight script
290 cat > $RESOURCEDIR/preflight
<<EOF
292 # Cleanup any old install of the wxPython package
293 rm -rf \$2$SITEPACKAGES/wxPython
294 rm -rf \$2$SITEPACKAGES/wx
297 chmod +x
$RESOURCEDIR/preflight
299 # make the postflight script
300 cat > $RESOURCEDIR/postflight
<<EOF
302 # Compile the .py files in the wxPython pacakge
303 $PYTHON \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wxPython
304 $PYTHON \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wx
305 $PYTHON -O \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wxPython
306 $PYTHON -O \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wx
309 # and all of the wxPython pacakge should be group writable
310 chgrp -R admin \$2$SITEPACKAGES/wxPython
311 chmod -R g+w \$2$SITEPACKAGES/wxPython
312 chgrp -R admin \$2$SITEPACKAGES/wx
313 chmod -R g+w \$2$SITEPACKAGES/wx
317 chmod +x
$RESOURCEDIR/postflight
321 # Build the main Installer Package...
322 rm -rf wxPythonOSX
-$KIND.pkg
323 python
$PROGDIR/..
/buildpkg.py \
324 --Title=wxPythonOSX
-$KIND \
326 --Description="wxPython $VERSION for $W_MSG MacPython-OSX $PYVER" \
327 --NeedsAuthorization="YES" \
329 --InstallOnly="YES" \
333 mv wxPythonOSX
-$KIND.pkg
$DMGDIR/root
337 # Make a README.txt to go on the disk image
338 cat > "$DMGDIR/root/README 1st.txt" <<EOF
341 On this disk image you will find the installer for wxPython $VERSION for $W_MSG MacPython-OSX $PYVER. MacPython-OSX is not included.
343 wxPython-$KIND.pkg The installer package. It contains the wxPython
344 extension modules, wxMac dynamic libraries and
345 headers, and some scripts for the command-line
348 Everything else here is optional and you can drag them out of the disk
349 image and drop them whereever you want. You do need to install the above
350 package before you can use any of the items below.
353 Apps/wxPython Demo An application bundle version of the demo.
354 (This has it's own copy of the sources within
357 Apps/XRCed An application for editing wxPython resource
360 Apps/PyCrust An application that provides an interactive
361 Python shell and also namespace inspectors.
365 Docs/wxDocs A folder containing the wxWidgets documentation
366 bundled in .zip files, and a small wxPython
367 application that can be used to view the docs.
370 Docs/licence License files.
372 Docs/other A few readmes, change log, etc. The full
373 documentation is downloadable separately.
376 Samples/samples Several small sample applications that
377 demonstrate how to use wxPython.
379 Samples/demo A copy of the wxPython demo source code,
380 just open the folder and run demo.pyw.
385 # PyAlaMode An extension of PyCrust that includes source
386 # file editing capabilities.
390 pushd $DMGDIR/root
/Docs
391 tar xzvf
$TARBALLDIR/wxPythonDocs
-$VERSION.
tar.gz
392 mv wxPython
-$VERSION/docs wxDocs
393 rm -r wxPython
-$VERSION
394 mv wxDocs
/viewdocs.py wxDocs
/viewdocs.pyw
396 # license files, docs, etc.
397 cp -pR $SRCROOT/wxPython
/licence .
398 cp -pR $SRCROOT/wxPython
/docs .
404 # Copy the demo and samples to the disk image from the tarball
405 pushd $DMGDIR/root
/Samples
406 tar xzvf
$TARBALLDIR/wxPythonDemo
-$VERSION.
tar.gz
407 mv wxPython
-$VERSION/* .
408 rm -rf wxPython
-$VERSION
409 rm demo
/b demo
/.setup.sh
410 mv demo
/demo.py demo
/demo.pyw
414 # Make an app bundle to launch PyCrust
415 $PYTHONW $PROGDIR/..
/buildapp.py \
416 --builddir=$DMGDIR/root
/Apps \
418 --mainprogram=$INSTALLROOT$BINPREFIX/pycrust.py \
419 --iconfile=$PROGDIR/PieShell.icns \
423 # $PYTHONW $PROGDIR/../buildapp.py \
424 # --builddir=$DMGDIR/root \
426 # --mainprogram=$INSTALLROOT$BINPREFIX/pyalamode.py \
427 # --iconfile=$PROGDIR/PieShell.icns \
430 # Make an app to launch XRCed
431 $PYTHONW $PROGDIR/..
/buildapp.py \
432 --builddir=$DMGDIR/root
/Apps \
434 --mainprogram=$INSTALLROOT$BINPREFIX/xrced.py \
435 --iconfile=$PROGDIR/XRCed.icns \
438 # Make an app bundle to run the demo
439 $PYTHONW $PROGDIR/..
/buildapp.py \
440 --builddir=$DMGDIR/root
/Apps \
441 --name="wxPython Demo" \
442 --mainprogram=$DMGDIR/root
/Samples
/demo
/demo.pyw \
443 --iconfile=$PROGDIR/RunDemo.icns \
445 cp -pR $DMGDIR/root
/Samples
/demo
/* "$DMGDIR/root/Apps/wxPython Demo.app/Contents/Resources"
448 # and then finally make a disk image containing the packages and etc.
449 $PROGDIR/..
/makedmg
$DMGDIR/root
$DMGDIR wxPythonOSX
-$VERSION-$KIND-Py$PYVER
451 echo Moving
$DMGDIR/wxPythonOSX
-$VERSION-$KIND-Py$PYVER.dmg to
$DESTDIR
452 mv $DMGDIR/wxPythonOSX
-$VERSION-$KIND-Py$PYVER.dmg
$DESTDIR
456 # Cleanup build/install dirs
457 if [ -z "$skipclean" ]; then
458 echo "Cleaning up..."
461 echo "Cleanup is disabled. You should remove $TMPDIR when finished"