#! /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
##
MY_NAME=${0##*/}
PROJECT_PATH=$(pwd)
DEFAULT_PROJECT_NAME=${PROJECT_PATH##*/}
configure=0
while test $# -gt 0; do
case "$1" in
(--configure|-c) configure=1;;
(--version|-v) echo "$Id$"; exit;;
(--help|-h) less <"
and run ${MY_NAME} again.
FILES TO EDIT
After creation of the files, you can edit them according to your
needs. Please don't forget to redo your edits after rebuilding a
file. Most files don't even need to be edited, they work out of the
box.
The following files normally require editing:
* AUTHORS
* README
* configure.ac
* src/makefile.am
* test/makefile.am
* examples/makefile.am
FILE DEPENDENCIES
You should rebuild (remove and run (see above) the files, whenever
you change the configuration a dependent, i.e.:
* test/makefile.am depends on AX_USE_LIBTOOL
* doc/doxyfile.in depends on AX_BUILD_EXAMPLES
* debian/control.in depends on AX_USE_DOXYGEN, AX_USE_CPPUNIT,
AX_CXX_QT, AX_CXX_CHECK_QT, AX_USE_LIBTOOL
* debian/${DEFAULT_PROJECT_NAME}.install depends on AX_USE_LIBTOOL
* debian/${DEFAULT_PROJECT_NAME}.dirs depends on AX_USE_LIBTOOL
* debian/${DEFAULT_PROJECT_NAME}-dev.install depends on AX_USE_LIBTOOL
* debian/${DEFAULT_PROJECT_NAME}-dev.dirs depends on AX_USE_LIBTOOL
FILES
* AUTHORS: First line is the main author and used in Debian and RPM
packaging, so there must be a GPG key that matches
to this line.
* README: First line is a short description of your project, then an
empty line must follow. All remaining lines are a
long description of your project. this information
is copied, e.g. in Debian or RPM packages. In C++
running:\e[0m $* ..."
result=$($* 2>&1)
res=$?
if test $res -ne 0; then
if test $check -eq 1; then
echo -e " \e[31merror\e[0m"
echo -e "\e[1m*** Failed with return code: $res\e[0m"
if test -n "$result"; then
echo "$result"
fi
exit 1
else
echo -e " \e[33mignored\e[0m"
fi
else
echo -e " \e[32msuccess\e[0m"
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
mode="u=rw,g=rw,o=r"
case "$1" in
(--condition) shift # test for a tag, abort if not set
if ! testtag "$1" configure.ac; then
return
fi;;
(--mode) shift # test for a tag, abort if not set
mode="$1";;
(*) break;;
esac
shift;
done
if test -f "$1"; then # file already exists
return
fi
checkdir "$(dirname ${1})"
echo -en "\e[1m-> generating:\e[0m $1 ..."
result=$(cat > "$1" 2>&1)
res=$?
if test $res -ne 0; then
echo -e " \e[31merror\e[0m"
echo -e "\e[1m*** Failed with return code: $res\e[0m"
if test -n "$result"; then
echo "$result"
fi
exit 1
else
echo -e " \e[32msuccess\e[0m"
fi
chmod $mode $1
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 -en "\e[1m-> doxyfile:\e[0m configure $1 ..."
if sed -i 's|\(^'"$1"' *=\) *|\1'" $2"'|g' doc/doxyfile.in; then
echo -e " \e[32msuccess\e[0m"
else
echo -e " \e[31merror\e[0m"
echo -e "\e[1m**** command: sed -i 's|\(^'"$1"' *=\) *|\1'" $2"'|g' doc/doxyfile.in;\e[0m"
exit 1
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
copy AUTHORS
if ! test -f configure.ac; then
to configure.ac <
namespace NAMESPACE {
/// get package string which consists of package name and package version
std::string package_string();
/// get package name
std::string package_name();
/// get package version
std::string version();
/// get code build date
std::string build_date();
/// get author, i.e. copyright holder
std::string author();
/// get short package description (1st line of README)
std::string description();
/// get long package description (starting at 3rd line in README)
std::string readme();
/// get package logo file name
std::string logo();
/// get package icon file name
std::string icon();
/// used for what filename
extern const std::string WHAT;
/// used for ident filename
extern const std::string IDENT;
}
EOF
to --condition AX_USE_CXX src/version.cxx <
namespace NAMESPACE {
std::string package_string() {
return PACKAGE_STRING;
}
std::string package_name() {
return PACKAGE_NAME;
}
std::string version() {
return PACKAGE_VERSION;
}
std::string build_date() {
return BUILD_DATE;
}
std::string author() {
return AUTHOR;
}
std::string description() {
return DESCRIPTION;
}
std::string readme() {
return README;
}
std::string logo() {
return PROJECT_LOGO;
}
std::string icon() {
return PROJECT_ICON;
}
const std::string WHAT("#(@) " PACKAGE_STRING);
const std::string IDENT("\$Id: " PACKAGE_STRING);
}
EOF
echo "${HEADER}" | to --condition AX_USE_DOXYGEN doc/makefile.am
to --condition AX_USE_CPPUNIT test/makefile.am <