support scripts and new parameters --build --overwrite --rebuild
This commit is contained in:
		| @@ -283,6 +283,11 @@ rpm: dist | ||||
| 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 | ||||
| AC_DEFUN([AX_USE_DOXYGEN], [ | ||||
|   AC_CHECK_PROG(have_doxygen, doxygen, yes, no) | ||||
|   | ||||
							
								
								
									
										83
									
								
								bootstrap.sh
									
									
									
									
									
								
							
							
						
						
									
										83
									
								
								bootstrap.sh
									
									
									
									
									
								
							| @@ -19,10 +19,18 @@ PROJECT_PATH=$(pwd) | ||||
| DEFAULT_PROJECT_NAME=${PROJECT_PATH##*/} | ||||
|  | ||||
| configure=0 | ||||
| build=0 | ||||
| overwrite=0 | ||||
| rebuild=0 | ||||
| while test $# -gt 0; do | ||||
|     case "$1" in | ||||
|         (--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 | ||||
| SYNOPSIS | ||||
|  | ||||
| @@ -31,6 +39,9 @@ SYNOPSIS | ||||
| OPTIONS | ||||
|  | ||||
|   --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 | ||||
|   --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/version.hxx - 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/doxyfile.in - if you enabled AX_USE_DOXYGEN | ||||
|     * test/makefile.am - if you enabled AX_USE_CPPUNIT | ||||
| @@ -108,8 +120,11 @@ GENERATED FILES | ||||
|     * debian/compat - if you enabled AX_USE_DEBIAN_PACKAGING | ||||
|     * 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>" | ||||
|   and run ${MY_NAME} again. | ||||
| REBUILDING FILES | ||||
|  | ||||
|   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 | ||||
|  | ||||
| @@ -128,8 +143,8 @@ FILES TO EDIT | ||||
|  | ||||
| FILE DEPENDENCIES | ||||
|  | ||||
|   You should rebuild (remove and run (see above) the files, whenever | ||||
|   you change the configuration a dependent, i.e.: | ||||
|   You should rebuild (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 | ||||
| @@ -162,8 +177,9 @@ FILES | ||||
|                   number. The following macros are supported: | ||||
|       * Enable C++: AX_USE_CXX | ||||
|       * Enable LibTool library creation: AX_USE_LIBTOOL | ||||
|       * Enable Scripts: AX_USE_SCRIPTS | ||||
|       * 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 | ||||
|       * Enable C++ testing using CppUnit: AX_USE_CPPUNIT | ||||
|       * Enable C++ examples, i.e. for libraries: AX_BUILD_EXAMPLES | ||||
| @@ -198,7 +214,7 @@ EOF | ||||
| 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)' | ||||
| # Feel free to change it or even remove and rebuild it, up to your needs | ||||
| @@ -247,6 +263,14 @@ checkdir() { | ||||
|     fi | ||||
| } | ||||
|  | ||||
| checkfile() { | ||||
|     exists=0 | ||||
|     if test -f "$1"; then | ||||
|         exists=1 | ||||
|     fi | ||||
|     test $exists -eq 1 | ||||
| } | ||||
|  | ||||
| to() { | ||||
|     while test $# -gt 0; do | ||||
|         mode="u=rw,g=rw,o=r" | ||||
| @@ -261,7 +285,7 @@ to() { | ||||
|         esac | ||||
|         shift; | ||||
|     done | ||||
|     if test -f "$1"; then # file already exists | ||||
|     if checkfile "$1" && test $rebuild -eq 0; then # file already exists | ||||
|         return | ||||
|     fi | ||||
|     checkdir "$(dirname ${1})" | ||||
| @@ -279,13 +303,18 @@ to() { | ||||
|         echo -e " \e[32msuccess\e[0m" | ||||
|     fi | ||||
|     chmod $mode $1 | ||||
|     run svn add "$1" | ||||
|     run svn propset svn:keywords "Id" "$1" | ||||
|     if test $exists -eq 0; then | ||||
|         run svn add "$1" | ||||
|         run svn propset svn:keywords "Id" "$1" | ||||
|     fi | ||||
| } | ||||
|  | ||||
| copy() { | ||||
|     if ! test -f "$1"; then | ||||
|         run cp "${0%/*}/$1" "$1" | ||||
|     if  checkfile "$1" && test $overwrite -eq 0; then | ||||
|         return | ||||
|     fi | ||||
|     run cp "${0%/*}/$1" "$1" | ||||
|     if test $exists -eq 0; then | ||||
|         run svn add "$1" | ||||
|         run svn propset svn:keywords "Id" "$1" | ||||
|     fi | ||||
| @@ -321,6 +350,7 @@ AX_INIT_STANDARD_PROJECT | ||||
| # requirements, uncomment, what you need: | ||||
| #AX_USE_CXX | ||||
| #AX_USE_LIBTOOL | ||||
| #AX_USE_SCRIPTS | ||||
| #AX_USE_DOXYGEN | ||||
| #AX_USE_DEBIAN_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 | ||||
| /*! @file | ||||
|  | ||||
|     @id \$Id: bootstrap.sh 31 2015-05-05 15:06:08Z marc $ | ||||
|     @id \$Id\$ | ||||
| */ | ||||
| //       1         2         3         4         5         6         7         8 | ||||
| // 45678901234567890123456789012345678901234567890123456789012345678901234567890 | ||||
| @@ -377,7 +407,7 @@ EOF | ||||
| to --condition AX_USE_CXX src/version.cxx <<EOF | ||||
| /*! @file | ||||
|  | ||||
|     @id $Id: bootstrap.sh 31 2015-05-05 15:06:08Z marc $ | ||||
|     @id $Id\$ | ||||
| */ | ||||
| //       1         2         3         4         5         6         7         8 | ||||
| // 45678901234567890123456789012345678901234567890123456789012345678901234567890 | ||||
| @@ -416,6 +446,7 @@ namespace NAMESPACE { | ||||
|   const std::string IDENT("\$Id: " PACKAGE_STRING); | ||||
| } | ||||
| EOF | ||||
| echo "${HEADER}" | to --condition AX_USE_SCRIPTS scripts/makefile.am | ||||
| echo "${HEADER}" | to --condition AX_USE_DOXYGEN doc/makefile.am | ||||
| to --condition AX_USE_CPPUNIT test/makefile.am <<EOF | ||||
| ${HEADER}AM_CPPFLAGS = -I${top_srcdir}/src -I${top_builddir}/src | ||||
| @@ -512,28 +543,17 @@ EOF | ||||
| NEWS | ||||
| README | ||||
| EOF | ||||
|     to debian/${PACKAGE_NAME}.install <<EOF | ||||
| usr/bin/* | ||||
|     to --condition AX_USE_LIBTOOL debian/${PACKAGE_NAME}.install <<EOF | ||||
| 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 | ||||
|     if testtag AX_USE_LIBTOOL; then | ||||
|         to debian/${PACKAGE_NAME}-dev.install <<EOF | ||||
|     to --condition AX_USE_LIBTOOL debian/${PACKAGE_NAME}-dev.install <<EOF | ||||
| usr/include/* | ||||
| usr/lib/lib*.a | ||||
| usr/lib/lib*.so | ||||
| usr/lib/pkgconfig/* | ||||
| 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 | ||||
|     fi | ||||
|     to --mode "u=rwx,g=rwx,o=rx" debian/rules <<EOF | ||||
| ${HEADER}%: | ||||
| 	dh \$@ | ||||
| @@ -542,7 +562,7 @@ EOF | ||||
| fi | ||||
| if ! test -f makefile.am; then | ||||
|     SUBDIRS="" | ||||
|     for d in src test doc examples; do | ||||
|     for d in src test scripts doc examples; do | ||||
|         test -d $d && SUBDIRS="${SUBDIRS} $d" | ||||
|     done | ||||
|     echo "${HEADER}SUBDIRS =${SUBDIRS}" | to makefile.am | ||||
| @@ -575,3 +595,8 @@ run autoconf | ||||
| if test "$configure" -eq 1; then | ||||
|     ./configure $* | ||||
| fi | ||||
|  | ||||
| #### Run Make If User Requires #### | ||||
| if test "$build" -eq 1; then | ||||
|     make | ||||
| fi | ||||
|   | ||||
		Reference in New Issue
	
	Block a user