prepare to include makefiles

master
Marc Wäckerlin 8 years ago
parent 38960f8635
commit c0981c4f71
  1. 18
      ax_cxx_compile_stdcxx_11.m4
  2. 23
      ax_init_standard_project.m4
  3. 13
      bootstrap.sh
  4. 2
      build-in-docker.sh
  5. 9
      makefile_test.inc.am
  6. 13
      resolve-rpmbuilddeps.sh
  7. 19
      scripts/ax_init_standard_project.m4
  8. 2
      scripts/bootstrap.sh
  9. 9
      scripts/makefile_test.inc.am
  10. 16
      sql-to-dot.sed

@ -4,6 +4,8 @@
# #
# SYNOPSIS # SYNOPSIS
# #
# AX_REQUIRE_STDCXX_11
# AX_REQUIRE_STDCXX_14
# AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional]) # AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional])
# AX_CXX_COMPILE_STDCXX_14([ext|noext],[mandatory|optional]) # AX_CXX_COMPILE_STDCXX_14([ext|noext],[mandatory|optional])
# #
@ -199,15 +201,29 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_14], [dnl
AC_MSG_ERROR([*** A compiler with support for C++14 language features is required.]) AC_MSG_ERROR([*** A compiler with support for C++14 language features is required.])
fi fi
else else
HAVE_CXX11=${HAVE_CXX14}
if test x$ac_success = xno; then if test x$ac_success = xno; then
HAVE_CXX14=0 HAVE_CXX14=0
AC_MSG_NOTICE([No compiler with C++14 support was found]) AC_MSG_NOTICE([No compiler with C++14 support was found])
AX_CXX_COMPILE_STDCXX_11([$1], [optional])
else else
HAVE_CXX14=1 HAVE_CXX14=1
AC_DEFINE(HAVE_CXX14,1, AC_DEFINE(HAVE_CXX14,1,
[define if the compiler supports basic C++14 syntax]) [define if the compiler supports basic C++14 syntax])
fi fi
AC_SUBST(HAVE_CXX11)
AC_SUBST(HAVE_CXX14) AC_SUBST(HAVE_CXX14)
fi fi
]) ])
AC_DEFUN([AX_REQUIRE_STDCXX_11], [
if test x${HAVE_CXX11} != x1; then
AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
fi
])
AC_DEFUN([AX_REQUIRE_STDCXX_14], [
if test x${HAVE_CXX14} != x1; then
AC_MSG_ERROR([*** A compiler with support for C++14 language features is required.])
fi
])

