Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 1 | #!/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 |
| 8 | PYVERSION=2.3a2 |
| 9 | PYVER=2.3 |
| 10 | BUILDNUM=3 |
| 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 | |
| 25 | BUILDROOT=$TMPDIR/build |
| 26 | INSTALLROOT=$TMPDIR/install |
| 27 | DMGDIR=$TMPDIR/dmg |
| 28 | RESOURCEDIR=$PROGDIR/resources |
Jack Jansen | 57c914c | 2003-03-22 00:02:23 +0000 | [diff] [blame] | 29 | DESTDIR=$TMPDIR/dist |
| 30 | PYTHONSRC=$PROGDIR/../../.. |
| 31 | WASTEDIR=$PYTHONSRC/../waste |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 32 | |
| 33 | # Setup |
| 34 | mkdir -p $BUILDROOT |
| 35 | mkdir -p $INSTALLROOT |
| 36 | rm -rf $DMGDIR |
| 37 | mkdir -p $DMGDIR/root |
| 38 | |
| 39 | |
| 40 | # Configure and build Python |
| 41 | pushd $BUILDROOT |
| 42 | |
| 43 | # Check if we should build and install the docs, but only if it |
| 44 | # doesn't appear to be done already. TODO: fix this path to be version independent |
| 45 | if [ ! -e "build/temp.darwin-6.3-Power Macintosh-2.3/build-html/build-html idx" ]; then |
| 46 | read -p "Build the Python docs? (y/N)? " builddocs |
| 47 | fi |
| 48 | |
| 49 | # If the filesystem is case-sensitive then "python" will be built, but |
| 50 | # some parts of the install expect "python.exe which is what is built |
| 51 | # on a case-insensitive filesystem. Make a link just in case it is |
| 52 | # needed. |
| 53 | if [ ! -e python.exe ]; then |
| 54 | ln -s python python.exe |
| 55 | fi |
| 56 | |
| 57 | # Make a link to the waste dir so that lib can be found. This allows |
| 58 | # the PythonIDE to be built |
| 59 | if [ ! -e waste ]; then |
| 60 | ln -s $WASTEDIR waste |
| 61 | fi |
| 62 | |
| 63 | $PYTHONSRC/configure --enable-framework=$INSTALLROOT/Library/Frameworks LDFLAGS=-Wl,-x |
| 64 | make |
| 65 | make frameworkinstall |
| 66 | |
| 67 | if [ "$builddocs" = "y" -o "$builddocs" = "Y" ]; then |
| 68 | ./python.exe $PYTHONSRC/Mac/OSX/setupDocs.py build |
| 69 | echo "" |
| 70 | read -p "When the help indexer is done press Enter..." ans |
| 71 | ./python.exe $PYTHONSRC/Mac/OSX/setupDocs.py install \ |
| 72 | --prefix=$INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER |
| 73 | fi |
| 74 | |
| 75 | popd |
| 76 | |
| 77 | |
| 78 | |
| 79 | # Make the Installer package: |
| 80 | # First, remove the unix tools as their paths will be wrong. We'll recreate |
| 81 | # them in the postinstall. |
Jack Jansen | 57c914c | 2003-03-22 00:02:23 +0000 | [diff] [blame] | 82 | rm -rf $INSTALLROOT/usr |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 83 | |
| 84 | # Next, remove the .pyc/.pyo files |
Jack Jansen | 57c914c | 2003-03-22 00:02:23 +0000 | [diff] [blame] | 85 | python $PYTHONSRC/Mac/scripts/zappycfiles.py $INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER |
| 86 | 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] | 87 | |
| 88 | # Make the welcome message |
| 89 | cat > $RESOURCEDIR/Welcome.txt <<EOF |
| 90 | Welcome! |
| 91 | |
| 92 | This program will install Python $PYVERSION for Mac OS X as a Framework. |
| 93 | |
| 94 | Build number: $BUILDNUM |
| 95 | Build date: `date` |
| 96 | EOF |
| 97 | |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 98 | # Finally, build the package... |
| 99 | rm -rf MacPython-OSX.pkg |
Jack Jansen | 57c914c | 2003-03-22 00:02:23 +0000 | [diff] [blame] | 100 | python $PYTHONSRC/Mac/scripts/buildpkg.py \ |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 101 | --Title=MacPython-OSX \ |
| 102 | --Version=$PYVERSION-$BUILDNUM \ |
| 103 | --Description="Python $PYVERSION for Mac OS X, framework based" \ |
| 104 | --NeedsAuthorization="YES" \ |
| 105 | --Relocatable="NO" \ |
| 106 | --InstallOnly="YES" \ |
| 107 | $INSTALLROOT \ |
| 108 | $RESOURCEDIR |
| 109 | |
| 110 | ## --RootVolumeOnly="YES" \ |
| 111 | |
| 112 | # ...and then make a disk image containing the package. |
| 113 | mv MacPython-OSX.pkg $DMGDIR/root |
Jack Jansen | 57c914c | 2003-03-22 00:02:23 +0000 | [diff] [blame] | 114 | $PROGDIR/makedmg $DMGDIR/root $DMGDIR MacPython-OSX-$PYVERSION-$BUILDNUM |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 115 | |
| 116 | echo Moving $DMGDIR/MacPython-OSX-$PYVERSION-$BUILDNUM to $DESTDIR |
| 117 | mv $DMGDIR/MacPython-OSX-$PYVERSION-$BUILDNUM.dmg $DESTDIR |
| 118 | |
| 119 | |
| 120 | # Cleanup build/install dirs |
| 121 | if [ $DOCLEANUP = yes ]; then |
| 122 | echo "Cleaning up..." |
| 123 | rm -rf $BUILDROOT |
| 124 | rm -rf $INSTALLROOT |
| 125 | rm -rf $DMGDIR |
| 126 | else |
| 127 | echo "Cleanup is disabled. You should remove these dirs when done:" |
| 128 | echo " $BUILDROOT" |
| 129 | echo " $INSTALLROOT" |
| 130 | echo " $DMGDIR" |
| 131 | fi |
Jack Jansen | 57c914c | 2003-03-22 00:02:23 +0000 | [diff] [blame] | 132 | echo "Your installer can be found in $DESTDIR" |
Jack Jansen | 8806d47 | 2003-03-21 23:52:36 +0000 | [diff] [blame] | 133 | |