47
43
rm wxPython-src-$VERSION.tar.bz2
50
echo "Invoking wxPythonOSX build script..."
52
47
export TARBALLDIR=$DESTDIR
51
#----------------------------------------------------------------------
52
# Do a universal build of wxWidgets and wxPython. This is a
53
# simplified version of parts of the old distrib/mac/wxPythonOSX/build
56
OSX_VERSION=`sw_vers -productVersion`
57
OSX_VERSION=${OSX_VERSION:0:4}
59
PYTHON=`which python$PYVER`
60
PYTHONW=`which pythonw$PYVER`
61
SHORTVER=${VERSION:0:3}
62
PYPREFIX=`$PYTHON -c "import sys; print sys.exec_prefix"`
63
PYLIB=$PYPREFIX/lib/python$PYVER
65
# Test if the python we are using is the System installed framework
66
# or one that was installed by the user. This changes where the
67
# site-packages (or its alias) is located in the installer tree.
69
if [ -e /Library/Python/$PYVER ] && [ `dirname $PYTHON` == "/usr/bin" ]; then
74
TARBALL=$TARBALLDIR/wxPython-src-$VERSION.tar.bz2
76
if [ ! -e $TARBALLDIR/wxPython-demo-$VERSION.tar.bz2 ]; then
77
echo "-------------------------------------------------------"
78
echo " WARNING: Demo tarball not found, will skip building "
79
echo " the Demo app bundle and etc."
80
echo " $TARBALLDIR/wxPython-demo-$VERSION.tar.bz2"
81
echo "-------------------------------------------------------"
84
if [ ! -e $TARBALLDIR/wxPython-docs-$VERSION.tar.bz2 ]; then
85
echo "-------------------------------------------------------"
86
echo " WARNING: Docs tarball not found, will skip building "
87
echo " the the wxDocsViewer app bundle and etc."
88
echo " $TARBALLDIR/wxPython-docs-$VERSION.tar.bz2"
89
echo "-------------------------------------------------------"
96
function do_universal_build {
99
if [ $CTYPE = unicode ]; then
105
SITEPACKAGES=$PYLIB/site-packages
106
PREFIX=/usr/local/lib/wxPython-$CTYPE-$VERSION
107
BINPREFIX=/usr/local/bin
109
TMPDIR=$DESTDIR/_build_
110
BUILDROOT=$TMPDIR/build
111
INSTALLROOT=$TMPDIR/install-root
112
INSTALLAPPS=$TMPDIR/install-apps
118
PROGDIR=$WXDIR/wxPython/distrib/mac
119
RESOURCEDIR=$PROGDIR/resources
124
mkdir -p $INSTALLROOT
125
mkdir -p $INSTALLAPPS
129
mkdir -p $DMGAPPS/Docs
130
mkdir -p $DMGAPPS/Samples
135
#-----------------------------------------------------------------
136
# Build and install wxWidgets
138
export BUILDPREFIX=$PREFIX
139
export INSTALLDIR=$INSTALLROOT$PREFIX
140
$WXDIR/distrib/scripts/mac/macbuild-lipo wxpython $CTYPE
142
# relink wx-config with a relative link
143
cd $INSTALLROOT$PREFIX/bin
145
ln -s ../lib/wx/config/* wx-config
147
#-----------------------------------------------------------------
148
# Now wxPython. Build ppc, then i386
150
export CXX="g++-3.3 -arch $ARCH -DMAC_OS_X_VERSION_MAX_ALLOWED=1030"
151
export CC="gcc-3.3 -arch $ARCH -DMAC_OS_X_VERSION_MAX_ALLOWED=1030"
152
export MACOSX_DEPLOYMENT_TARGET=10.3
153
mkdir -p $INSTALLROOT/$ARCH
154
mkdir -p $BUILDROOT/$ARCH
156
echo "Building wxPython for PPC..."
159
UNICODE=$PYUNICODEOPT \
162
WX_CONFIG="$INSTALLROOT/$PREFIX/bin/wx-config --prefix=$INSTALLROOT$PREFIX" \
163
BUILD_BASE=$BUILDROOT/$ARCH/wxPython \
168
export CXX="g++-4.0 -arch $ARCH"
169
export CC="gcc-4.0 -arch $ARCH"
170
export MACOSX_DEPLOYMENT_TARGET=10.4
171
mkdir -p $INSTALLROOT/$ARCH
172
mkdir -p $BUILDROOT/$ARCH
174
echo "Building wxPython for Intel..."
177
UNICODE=$PYUNICODEOPT \
180
WX_CONFIG="$INSTALLROOT/$PREFIX/bin/wx-config --prefix=$INSTALLROOT$PREFIX" \
181
BUILD_BASE=$BUILDROOT/$ARCH/wxPython \
187
#-----------------------------------------------------------------
188
# Install the two builds of wxPython
191
export CXX="g++-3.3 -arch $ARCH -DMAC_OS_X_VERSION_MAX_ALLOWED=1030"
192
export CC="gcc-3.3 -arch $ARCH -DMAC_OS_X_VERSION_MAX_ALLOWED=1030"
193
export MACOSX_DEPLOYMENT_TARGET=10.3
196
UNICODE=$PYUNICODEOPT \
199
WX_CONFIG="$INSTALLROOT$PREFIX/bin/wx-config --prefix=$INSTALLROOT$PREFIX" \
200
BUILD_BASE=$BUILDROOT/$ARCH/wxPython \
202
--root=$INSTALLROOT/$ARCH
205
export CXX="g++-4.0 -arch $ARCH"
206
export CC="gcc-4.0 -arch $ARCH"
207
export MACOSX_DEPLOYMENT_TARGET=10.4
210
UNICODE=$PYUNICODEOPT \
213
WX_CONFIG="$INSTALLROOT$PREFIX/bin/wx-config --prefix=$INSTALLROOT$PREFIX" \
214
BUILD_BASE=$BUILDROOT/$ARCH/wxPython \
216
--root=$INSTALLROOT/$ARCH
219
echo "Lipoing $INSTALLROOT/ppc and $INSTALLROOT/i386..."
220
$PYTHON $WXROOT/distrib/scripts/mac/lipo-dir.py $INSTALLROOT/ppc $INSTALLROOT/i386 $INSTALLROOT
222
rm -rf $INSTALLROOT/ppc $INSTALLROOT/i386
225
# Apple's Python Framework (such as what comes with Panther)
226
# sym-links the site-packages dir in the framework 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 [ $APPLE_PYTHON == yes ]; then
230
if [ -e $INSTALLROOT/Library/Python/$PYVER ]; then
231
rm -r $INSTALLROOT/Library/Python/$PYVER
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
238
PKGDIR=`cat $INSTALLROOT$SITEPACKAGES/wx.pth`
240
# install wxPython's tool scripts
241
mkdir -p $INSTALLROOT$BINPREFIX
242
cd $WXROOT/wxPython/scripts
243
$PYTHON CreateMacScripts.py $INSTALLROOT $BINPREFIX
246
# Remove the .pyc/.pyo files they just take up space and can be recreated
247
# during the install.
248
pushd $WXROOT/wxPython
249
$PYTHON $WXROOT/wxPython/distrib/mac/zappycfiles.py $INSTALLROOT > /dev/null
252
# Set premissions for files in $INSTALLROOT
253
if [ "$UID" = "0" ]; then
254
chown -R root:admin $INSTALLROOT
255
chmod -R g+w $INSTALLROOT
260
#-----------------------------------------------------------------
261
# Make the Installer package and disk image
263
# first some resource files
264
cat > $RESOURCEDIR/Welcome.txt <<EOF
267
This Installer package will install the wxPython $CTYPE runtime $VERSION for the Universal version of MacPython-OSX $PYVER. This includes:
269
* The wxPython extension modules and library packages
270
* The wxWidgets shared libraries and headers
271
* Some command line tool scripts, installed to /usr/local/bin.
273
You must install onto your current boot disk, even though the installer does not enforce this, otherwise things will not work.
275
You can install more than one version of the wxPython runtime if you desire. The most recently installed version will be the default wxPython, but you can choose another by setting the PYTHONPATH or by using the wxversion module. See http://wiki.wxpython.org/index.cgi/MultiVersionInstalls for more details.
280
# make the preflight script
281
cat > $RESOURCEDIR/preflight <<EOF
283
# Cleanup any old install of the wxPython package
284
rm -rf \$2$SITEPACKAGES/wxPython
285
rm -rf \$2$SITEPACKAGES/wx
286
rm -rf \$2$SITEPACKAGES/$PKGDIR
289
chmod +x $RESOURCEDIR/preflight
291
# make the postflight script
292
cat > $RESOURCEDIR/postflight <<EOF
295
# Compile the .py files in the wxPython pacakge
296
COMPILE=\$2$PYLIB/compileall.py
297
if [ ! -e \$COMPILE ]; then
298
COMPILE=\$2$PYLIB/compileall.pyc
300
if [ -e \$COMPILE ]; then
301
$PYTHON \$COMPILE \$2$SITEPACKAGES/$PKGDIR
302
$PYTHON -O \$COMPILE \$2$SITEPACKAGES/$PKGDIR
305
# and all of the wxPython pacakge should be group writable
306
chgrp -R admin \$2$SITEPACKAGES/$PKGDIR
307
chmod -R g+w \$2$SITEPACKAGES/$PKGDIR
311
# On Tiger the structure of the user installable dir changed
312
# slightly. Since we are installing the files as if it were
313
# Panther then we need this little tweak to make it compatible.
314
if [ $APPLE_PYTHON == yes ]; then
315
cat >> $RESOURCEDIR/postflight <<EOF
316
# Add a .pth file for Tiger so our wx.pth can be found before the default wx from Apple
317
if [ -e \$2$SITEPACKAGES/site-packages ]; then
318
echo "import site; site.addsitedir('$SITEPACKAGES')" > \$2$SITEPACKAGES/site-packages/00-compat-wx-path.pth
323
cat >> $RESOURCEDIR/postflight <<EOF
326
chmod +x $RESOURCEDIR/postflight
330
# Build the main Installer Package...
331
PKGNAME=wxPython${SHORTVER}-osx-$CTYPE-$TAG-py$PYVER
333
$PYTHON $PROGDIR/buildpkg.py \
336
--Description="wxPython $CTYPE runtime $VERSION for the Universal version of MacPython-OSX $PYVER" \
337
--NeedsAuthorization="YES" \
339
--InstallOnly="YES" \
343
mv $PKGNAME.pkg $DMGROOT/$PKGNAME.pkg
345
rm $RESOURCEDIR/postflight
346
rm $RESOURCEDIR/preflight
347
rm $RESOURCEDIR/Welcome.txt
350
cat > "$DMGROOT/README 1st.txt" <<EOF
353
This disk image contains the following items:
355
wxPython${SHORTVER}-osx-$CTYPE-$VERSION-$TAG
357
This Installer contains the wxPython runtime, built using the
358
$CTYPE build of the wxWidgets library. It includes the
359
Python modules and extension modules for wxPython, as well as
360
the wxWidgets libraries.
362
It is possible to have more than one version of the runtime
363
installed at once if you wish. The most recently installed
364
version will be the default wxPython, but you can choose
365
another by setting the PYTHONPATH or by using the wxversion
366
module. For more details see:
367
http://wiki.wxpython.org/index.cgi/MultiVersionInstalls
370
uninstall_wxPython.py
372
A simple tool to help you manage your installed versions of
373
wxPython. It will allow you to choose from the currently
374
installed wxPython packages and to select one for
375
uninstallation. It is a text-mode tool so you can either run
376
it from a Terminal command line, or you can open it with
377
PythonLauncher and let it create a Terminal to run it in.
379
NOTE: If you have versions prior to 2.5.3.1 installed, please
380
do run this uninstall tool to remove the older version.
385
cp $PROGDIR/uninstall_wxPython.py $DMGROOT
387
# Make a disk image to hold these files
388
dmgname=wxPython${SHORTVER}-osx-$CTYPE-$VERSION-$TAG-py$PYVER
389
$PROGDIR/makedmg $DMGROOT $DMGDIR $dmgname
391
echo Moving $DMGDIR/$dmgname.dmg to $DESTDIR
392
mv $DMGDIR/$dmgname.dmg $DESTDIR/$dmgname.dmg
396
#-----------------------------------------------------------------
397
# Now create app bundles for the demo, docs, and tools and make
398
# another disk image to hold it all.
400
cat > "$DMGAPPS/README 1st.txt" <<EOF
403
On this disk image you will find Demo, Tools, Docs, and etc. for
406
Everything here is optional and you can drag them out of the disk
407
image and drop them wherever you want. You will need to have an
408
installed wxPython runtime to be able to use any of them.
411
wxPython Demo An application bundle version of the demo.
412
(This has it's own copy of the demo sources
413
within the bundle so you can move the whole
414
bundle around as needed.)
416
XRCed An application for editing wxPython resource
419
PyCrust An application that provides an interactive
420
Python shell and also namespace inspectors.
424
Docs/wxDocsViewer An application that allows you to view the
425
wxWidgets documentation.
427
Docs/licence License files.
429
Docs/other A few readmes, change log, etc.
432
Samples/samples Several small sample applications that
433
demonstrate how to use wxPython.
435
Samples/demo A copy of the wxPython demo source code,
436
just open the folder and run demo.pyw.
441
# PyAlaMode An extension of PyCrust that includes source
442
# file editing capabilities.
446
if [ ! -e $TARBALLDIR/wxPython-docs-$VERSION.tar.bz2 ]; then
447
cat > "$DMGAPPS/Docs/Build ERROR.txt" <<EOF
449
The wxPython-docs tarball was not found when building this disk image!
455
tar xjvf $TARBALLDIR/wxPython-docs-$VERSION.tar.bz2
458
# Make an app to launch viewdocs.py
459
$PYTHONW $PROGDIR/buildapp.py \
460
--builddir=$DMGAPPS/Docs \
461
--name=wxDocsViewer \
462
--mainprogram=$BUILDROOT/wxPython-$VERSION/docs/viewdocs.py \
463
--iconfile=$PROGDIR/Info.icns \
466
cp $BUILDROOT/wxPython-$VERSION/docs/*.zip $DMGAPPS/Docs/wxDocsViewer.app/Contents/Resources
468
cat > "$DMGAPPS/Docs/README 1st.txt" <<EOF
470
The wxDocsViewer application needs to be copied to your Desktop (or
471
someplace else you have write access to) before you can run it, so it
472
can cache some indexes within its bundle.
478
# license files, docs, etc.
480
cp -pR $WXDIR/wxPython/licence .
481
cp -pR $WXDIR/wxPython/docs .
488
if [ ! -e $TARBALLDIR/wxPython-demo-$VERSION.tar.bz2 ]; then
489
cat > "$DMGAPPS/Samples/Build ERROR.txt" <<EOF
491
The wxPython-$VERSION-demo tarball was not found when building this disk image!
494
cp "$DMGAPPS/Samples/Build ERROR.txt" $DMGAPPS
498
# Copy the demo and samples to the disk image from the tarball
499
pushd $DMGAPPS/Samples
500
tar xjvf $TARBALLDIR/wxPython-demo-$VERSION.tar.bz2
501
mv wxPython-$VERSION/* .
502
rm -rf wxPython-$VERSION
503
rm -f demo/b demo/.setup.sh
504
mv demo/demo.py demo/demo.pyw
507
# Make an app bundle to run the demo
508
$PYTHONW $PROGDIR/buildapp.py \
509
--builddir=$DMGAPPS \
510
--name="wxPython Demo" \
511
--mainprogram=$DMGAPPS/Samples/demo/demo.pyw \
512
--iconfile=$PROGDIR/RunDemo.icns \
514
cp -pR $DMGAPPS/Samples/demo/* "$DMGAPPS/wxPython Demo.app/Contents/Resources"
518
# Make an app bundle to launch PyCrust
519
$PYTHONW $PROGDIR/buildapp.py \
520
--builddir=$DMGAPPS \
522
--mainprogram=$INSTALLROOT$BINPREFIX/pycrust.py \
523
--iconfile=$PROGDIR/PieShell.icns \
526
## TODO: PyAlaMode needs tweaked to be able to run from a bundle. It
527
## needs to know to ignore command line parameters and etc...
529
# $PYTHONW $PROGDIR/buildapp.py \
530
# --builddir=$DMGAPPS \
532
# --mainprogram=$INSTALLROOT$BINPREFIX/pyalamode.py \
533
# --iconfile=$PROGDIR/PieShell.icns \
536
# Make an app to launch XRCed
537
$PYTHONW $PROGDIR/buildapp.py \
538
--builddir=$DMGAPPS \
540
--mainprogram=$INSTALLROOT$BINPREFIX/xrced.py \
541
--iconfile=$PROGDIR/XRCed.icns \
545
# and then finally make a disk image containing everything
546
dmgname=wxPython${SHORTVER}-osx-docs-demos-$VERSION-$TAG-py$PYVER
547
$PROGDIR/makedmg $DMGAPPS $DMGDIR $dmgname
549
echo Moving $DMGDIR/$dmgname.dmg to $DESTDIR
550
mv $DMGDIR/$dmgname.dmg $DESTDIR/$dmgname.dmg
553
rm -r $TMPDIR || true
54
558
if [ $CHARTYPE = both ]; then
55
distrib/mac/wxPythonOSX/build $PYVER inplace ansi $FLAGS
56
distrib/mac/wxPythonOSX/build $PYVER inplace unicode $FLAGS
559
do_universal_build ansi
560
do_universal_build unicode
58
distrib/mac/wxPythonOSX/build $PYVER inplace $CHARTYPE $FLAGS
562
do_universal_build $CHARTYPE
61
echo "Copying installers to $DESTDIR..."
62
cp dist/*.dmg $DESTDIR
566
#----------------------------------------------------------------------
66
569
if [ $SKIPCLEAN != yes ]; then
67
570
echo "Cleaning up..."
68
572
rm -r $WXDIR || true
69
rm wxPython-docs-$VERSION.tar.bz2
70
rm wxPython-demo-$VERSION.tar.bz2
573
rm wxPython-docs-$VERSION.tar.bz2 || true
574
rm wxPython-demo-$VERSION.tar.bz2 || true
73
577
echo "-=-=-=- Goodbye! -=-=-=-"