blob: ee5c450930baaf804e3f177614b790432be50d40 [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 Jansenf7538162003-07-22 13:45:26 +00008PYVERSION=2.3rc1plus
Jack Jansen8806d472003-03-21 23:52:36 +00009PYVER=2.3
Jack Jansen1fb83c12003-07-23 10:51:55 +000010BUILDNUM=8
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
Jack Jansen8806d472003-03-21 23:52:36 +000025INSTALLROOT=$TMPDIR/install
26DMGDIR=$TMPDIR/dmg
27RESOURCEDIR=$PROGDIR/resources
Jack Jansen57c914c2003-03-22 00:02:23 +000028DESTDIR=$TMPDIR/dist
29PYTHONSRC=$PROGDIR/../../..
30WASTEDIR=$PYTHONSRC/../waste
Jack Jansen8806d472003-03-21 23:52:36 +000031
Jack Jansen7006fa12003-06-16 15:12:16 +000032case x$1 in
33x)
34 BUILDROOT=$TMPDIR/build
35 ;;
36*)
37 BUILDROOT=$1
38 ;;
39esac
40
Jack Jansen8806d472003-03-21 23:52:36 +000041# Setup
Jack Jansen7006fa12003-06-16 15:12:16 +000042if [ -e $BUILDROOT ]; then
43 echo Using existing build directory $BUILDROOT
44 CLEANBUILD=no
45else
46 echo Creating clean build directory $BUILDROOT
47 CLEANBUILD=yes
48 mkdir -p $BUILDROOT
49fi
Jack Jansen8806d472003-03-21 23:52:36 +000050rm -rf $DMGDIR
Jack Jansenfc3542f2003-06-18 21:28:44 +000051if [ ! -e $TMPDIR ]; then
52 mkdir $TMPDIR
53fi
Jack Jansen53e54fd2003-06-17 14:36:54 +000054chgrp admin $TMPDIR
Jack Jansen8806d472003-03-21 23:52:36 +000055mkdir -p $DMGDIR/root
56
57
58# Configure and build Python
59pushd $BUILDROOT
60
Jack Jansena6872b82003-05-07 08:58:11 +000061# Ask the user whether s/he has edited Welcome.txt
62read -p "Have you updated $RESOURCEDIR/Welcome.txt (Y/n)? " welcome
63
64if [ "$welcome" = "n" -o "$welcome" = "N" ]; then
65 echo "Please do so and retry"
66 exit
67fi
68
Jack Jansen8806d472003-03-21 23:52:36 +000069# Check if we should build and install the docs, but only if it
70# doesn't appear to be done already. TODO: fix this path to be version independent
71if [ ! -e "build/temp.darwin-6.3-Power Macintosh-2.3/build-html/build-html idx" ]; then
72 read -p "Build the Python docs? (y/N)? " builddocs
73fi
74
75# If the filesystem is case-sensitive then "python" will be built, but
76# some parts of the install expect "python.exe which is what is built
77# on a case-insensitive filesystem. Make a link just in case it is
78# needed.
79if [ ! -e python.exe ]; then
80 ln -s python python.exe
81fi
82
83# Make a link to the waste dir so that lib can be found. This allows
84# the PythonIDE to be built
85if [ ! -e waste ]; then
86 ln -s $WASTEDIR waste
87fi
88
Jack Jansen7006fa12003-06-16 15:12:16 +000089$PYTHONSRC/configure -C --enable-framework LDFLAGS=-Wl,-x
Jack Jansen8806d472003-03-21 23:52:36 +000090make
Jack Jansen7006fa12003-06-16 15:12:16 +000091make DIRMODE=775 EXEMODE=775 FILEMODE=664 DESTDIR=$INSTALLROOT frameworkinstall
Jack Jansen8cf644d2003-06-19 22:45:37 +000092make DIRMODE=775 EXEMODE=775 FILEMODE=664 DESTDIR=$INSTALLROOT frameworkinstallextras
Jack Jansen8806d472003-03-21 23:52:36 +000093
Jack Jansenb6b988b2003-06-20 21:40:57 +000094# Unfortunately all the ...MODE arguments above still don't do the trick.
95# Cop out, and recursively set everything group-writeable.
96chmod -R ug+w $INSTALLROOT
97
Jack Jansen8806d472003-03-21 23:52:36 +000098if [ "$builddocs" = "y" -o "$builddocs" = "Y" ]; then
99 ./python.exe $PYTHONSRC/Mac/OSX/setupDocs.py build
100 echo ""
101 read -p "When the help indexer is done press Enter..." ans
102 ./python.exe $PYTHONSRC/Mac/OSX/setupDocs.py install \
103 --prefix=$INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER
104fi
105
106popd
107
108
109
110# Make the Installer package:
111# First, remove the unix tools as their paths will be wrong. We'll recreate
112# them in the postinstall.
Jack Jansen57c914c2003-03-22 00:02:23 +0000113rm -rf $INSTALLROOT/usr
Jack Jansen8806d472003-03-21 23:52:36 +0000114
115# Next, remove the .pyc/.pyo files
Jack Jansen57c914c2003-03-22 00:02:23 +0000116python $PYTHONSRC/Mac/scripts/zappycfiles.py $INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER
117python $PYTHONSRC/Mac/scripts/zappycfiles.py $INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER/Mac/Tools
Jack Jansen8806d472003-03-21 23:52:36 +0000118
Jack Jansen8806d472003-03-21 23:52:36 +0000119# Finally, build the package...
120rm -rf MacPython-OSX.pkg
Jack Jansen57c914c2003-03-22 00:02:23 +0000121python $PYTHONSRC/Mac/scripts/buildpkg.py \
Jack Jansen8806d472003-03-21 23:52:36 +0000122 --Title=MacPython-OSX \
123 --Version=$PYVERSION-$BUILDNUM \
124 --Description="Python $PYVERSION for Mac OS X, framework based" \
125 --NeedsAuthorization="YES" \
126 --Relocatable="NO" \
127 --InstallOnly="YES" \
Jack Jansenfc3542f2003-06-18 21:28:44 +0000128 --UseUserMask="NO" \
Jack Jansen8806d472003-03-21 23:52:36 +0000129 $INSTALLROOT \
130 $RESOURCEDIR
131
Jack Jansen1fb83c12003-07-23 10:51:55 +0000132# --RootVolumeOnly="YES" \
Jack Jansen8806d472003-03-21 23:52:36 +0000133
134# ...and then make a disk image containing the package.
135mv MacPython-OSX.pkg $DMGDIR/root
Jack Jansena6872b82003-05-07 08:58:11 +0000136cp $RESOURCEDIR/Welcome.txt $DMGDIR/root/README.txt
Jack Jansen57c914c2003-03-22 00:02:23 +0000137$PROGDIR/makedmg $DMGDIR/root $DMGDIR MacPython-OSX-$PYVERSION-$BUILDNUM
Jack Jansen8806d472003-03-21 23:52:36 +0000138
139echo Moving $DMGDIR/MacPython-OSX-$PYVERSION-$BUILDNUM to $DESTDIR
Jack Jansena6872b82003-05-07 08:58:11 +0000140if [ ! -e $DESTDIR ]; then
141 mkdir $DESTDIR
142fi
Jack Jansen8806d472003-03-21 23:52:36 +0000143mv $DMGDIR/MacPython-OSX-$PYVERSION-$BUILDNUM.dmg $DESTDIR
144
145
146# Cleanup build/install dirs
147if [ $DOCLEANUP = yes ]; then
148 echo "Cleaning up..."
Jack Jansen7006fa12003-06-16 15:12:16 +0000149 if [ $CLEANBUILD = yes ]; then
150 rm -rf $BUILDROOT
151 fi
Jack Jansen8806d472003-03-21 23:52:36 +0000152 rm -rf $INSTALLROOT
153 rm -rf $DMGDIR
154else
155 echo "Cleanup is disabled. You should remove these dirs when done:"
Jack Jansen7006fa12003-06-16 15:12:16 +0000156 if [ $CLEANBUILD = yes ]; then
157 echo " $BUILDROOT"
158 fi
Jack Jansen8806d472003-03-21 23:52:36 +0000159 echo " $INSTALLROOT"
160 echo " $DMGDIR"
161fi
Jack Jansen57c914c2003-03-22 00:02:23 +0000162echo "Your installer can be found in $DESTDIR"
Jack Jansen8806d472003-03-21 23:52:36 +0000163