#! /bin/sh

#######################################################################
#
# pgAdmin III - PostgreSQL Tools
# $Id: build-tarball 5041 2006-03-06 11:36:26Z dpage $
# Copyright (C) 2002 - 2006, The pgAdmin Development Team
# This software is released under the Artistic Licence
#
# build-tarball - Build a source tarball 
#
#######################################################################

# Setup the build environment
PATH=$PATH:/usr/local/bin
PGDIR=/usr/local/pgsql
WXDIR=/usr/local/
export PATH PGDIR WXDIR

# Cleanup
cd /usr/local/src/pgadmin3
rm -rf ./slackpack
rm -rf ./doc
rm -rf ./i18n
rm -rf ./pkg
rm -rf ./src

# SVN update
/usr/local/bin/svn update

# Touch the makefiles to ensure make dist doesn't get confused.
touch Makefile.am
touch src/Makefile.am

# Fixup the line ends in the VC++ project files
/usr/bin/perl -wlpi -e 's/$/\r/' src/pgAdmin3.ds{p,w}

# Bootstrap
/bin/sh bootstrap

# Configure for the local OS
./configure --with-pgsql=$PGDIR --with-wx=$WXDIR --enable-static --enable-debug

# Make and store the source tarball
make dist
if [ -e pgadmin3-1.4.2.tar.gz ]; then
	mv pgadmin3-1.4.2.tar.gz /var/www/developer.pgadmin.org/snapshots/src/pgadmin3-src-`/usr/bin/date +%Y%m%d`.tar.gz
	ln -s -f src/pgadmin3-src-`/usr/bin/date +%Y%m%d`.tar.gz /var/www/developer.pgadmin.org/snapshots/pgadmin3-src.tar.gz
fi
