#!/bin/sh
#
# This bootstrap file has been inspired by Bootstraping chapter
# in Autobook by Vaughan, Elliston, Tromey and Taylor.
# http://sources.redhat.com/autobook/
#
# Usage: $0 [path to wxwin.m4]
#

# This file prepares files for autoconfig/automake process
#
# BOOTSTRAP FOR *** RELEASE ****
#
# It's not intended for development!
#
#
# define version, all other is self-working

VER=0.5.7

#---
# execution part:

set -x
set -e

# required by autoconf
hg log --style changelog > ChangeLog

cat configure.ac | awk -v ver=$VER '{if(/^AC_INIT/) {print "AC_INIT([Munipack],[" ver "],[hroch@physics.muni.cz],[munipack],[http://munipack.physics.muni.cz])";} else print;}' > configure.new
mv configure.new configure.ac

# generate .spec
awk -v v=$VER '{ if( /^Version:/ ) print $1,v; else print; }' < munipack.spec.template > munipack.spec

# generate thumbnails in doc/ and icons in xmunipack/, RSS optionaly
( cd doc && sh genthumb.sh )
( cd xmunipack && sh image_list.sh )
#( cd doc && sh rss.sh )
# RSS must be generated out of official Debian repository to prevent:
#  https://lintian.debian.org/tags/privacy-breach-generic.html

# add -I for localy installed wxwin.m4 (or add its parent directory as
#                                      the first command-line argument)

if [ "$1" ]; then
   ACLOCAL_PATH="-I $1"
fi

autoreconf $ACLOCAL_PATH -i
