support scripts and new parameters --build --overwrite --rebuild

master
Marc Wäckerlin 10 years ago
parent 0a2f53d126
commit 960dd77571
  1. 5
      ax_init_standard_project.m4
  2. 77
      bootstrap.sh

@ -283,6 +283,11 @@ rpm: dist
EOF EOF
]) ])
# use this in configure.ac to support scripts, e.g. bash scripts
AC_DEFUN([AX_USE_SCRIPTS], [
AC_CONFIG_FILES([scripts/makefile])
])
# use this in configure.ac to support Doxygen documentation generation # use this in configure.ac to support Doxygen documentation generation
AC_DEFUN([AX_USE_DOXYGEN], [ AC_DEFUN([AX_USE_DOXYGEN], [
AC_CHECK_PROG(have_doxygen, doxygen, yes, no) AC_CHECK_PROG(have_doxygen, doxygen, yes, no)

@ -19,10 +19,18 @@ PROJECT_PATH=$(pwd)
DEFAULT_PROJECT_NAME=${PROJECT_PATH##*/} DEFAULT_PROJECT_NAME=${PROJECT_PATH##*/}
configure=0 configure=0
build=0
overwrite=0
rebuild=0
while test $# -gt 0; do while test $# -gt 0; do
case "$1" in case "$1" in
(--configure|-c) configure=1;; (--configure|-c) configure=1;;
(--version|-v) echo "$Id: bootstrap.sh 31 2015-05-05 15:06:08Z marc $"; exit;; (--build|-b) configure=1; build=1;;
(--overwrite|-o) overwrite=1;;
(--rebuild|-r) rebuild=1;;
(--version|-v)
echo "$Id: bootstrap.sh 31 2015-05-05 15:06:08Z marc $";
exit;;
(--help|-h) less <<EOF (--help|-h) less <<EOF
SYNOPSIS SYNOPSIS
@ -31,6 +39,9 @@ SYNOPSIS
OPTIONS OPTIONS
--configure, -c call ./configure after initialization --configure, -c call ./configure after initialization
--build, -c build, call ./configure && make after initialization
--overwrite, -o overwrite all basic files (bootstrap.sh, m4-macros)
--rebuild -r force rebuild of generated files, even if modified
--help, -h show this help --help, -h show this help
--version, -v show version and date of this file --version, -v show version and date of this file
@ -93,6 +104,7 @@ GENERATED FILES
* src/makefile.am - if you enabled AX_USE_CXX * src/makefile.am - if you enabled AX_USE_CXX
* src/version.hxx - if you enabled AX_USE_CXX * src/version.hxx - if you enabled AX_USE_CXX
* src/version.cxx - if you enabled AX_USE_CXX * src/version.cxx - if you enabled AX_USE_CXX
* scripts/makefile.in - if you enabled AX_USE_SCRIPTS
* doc/makefile.am - if you enabled AX_USE_DOXYGEN * doc/makefile.am - if you enabled AX_USE_DOXYGEN
* doc/doxyfile.in - if you enabled AX_USE_DOXYGEN * doc/doxyfile.in - if you enabled AX_USE_DOXYGEN
* test/makefile.am - if you enabled AX_USE_CPPUNIT * test/makefile.am - if you enabled AX_USE_CPPUNIT
@ -108,8 +120,11 @@ GENERATED FILES
* debian/compat - if you enabled AX_USE_DEBIAN_PACKAGING * debian/compat - if you enabled AX_USE_DEBIAN_PACKAGING
* src/${DEFAULT_PROJECT_NAME}.pc.in - if you enabled AX_USE_LIBTOOL * src/${DEFAULT_PROJECT_NAME}.pc.in - if you enabled AX_USE_LIBTOOL
To rebuild any of these files, just remove it using "svn rm <filename>" REBUILDING FILES
and run ${MY_NAME} again.
To rebuild all these files, just run "${MY_NAME} -o". You can also
remove and rebuild a single file by removing it from subversion,
just call "svn rm <file>" and "${MY_NAME}" to rebuild file "<file>".
FILES TO EDIT FILES TO EDIT
@ -128,8 +143,8 @@ FILES TO EDIT
FILE DEPENDENCIES FILE DEPENDENCIES
You should rebuild (remove and run (see above) the files, whenever You should rebuild (see above) the files, whenever you change the
you change the configuration a dependent, i.e.: configuration a dependent, i.e.:
* test/makefile.am depends on AX_USE_LIBTOOL * test/makefile.am depends on AX_USE_LIBTOOL
* doc/doxyfile.in depends on AX_BUILD_EXAMPLES * doc/doxyfile.in depends on AX_BUILD_EXAMPLES
@ -162,8 +177,9 @@ FILES
number. The following macros are supported: number. The following macros are supported:
* Enable C++: AX_USE_CXX * Enable C++: AX_USE_CXX
* Enable LibTool library creation: AX_USE_LIBTOOL * Enable LibTool library creation: AX_USE_LIBTOOL
* Enable Scripts: AX_USE_SCRIPTS
* Enable Doxygen documentation generation: AX_USE_DOXYGEN * Enable Doxygen documentation generation: AX_USE_DOXYGEN
* Enable debian packaging by calling "make deb": AX_USE_DEBIAN_PACKAGING * Enable Debian packaging by calling "make deb": AX_USE_DEBIAN_PACKAGING
* Not yet implemented: AX_USE_RPM_PACKAGING * Not yet implemented: AX_USE_RPM_PACKAGING
* Enable C++ testing using CppUnit: AX_USE_CPPUNIT * Enable C++ testing using CppUnit: AX_USE_CPPUNIT
* Enable C++ examples, i.e. for libraries: AX_BUILD_EXAMPLES * Enable C++ examples, i.e. for libraries: AX_BUILD_EXAMPLES
@ -198,7 +214,7 @@ EOF
done done
HEADER='## @id $Id: bootstrap.sh 31 2015-05-05 15:06:08Z marc $ HEADER='## @id '"\$Id\$"'
# #
# This file has been added by '${MY_NAME}' on '$(date -R)' # 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 # Feel free to change it or even remove and rebuild it, up to your needs
@ -247,6 +263,14 @@ checkdir() {
fi fi
} }
checkfile() {
exists=0
if test -f "$1"; then
exists=1
fi
test $exists -eq 1
}
to() { to() {
while test $# -gt 0; do while test $# -gt 0; do
mode="u=rw,g=rw,o=r" mode="u=rw,g=rw,o=r"
@ -261,7 +285,7 @@ to() {
esac esac
shift; shift;
done done
if test -f "$1"; then # file already exists if checkfile "$1" && test $rebuild -eq 0; then # file already exists
return return
fi fi
checkdir "$(dirname ${1})" checkdir "$(dirname ${1})"
@ -279,13 +303,18 @@ to() {
echo -e " \e[32msuccess\e[0m" echo -e " \e[32msuccess\e[0m"
fi fi
chmod $mode $1 chmod $mode $1
if test $exists -eq 0; then
run svn add "$1" run svn add "$1"
run svn propset svn:keywords "Id" "$1" run svn propset svn:keywords "Id" "$1"
fi
} }
copy() { copy() {
if ! test -f "$1"; then if checkfile "$1" && test $overwrite -eq 0; then
return
fi
run cp "${0%/*}/$1" "$1" run cp "${0%/*}/$1" "$1"
if test $exists -eq 0; then
run svn add "$1" run svn add "$1"
run svn propset svn:keywords "Id" "$1" run svn propset svn:keywords "Id" "$1"
fi fi
@ -321,6 +350,7 @@ AX_INIT_STANDARD_PROJECT
# requirements, uncomment, what you need: # requirements, uncomment, what you need:
#AX_USE_CXX #AX_USE_CXX
#AX_USE_LIBTOOL #AX_USE_LIBTOOL
#AX_USE_SCRIPTS
#AX_USE_DOXYGEN #AX_USE_DOXYGEN
#AX_USE_DEBIAN_PACKAGING #AX_USE_DEBIAN_PACKAGING
#AX_USE_RPM_PACKAGING #AX_USE_RPM_PACKAGING
@ -342,7 +372,7 @@ echo "${HEADER}" | to --condition AX_USE_CXX src/makefile.am
to --condition AX_USE_CXX src/version.hxx <<EOF to --condition AX_USE_CXX src/version.hxx <<EOF
/*! @file /*! @file
@id \$Id: bootstrap.sh 31 2015-05-05 15:06:08Z marc $ @id \$Id\$
*/ */
// 1 2 3 4 5 6 7 8 // 1 2 3 4 5 6 7 8
// 45678901234567890123456789012345678901234567890123456789012345678901234567890 // 45678901234567890123456789012345678901234567890123456789012345678901234567890
@ -377,7 +407,7 @@ EOF
to --condition AX_USE_CXX src/version.cxx <<EOF to --condition AX_USE_CXX src/version.cxx <<EOF
/*! @file /*! @file
@id $Id: bootstrap.sh 31 2015-05-05 15:06:08Z marc $ @id $Id\$
*/ */
// 1 2 3 4 5 6 7 8 // 1 2 3 4 5 6 7 8
// 45678901234567890123456789012345678901234567890123456789012345678901234567890 // 45678901234567890123456789012345678901234567890123456789012345678901234567890
@ -416,6 +446,7 @@ namespace NAMESPACE {
const std::string IDENT("\$Id: " PACKAGE_STRING); const std::string IDENT("\$Id: " PACKAGE_STRING);
} }
EOF EOF
echo "${HEADER}" | to --condition AX_USE_SCRIPTS scripts/makefile.am
echo "${HEADER}" | to --condition AX_USE_DOXYGEN doc/makefile.am echo "${HEADER}" | to --condition AX_USE_DOXYGEN doc/makefile.am
to --condition AX_USE_CPPUNIT test/makefile.am <<EOF to --condition AX_USE_CPPUNIT test/makefile.am <<EOF
${HEADER}AM_CPPFLAGS = -I${top_srcdir}/src -I${top_builddir}/src ${HEADER}AM_CPPFLAGS = -I${top_srcdir}/src -I${top_builddir}/src
@ -512,28 +543,17 @@ EOF
NEWS NEWS
README README
EOF EOF
to debian/${PACKAGE_NAME}.install <<EOF to --condition AX_USE_LIBTOOL debian/${PACKAGE_NAME}.install <<EOF
usr/bin/*
usr/lib/lib*.so.* usr/lib/lib*.so.*
$(if ! testtag AX_USE_LIBTOOL; then echo "usr/share/doc/${PACKAGE_NAME}/html"; fi)
EOF
to debian/${PACKAGE_NAME}.dirs <<EOF
usr/lib
EOF EOF
if testtag AX_USE_LIBTOOL; then to --condition AX_USE_LIBTOOL debian/${PACKAGE_NAME}-dev.install <<EOF
to debian/${PACKAGE_NAME}-dev.install <<EOF
usr/include/* usr/include/*
usr/lib/lib*.a usr/lib/lib*.a
usr/lib/lib*.so usr/lib/lib*.so
usr/lib/pkgconfig/* usr/lib/pkgconfig/*
usr/lib/*.la usr/lib/*.la
$(if testtag AX_USE_LIBTOOL; then echo "usr/share/doc/${PACKAGE_NAME}/html"; fi) usr/share/doc/${PACKAGE_NAME}/html
EOF
to debian/${PACKAGE_NAME}-dev.dirs <<EOF
usr/lib
usr/include
EOF EOF
fi
to --mode "u=rwx,g=rwx,o=rx" debian/rules <<EOF to --mode "u=rwx,g=rwx,o=rx" debian/rules <<EOF
${HEADER}%: ${HEADER}%:
dh \$@ dh \$@
@ -542,7 +562,7 @@ EOF
fi fi
if ! test -f makefile.am; then if ! test -f makefile.am; then
SUBDIRS="" SUBDIRS=""
for d in src test doc examples; do for d in src test scripts doc examples; do
test -d $d && SUBDIRS="${SUBDIRS} $d" test -d $d && SUBDIRS="${SUBDIRS} $d"
done done
echo "${HEADER}SUBDIRS =${SUBDIRS}" | to makefile.am echo "${HEADER}SUBDIRS =${SUBDIRS}" | to makefile.am
@ -575,3 +595,8 @@ run autoconf
if test "$configure" -eq 1; then if test "$configure" -eq 1; then
./configure $* ./configure $*
fi fi
#### Run Make If User Requires ####
if test "$build" -eq 1; then
make
fi

Loading…
Cancel
Save