Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 1 | #!/bin/sh -e |
| 2 | #---------------------------------------------------------------------- |
Jack Jansen | de2ecb8 | 2004-12-27 15:53:20 +0000 | [diff] [blame] | 3 | # Build MacPython 2.5 and make an Installer package of it |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 4 | |
| 5 | # TODO: Parameterize the versions, builddirs, etc... |
| 6 | |
| 7 | # Script configs |
Jack Jansen | de2ecb8 | 2004-12-27 15:53:20 +0000 | [diff] [blame] | 8 | PYVERSION=2.5a0 |
| 9 | PYVER=2.5 |
Jack Jansen | 652b28c | 2003-11-19 13:53:55 +0000 | [diff] [blame] | 10 | BUILDNUM=1 |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 11 | DOCLEANUP=no |
| 12 | |
| 13 | PROGDIR="`dirname \"$0\"`" |
Jack Jansen | 57c914c | 2003-03-22 00:02:23 +0000 | [diff] [blame] | 14 | case x$PROGDIR in |
| 15 | x|x.) PROGDIR=`pwd` ;; |
| 16 | x/*) ;; |
| 17 | *) echo "Please run with a full pathname" |
| 18 | exit 1 |
| 19 | ;; |
| 20 | esac |
| 21 | |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 22 | TMPDIR=/tmp/_py |
| 23 | #TMPDIR=/projects/_py |
| 24 | |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 25 | INSTALLROOT=$TMPDIR/install |
| 26 | DMGDIR=$TMPDIR/dmg |
| 27 | RESOURCEDIR=$PROGDIR/resources |
Jack Jansen | 57c914c | 2003-03-22 00:02:23 +0000 | [diff] [blame] | 28 | DESTDIR=$TMPDIR/dist |
| 29 | PYTHONSRC=$PROGDIR/../../.. |
| 30 | WASTEDIR=$PYTHONSRC/../waste |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 31 | |
Jack Jansen | 7006fa1 | 2003-06-16 15:12:16 +0000 | [diff] [blame] | 32 | case x$1 in |
| 33 | x) |
| 34 | BUILDROOT=$TMPDIR/build |
| 35 | ;; |
| 36 | *) |
| 37 | BUILDROOT=$1 |
| 38 | ;; |
| 39 | esac |
| 40 | |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 41 | # Setup |
Jack Jansen | 7006fa1 | 2003-06-16 15:12:16 +0000 | [diff] [blame] | 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 |
| 49 | fi |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 50 | rm -rf $DMGDIR |
Jack Jansen | fc3542f | 2003-06-18 21:28:44 +0000 | [diff] [blame] | 51 | if [ ! -e $TMPDIR ]; then |
| 52 | mkdir $TMPDIR |
| 53 | fi |
Jack Jansen | 53e54fd | 2003-06-17 14:36:54 +0000 | [diff] [blame] | 54 | chgrp admin $TMPDIR |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 55 | mkdir -p $DMGDIR/root |
| 56 | |
| 57 | |
| 58 | # Configure and build Python |
| 59 | pushd $BUILDROOT |
| 60 | |
Jack Jansen | a6872b8 | 2003-05-07 08:58:11 +0000 | [diff] [blame] | 61 | # Ask the user whether s/he has edited Welcome.txt |
| 62 | read -p "Have you updated $RESOURCEDIR/Welcome.txt (Y/n)? " welcome |
| 63 | |
| 64 | if [ "$welcome" = "n" -o "$welcome" = "N" ]; then |
| 65 | echo "Please do so and retry" |
| 66 | exit |
| 67 | fi |
| 68 | |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 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 |
| 73 | fi |
| 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. |
| 79 | if [ ! -e python.exe ]; then |
| 80 | ln -s python python.exe |
| 81 | fi |
| 82 | |
| 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 |
| 87 | fi |
| 88 | |
Jack Jansen | de2ecb8 | 2004-12-27 15:53:20 +0000 | [diff] [blame] | 89 | #$PYTHONSRC/configure -C --enable-framework LDFLAGS=-Wl,-x |
| 90 | $PYTHONSRC/configure -C --enable-framework |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 91 | make |
Jack Jansen | 7006fa1 | 2003-06-16 15:12:16 +0000 | [diff] [blame] | 92 | make DIRMODE=775 EXEMODE=775 FILEMODE=664 DESTDIR=$INSTALLROOT frameworkinstall |
Jack Jansen | 8cf644d | 2003-06-19 22:45:37 +0000 | [diff] [blame] | 93 | make DIRMODE=775 EXEMODE=775 FILEMODE=664 DESTDIR=$INSTALLROOT frameworkinstallextras |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 94 | |
Jack Jansen | b6b988b | 2003-06-20 21:40:57 +0000 | [diff] [blame] | 95 | # Unfortunately all the ...MODE arguments above still don't do the trick. |
| 96 | # Cop out, and recursively set everything group-writeable. |
| 97 | chmod -R ug+w $INSTALLROOT |
| 98 | |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 99 | if [ "$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 |
| 105 | fi |
| 106 | |
| 107 | popd |
| 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 Jansen | 57c914c | 2003-03-22 00:02:23 +0000 | [diff] [blame] | 114 | rm -rf $INSTALLROOT/usr |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 115 | |
| 116 | # Next, remove the .pyc/.pyo files |
Jack Jansen | 57c914c | 2003-03-22 00:02:23 +0000 | [diff] [blame] | 117 | python $PYTHONSRC/Mac/scripts/zappycfiles.py $INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER |
| 118 | python $PYTHONSRC/Mac/scripts/zappycfiles.py $INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER/Mac/Tools |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 119 | |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 120 | # Finally, build the package... |
| 121 | rm -rf MacPython-OSX.pkg |
Jack Jansen | 57c914c | 2003-03-22 00:02:23 +0000 | [diff] [blame] | 122 | python $PYTHONSRC/Mac/scripts/buildpkg.py \ |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 123 | --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 Jansen | fc3542f | 2003-06-18 21:28:44 +0000 | [diff] [blame] | 129 | --UseUserMask="NO" \ |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 130 | $INSTALLROOT \ |
| 131 | $RESOURCEDIR |
| 132 | |
Jack Jansen | 1fb83c1 | 2003-07-23 10:51:55 +0000 | [diff] [blame] | 133 | # --RootVolumeOnly="YES" \ |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 134 | |
| 135 | # ...and then make a disk image containing the package. |
| 136 | mv MacPython-OSX.pkg $DMGDIR/root |
Jack Jansen | 652b28c | 2003-11-19 13:53:55 +0000 | [diff] [blame] | 137 | cp $RESOURCEDIR/ReadMe.txt $DMGDIR/root/ReadMe.txt |
Jack Jansen | 57c914c | 2003-03-22 00:02:23 +0000 | [diff] [blame] | 138 | $PROGDIR/makedmg $DMGDIR/root $DMGDIR MacPython-OSX-$PYVERSION-$BUILDNUM |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 139 | |
| 140 | echo Moving $DMGDIR/MacPython-OSX-$PYVERSION-$BUILDNUM to $DESTDIR |
Jack Jansen | a6872b8 | 2003-05-07 08:58:11 +0000 | [diff] [blame] | 141 | if [ ! -e $DESTDIR ]; then |
| 142 | mkdir $DESTDIR |
| 143 | fi |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 144 | mv $DMGDIR/MacPython-OSX-$PYVERSION-$BUILDNUM.dmg $DESTDIR |
| 145 | |
| 146 | |
| 147 | # Cleanup build/install dirs |
| 148 | if [ $DOCLEANUP = yes ]; then |
| 149 | echo "Cleaning up..." |
Jack Jansen | 7006fa1 | 2003-06-16 15:12:16 +0000 | [diff] [blame] | 150 | if [ $CLEANBUILD = yes ]; then |
| 151 | rm -rf $BUILDROOT |
| 152 | fi |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 153 | rm -rf $INSTALLROOT |
| 154 | rm -rf $DMGDIR |
| 155 | else |
| 156 | echo "Cleanup is disabled. You should remove these dirs when done:" |
Jack Jansen | 7006fa1 | 2003-06-16 15:12:16 +0000 | [diff] [blame] | 157 | if [ $CLEANBUILD = yes ]; then |
| 158 | echo " $BUILDROOT" |
| 159 | fi |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 160 | echo " $INSTALLROOT" |
| 161 | echo " $DMGDIR" |
| 162 | fi |
Jack Jansen | 57c914c | 2003-03-22 00:02:23 +0000 | [diff] [blame] | 163 | echo "Your installer can be found in $DESTDIR" |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 164 | |