Blame config/MacOSX/createdist.sh

Packit 0986c0
## createdist.sh
Packit 0986c0
## This is a shell script to automatically create a gnuplot distribution 
Packit 0986c0
## for Mac OS X. It will download and build a source tarball and create
Packit 0986c0
## a disk image with a standard GUI installer and folders with supporting
Packit 0986c0
## files (ReadMe, docs in PDF and demos).
Packit 0986c0
##
Packit 0986c0
## The utility "freeze" from the application Iceberg is required, see
Packit 0986c0
## http://s.sudre.free.fr/Software/Iceberg.html
Packit 0986c0
##
Packit 0986c0
## 2004-10-21 Per Persson, persquare@users.sf.net
Packit 0986c0
Packit 0986c0
## Change as needed
Packit 0986c0
VERSION="4.0.0"
Packit 0986c0
SHORTVER="4.0"
Packit 0986c0
BETA=
Packit 0986c0
DISTRO_DIR=`pwd`
Packit 0986c0
## No changes needed below this line
Packit 0986c0
Packit 0986c0
echo "==== Creating distro of gnuplot $VERSION$BETA"
Packit 0986c0
Packit 0986c0
TARBALL="gnuplot-$VERSION.tar.gz"
Packit 0986c0
WORK_DIR="$DISTRO_DIR/work"
Packit 0986c0
SRC_DIR="$WORK_DIR/gnuplot-$VERSION"
Packit 0986c0
BUILD_DIR="$DISTRO_DIR/build"
Packit 0986c0
PRODUCTS_DIR="$BUILD_DIR/products"
Packit 0986c0
DMG_ROOT="$BUILD_DIR/dmg_root"
Packit 0986c0
Packit 0986c0
## Always remove product
Packit 0986c0
rm -rf $BUILD_DIR/Gnuplot-$VERSION$BETA.dmg 
Packit 0986c0
Packit 0986c0
if [ "$1" = "pack" ]; then
Packit 0986c0
    echo "*** Warning skipping build"
Packit 0986c0
else
Packit 0986c0
    echo "Setting up directories"
Packit 0986c0
    rm -rf build.log
Packit 0986c0
    rm -rf $BUILD_DIR
Packit 0986c0
    mkdir $BUILD_DIR
Packit 0986c0
    if [ ! -d $WORK_DIR ]; then
Packit 0986c0
	mkdir $WORK_DIR
Packit 0986c0
    else
Packit 0986c0
	(cd $WORK_DIR; rm -rf $SRC_DIR)
Packit 0986c0
    fi
Packit 0986c0
    mkdir $PRODUCTS_DIR
Packit 0986c0
    mkdir $DMG_ROOT
Packit 0986c0
    mkdir $DMG_ROOT/Demo
Packit 0986c0
    mkdir $DMG_ROOT/Docs
Packit 0986c0
Packit 0986c0
    echo "Fetching tarball to $WORK_DIR"
Packit 0986c0
    if [ ! -f $WORK_DIR/$TARBALL ]; then 
Packit 0986c0
	curl -o $WORK_DIR/$TARBALL http://heanet.dl.sourceforge.net/sourceforge/gnuplot/$TARBALL
Packit 0986c0
    fi
Packit 0986c0
    ( 
Packit 0986c0
	cd $WORK_DIR
Packit 0986c0
	gnutar xvzf $TARBALL
Packit 0986c0
    )
Packit 0986c0
Packit 0986c0
    echo "Configuring in $SRC_DIR"
Packit 0986c0
    (
Packit 0986c0
	cd $SRC_DIR
Packit 0986c0
	./configure --prefix=/usr/local \
Packit 0986c0
	    --without-gd --without-png
Packit 0986c0
    )
Packit 0986c0
    echo "#undef'ing HAVE_STPCPY which didn't exist prior to 10.3"
Packit 0986c0
    (
Packit 0986c0
	cd $SRC_DIR 
Packit 0986c0
	cp config.h config_10_3.h
Packit 0986c0
	sed "s/#define HAVE_STPCPY 1/\/\* #undef HAVE_STPCPY \*\//g" < config.h > config_10_2.h
Packit 0986c0
	cp config_10_2.h config.h
Packit 0986c0
    )
Packit 0986c0
Packit 0986c0
    echo "Building in $SRC_DIR"
Packit 0986c0
    (
Packit 0986c0
	cd $SRC_DIR
Packit 0986c0
	make
Packit 0986c0
    )
Packit 0986c0
    
Packit 0986c0
    echo "Installing in $PRODUCTS_DIR"
Packit 0986c0
    (
Packit 0986c0
	cd $SRC_DIR
Packit 0986c0
	make install DESTDIR=$PRODUCTS_DIR
Packit 0986c0
    )
Packit 0986c0
Packit 0986c0
    echo "Copying demo files to $DMGROOT/Demo"
Packit 0986c0
    cp $SRC_DIR/demo/* $DMG_ROOT/Demo/.
Packit 0986c0
    rm -f $DMG_ROOT/demo/Make*
Packit 0986c0
    rm -f $DMG_ROOT/demo/webify.pl
Packit 0986c0
Packit 0986c0
    echo "Building docs"
Packit 0986c0
    (
Packit 0986c0
	cd $SRC_DIR/docs
Packit 0986c0
	make pdf
Packit 0986c0
    )
Packit 0986c0
    (
Packit 0986c0
	cd $SRC_DIR/tutorial
Packit 0986c0
	make pdf
Packit 0986c0
    )
Packit 0986c0
Packit 0986c0
    echo "Copying docs to $DMGROOT/Docs"
Packit 0986c0
    cp $SRC_DIR/docs/gnuplot.pdf $DMG_ROOT/Docs/.
Packit 0986c0
    cp $SRC_DIR/tutorial/tutorial.pdf $DMG_ROOT/Docs/gnuplot_LateX_tutorial.pdf
Packit 0986c0
    cp $SRC_DIR/{FAQ,README,Copyright} $DMG_ROOT/Docs/.
Packit 0986c0
fi ## skip build
Packit 0986c0
Packit 0986c0
echo "==== Making distro ===="
Packit 0986c0
echo "gnuplot $VERSION$BETA for Mac OS X binary distribution" > build.log
Packit 0986c0
echo "Dependencies" >> build.log 
Packit 0986c0
otool -L $PRODUCTS_DIR/usr/local/bin/gnuplot | tee -a build.log
Packit 0986c0
otool -L $PRODUCTS_DIR/usr/local/libexec/gnuplot/$SHORTVER/gnuplot_x11 | tee -a build.log
Packit 0986c0
echo "Installer contents" >> build.log 
Packit 0986c0
lsbom $DMG_ROOT/gnuplot.pkg/Contents/Archive.bom | tee -a build.log
Packit 0986c0
Packit 0986c0
echo "---- Packing up ----"
Packit 0986c0
freeze gnuplot.packproj
Packit 0986c0
Packit 0986c0
echo "---- Creating DMG ----"
Packit 0986c0
cp $DISTRO_DIR/ReadMe.rtf $DMG_ROOT/.
Packit 0986c0
hdiutil create -volname Gnuplot-$VERSION -fs HFS+ -srcfolder $DMG_ROOT $BUILD_DIR/Gnuplot-$VERSION$BETA.dmg
Packit 0986c0
Packit 0986c0
echo "---- Done ----"