2003-03-21 19:52:36 -04:00
|
|
|
#!/bin/sh -e
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
# Build MacPython 2.3 and make an Installer package of it
|
|
|
|
|
|
|
|
# TODO: Parameterize the versions, builddirs, etc...
|
|
|
|
|
|
|
|
# Script configs
|
2003-07-22 10:45:26 -03:00
|
|
|
PYVERSION=2.3rc1plus
|
2003-03-21 19:52:36 -04:00
|
|
|
PYVER=2.3
|
2003-07-23 07:51:55 -03:00
|
|
|
BUILDNUM=8
|
2003-03-21 19:52:36 -04:00
|
|
|
DOCLEANUP=no
|
|
|
|
|
|
|
|
PROGDIR="`dirname \"$0\"`"
|
2003-03-21 20:02:23 -04:00
|
|
|
case x$PROGDIR in
|
|
|
|
x|x.) PROGDIR=`pwd` ;;
|
|
|
|
x/*) ;;
|
|
|
|
*) echo "Please run with a full pathname"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2003-03-21 19:52:36 -04:00
|
|
|
TMPDIR=/tmp/_py
|
|
|
|
#TMPDIR=/projects/_py
|
|
|
|
|
|
|
|
INSTALLROOT=$TMPDIR/install
|
|
|
|
DMGDIR=$TMPDIR/dmg
|
|
|
|
RESOURCEDIR=$PROGDIR/resources
|
2003-03-21 20:02:23 -04:00
|
|
|
DESTDIR=$TMPDIR/dist
|
|
|
|
PYTHONSRC=$PROGDIR/../../..
|
|
|
|
WASTEDIR=$PYTHONSRC/../waste
|
2003-03-21 19:52:36 -04:00
|
|
|
|
2003-06-16 12:12:16 -03:00
|
|
|
case x$1 in
|
|
|
|
x)
|
|
|
|
BUILDROOT=$TMPDIR/build
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
BUILDROOT=$1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2003-03-21 19:52:36 -04:00
|
|
|
# Setup
|
2003-06-16 12:12:16 -03:00
|
|
|
if [ -e $BUILDROOT ]; then
|
|
|
|
echo Using existing build directory $BUILDROOT
|
|
|
|
CLEANBUILD=no
|
|
|
|
else
|
|
|
|
echo Creating clean build directory $BUILDROOT
|
|
|
|
CLEANBUILD=yes
|
|
|
|
mkdir -p $BUILDROOT
|
|
|
|
fi
|
2003-03-21 19:52:36 -04:00
|
|
|
rm -rf $DMGDIR
|
2003-06-18 18:28:44 -03:00
|
|
|
if [ ! -e $TMPDIR ]; then
|
|
|
|
mkdir $TMPDIR
|
|
|
|
fi
|
2003-06-17 11:36:54 -03:00
|
|
|
chgrp admin $TMPDIR
|
2003-03-21 19:52:36 -04:00
|
|
|
mkdir -p $DMGDIR/root
|
|
|
|
|
|
|
|
|
|
|
|
# Configure and build Python
|
|
|
|
pushd $BUILDROOT
|
|
|
|
|
2003-05-07 05:58:11 -03:00
|
|
|
# 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
|
|
|
|
|
2003-03-21 19:52:36 -04:00
|
|
|
# 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
|
|
|
|
|
2003-06-16 12:12:16 -03:00
|
|
|
$PYTHONSRC/configure -C --enable-framework LDFLAGS=-Wl,-x
|
2003-03-21 19:52:36 -04:00
|
|
|
make
|
2003-06-16 12:12:16 -03:00
|
|
|
make DIRMODE=775 EXEMODE=775 FILEMODE=664 DESTDIR=$INSTALLROOT frameworkinstall
|
2003-06-19 19:45:37 -03:00
|
|
|
make DIRMODE=775 EXEMODE=775 FILEMODE=664 DESTDIR=$INSTALLROOT frameworkinstallextras
|
2003-03-21 19:52:36 -04:00
|
|
|
|
2003-06-20 18:40:57 -03:00
|
|
|
# Unfortunately all the ...MODE arguments above still don't do the trick.
|
|
|
|
# Cop out, and recursively set everything group-writeable.
|
|
|
|
chmod -R ug+w $INSTALLROOT
|
|
|
|
|
2003-03-21 19:52:36 -04:00
|
|
|
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.
|
2003-03-21 20:02:23 -04:00
|
|
|
rm -rf $INSTALLROOT/usr
|
2003-03-21 19:52:36 -04:00
|
|
|
|
|
|
|
# Next, remove the .pyc/.pyo files
|
2003-03-21 20:02:23 -04:00
|
|
|
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
|
2003-03-21 19:52:36 -04:00
|
|
|
|
|
|
|
# Finally, build the package...
|
|
|
|
rm -rf MacPython-OSX.pkg
|
2003-03-21 20:02:23 -04:00
|
|
|
python $PYTHONSRC/Mac/scripts/buildpkg.py \
|
2003-03-21 19:52:36 -04:00
|
|
|
--Title=MacPython-OSX \
|
|
|
|
--Version=$PYVERSION-$BUILDNUM \
|
|
|
|
--Description="Python $PYVERSION for Mac OS X, framework based" \
|
|
|
|
--NeedsAuthorization="YES" \
|
|
|
|
--Relocatable="NO" \
|
|
|
|
--InstallOnly="YES" \
|
2003-06-18 18:28:44 -03:00
|
|
|
--UseUserMask="NO" \
|
2003-03-21 19:52:36 -04:00
|
|
|
$INSTALLROOT \
|
|
|
|
$RESOURCEDIR
|
|
|
|
|
2003-07-23 07:51:55 -03:00
|
|
|
# --RootVolumeOnly="YES" \
|
2003-03-21 19:52:36 -04:00
|
|
|
|
|
|
|
# ...and then make a disk image containing the package.
|
|
|
|
mv MacPython-OSX.pkg $DMGDIR/root
|
2003-05-07 05:58:11 -03:00
|
|
|
cp $RESOURCEDIR/Welcome.txt $DMGDIR/root/README.txt
|
2003-03-21 20:02:23 -04:00
|
|
|
$PROGDIR/makedmg $DMGDIR/root $DMGDIR MacPython-OSX-$PYVERSION-$BUILDNUM
|
2003-03-21 19:52:36 -04:00
|
|
|
|
|
|
|
echo Moving $DMGDIR/MacPython-OSX-$PYVERSION-$BUILDNUM to $DESTDIR
|
2003-05-07 05:58:11 -03:00
|
|
|
if [ ! -e $DESTDIR ]; then
|
|
|
|
mkdir $DESTDIR
|
|
|
|
fi
|
2003-03-21 19:52:36 -04:00
|
|
|
mv $DMGDIR/MacPython-OSX-$PYVERSION-$BUILDNUM.dmg $DESTDIR
|
|
|
|
|
|
|
|
|
|
|
|
# Cleanup build/install dirs
|
|
|
|
if [ $DOCLEANUP = yes ]; then
|
|
|
|
echo "Cleaning up..."
|
2003-06-16 12:12:16 -03:00
|
|
|
if [ $CLEANBUILD = yes ]; then
|
|
|
|
rm -rf $BUILDROOT
|
|
|
|
fi
|
2003-03-21 19:52:36 -04:00
|
|
|
rm -rf $INSTALLROOT
|
|
|
|
rm -rf $DMGDIR
|
|
|
|
else
|
|
|
|
echo "Cleanup is disabled. You should remove these dirs when done:"
|
2003-06-16 12:12:16 -03:00
|
|
|
if [ $CLEANBUILD = yes ]; then
|
|
|
|
echo " $BUILDROOT"
|
|
|
|
fi
|
2003-03-21 19:52:36 -04:00
|
|
|
echo " $INSTALLROOT"
|
|
|
|
echo " $DMGDIR"
|
|
|
|
fi
|
2003-03-21 20:02:23 -04:00
|
|
|
echo "Your installer can be found in $DESTDIR"
|
2003-03-21 19:52:36 -04:00
|
|
|
|