@ -129,7 +129,7 @@ AC_DEFUN([AX_SUBST], [
# m4_define(x_minor, MINOR_NUMBER) # project's minor version # m4_define(x_minor, MINOR_NUMBER) # project's minor version
# m4_include(ax_init_standard_project.m4) # m4_include(ax_init_standard_project.m4)
# AC_INIT(x_package_name, x_version, x_bugreport, x_package_name) # AC_INIT(x_package_name, x_version, x_bugreport, x_package_name)
# AM_INIT_AUTOMAKE([1.9 tar-pax]) # AM_INIT_AUTOMAKE([1.9 tar-pax parallel-tests color-tests])
# AX_INIT_STANDARD_PROJECT # AX_INIT_STANDARD_PROJECT
# #
# you change nothing but: YOUR_PACKAGE_NAME, MAJOR_NUMBER, MINOR_NUMBER # you change nothing but: YOUR_PACKAGE_NAME, MAJOR_NUMBER, MINOR_NUMBER
@ -243,6 +243,25 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [
AM_CPPFLAGS="${AM_CPPFLAGS} -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG" AM_CPPFLAGS="${AM_CPPFLAGS} -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG"
fi fi
AC_ARG_WITH(gcov,
[AS_HELP_STRING([--with-gcov=FILE],
[enable gcov, set gcov file (defaults to gcov)])],
[GCOV="$enableval"], [GCOV="no"])
AM_CONDITIONAL(COVERAGE, test "$GCOV" != "no")
if test "$GCOV" != "no"; then
if test "$GCOV" == "yes"; then
GCOV=gcov
fi
AC_CHECK_PROG(has_gcov, [$GCOV], [yes], [no])
if test "$has_gcov" != "yes"; then
AC_MSG_ERROR([gcov: program $GCOV not found])
fi
AC_MSG_NOTICE([Coverage tests enabled, using ${GCOV}]);
AM_CXXFLAGS="${AM_CXXFLAGS:-} -O0 --coverage -fprofile-arcs -ftest-coverage"
AM_LDFLAGS="${AM_LDFLAGS} -O0 --coverage -fprofile-arcs"
AX_SUBST(GCOV)
fi
if test -f ${PACKAGE_NAME}.desktop.in; then if test -f ${PACKAGE_NAME}.desktop.in; then
AC_CONFIG_FILES([${PACKAGE_NAME}.desktop]) AC_CONFIG_FILES([${PACKAGE_NAME}.desktop])
fi fi
@ -273,7 +292,7 @@ EOF
AC_DEFUN([AX_USE_CXX], [ AC_DEFUN([AX_USE_CXX], [
m4_include(ax_cxx_compile_stdcxx_11.m4) m4_include(ax_cxx_compile_stdcxx_11.m4)
AC_LANG(C++) AC_LANG(C++)
AX_CXX_COMPILE_STDCXX_11(noext, optional) AX_CXX_COMPILE_STDCXX_14(noext, optional)
AC_PROG_CXX AC_PROG_CXX
AC_PROG_CPP AC_PROG_CPP

@ -31,8 +31,9 @@ while test $# -gt 0; do
(--configure|-c) configure=1;; (--configure|-c) configure=1;;
(--docker|-d) docker=1;; (--docker|-d) docker=1;;
(--build|-b) configure=1; build=1; buildtarget+=" distcheck";; (--build|-b) configure=1; build=1; buildtarget+=" distcheck";;
(--target|-t) shift; configure=1; build=1; buildtarget+=" $1";; (--all|-a) shift; configure=1; build=1; buildtarget+=" all";;
(--clean) shift; configure=1; build=1; buildtarget+=" maintainer-clean";; (--clean) shift; configure=1; build=1; buildtarget+=" maintainer-clean";;
(--target|-t) shift; configure=1; build=1; buildtarget+=" $1";;
(--overwrite|-o) overwrite=1;; (--overwrite|-o) overwrite=1;;
(--rebuild|-r) rebuild=1;; (--rebuild|-r) rebuild=1;;
(--rebuild-file|-f) shift; rebuildfiles+=("$1");; (--rebuild-file|-f) shift; rebuildfiles+=("$1");;
@ -51,6 +52,8 @@ OPTIONS
--configure, -c call ./configure after initialization --configure, -c call ./configure after initialization
--docker, -d build and run tests in a docker instance --docker, -d build and run tests in a docker instance
--build, -b build, also call ./configure && make distcheck --build, -b build, also call ./configure && make distcheck
--all, -a same as -b, but make target all
--clean same as -b, but make target maintainer-clean
--target, -t <target> same as -b, but specify target instead of distcheck --target, -t <target> same as -b, but specify target instead of distcheck
--overwrite, -o overwrite all basic files (bootstrap.sh, m4-macros) --overwrite, -o overwrite all basic files (bootstrap.sh, m4-macros)
--rebuild, -r force rebuild of generated files, even if modified --rebuild, -r force rebuild of generated files, even if modified
@ -126,6 +129,7 @@ GENERATED FILES
* ax_init_standard_project.m4 - auxiliary macro definition file * ax_init_standard_project.m4 - auxiliary macro definition file
* ax_cxx_compile_stdcxx_11.m4 - auxiliary macro definition file * ax_cxx_compile_stdcxx_11.m4 - auxiliary macro definition file
* ax_check_qt.m4 - auxiliary macro definition file * ax_check_qt.m4 - auxiliary macro definition file
* makefile_test.inc.am - makefile to be included in tests
* resolve-debbuilddeps.sh - script to install debian package dependencies * resolve-debbuilddeps.sh - script to install debian package dependencies
* resolve-rpmbuilddeps.sh - script to install RPM package dependencies * resolve-rpmbuilddeps.sh - script to install RPM package dependencies
* build-in-docker.sh - script to build the project encapsulated in a docker container * build-in-docker.sh - script to build the project encapsulated in a docker container
@ -497,6 +501,7 @@ copy ${MY_NAME}
copy ax_init_standard_project.m4 copy ax_init_standard_project.m4
copy ax_cxx_compile_stdcxx_11.m4 copy ax_cxx_compile_stdcxx_11.m4
copy ax_check_qt.m4 copy ax_check_qt.m4
copy makefile_test.inc.am
copy resolve-debbuilddeps.sh copy resolve-debbuilddeps.sh
copy resolve-rpmbuilddeps.sh copy resolve-rpmbuilddeps.sh
copy build-in-docker.sh copy build-in-docker.sh
@ -1184,15 +1189,15 @@ run autoconf
#### Run Configure If User Requires #### #### Run Configure If User Requires ####
if test "$configure" -eq 1; then if test "$configure" -eq 1; then
./configure $* ./configure $* || exit 1
fi fi
#### Run Make If User Requires #### #### Run Make If User Requires ####
if test "$build" -eq 1; then if test "$build" -eq 1; then
make $buildtarget make $buildtarget || exit 1
fi fi
#### Build In Docker If User Requires #### #### Build In Docker If User Requires ####
if test "$docker" -eq 1; then if test "$docker" -eq 1; then
./build-in-docker.sh ./build-in-docker.sh || exit 1
fi fi

@ -183,7 +183,7 @@ function ifthenelse() {
set -x set -x
docker pull $img docker pull $img
DOCKER_ID=$(docker run -d ${dirs[@]} ${envs[@]} -w /workdir $img sleep infinity) DOCKER_ID=$(docker run -d ${dirs[@]} ${envs[@]} -e HOME="${HOME}" -w /workdir $img sleep infinity)
trap 'traperror '"${DOCKER_ID}"' "$? ${PIPESTATUS[@]}" $LINENO $BASH_LINENO "$BASH_COMMAND" "${FUNCNAME[@]}" "${FUNCTION}"' SIGINT INT TERM EXIT trap 'traperror '"${DOCKER_ID}"' "$? ${PIPESTATUS[@]}" $LINENO $BASH_LINENO "$BASH_COMMAND" "${FUNCNAME[@]}" "${FUNCTION}"' SIGINT INT TERM EXIT
case $mode in case $mode in
(apt) (apt)

@ -0,0 +1,9 @@
## @id $Id$
## 1 2 3 4 5 6 7 8
## 45678901234567890123456789012345678901234567890123456789012345678901234567890
%.gcda: %
gcov $<
CLEANFILES += ${CLEANFILES} ${TEST:%=%.gcno} ${TEST:%=%.gcda} *.gcov

@ -12,10 +12,17 @@
SCHROOTNAME="$1" SCHROOTNAME="$1"
PACKAGE_NAME=$(sed -n 's/^ *m4_define(x_package_name, \(.*\)).*/\1/p' configure.ac) PACKAGE_NAME=$(sed -n 's/^ *m4_define(x_package_name, \(.*\)).*/\1/p' configure.ac)
PKGCONFIGS="${2:-epel-release}" # packages to configure yum
if test -n "${SCHROOTNAME}"; then if test -n "${SCHROOTNAME}"; then
FILES=$(LANG= schroot -c ${SCHROOTNAME} -- rpmbuild -bb --clean --nobuild --define "_topdir ." --define "_sourcedir ." ${PACKAGE_NAME}.spec 2>&1 | sed -n 's, is needed by.*,,p') FILES=$(LANG= schroot -c ${SCHROOTNAME} -- rpmbuild -bb --clean --nobuild --define "_topdir ." --define "_sourcedir ." ${PACKAGE_NAME}.spec 2>&1 | sed -n 's, is needed by.*,,p')
if test -n "${FILES}"; then if test -n "${FILES}"; then
FIRST=$(echo "${FILES}" | egrep -o "${PKGCONFIGS// /|}")
if test -n "${FIRST}"; then
schroot -c ${SCHROOTNAME} -u root -- yum install -y ${FIRST} || \
schroot -c ${SCHROOTNAME} -u root -- zypper install -y ${FIRST} || \
schroot -c ${SCHROOTNAME} -u root -- dnf install -y ${FIRST}
fi
schroot -c ${SCHROOTNAME} -u root -- yum install -y ${FILES} || \ schroot -c ${SCHROOTNAME} -u root -- yum install -y ${FILES} || \
schroot -c ${SCHROOTNAME} -u root -- zypper install -y ${FILES} || \ schroot -c ${SCHROOTNAME} -u root -- zypper install -y ${FILES} || \
schroot -c ${SCHROOTNAME} -u root -- dnf install -y ${FILES} schroot -c ${SCHROOTNAME} -u root -- dnf install -y ${FILES}
@ -23,6 +30,12 @@ if test -n "${SCHROOTNAME}"; then
else else
FILES=$(LANG= rpmbuild -bb --clean --nobuild --define "_topdir ." --define "_sourcedir ." ${PACKAGE_NAME}.spec 2>&1 | sed -n 's, is needed by.*,,p') FILES=$(LANG= rpmbuild -bb --clean --nobuild --define "_topdir ." --define "_sourcedir ." ${PACKAGE_NAME}.spec 2>&1 | sed -n 's, is needed by.*,,p')
if test -n "${FILES}"; then if test -n "${FILES}"; then
FIRST=$(echo "${FILES}" | egrep -o "${PKGCONFIGS// /|}")
if test -n "${FIRST}"; then
yum install -y ${FIRST} || \
zypper install -y ${FIRST} || \
dnf install -y ${FIRST}
fi
yum install -y ${FILES} || \ yum install -y ${FILES} || \
zypper install -y ${FILES} || \ zypper install -y ${FILES} || \
dnf install -y ${FILES} dnf install -y ${FILES}

@ -243,6 +243,25 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [
AM_CPPFLAGS="${AM_CPPFLAGS} -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG" AM_CPPFLAGS="${AM_CPPFLAGS} -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG"
fi fi
AC_ARG_WITH(gcov,
[AS_HELP_STRING([--with-gcov=FILE],
[enable gcov, set gcov file (defaults to gcov)])],
[GCOV="$enableval"], [GCOV="no"])
AM_CONDITIONAL(COVERAGE, test "$GCOV" != "no")
if test "$GCOV" != "no"; then
if test "$GCOV" == "yes"; then
GCOV=gcov
fi
AC_CHECK_PROG(has_gcov, [$GCOV], [yes], [no])
if test "$has_gcov" != "yes"; then
AC_MSG_ERROR([gcov: program $GCOV not found])
fi
AC_MSG_NOTICE([Coverage tests enabled, using ${GCOV}]);
AM_CXXFLAGS="${AM_CXXFLAGS:-} -O0 --coverage -fprofile-arcs -ftest-coverage"
AM_LDFLAGS="${AM_LDFLAGS} -O0 --coverage -fprofile-arcs"
AX_SUBST(GCOV)
fi
if test -f ${PACKAGE_NAME}.desktop.in; then if test -f ${PACKAGE_NAME}.desktop.in; then
AC_CONFIG_FILES([${PACKAGE_NAME}.desktop]) AC_CONFIG_FILES([${PACKAGE_NAME}.desktop])
fi fi

@ -129,6 +129,7 @@ GENERATED FILES
* ax_init_standard_project.m4 - auxiliary macro definition file * ax_init_standard_project.m4 - auxiliary macro definition file
* ax_cxx_compile_stdcxx_11.m4 - auxiliary macro definition file * ax_cxx_compile_stdcxx_11.m4 - auxiliary macro definition file
* ax_check_qt.m4 - auxiliary macro definition file * ax_check_qt.m4 - auxiliary macro definition file
* makefile_test.inc.am - makefile to be included in tests
* resolve-debbuilddeps.sh - script to install debian package dependencies * resolve-debbuilddeps.sh - script to install debian package dependencies
* resolve-rpmbuilddeps.sh - script to install RPM package dependencies * resolve-rpmbuilddeps.sh - script to install RPM package dependencies
* build-in-docker.sh - script to build the project encapsulated in a docker container * build-in-docker.sh - script to build the project encapsulated in a docker container
@ -500,6 +501,7 @@ copy ${MY_NAME}
copy ax_init_standard_project.m4 copy ax_init_standard_project.m4
copy ax_cxx_compile_stdcxx_11.m4 copy ax_cxx_compile_stdcxx_11.m4
copy ax_check_qt.m4 copy ax_check_qt.m4
copy makefile_test.inc.am
copy resolve-debbuilddeps.sh copy resolve-debbuilddeps.sh
copy resolve-rpmbuilddeps.sh copy resolve-rpmbuilddeps.sh
copy build-in-docker.sh copy build-in-docker.sh

@ -0,0 +1,9 @@
## @id $Id$
## 1 2 3 4 5 6 7 8
## 45678901234567890123456789012345678901234567890123456789012345678901234567890
%.gcda: %
gcov $<
CLEANFILES += ${CLEANFILES} ${TEST:%=%.gcno} ${TEST:%=%.gcda} *.gcov

@ -11,6 +11,11 @@ H;$!d;$x
# remove all single-line comment lines # remove all single-line comment lines
s/\n--[^\n]*//g s/\n--[^\n]*//g
# encode html entities
s/&/\&amp##SEMICOLON##/g
s/</\&lt##SEMICOLON##/g
s/>/\&gt##SEMICOLON##/g
# reduce spaces # reduce spaces
s,\t\| \+, ,g s,\t\| \+, ,g
@ -21,7 +26,7 @@ s,\t\| \+, ,g
s,\n\+,\n,g s,\n\+,\n,g
# remove unknown commands # remove unknown commands
s,\(;\|\n\) *\(DELIMITER\|USE\|DROP\|CREATE[ \n]\+DATABASE\)[ \n]\+[^;]*;\+,,ig s,\(;\|\n\) *\(INSERT\|DELIMITER\|USE\|DROP\|CREATE[ \n]\+DATABASE\)[ \n]\+[^;]*;\+,,ig
# convert special characters within quotes # convert special characters within quotes
:a;s/^\(\([^"]*"[^",]*"\)*[^"]*"[^"]*\),\([^"]*".*\)/\1\##COMMA##\3/g;ta :a;s/^\(\([^"]*"[^",]*"\)*[^"]*"[^"]*\),\([^"]*".*\)/\1\##COMMA##\3/g;ta
@ -34,17 +39,18 @@ h
s,.*\(create[ \n]\+table[^;]*;\).*,\1,ig s,.*\(create[ \n]\+table[^;]*;\).*,\1,ig
# start html table node # start html table node
s|CREATE[ \n]\+TABLE[ \n]\+\(if[ \n]\+not[ \n]\+exists[ \n]\+\)\?`\?\(\w\+\)`\?| \2\n [shape=none, margin=0, label=<\n <table bgcolor="#dddddd">\n <tr><td bgcolor="#ddddff" colspan="4"><b>\2</b></td></tr>|ig s|CREATE[ \n]\+TABLE[ \n]\+\(IF[ \n]\+NOT[ \n]\+EXISTS[ \n]\+\)\?`\?\(\w\+\)`\?| \2\n [shape=none, margin=0, label=<\n <table bgcolor="#dddddd">\n <tr><td bgcolor="#ddddff" colspan="4"><b>\2</b></td></tr>|ig
# remove key definitions # remove key definitions
s/[),][\n ]*\(PRIMARY[ \n]\+\)\?KEY[ \n]\+[^(]*([^)]*)//gi s/[),][\n ]*\(\(UNIQUE\|PRIMARY\)[ \n]\+\)\?KEY[ \n]\+[^(]*([^)]*)//gi
# move foreign keys as relation to the end # move foreign keys as relation to the end
:b;s/\(\w\+\)\([^;]*\)FOREIGN[\n ]\+KEY[ \n]*([ \n]*`\?\([a-z]\+\)`\?[ \n]*)[ \n]*REFERENCES[ \n]*`\?\([a-z]\+\)`\?[ \n]*([ \n]*`\?\([a-z]\+\)`\?[ \n]*)[ \n]*\([^,)]*\)\([,)].*\)/\1\2\7\n \1:\3 -> \4:\5 [label="\6"]##SEMICOLON##/ig;tb :b;s/\(\w\+\)\([^;]*\)FOREIGN[\n ]\+KEY[ \n]*([ \n]*`\?\([a-z]\+\)`\?[ \n]*)[ \n]*REFERENCES[ \n]*`\?\([a-z]\+\)`\?[ \n]*([ \n]*`\?\([a-z]\+\)`\?[ \n]*)[ \n]*\([^,)]*\)\([,)].*\)/\1\2\7\n \1:\3 -> \4:\5 [label="\6"]##SEMICOLON##/ig;tb
# create table rows # create table rows
s|[(,][ \n]*`\?\(\w\+\)`\?[ \n]\+\(\w\+\(([^)]\+)\)\?\)[ \n]*\([^,)]*\)[ \n]\+COMMENT[ \n]*["']\([^"']*\)["'][ \n]*|\n <tr><td align="left" port="\1"><b>\1</b></td><td align="left">\2</td><td align="left">\4</td><td align="left">\5</td></tr>|gi s|[(,][ \n]*`\?\(\w\+\)`\?[ \n]\+\(\w\+\(([^)]\+)\)\?\)[ \n]*\([^,)]*\)|\n <tr><td align="left" port="\1"><b>\1</b></td><td align="left">\2</td><td align="left">\4</td><td></td></tr>|g
s|[(,][ \n]*`\?\(\w\+\)`\?[ \n]\+\(\w\+\(([^)]\+)\)\?\)[ \n]*\([^,)]*\)|\n <tr><td align="left" port="\1"><b>\1</b></td><td align="left">\2</td><td align="left">\4</td></tr>|g # extract comment
s|\(<td\( *\w*="\w*"\)* *>[^<]*\)COMMENT[ \n]\+["']\([^"']*\)["']\([^<]*</td>\)<td></td>|\1\4<td align="left">\3</td>|g
# add line breaks for long lines # add line breaks for long lines
s|\(<td[^>]*>[^<]\{30,40\}\)[ \n]\+\([^<]\{20,\}</td>\)|\1<br/>\2|g s|\(<td[^>]*>[^<]\{30,40\}\)[ \n]\+\([^<]\{20,\}</td>\)|\1<br/>\2|g

Loading…
Cancel
Save