#!/bin/bash
#
# $Id: bootstrap 1333 2011-01-18 17:25:26Z rdempsey $
#
# This script is responsible for setting up a fresh development tree
# following a git checkout.  It copies static files and shared include
# files to the export tree prior to building the software.

set -e

mkdir -p export/mysql
#FIXME rename this
cp dbcon/mysql/install_calpont_mysql.sh export/mysql/

#TODO: see if this my.cnf is necessary
cp dbcon/mysql/my.cnf export/mysql/.

#TODO: the init.d service file should not be mixed case
#TODO: the init.d service file should not contain calpont
cp dbcon/mysql/mysql-Columnstore export/mysql/ && \
cp build/files.lst export/mysql/ && \
cp dbcon/mysql/install_calpont_mysql.sh export/mysql/ && \
cp dbcon/mysql/my.cnf export/mysql/ && \
cp dbcon/mysql/mysql-Columnstore export/mysql/

#FIXME:
#This is not going to update the version in configure.ac
echo Generating version header
./build/genVersion.sh
if [ $? -ne 0 ]; then
  echo Could not generate version header
  exit $?
fi

echo Running GNU autotools to generate build environment
aclocal && \
autoconf && \
autoheader && \
libtoolize && \
automake --add-missing && \
autoreconf

if [ $? -ne 0 ]; then
  echo GNU autotools generation failed
  exit $?
fi


echo GNU autotools environment generation completed successfully

#cd net-snmp/net-snmp
#	./configure --prefix=$PREFIX --with-mib-modules=disman/event-mib --with-cc=gcc \
#                --with-logfile=$PREFIX/log/snmpd.log \
#                --with-sys-location=Unknown \
#                --with-sys-contact=root@localhost.localdomain \
#                --with-default-snmp-version=3 \
#                --with-persistent-directory=$PREFIX/var/net-snmp \
#                --without-openssl \
#                --with-ldflags="-Wl,-rpath -Wl,$PREFIX/lib"

