blob: 1560ee128a97232edb656dabc0113d3ba3508d3c [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
Jack Jansena6872b82003-05-07 08:58:11 +00008PYVERSION=2.3b1
Jack Jansen8806d472003-03-21 23:52:36 +00009PYVER=2.3
Jack Jansena6872b82003-05-07 08:58:11 +000010BUILDNUM=1
Jack Jansen8806d472003-03-21 23:52:36 +000011DOCLEANUP=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
Jack Jansena6872b82003-05-07 08:58:11 +000043# Ask the user whether s/he has edited Welcome.txt
44read -p "Have you updated $RESOURCEDIR/Welcome.txt (Y/n)? " welcome
45
46if [ "$welcome" = "n" -o "$welcome" = "N" ]; then
47 echo "Please do so and retry"
48 exit
49fi
50
Jack Jansen8806d472003-03-21 23:52:36 +000051# Check if we should build and install the docs, but only if it
52# doesn't appear to be done already. TODO: fix this path to be version independent
53if [ ! -e "build/temp.darwin-6.3-Power Macintosh-2.3/build-html/build-html idx" ]; then
54 read -p "Build the Python docs? (y/N)? " builddocs
55fi
56
57# If the filesystem is case-sensitive then "python" will be built, but
58# some parts of the install expect "python.exe which is what is built
59# on a case-insensitive filesystem. Make a link just in case it is
60# needed.
61if [ ! -e python.exe ]; then
62 ln -s python python.exe
63fi
64
65# Make a link to the waste dir so that lib can be found. This allows
66# the PythonIDE to be built
67if [ ! -e waste ]; then
68 ln -s $WASTEDIR waste
69fi
70
71$PYTHONSRC/configure --enable-framework=$INSTALLROOT/Library/Frameworks LDFLAGS=-Wl,-x
72make
73make frameworkinstall
74
75if [ "$builddocs" = "y" -o "$builddocs" = "Y" ]; then
76 ./python.exe $PYTHONSRC/Mac/OSX/setupDocs.py build
77 echo ""
78 read -p "When the help indexer is done press Enter..." ans
79 ./python.exe $PYTHONSRC/Mac/OSX/setupDocs.py install \
80 --prefix=$INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER
81fi
82
83popd
84
85
86
87# Make the Installer package:
88# First, remove the unix tools as their paths will be wrong. We'll recreate
89# them in the postinstall.
Jack Jansen57c914c2003-03-22 00:02:23 +000090rm -rf $INSTALLROOT/usr
Jack Jansen8806d472003-03-21 23:52:36 +000091
92# Next, remove the .pyc/.pyo files
Jack Jansen57c914c2003-03-22 00:02:23 +000093python $PYTHONSRC/Mac/scripts/zappycfiles.py $INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER
94python $PYTHONSRC/Mac/scripts/zappycfiles.py $INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER/Mac/Tools
Jack Jansen8806d472003-03-21 23:52:36 +000095
Jack Jansen8806d472003-03-21 23:52:36 +000096# Finally, build the package...
97rm -rf MacPython-OSX.pkg
Jack Jansen57c914c2003-03-22 00:02:23 +000098python $PYTHONSRC/Mac/scripts/buildpkg.py \
Jack Jansen8806d472003-03-21 23:52:36 +000099 --Title=MacPython-OSX \
100 --Version=$PYVERSION-$BUILDNUM \
101 --Description="Python $PYVERSION for Mac OS X, framework based" \
102 --NeedsAuthorization="YES" \
103 --Relocatable="NO" \
104 --InstallOnly="YES" \
105 $INSTALLROOT \
106 $RESOURCEDIR
107
108## --RootVolumeOnly="YES" \
109
110# ...and then make a disk image containing the package.
111mv MacPython-OSX.pkg $DMGDIR/root
Jack Jansena6872b82003-05-07 08:58:11 +0000112cp $RESOURCEDIR/Welcome.txt $DMGDIR/root/README.txt
Jack Jansen57c914c2003-03-22 00:02:23 +0000113$PROGDIR/makedmg $DMGDIR/root $DMGDIR MacPython-OSX-$PYVERSION-$BUILDNUM
Jack Jansen8806d472003-03-21 23:52:36 +0000114
115echo Moving $DMGDIR/MacPython-OSX-$PYVERSION-$BUILDNUM to $DESTDIR
Jack Jansena6872b82003-05-07 08:58:11 +0000116if [ ! -e $DESTDIR ]; then
117 mkdir $DESTDIR
118fi
Jack Jansen8806d472003-03-21 23:52:36 +0000119mv $DMGDIR/MacPython-OSX-$PYVERSION-$BUILDNUM.dmg $DESTDIR
120
121
122# Cleanup build/install dirs
123if [ $DOCLEANUP = yes ]; then
124 echo "Cleaning up..."
125 rm -rf $BUILDROOT
126 rm -rf $INSTALLROOT
127 rm -rf $DMGDIR
128else
129 echo "Cleanup is disabled. You should remove these dirs when done:"
130 echo " $BUILDROOT"
131 echo " $INSTALLROOT"
132 echo " $DMGDIR"
133fi
Jack Jansen57c914c2003-03-22 00:02:23 +0000134echo "Your installer can be found in $DESTDIR"
Jack Jansen8806d472003-03-21 23:52:36 +0000135