blob: b5ebe3edbcf26e2aefe8a9a405e877ba8cf4ad07 [file] [log] [blame]
Jack Jansen8806d472003-03-21 23:52:36 +00001#!/bin/sh -e
2#----------------------------------------------------------------------
Jack Jansende2ecb82004-12-27 15:53:20 +00003# Build MacPython 2.5 and make an Installer package of it
Jack Jansen8806d472003-03-21 23:52:36 +00004
5# TODO: Parameterize the versions, builddirs, etc...
6
7# Script configs
Jack Jansende2ecb82004-12-27 15:53:20 +00008PYVERSION=2.5a0
9PYVER=2.5
Jack Jansen652b28c2003-11-19 13:53:55 +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
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 Jansende2ecb82004-12-27 15:53:20 +000089#$PYTHONSRC/configure -C --enable-framework LDFLAGS=-Wl,-x
90$PYTHONSRC/configure -C --enable-framework
Jack Jansen8806d472003-03-21 23:52:36 +000091make
Jack Jansen7006fa12003-06-16 15:12:16 +000092make DIRMODE=775 EXEMODE=775 FILEMODE=664 DESTDIR=$INSTALLROOT frameworkinstall
Jack Jansen8cf644d2003-06-19 22:45:37 +000093make DIRMODE=775 EXEMODE=775 FILEMODE=664 DESTDIR=$INSTALLROOT frameworkinstallextras
Jack Jansen8806d472003-03-21 23:52:36 +000094
Jack Jansenb6b988b2003-06-20 21:40:57 +000095# Unfortunately all the ...MODE arguments above still don't do the trick.
96# Cop out, and recursively set everything group-writeable.
97chmod -R ug+w $INSTALLROOT
98
Jack Jansen8806d472003-03-21 23:52:36 +000099if [ "$builddocs" = "y" -o "$builddocs" = "Y" ]; then
100 ./python.exe $PYTHONSRC/Mac/OSX/setupDocs.py build
101 echo ""
102 read -p "When the help indexer is done press Enter..." ans
103 ./python.exe $PYTHONSRC/Mac/OSX/setupDocs.py install \
104 --prefix=$INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER
105fi
106
107popd
108
109
110
111# Make the Installer package:
112# First, remove the unix tools as their paths will be wrong. We'll recreate
113# them in the postinstall.
Jack Jansen57c914c2003-03-22 00:02:23 +0000114rm -rf $INSTALLROOT/usr
Jack Jansen8806d472003-03-21 23:52:36 +0000115
116# Next, remove the .pyc/.pyo files
Jack Jansen57c914c2003-03-22 00:02:23 +0000117python $PYTHONSRC/Mac/scripts/zappycfiles.py $INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER
118python $PYTHONSRC/Mac/scripts/zappycfiles.py $INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER/Mac/Tools
Jack Jansen8806d472003-03-21 23:52:36 +0000119
Jack Jansen8806d472003-03-21 23:52:36 +0000120# Finally, build the package...
121rm -rf MacPython-OSX.pkg
Jack Jansen57c914c2003-03-22 00:02:23 +0000122python $PYTHONSRC/Mac/scripts/buildpkg.py \
Jack Jansen8806d472003-03-21 23:52:36 +0000123 --Title=MacPython-OSX \
124 --Version=$PYVERSION-$BUILDNUM \
125 --Description="Python $PYVERSION for Mac OS X, framework based" \
126 --NeedsAuthorization="YES" \
127 --Relocatable="NO" \
128 --InstallOnly="YES" \
Jack Jansenfc3542f2003-06-18 21:28:44 +0000129 --UseUserMask="NO" \
Jack Jansen8806d472003-03-21 23:52:36 +0000130 $INSTALLROOT \
131 $RESOURCEDIR
132
Jack Jansen1fb83c12003-07-23 10:51:55 +0000133# --RootVolumeOnly="YES" \
Jack Jansen8806d472003-03-21 23:52:36 +0000134
135# ...and then make a disk image containing the package.
136mv MacPython-OSX.pkg $DMGDIR/root
Jack Jansen652b28c2003-11-19 13:53:55 +0000137cp $RESOURCEDIR/ReadMe.txt $DMGDIR/root/ReadMe.txt
Jack Jansen57c914c2003-03-22 00:02:23 +0000138$PROGDIR/makedmg $DMGDIR/root $DMGDIR MacPython-OSX-$PYVERSION-$BUILDNUM
Jack Jansen8806d472003-03-21 23:52:36 +0000139
140echo Moving $DMGDIR/MacPython-OSX-$PYVERSION-$BUILDNUM to $DESTDIR
Jack Jansena6872b82003-05-07 08:58:11 +0000141if [ ! -e $DESTDIR ]; then
142 mkdir $DESTDIR
143fi
Jack Jansen8806d472003-03-21 23:52:36 +0000144mv $DMGDIR/MacPython-OSX-$PYVERSION-$BUILDNUM.dmg $DESTDIR
145
146
147# Cleanup build/install dirs
148if [ $DOCLEANUP = yes ]; then
149 echo "Cleaning up..."
Jack Jansen7006fa12003-06-16 15:12:16 +0000150 if [ $CLEANBUILD = yes ]; then
151 rm -rf $BUILDROOT
152 fi
Jack Jansen8806d472003-03-21 23:52:36 +0000153 rm -rf $INSTALLROOT
154 rm -rf $DMGDIR
155else
156 echo "Cleanup is disabled. You should remove these dirs when done:"
Jack Jansen7006fa12003-06-16 15:12:16 +0000157 if [ $CLEANBUILD = yes ]; then
158 echo " $BUILDROOT"
159 fi
Jack Jansen8806d472003-03-21 23:52:36 +0000160 echo " $INSTALLROOT"
161 echo " $DMGDIR"
162fi
Jack Jansen57c914c2003-03-22 00:02:23 +0000163echo "Your installer can be found in $DESTDIR"
Jack Jansen8806d472003-03-21 23:52:36 +0000164