blob: a8976facececb7f1a95e49336646f0b596575b32 [file] [log] [blame]
Jack Jansen8806d472003-03-21 23:52:36 +00001#!/bin/sh -e
2#----------------------------------------------------------------------
3# Build MacPython 2.3 and make an Installer package of it
4
5# TODO: Parameterize the versions, builddirs, etc...
6
7# Script configs
8PYVERSION=2.3a2
9PYVER=2.3
10BUILDNUM=3
11DOCLEANUP=no
12
13PROGDIR="`dirname \"$0\"`"
Jack Jansen57c914c2003-03-22 00:02:23 +000014case x$PROGDIR in
15x|x.) PROGDIR=`pwd` ;;
16x/*) ;;
17*) echo "Please run with a full pathname"
18 exit 1
19 ;;
20esac
21
Jack Jansen8806d472003-03-21 23:52:36 +000022TMPDIR=/tmp/_py
23#TMPDIR=/projects/_py
24
25BUILDROOT=$TMPDIR/build
26INSTALLROOT=$TMPDIR/install
27DMGDIR=$TMPDIR/dmg
28RESOURCEDIR=$PROGDIR/resources
Jack Jansen57c914c2003-03-22 00:02:23 +000029DESTDIR=$TMPDIR/dist
30PYTHONSRC=$PROGDIR/../../..
31WASTEDIR=$PYTHONSRC/../waste
Jack Jansen8806d472003-03-21 23:52:36 +000032
33# Setup
34mkdir -p $BUILDROOT
35mkdir -p $INSTALLROOT
36rm -rf $DMGDIR
37mkdir -p $DMGDIR/root
38
39
40# Configure and build Python
41pushd $BUILDROOT
42
43# Check if we should build and install the docs, but only if it
44# doesn't appear to be done already. TODO: fix this path to be version independent
45if [ ! -e "build/temp.darwin-6.3-Power Macintosh-2.3/build-html/build-html idx" ]; then
46 read -p "Build the Python docs? (y/N)? " builddocs
47fi
48
49# If the filesystem is case-sensitive then "python" will be built, but
50# some parts of the install expect "python.exe which is what is built
51# on a case-insensitive filesystem. Make a link just in case it is
52# needed.
53if [ ! -e python.exe ]; then
54 ln -s python python.exe
55fi
56
57# Make a link to the waste dir so that lib can be found. This allows
58# the PythonIDE to be built
59if [ ! -e waste ]; then
60 ln -s $WASTEDIR waste
61fi
62
63$PYTHONSRC/configure --enable-framework=$INSTALLROOT/Library/Frameworks LDFLAGS=-Wl,-x
64make
65make frameworkinstall
66
67if [ "$builddocs" = "y" -o "$builddocs" = "Y" ]; then
68 ./python.exe $PYTHONSRC/Mac/OSX/setupDocs.py build
69 echo ""
70 read -p "When the help indexer is done press Enter..." ans
71 ./python.exe $PYTHONSRC/Mac/OSX/setupDocs.py install \
72 --prefix=$INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER
73fi
74
75popd
76
77
78
79# Make the Installer package:
80# First, remove the unix tools as their paths will be wrong. We'll recreate
81# them in the postinstall.
Jack Jansen57c914c2003-03-22 00:02:23 +000082rm -rf $INSTALLROOT/usr
Jack Jansen8806d472003-03-21 23:52:36 +000083
84# Next, remove the .pyc/.pyo files
Jack Jansen57c914c2003-03-22 00:02:23 +000085python $PYTHONSRC/Mac/scripts/zappycfiles.py $INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER
86python $PYTHONSRC/Mac/scripts/zappycfiles.py $INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER/Mac/Tools
Jack Jansen8806d472003-03-21 23:52:36 +000087
88# Make the welcome message
89cat > $RESOURCEDIR/Welcome.txt <<EOF
90Welcome!
91
92This program will install Python $PYVERSION for Mac OS X as a Framework.
93
94Build number: $BUILDNUM
95Build date: `date`
96EOF
97
Jack Jansen8806d472003-03-21 23:52:36 +000098# Finally, build the package...
99rm -rf MacPython-OSX.pkg
Jack Jansen57c914c2003-03-22 00:02:23 +0000100python $PYTHONSRC/Mac/scripts/buildpkg.py \
Jack Jansen8806d472003-03-21 23:52:36 +0000101 --Title=MacPython-OSX \
102 --Version=$PYVERSION-$BUILDNUM \
103 --Description="Python $PYVERSION for Mac OS X, framework based" \
104 --NeedsAuthorization="YES" \
105 --Relocatable="NO" \
106 --InstallOnly="YES" \
107 $INSTALLROOT \
108 $RESOURCEDIR
109
110## --RootVolumeOnly="YES" \
111
112# ...and then make a disk image containing the package.
113mv MacPython-OSX.pkg $DMGDIR/root
Jack Jansen57c914c2003-03-22 00:02:23 +0000114$PROGDIR/makedmg $DMGDIR/root $DMGDIR MacPython-OSX-$PYVERSION-$BUILDNUM
Jack Jansen8806d472003-03-21 23:52:36 +0000115
116echo Moving $DMGDIR/MacPython-OSX-$PYVERSION-$BUILDNUM to $DESTDIR
117mv $DMGDIR/MacPython-OSX-$PYVERSION-$BUILDNUM.dmg $DESTDIR
118
119
120# Cleanup build/install dirs
121if [ $DOCLEANUP = yes ]; then
122 echo "Cleaning up..."
123 rm -rf $BUILDROOT
124 rm -rf $INSTALLROOT
125 rm -rf $DMGDIR
126else
127 echo "Cleanup is disabled. You should remove these dirs when done:"
128 echo " $BUILDROOT"
129 echo " $INSTALLROOT"
130 echo " $DMGDIR"
131fi
Jack Jansen57c914c2003-03-22 00:02:23 +0000132echo "Your installer can be found in $DESTDIR"
Jack Jansen8806d472003-03-21 23:52:36 +0000133