#! /bin/bash
## @file
##
## $Id$
##
## $Date: 2004/08/31 15:57:19 $
## $Author: marc $
##
## @copy © Marc Wäckerlin
## @license LGPL, see file COPYING
##
## $Log: bootstrap.sh,v $
## Revision 1.3 2004/08/31 15:57:19 marc
## added file header
##
configure=0
while test $# -gt 0; do
case "$1" in
(--configure|-c) configure=1;;
(*) break;;
esac
shift;
done
MY_NAME=${0##*/}
PROJECT_PATH=$(pwd)
DEFAULT_PROJECT_NAME=${PROJECT_PATH##*/}
HEADER='## @id $Id$
#
# This file has been added by '${MY_NAME}' on '$(date -R)'
# Feel free to change it or even remove and rebuild it, up to your needs
#
## 1 2 3 4 5 6 7 8
## 45678901234567890123456789012345678901234567890123456789012345678901234567890
'
run() {
check=1
while test $# -gt 0; do
case "$1" in
(--no-check) check=0;;
(*) break;;
esac
shift;
done
echo -n "-> running: $* ..."
result=$($* 2>&1)
res=$?
if test $res -ne 0; then
if test $check -eq 1; then
echo " error"
echo "*** Failed with return code: $res"
if test -n "$result"; then
echo "$result"
fi
exit 1
else
echo " ignored"
fi
else
echo " success"
fi
}
testtag() {
egrep -q '^ *'"$1" configure.ac
}
checkdir() {
if ! test -d "$1"; then # create path
run mkdir -p "$1"
run svn add "$1"
fi
}
to() {
while test $# -gt 0; do
case "$1" in
(--condition) shift # test for a tag, abort if not set
if ! testtag "$1" configure.ac; then
return
fi;;
(*) break;;
esac
shift;
done
if test -f "$1"; then # file already exists
return
fi
checkdir "$(dirname ${1})"
echo -n "-> generating $1 ..."
result=$(cat > "$1" 2>&1)
res=$?
if test $res -ne 0; then
echo " error"
echo "*** Failed with return code: $res"
if test -n "$result"; then
echo "$result"
fi
exit 1
else
echo " success"
fi
run svn add "$1"
run svn propset svn:keywords "Id" "$1"
}
copy() {
if ! test -f "$1"; then
run cp "${0%/*}/$1" "$1"
run svn add "$1"
run svn propset svn:keywords "Id" "$1"
fi
}
doxyreplace() {
echo -n "-> doxyfile: configure $1 ..."
if sed -i 's§\(^'"$1"' *=\) *§\1'" $2"'§g' doc/doxyfile.in; then
echo " success"
else
echo " ignored"
fi
}
# Initialize the environment:
copy ${MY_NAME}
copy ax_init_standard_project.m4
copy ax_cxx_compile_stdcxx_11.m4
copy ax_check_qt.m4
if ! test -f configure.ac; then
to configure.ac <