diff --git a/ChangeLog b/ChangeLog index 9cb5e2f..bc9a547 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,55 @@ +2016-12-12 14:13 + + * [r121] scripts/build-in-docker.sh: + new build mode for windows mingw cross compilation + +2016-12-11 21:51 + + * [r120] scripts/bootstrap.sh, scripts/build-in-docker.sh, + scripts/resolve-rpmbuilddeps.sh: + fix some typos + +2016-12-09 15:51 + + * [r119] scripts/ax_init_standard_project.m4, scripts/bootstrap.sh, + scripts/build-in-docker.sh, scripts/resolve-debbuilddeps.sh: + fix build issues - utf-8 gpg uid still not supported for most rpm + based distros + +2016-12-09 07:11 + + * [r118] scripts/ax_init_standard_project.m4, scripts/bootstrap.sh, + scripts/build-in-docker.sh: + rpm development + +2016-12-08 15:59 + + * [r117] scripts/ax_init_standard_project.m4, + scripts/build-in-docker.sh: + updates for rpm distros + +2016-12-07 21:44 + + * [r116] scripts/bootstrap.sh, scripts/build-in-docker.sh, + scripts/resolve-rpmbuilddeps.sh: + ready for mageia + +2016-12-07 16:00 + + * [r115] scripts/ax_init_standard_project.m4, scripts/bootstrap.sh, + scripts/build-in-docker.sh, scripts/resolve-rpmbuilddeps.sh: + build improved for fedora, centos, opensuse + +2016-11-25 17:28 + + * [r114] COPYING, ChangeLog, INSTALL, ax_cxx_compile_stdcxx_11.m4, + ax_init_standard_project.m4, bootstrap.sh, build-in-docker.sh, + doc/footer.html.in[ADD], doc/header.html.in[ADD], + doc/plantuml.jar[ADD], doc/style.css[ADD], + resolve-debbuilddeps.sh, scripts/bootstrap.sh, + scripts/build-in-docker.sh: + updated build system + 2016-11-25 15:05 * [r113] scripts/ax_init_standard_project.m4, scripts/bootstrap.sh, diff --git a/ax_init_standard_project.m4 b/ax_init_standard_project.m4 index 2282cbf..9b78951 100644 --- a/ax_init_standard_project.m4 +++ b/ax_init_standard_project.m4 @@ -196,9 +196,9 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [ CHANGELOG=$(.*,\1,') - PACKAGER=$(gpg -K 2>/dev/null | sed -n 's,uid *\(\[[ultimate\]] *\)\?,,p' | head -1) - if -z "${PACKAGER}"; then + PACKAGER=$(gpg -K --display-charset utf-8 --lock-never 2>/dev/null | sed -n 's,uid *\(\[[ultimate\]] *\)\?,,p' | head -1) + if test -z "${PACKAGER}"; then PACKAGER="$AUTHOR" fi AX_SUBST(AUTHOR) @@ -220,6 +220,8 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [ SOURCE_DOWNLOAD="${SOURCE_DOWNLOAD:-${AUTHOR_URL}/downloads/${PACKAGE_NAME}}" AX_SUBST(PROJECT_URL) AX_SUBST(SOURCE_DOWNLOAD) + VENDOR=$((lsb_release -is 2>/dev/null || echo unknown) | tr ' ' '_') + AX_SUBST(VENDOR) DISTRO=$(lsb_release -sc 2>/dev/null || uname -s 2>/dev/null) AX_SUBST(DISTRO) ARCH=$((@<:@@<:@ $(uname -sm) =~ 64 @:>@@:>@ && echo amd64) || (@<:@@<:@ $(uname -sm) =~ 'i?86' @:>@@:>@ && echo i386 || uname -sm)) @@ -422,7 +424,7 @@ EOF # use this in configure.ac to support CppUnit for C++ unit tests AC_DEFUN([AX_USE_CPPUNIT], [ - AM_PATH_CPPUNIT([1.0.0], [have_cppunit="yes"], [have_cppunit="no"]) + PKG_CHECK_MODULES(CPPUNIT, cppunit, [have_cppunit="yes"], [have_cppunit="no"]) # infos and warnings if test "$have_cppunit" = "no"; then AC_MSG_WARN([Missing cppunit development library! @@ -560,6 +562,7 @@ AC_DEFUN([AX_USE_RPM_PACKAGING], [ EXTRA_DIST += \${PACKAGE_NAME}.spec.in rpm: dist rpmbuild -ba --define "_topdir \$\$(pwd)" --define "_sourcedir \$\$(pwd)" \${PACKAGE_NAME}.spec + rpmsign --define "_gpg_name \${PACKAGER}" --addsign RPMS/*/*.rpm SRPMS/*.rpm clean-rpm-targets: -rm -rf BUILD BUILDROOT RPMS SPECS SRPMS distclean-rpm-targets: @@ -646,7 +649,7 @@ AC_DEFUN([AX_USE_PERLDOC], [ PERL_SOURCES="m4_default([$1], [perl])" AX_SUBST(PERL_SOURCES) if test -z "$PERL_SOURCES"; then - AC_MSG_ERROR([You must specify the path to per files + AC_MSG_ERROR([You must specify the path to perl files - use [AX]_[USE]_PERLDOC([[pathes to perldoc]])]); fi AC_CHECK_PROG(have_perldoc, pods2html, yes, no) if test "$have_doxygen" = "no"; then diff --git a/bootstrap.sh b/bootstrap.sh index ad0f1f1..0afedc3 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -301,11 +301,13 @@ VCS="" VCSDEPENDS="" if test -d .svn; then VCS="svn" - VCSDEPENDS="svn2cl, subversion, subversion-tools," + VCSDEPENDS_DEB="svn2cl, subversion, subversion-tools," + VCSDEPENDS_RPM="subversion, subversion-tools," echo -e " \e[32msuccess\e[0m detected ${VCS}" elif test -d .git; then VCS="git" - VCSDEPENDS="git2cl, git," + VCSDEPENDS_DEB="git2cl, git," + VCSDEPENDS_RPM="git," echo -e " \e[32msuccess\e[0m detected ${VCS}" else echo -e " \e[33mignored\e[0m" @@ -1463,7 +1465,7 @@ if testtag AX_USE_DEBIAN_PACKAGING; then -- @PACKAGER@ @BUILD_DATE@ EOF - BUILD_DEPENDS="debhelper, ${VCSDEPENDS} pkg-config, automake, libtool, autotools-dev, pandoc, lsb-release, fakeroot, $(if testtag AX_USE_DOXYGEN; then echo -n ", doxygen, graphviz, mscgen, default-jre-headless|default-jre"; fi; if testtag AX_USE_PERLDOC; then echo -n ", libpod-tree-perl"; fi; if testtag AX_USE_CPPUNIT; then echo -n ", libcppunit-dev"; fi; if testtag AX_CXX_QT || testtag AX_CHECK_QT AX_REQUIRE_QT; then echo -n ", qt5-default | libqt4-core | libqtcore4, qt5-qmake | qt4-qmake, qtbase5-dev | libqt4-dev, qtbase5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools"; fi)" + BUILD_DEPENDS="debhelper, fakeroot, ${VCSDEPENDS_DEB} pkg-config, automake, libtool, autotools-dev, pandoc, lsb-release, fakeroot, $(if testtag AX_USE_DOXYGEN; then echo -n ", doxygen, graphviz, mscgen, default-jre-headless|default-jre"; fi; if testtag AX_USE_PERLDOC; then echo -n ", libpod-tree-perl"; fi; if testtag AX_USE_CPPUNIT; then echo -n ", libcppunit-dev"; fi; if testtag AX_CXX_QT || testtag AX_CHECK_QT AX_REQUIRE_QT; then echo -n ", qt5-default | libqt4-core | libqtcore4, qt5-qmake | qt4-qmake, qtbase5-dev | libqt4-dev, qtbase5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools"; fi)" to debian/control.in < 6 || 0%{?rhl} > 6 || 0%{?centos} > 6 || 0%{?fedora} || 0%{?mageia} +BuildRequires: rpm-sign +%endif +%if 0%{?mageia} +BuildRequires: gnupg, lsb-release$( + if testtag AX_USE_LIBTOOL; then + echo -n ", libltdl-devel" + fi +) +%else +BuildRequires: gpg, redhat-lsb$( + if testtag AX_USE_LIBTOOL; then + echo -n ", libtool-ltdl-devel" + fi +) +%endif %if ! ( 0%{?centos} || 0%{?centos_ver} || 0%{?centos_version} ) $(if testtag AX_USE_DOXYGEN; then echo -n "BuildRequires: mscgen"; fi) $(if testtag AX_REQUIRE_QT || testtag AX_CHECK_QT AX_REQUIRE_QT; then echo -n "BuildRequires: qt5-qtbase-devel, qt5-qttools, qt5-qtwebkit-devel"; fi) @@ -1668,7 +1693,7 @@ for d in src test scripts doc examples html; do done to --mode "u=rwx,g=rwx,o=rx" autogen.sh < ChangeLog";; diff --git a/build-in-docker.conf b/build-in-docker.conf index 692d2fd..65e4815 100644 --- a/build-in-docker.conf +++ b/build-in-docker.conf @@ -1,4 +1 @@ -repos+=("Debian|Ubuntu-precise::::::universe") -repos+=("Ubuntu-precise:::'deb http://archive.ubuntu.com/ubuntu precise universe'") -envs+=("-e 'HOME=${HOME}'") -dirs+=("-v ${HOME}/.gnupg:${HOME}/.gnupg:ro") +repos+=("Ubuntu:::universe") diff --git a/build-in-docker.sh b/build-in-docker.sh index 2967ff4..7bd8ac6 100755 --- a/build-in-docker.sh +++ b/build-in-docker.sh @@ -6,16 +6,18 @@ myarch=$(dpkg --print-architecture) if test "${arch}" = "amd64"; then myarch="amd64|i386" fi -mode="apt" +mode="deb" img="ubuntu:latest" repos=() keys=() -envs=("-e DEBIAN_FRONTEND=noninteractive" "-e DEBCONF_NONINTERACTIVE_SEEN=true") -dirs=("-v $(pwd):/workdir") +envs=("-e LANG=${LANG}" "-e HOME=/home/$(id -un)" "-e TERM=xterm" "-e DEBIAN_FRONTEND=noninteractive" "-e DEBCONF_NONINTERACTIVE_SEEN=true") +dirs=("-v $(pwd):/workdir" "-v ${HOME}/.gnupg:/home/$(id -un)/.gnupg") packages=() targets="all check distcheck" commands=() -arch=$(dpkg --print-architecture) +arch=$((which dpkg > /dev/null 2> /dev/null && dpkg --print-architecture) || echo amd64) +host= +flags=() wait=0 if test -e ./build-in-docker.conf; then # you can preconfigure the variables in file build-in-docker.conf @@ -30,10 +32,12 @@ while test $# -gt 0; do echo "OPTIONS:" echo echo " -h, --help show this help" - echo " -m, --mode mode: apt or yum, default: ${mode}" + echo " -m, --mode mode: deb, rpm, win, default: ${mode}" echo " -i, --image use given docker image instead of ${img}" echo " -a, --arch build for given hardware architecture" echo " -t, --targets targets specify build targets, default: ${targets}" + echo " --host host for cross compiling, e.g. i686-w64-mingw32" + echo " -f, --flag add flag to ./bootstrap.sh or ./configure" echo " -r, --repo add given apt repository" echo " -k, --key add public key from url" echo " -e, --env = set environment variable in docker" @@ -43,6 +47,10 @@ while test $# -gt 0; do echo " -w, --wait on error keep docker container and wait for enter" echo echo " The option -i must be after -m, because mode sets a new default image" + echo " The option -m must be after -t, because mode may be auto detected from targets" + echo " The option -m must be after -h, because mode may set a host" + echo " If target is either deb or rpm, mode is set to the same value" + echo " If target is win, host is set to i686-w64-mingw32" echo echo " The options -r -k -e -d -p -c can be repeated several times." echo @@ -73,8 +81,11 @@ while test $# -gt 0; do (-m|--mode) shift; mode="$1" case "$mode" in - (apt) img="ubuntu:latest";; + (deb|apt) img="ubuntu:latest";; + (rpm|zypper) img="opensuse:latest";; (yum) img="centos:latest";; + (dnf) img="fedora:latest";; + (win) img="ubuntu:latest"; host="${host:---host=i686-w64-mingw32}";; (*) echo "**** ERROR: unknown mode '$1', try --help" 1>&2 exit 1 @@ -89,6 +100,17 @@ while test $# -gt 0; do ;; (-t|--targets) shift; targets="$1" + if test "$1" = "deb" -o "$1" = "rpm"; then + # set mode to same value + set -- "-m" $@ + continue + fi + ;; + (--host) shift; + host="--host=$1" + ;; + (-f|--flag) shift; + flags+=("$1") ;; (-r|--repo) shift; repos+=("$1") @@ -149,7 +171,8 @@ function traperror() { read fi echo -n " ... cleanup docker: " - docker rm -f "${DOCKER_ID}" + docker stop "${DOCKER_ID}" || true + docker rm "${DOCKER_ID}" echo "returning status: $e" echo "--->" exit $e @@ -176,14 +199,14 @@ function ifthenelse() { os="${arg%%:::*}" thenpart="${arg#*:::}" if test "${thenpart/:::/}" = "${thenpart}"; then - docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if [[ "$(lsb_release -is)-$(lsb_release -cs)-$(dpkg --print-architecture)" =~ ${os} ]]; then '"${cmd//ARG/${thenpart}}"'; fi' + docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if [[ "$(lsb_release -is)-$(lsb_release -cs)-$((which dpkg > /dev/null 2> /dev/null && dpkg --print-architecture) || echo amd64)" =~ ${os} ]]; then '"${cmd//ARG/${thenpart}}"'; fi' else elsepart="${thenpart##*:::}" thenpart="${thenpart%:::*}" if test -n "${thenpart}"; then - docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if [[ "$(lsb_release -is)-$(lsb_release -cs)-$(dpkg --print-architecture)" =~ ${os} ]]; then '"${cmd//ARG/${thenpart}}"'; else '"${cmd//ARG/${elsepart}}"'; fi' + docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if [[ "$(lsb_release -is)-$(lsb_release -cs)-$((which dpkg > /dev/null 2> /dev/null && dpkg --print-architecture) || echo amd64)" =~ ${os} ]]; then '"${cmd//ARG/${thenpart}}"'; else '"${cmd//ARG/${elsepart}}"'; fi' else - docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if [[ "$(lsb_release -is)-$(lsb_release -cs)-$(dpkg --print-architecture)" =~ ${os} ]]; then true; else '"${cmd//ARG/${elsepart}}"'; fi' + docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if [[ "$(lsb_release -is)-$(lsb_release -cs)-$((which dpkg > /dev/null 2> /dev/null && dpkg --print-architecture) || echo amd64)" =~ ${os} ]]; then true; else '"${cmd//ARG/${elsepart}}"'; fi' fi fi fi @@ -192,15 +215,24 @@ function ifthenelse() { set -x docker pull $img -DOCKER_ID=$(docker create ${dirs[@]} ${envs[@]} -e HOME="${HOME}" -w /workdir $img sleep infinity) +DOCKER_ID=$(docker create ${dirs[@]} ${envs[@]} -w /workdir $img sleep infinity) trap 'traperror '"${DOCKER_ID}"' "$? ${PIPESTATUS[@]}" $LINENO $BASH_LINENO "$BASH_COMMAND" "${FUNCNAME[@]}" "${FUNCTION}"' SIGINT INT TERM EXIT if ! [[ $arch =~ $myarch ]]; then docker cp "/usr/bin/qemu-${arch}-static" "${DOCKER_ID}:/usr/bin/qemu-${arch}-static" fi docker start "${DOCKER_ID}" -docker exec ${DOCKER_ID} useradd -u$(id -u) -m -d"${HOME}" $(id -un) +if ! docker exec ${DOCKER_ID} getent group $(id -g) > /dev/null 2>&1; then + docker exec ${DOCKER_ID} groupadd -g $(id -g) $(id -gn) +fi +if ! docker exec ${DOCKER_ID} getent passwd $(id -u) > /dev/null 2>&1; then + docker exec ${DOCKER_ID} useradd -m -u $(id -u) -g $(id -g) -d"${HOME}" $(id -un) +fi case $mode in - (apt) + (deb|apt) + if [[ "${img}" =~ "ubuntu" ]]; then + docker exec ${DOCKER_ID} locale-gen ${LANG} + docker exec ${DOCKER_ID} update-locale LANG=${LANG} + fi OPTIONS='-o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew -y --force-yes --no-install-suggests --no-install-recommends' for f in 'libpam-systemd:amd64' 'policykit*' 'colord'; do docker exec ${DOCKER_ID} bash -c "echo 'Package: $f' >> /etc/apt/preferences" @@ -228,8 +260,7 @@ case $mode in done docker exec ${DOCKER_ID} ./resolve-debbuilddeps.sh ;; - (yum) - ./bootstrap.sh -t dist + (rpm|yum|dnf|zypper|urpmi) if [[ "$img" =~ "centos" ]]; then docker exec ${DOCKER_ID} yum install -y redhat-lsb docker exec -i ${DOCKER_ID} bash -c 'cat > /etc/yum.repos.d/wandisco-svn.repo' <&1 | grep -q 'N: Unable to locate package')" && ! ${DO} dpkg -l "${f}"; then + if test -n "$(${DO} apt-cache policy -q ${f})" && ((! $(${DO} apt-cache policy ${f} 2>&1 | grep -q 'N: Unable to locate package')) && (! ${DO} dpkg -l "${f}")); then TO_INSTALL+=" ${f}" fi done diff --git a/resolve-rpmbuilddeps.sh b/resolve-rpmbuilddeps.sh index 5ddd1b2..1ed2408 100755 --- a/resolve-rpmbuilddeps.sh +++ b/resolve-rpmbuilddeps.sh @@ -10,35 +10,34 @@ ## 1 2 3 4 5 6 7 8 ## 45678901234567890123456789012345678901234567890123456789012345678901234567890 +INSTALL_TOOL=${INSTALL_TOOL:-$((test -x /usr/bin/zypper && echo zypper install -y) || (test -x /usr/bin/dnf && echo dnf install -y) || (test -x /usr/bin/yum && echo yum install -y) || (test -x /usr/sbin/urpmi && echo urpmi --auto))} SCHROOTNAME="$1" PACKAGE_NAME=$(sed -n 's/^ *m4_define(x_package_name, \(.*\)).*/\1/p' configure.ac) -PKGCONFIGS="${2:-epel-release}" # packages to configure yum + +TRAP_CMD= +if test -e ${PACKAGE_NAME}.spec.in -a ! -e ${PACKAGE_NAME}.spec; then + TRAP_CMD+="rm ${PACKAGE_NAME}.spec;" + trap "${TRAP_CMD}" INT TERM EXIT + sed 's,@RPM_DEPEND_IFEXISTS@,,g' ${PACKAGE_NAME}.spec.in | \ + sed 's,@[^@]*@, dummytext,g' > ${PACKAGE_NAME}.spec +fi + +TGZFILE=$(sed -n '/^Name: */{s///;h};/^Version: */{s///;H;x;s/\n/-/;s/$/.tar.gz/;p}' ${PACKAGE_NAME}.spec) +if ! test -e $TGZFILE; then + TRAP_CMD+="rm ${TGZFILE};" + trap "${TRAP_CMD}" INT TERM EXIT + touch $TGZFILE +fi 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} + schroot -c ${SCHROOTNAME} -u root -- ${INSTALL_TOOL} ${FILES} fi 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} + ${INSTALL_TOOL} ${FILES} fi fi