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