#!/bin/sh
version=3.1
name=gallery

# Set initial variables:
CWD=`pwd`
if [ "$TMP" = "" ]; then
  TMP=/tmp
fi
PKG=$TMP/package-${name}

if [ ! -d $TMP ]; then
  mkdir -p $TMP # location to build the source
fi
if [ ! -d $PKG ]; then
  mkdir -p $PKG # place for the package to be built
fi

echo "+===============+"
echo "| ${name}-${version}   |"
echo "+===============+"
cd $TMP
tar xzvvf $CWD/${name}-${version}.tar.gz
cd ${name}-${version}
./configure --prefix=/usr --without-debug --with-gziped-man --with-polish-man
make
make prefix=$PKG/usr install

# Build the package:
cd $PKG
tar czvvf $TMP/${name}.tgz .

# Clean up the extra stuff:
if [ "$1" = "--cleanup" ]; then
  rm -rf $TMP/${name}-${version}
  rm -rf $PKG
fi
