diff --git a/ax_cxx_compile_stdcxx_11.m4 b/ax_cxx_compile_stdcxx_11.m4 index c015cd9..e3c8d75 100644 --- a/ax_cxx_compile_stdcxx_11.m4 +++ b/ax_cxx_compile_stdcxx_11.m4 @@ -4,6 +4,8 @@ # # SYNOPSIS # +# AX_REQUIRE_STDCXX_11 +# AX_REQUIRE_STDCXX_14 # AX_CXX_COMPILE_STDCXX_11([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.]) fi else + HAVE_CXX11=${HAVE_CXX14} if test x$ac_success = xno; then HAVE_CXX14=0 AC_MSG_NOTICE([No compiler with C++14 support was found]) + AX_CXX_COMPILE_STDCXX_11([$1], [optional]) else HAVE_CXX14=1 AC_DEFINE(HAVE_CXX14,1, [define if the compiler supports basic C++14 syntax]) fi - + AC_SUBST(HAVE_CXX11) AC_SUBST(HAVE_CXX14) 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 +]) diff --git a/ax_init_standard_project.m4 b/ax_init_standard_project.m4 index 4128d9f..ab87e67 100644 --- a/ax_init_standard_project.m4 +++ b/ax_init_standard_project.m4 @@ -129,7 +129,7 @@ AC_DEFUN([AX_SUBST], [ # m4_define(x_minor, MINOR_NUMBER) # project's minor version # m4_include(ax_init_standard_project.m4) # 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 # # you change nothing but: YOUR_PACKAGE_NAME, MAJOR_NUMBER, MINOR_NUMBER @@ -242,6 +242,25 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [ else AM_CPPFLAGS="${AM_CPPFLAGS} -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG" 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 AC_CONFIG_FILES([${PACKAGE_NAME}.desktop]) @@ -273,7 +292,7 @@ EOF AC_DEFUN([AX_USE_CXX], [ m4_include(ax_cxx_compile_stdcxx_11.m4) AC_LANG(C++) - AX_CXX_COMPILE_STDCXX_11(noext, optional) + AX_CXX_COMPILE_STDCXX_14(noext, optional) AC_PROG_CXX AC_PROG_CPP diff --git a/bootstrap.sh b/bootstrap.sh index ca170dd..35cf0b3 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -31,8 +31,9 @@ while test $# -gt 0; do (--configure|-c) configure=1;; (--docker|-d) docker=1;; (--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";; + (--target|-t) shift; configure=1; build=1; buildtarget+=" $1";; (--overwrite|-o) overwrite=1;; (--rebuild|-r) rebuild=1;; (--rebuild-file|-f) shift; rebuildfiles+=("$1");; @@ -51,6 +52,8 @@ OPTIONS --configure, -c call ./configure after initialization --docker, -d build and run tests in a docker instance --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 same as -b, but specify target instead of distcheck --overwrite, -o overwrite all basic files (bootstrap.sh, m4-macros) --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_cxx_compile_stdcxx_11.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-rpmbuilddeps.sh - script to install RPM package dependencies * 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_cxx_compile_stdcxx_11.m4 copy ax_check_qt.m4 +copy makefile_test.inc.am copy resolve-debbuilddeps.sh copy resolve-rpmbuilddeps.sh copy build-in-docker.sh @@ -1184,15 +1189,15 @@ run autoconf #### Run Configure If User Requires #### if test "$configure" -eq 1; then - ./configure $* + ./configure $* || exit 1 fi #### Run Make If User Requires #### if test "$build" -eq 1; then - make $buildtarget + make $buildtarget || exit 1 fi #### Build In Docker If User Requires #### if test "$docker" -eq 1; then - ./build-in-docker.sh + ./build-in-docker.sh || exit 1 fi diff --git a/build-in-docker.sh b/build-in-docker.sh index 8bca39c..674ff2c 100755 --- a/build-in-docker.sh +++ b/build-in-docker.sh @@ -183,7 +183,7 @@ function ifthenelse() { set -x 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 case $mode in (apt) diff --git a/makefile_test.inc.am b/makefile_test.inc.am new file mode 100644 index 0000000..baf81c4 --- /dev/null +++ b/makefile_test.inc.am @@ -0,0 +1,9 @@ +## @id $Id$ + +## 1 2 3 4 5 6 7 8 +## 45678901234567890123456789012345678901234567890123456789012345678901234567890 + +%.gcda: % + gcov $< + +CLEANFILES += ${CLEANFILES} ${TEST:%=%.gcno} ${TEST:%=%.gcda} *.gcov diff --git a/resolve-rpmbuilddeps.sh b/resolve-rpmbuilddeps.sh index 2a5df60..5ddd1b2 100755 --- a/resolve-rpmbuilddeps.sh +++ b/resolve-rpmbuilddeps.sh @@ -12,10 +12,17 @@ SCHROOTNAME="$1" 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 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 + 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 -- zypper install -y ${FILES} || \ schroot -c ${SCHROOTNAME} -u root -- dnf install -y ${FILES} @@ -23,6 +30,12 @@ if test -n "${SCHROOTNAME}"; then else 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 + 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} || \ zypper install -y ${FILES} || \ dnf install -y ${FILES} diff --git a/scripts/ax_init_standard_project.m4 b/scripts/ax_init_standard_project.m4 index 4e2dd35..03b827c 100644 --- a/scripts/ax_init_standard_project.m4 +++ b/scripts/ax_init_standard_project.m4 @@ -242,6 +242,25 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [ else AM_CPPFLAGS="${AM_CPPFLAGS} -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG" 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 AC_CONFIG_FILES([${PACKAGE_NAME}.desktop]) diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index d563951..3da5d90 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -129,6 +129,7 @@ GENERATED FILES * ax_init_standard_project.m4 - auxiliary macro definition file * ax_cxx_compile_stdcxx_11.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-rpmbuilddeps.sh - script to install RPM package dependencies * 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_cxx_compile_stdcxx_11.m4 copy ax_check_qt.m4 +copy makefile_test.inc.am copy resolve-debbuilddeps.sh copy resolve-rpmbuilddeps.sh copy build-in-docker.sh diff --git a/scripts/makefile_test.inc.am b/scripts/makefile_test.inc.am new file mode 100644 index 0000000..baf81c4 --- /dev/null +++ b/scripts/makefile_test.inc.am @@ -0,0 +1,9 @@ +## @id $Id$ + +## 1 2 3 4 5 6 7 8 +## 45678901234567890123456789012345678901234567890123456789012345678901234567890 + +%.gcda: % + gcov $< + +CLEANFILES += ${CLEANFILES} ${TEST:%=%.gcno} ${TEST:%=%.gcda} *.gcov diff --git a/sql-to-dot.sed b/sql-to-dot.sed index 07b2989..e4e99b3 100755 --- a/sql-to-dot.sed +++ b/sql-to-dot.sed @@ -11,6 +11,11 @@ H;$!d;$x # remove all single-line comment lines s/\n--[^\n]*//g +# encode html entities +s/&/\&##SEMICOLON##/g +s//\>##SEMICOLON##/g + # reduce spaces s,\t\| \+, ,g @@ -21,7 +26,7 @@ s,\t\| \+, ,g s,\n\+,\n,g # 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 :a;s/^\(\([^"]*"[^",]*"\)*[^"]*"[^"]*\),\([^"]*".*\)/\1\##COMMA##\3/g;ta @@ -34,17 +39,18 @@ h s,.*\(create[ \n]\+table[^;]*;\).*,\1,ig # start html table node -s|CREATE[ \n]\+TABLE[ \n]\+\(if[ \n]\+not[ \n]\+exists[ \n]\+\)\?`\?\(\w\+\)`\?| \2\n [shape=none, margin=0, label=<\n \n |ig +s|CREATE[ \n]\+TABLE[ \n]\+\(IF[ \n]\+NOT[ \n]\+EXISTS[ \n]\+\)\?`\?\(\w\+\)`\?| \2\n [shape=none, margin=0, label=<\n
\2
\n |ig # 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 :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 -s|[(,][ \n]*`\?\(\w\+\)`\?[ \n]\+\(\w\+\(([^)]\+)\)\?\)[ \n]*\([^,)]*\)[ \n]\+COMMENT[ \n]*["']\([^"']*\)["'][ \n]*|\n |gi -s|[(,][ \n]*`\?\(\w\+\)`\?[ \n]\+\(\w\+\(([^)]\+)\)\?\)[ \n]*\([^,)]*\)|\n |g +s|[(,][ \n]*`\?\(\w\+\)`\?[ \n]\+\(\w\+\(([^)]\+)\)\?\)[ \n]*\([^,)]*\)|\n |g +# extract comment +s|\([^<]*\)COMMENT[ \n]\+["']\([^"']*\)["']\([^<]*\)|\1\4|g # add line breaks for long lines s|\(]*>[^<]\{30,40\}\)[ \n]\+\([^<]\{20,\}\)|\1
\2|g
\2
\1\2\4\5
\1\2\4
\1\2\4
\3