#!/bin/sh -e #---------------------------------------------------------------------- # Build MacPython 2.3 and make an Installer package of it # TODO: Parameterize the versions, builddirs, etc... # Script configs PYVERSION=2.3b1 PYVER=2.3 BUILDNUM=1 DOCLEANUP=no PROGDIR="`dirname \"$0\"`" case x$PROGDIR in x|x.) PROGDIR=`pwd` ;; x/*) ;; *) echo "Please run with a full pathname" exit 1 ;; esac TMPDIR=/tmp/_py #TMPDIR=/projects/_py BUILDROOT=$TMPDIR/build INSTALLROOT=$TMPDIR/install DMGDIR=$TMPDIR/dmg RESOURCEDIR=$PROGDIR/resources DESTDIR=$TMPDIR/dist PYTHONSRC=$PROGDIR/../../.. WASTEDIR=$PYTHONSRC/../waste # Setup mkdir -p $BUILDROOT mkdir -p $INSTALLROOT rm -rf $DMGDIR mkdir -p $DMGDIR/root # Configure and build Python pushd $BUILDROOT # Ask the user whether s/he has edited Welcome.txt read -p "Have you updated $RESOURCEDIR/Welcome.txt (Y/n)? " welcome if [ "$welcome" = "n" -o "$welcome" = "N" ]; then echo "Please do so and retry" exit fi # Check if we should build and install the docs, but only if it # doesn't appear to be done already. TODO: fix this path to be version independent if [ ! -e "build/temp.darwin-6.3-Power Macintosh-2.3/build-html/build-html idx" ]; then read -p "Build the Python docs? (y/N)? " builddocs fi # If the filesystem is case-sensitive then "python" will be built, but # some parts of the install expect "python.exe which is what is built # on a case-insensitive filesystem. Make a link just in case it is # needed. if [ ! -e python.exe ]; then ln -s python python.exe fi # Make a link to the waste dir so that lib can be found. This allows # the PythonIDE to be built if [ ! -e waste ]; then ln -s $WASTEDIR waste fi $PYTHONSRC/configure --enable-framework=$INSTALLROOT/Library/Frameworks LDFLAGS=-Wl,-x make make DIRMODE=775 EXEMODE=775 FILEMODE=664 frameworkinstall if [ "$builddocs" = "y" -o "$builddocs" = "Y" ]; then ./python.exe $PYTHONSRC/Mac/OSX/setupDocs.py build echo "" read -p "When the help indexer is done press Enter..." ans ./python.exe $PYTHONSRC/Mac/OSX/setupDocs.py install \ --prefix=$INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER fi popd # Make the Installer package: # First, remove the unix tools as their paths will be wrong. We'll recreate # them in the postinstall. rm -rf $INSTALLROOT/usr # Next, remove the .pyc/.pyo files python $PYTHONSRC/Mac/scripts/zappycfiles.py $INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER python $PYTHONSRC/Mac/scripts/zappycfiles.py $INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER/Mac/Tools # Finally, build the package... rm -rf MacPython-OSX.pkg python $PYTHONSRC/Mac/scripts/buildpkg.py \ --Title=MacPython-OSX \ --Version=$PYVERSION-$BUILDNUM \ --Description="Python $PYVERSION for Mac OS X, framework based" \ --NeedsAuthorization="YES" \ --Relocatable="NO" \ --InstallOnly="YES" \ $INSTALLROOT \ $RESOURCEDIR ## --RootVolumeOnly="YES" \ # ...and then make a disk image containing the package. mv MacPython-OSX.pkg $DMGDIR/root cp $RESOURCEDIR/Welcome.txt $DMGDIR/root/README.txt $PROGDIR/makedmg $DMGDIR/root $DMGDIR MacPython-OSX-$PYVERSION-$BUILDNUM echo Moving $DMGDIR/MacPython-OSX-$PYVERSION-$BUILDNUM to $DESTDIR if [ ! -e $DESTDIR ]; then mkdir $DESTDIR fi mv $DMGDIR/MacPython-OSX-$PYVERSION-$BUILDNUM.dmg $DESTDIR # Cleanup build/install dirs if [ $DOCLEANUP = yes ]; then echo "Cleaning up..." rm -rf $BUILDROOT rm -rf $INSTALLROOT rm -rf $DMGDIR else echo "Cleanup is disabled. You should remove these dirs when done:" echo " $BUILDROOT" echo " $INSTALLROOT" echo " $DMGDIR" fi echo "Your installer can be found in $DESTDIR"