This commit was manufactured by cvs2svn to create tag 'r234c1'.
[python/dscho.git] / Mac / OSX / Dist / build
blob532f50a556a19da1629392d15504e7dc975d104d
1 #!/bin/sh -e
2 #----------------------------------------------------------------------
3 # Build MacPython 2.3 and make an Installer package of it
5 # TODO: Parameterize the versions, builddirs, etc...
7 # Script configs
8 PYVERSION=2.3.2
9 PYVER=2.3
10 BUILDNUM=1
11 DOCLEANUP=no
13 PROGDIR="`dirname \"$0\"`"
14 case x$PROGDIR in
15 x|x.) PROGDIR=`pwd` ;;
16 x/*) ;;
17 *) echo "Please run with a full pathname"
18 exit 1
20 esac
22 TMPDIR=/tmp/_py
23 #TMPDIR=/projects/_py
25 INSTALLROOT=$TMPDIR/install
26 DMGDIR=$TMPDIR/dmg
27 RESOURCEDIR=$PROGDIR/resources
28 DESTDIR=$TMPDIR/dist
29 PYTHONSRC=$PROGDIR/../../..
30 WASTEDIR=$PYTHONSRC/../waste
32 case x$1 in
34 BUILDROOT=$TMPDIR/build
37 BUILDROOT=$1
39 esac
41 # Setup
42 if [ -e $BUILDROOT ]; then
43 echo Using existing build directory $BUILDROOT
44 CLEANBUILD=no
45 else
46 echo Creating clean build directory $BUILDROOT
47 CLEANBUILD=yes
48 mkdir -p $BUILDROOT
50 rm -rf $DMGDIR
51 if [ ! -e $TMPDIR ]; then
52 mkdir $TMPDIR
54 chgrp admin $TMPDIR
55 mkdir -p $DMGDIR/root
58 # Configure and build Python
59 pushd $BUILDROOT
61 # Ask the user whether s/he has edited Welcome.txt
62 read -p "Have you updated $RESOURCEDIR/Welcome.txt (Y/n)? " welcome
64 if [ "$welcome" = "n" -o "$welcome" = "N" ]; then
65 echo "Please do so and retry"
66 exit
69 # 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
71 if [ ! -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
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.
79 if [ ! -e python.exe ]; then
80 ln -s python python.exe
83 # Make a link to the waste dir so that lib can be found. This allows
84 # the PythonIDE to be built
85 if [ ! -e waste ]; then
86 ln -s $WASTEDIR waste
89 $PYTHONSRC/configure -C --enable-framework LDFLAGS=-Wl,-x
90 make
91 make DIRMODE=775 EXEMODE=775 FILEMODE=664 DESTDIR=$INSTALLROOT frameworkinstall
92 make DIRMODE=775 EXEMODE=775 FILEMODE=664 DESTDIR=$INSTALLROOT frameworkinstallextras
94 # Unfortunately all the ...MODE arguments above still don't do the trick.
95 # Cop out, and recursively set everything group-writeable.
96 chmod -R ug+w $INSTALLROOT
98 if [ "$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
106 popd
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.
113 rm -rf $INSTALLROOT/usr
115 # Next, remove the .pyc/.pyo files
116 python $PYTHONSRC/Mac/scripts/zappycfiles.py $INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER
117 python $PYTHONSRC/Mac/scripts/zappycfiles.py $INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER/Mac/Tools
119 # Finally, build the package...
120 rm -rf MacPython-OSX.pkg
121 python $PYTHONSRC/Mac/scripts/buildpkg.py \
122 --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" \
128 --UseUserMask="NO" \
129 $INSTALLROOT \
130 $RESOURCEDIR
132 # --RootVolumeOnly="YES" \
134 # ...and then make a disk image containing the package.
135 mv MacPython-OSX.pkg $DMGDIR/root
136 cp $RESOURCEDIR/ReadMe.txt $DMGDIR/root/ReadMe.txt
137 $PROGDIR/makedmg $DMGDIR/root $DMGDIR MacPython-OSX-$PYVERSION-$BUILDNUM
139 echo Moving $DMGDIR/MacPython-OSX-$PYVERSION-$BUILDNUM to $DESTDIR
140 if [ ! -e $DESTDIR ]; then
141 mkdir $DESTDIR
143 mv $DMGDIR/MacPython-OSX-$PYVERSION-$BUILDNUM.dmg $DESTDIR
146 # Cleanup build/install dirs
147 if [ $DOCLEANUP = yes ]; then
148 echo "Cleaning up..."
149 if [ $CLEANBUILD = yes ]; then
150 rm -rf $BUILDROOT
152 rm -rf $INSTALLROOT
153 rm -rf $DMGDIR
154 else
155 echo "Cleanup is disabled. You should remove these dirs when done:"
156 if [ $CLEANBUILD = yes ]; then
157 echo " $BUILDROOT"
159 echo " $INSTALLROOT"
160 echo " $DMGDIR"
162 echo "Your installer can be found in $DESTDIR"