From 86bfb61775cf84f92dc6327bc651f9a0dc4106e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Tue, 23 Oct 2018 23:24:25 +0200 Subject: [PATCH] update buildsystem --- ax_init_standard_project.m4 | 31 ++++++++------- bootstrap.sh | 2 +- build-in-docker.sh | 76 ++++++++++++++++++++++++++----------- mac-create-app-bundle.sh | 2 +- resolve-rpmbuilddeps.sh | 6 +-- 5 files changed, 76 insertions(+), 41 deletions(-) diff --git a/ax_init_standard_project.m4 b/ax_init_standard_project.m4 index 0b1766c..3f0e811 100644 --- a/ax_init_standard_project.m4 +++ b/ax_init_standard_project.m4 @@ -867,7 +867,7 @@ AC_DEFUN([AX_PKG_REQUIRE], [ DEV_DIST_PKG= pkg=m4_default([$2], [$1]) $6 - dep_pkg=${DEV_DEB_DIST_PKG:-${DEV_DIST_PKG:-${pkg}}-dev} + deb_pkg=${DEV_DEB_DIST_PKG:-${DEV_DIST_PKG:-${pkg}}-dev} rpm_pkg=${DEV_RPM_DIST_PKG:-${DEV_DIST_PKG:-${pkg}}-devel} if test -n "$4"; then for f in $pkg $4; do @@ -1092,24 +1092,21 @@ AC_DEFUN([AX_DEB_DEPEND_IFEXISTS], [ # - parameter: # $1 = package name AC_DEFUN([AX_DEB_BUILD_DEPEND], [ - pkg="$1" - DEB_BUILD_DEPEND="${DEB_BUILD_DEPEND}, ${pkg}" + DEB_BUILD_DEPEND="${DEB_BUILD_DEPEND}, $1" ]) # require package in debian/control.in append @DEB_DEPEND@ to Depends # - parameter: # $1 = package name AC_DEFUN([AX_DEB_DEPEND], [ - pkg="$1" - DEB_DEPEND="${DEB_DEPEND}, ${pkg}" + DEB_DEPEND="${DEB_DEPEND}, $1" ]) # require package in debian/control.in append @DEB_DEPEND@ to Depends # - parameter: # $1 = package name AC_DEFUN([AX_DEB_SECTION], [ - pkg="$1" - DEB_SECTION="${pkg}" + DEB_SECTION="$1" ]) # call after setting debian dependencies @@ -1141,19 +1138,17 @@ AC_DEFUN([AX_RPM_DEPEND_IFEXISTS], [ # - parameter: # $1 = package name AC_DEFUN([AX_RPM_BUILD_DEPEND], [ - pkg="$1" - RPM_BUILD_DEPEND="${RPM_BUILD_DEPEND}, ${pkg}" + RPM_BUILD_DEPEND="${RPM_BUILD_DEPEND}, $1" ]) # require package in .spec.in append @RPM_DEPEND@ to Depends # - parameter: # $1 = package name AC_DEFUN([AX_RPM_DEPEND], [ - pkg="$1" if test -z "${RPM_DEPEND}"; then - RPM_DEPEND="${pkg}" + RPM_DEPEND="$1" else - RPM_DEPEND="${RPM_DEPEND}, ${pkg}" + RPM_DEPEND="${RPM_DEPEND}, $1" fi ]) @@ -1161,8 +1156,7 @@ AC_DEFUN([AX_RPM_DEPEND], [ # - parameter: # $1 = package name AC_DEFUN([AX_RPM_GROUP], [ - pkg="$1" - RPM_GROUP="${pkg}" + RPM_GROUP="$1" ]) # call after setting rpmian dependencies @@ -1203,6 +1197,15 @@ AC_DEFUN([AX_ALL_BUILD_DEPEND], [ RPM_BUILD_DEPEND="${RPM_BUILD_DEPEND}, ${pkg}" ]) +# require package in .spec.in and control.in, append to runtime depends +# - parameter: +# $1 = package name +AC_DEFUN([AX_ALL_DEPEND], [ + pkg="$1" + DEB_DEPEND="${DEB_DEPEND}, ${pkg}" + RPM_DEPEND="${RPM_DEPEND}, ${pkg}" +]) + # require package in .spec.in append @ALL_BUILD_DEPEND@ to Build-Depends # - parameter: # $1 = package name diff --git a/bootstrap.sh b/bootstrap.sh index 5d9c835..cfd6546 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1606,7 +1606,7 @@ if testtag AX_USE_DEBIAN_PACKAGING; then -- @PACKAGER@ @BUILD_DATE@ EOF RUN_DEPENDS="$(if testtag AX_USE_NODEJS; then echo -n ", nodejs, npm,"; fi)" - BUILD_DEPENDS="debhelper, fakeroot, ${VCSDEPENDS_DEB} pkg-config, automake, libtool, autotools-dev, pandoc, lsb-release$(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 | qt4-dev,"; fi)" + BUILD_DEPENDS="gnupg, debhelper, fakeroot, ${VCSDEPENDS_DEB} pkg-config, automake, libtool, libltdl-dev, autotools-dev, pandoc, lsb-release$(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 | qt4-dev,"; fi)" to debian/control.in < /dev/null 2> /dev/null && docker exec ${DOCKER_ID} dpkg --print-architecture) || echo amd64) + case "$DISTRIBUTOR" in + (opensuse) # code name may be not available, then set leap or tumbleweed + if test "$CODENAME" = "n/a"; then + CODENAME=$(docker exec ${DOCKER_ID} lsb_release -ds | sed "s,\($(docker exec ${DOCKER_ID} lsb_release -si | sed 's, ,\\|,g')\) *,,"';s, .*,,g;s,",,g;s,.*,\L&,g') + fi + ;; + (fedora|mageia) # numeric code name + CODENAME=$(docker exec ${DOCKER_ID} lsb_release -rs) + ;; + (centos) # only look at major number in centos + CODENAME=$(docker exec ${DOCKER_ID} lsb_release -rs | sed 's,\..*,,') + ;; + esac if test "${arg/:::/}" = "${arg}"; then - docker exec ${DOCKER_ID} bash -c "${cmd//ARG/${arg//@DISTRIBUTOR@/${DISTRIBUTOR}}}" + cmd_tmp="${cmd//ARG/${arg//@DISTRIBUTOR@/${DISTRIBUTOR}}}" + docker exec ${DOCKER_ID} bash -c "${cmd_tmp//@CODENAME@/${CODENAME}}" else os="${arg%%:::*}" thenpart="${arg#*:::}" @@ -215,11 +229,13 @@ function ifthenelse() { fi if [[ "${DISTRIBUTOR}-${CODENAME}-${ARCH}" =~ ${os} ]]; then if test -n "${thenpart}"; then - docker exec ${DOCKER_ID} bash -c "${cmd//ARG/${thenpart//@DISTRIBUTOR@/${DISTRIBUTOR}}}" + cmd_tmp="${cmd//ARG/${thenpart//@DISTRIBUTOR@/${DISTRIBUTOR}}}" + docker exec ${DOCKER_ID} bash -c "${cmd_tmp//@CODENAME@/${CODENAME}}" fi else if test -n "${elsepart}"; then - docker exec ${DOCKER_ID} bash -c "${cmd//ARG/${elsepart//@DISTRIBUTOR@/${DISTRIBUTOR}}}" + cmd_tmp="${cmd//ARG/${elsepart//@DISTRIBUTOR@/${DISTRIBUTOR}}}" + docker exec ${DOCKER_ID} bash -c "${cmd_tmp//@CODENAME@/${CODENAME}}" fi fi fi @@ -255,36 +271,38 @@ if test -z "$mode"; then fi case "$mode" in (deb|apt|win) + OPTIONS='-o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew -y --force-yes --no-install-suggests --no-install-recommends' + PREVENT='libpam-systemd policykit.* colord dconf-service' + docker exec ${DOCKER_ID} apt-get update ${OPTIONS} + docker exec ${DOCKER_ID} apt-mark hold ${PREVENT} + #docker exec ${DOCKER_ID} apt-get upgrade ${OPTIONS} + docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT// /- }- python-software-properties software-properties-common apt-transport-https dpkg-dev lsb-release wget || \ + docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT// /- }- software-properties-common apt-transport-https dpkg-dev lsb-release wget || \ + docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT// /- }- python-software-properties apt-transport-https dpkg-dev lsb-release wget; if [[ "${img}" =~ "ubuntu" ]]; then + docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT// /- }- locales 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' - PREVENT='libpam-systemd policykit.* colord dconf-service' for f in ${PREVENT}; do docker exec ${DOCKER_ID} bash -c "echo 'Package: ${f}' >> /etc/apt/preferences" docker exec ${DOCKER_ID} bash -c "echo 'Pin-Priority: -100' >> /etc/apt/preferences" docker exec ${DOCKER_ID} bash -c "echo >> /etc/apt/preferences" done - docker exec ${DOCKER_ID} apt-get update ${OPTIONS} - docker exec ${DOCKER_ID} apt-mark hold ${PREVENT} - docker exec ${DOCKER_ID} apt-get upgrade ${OPTIONS} - docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT// /- }- python-software-properties software-properties-common apt-transport-https dpkg-dev lsb-release wget || \ - docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT// /- }- software-properties-common apt-transport-https dpkg-dev lsb-release wget || \ - docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT// /- }- python-software-properties apt-transport-https dpkg-dev lsb-release wget; - for key in "${keys[@]}"; do - wget -O- "$key" \ - | docker exec -i ${DOCKER_ID} apt-key add - - done + if test -n "${keys[@]}"; then # fix dependency bug in cosmic and stretch + docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT// /- }- gnupg + for key in "${keys[@]}"; do + wget -O- "$key" \ + | docker exec -i ${DOCKER_ID} apt-key add - + done + fi for repo in "${repos[@]}"; do ifthenelse "${repo}" "apt-add-repository 'ARG'" done - - docker exec ${DOCKER_ID} apt-get update ${OPTIONS} for package in "${packages[@]}"; do - ifthenelse "${package}" "apt-get install ${OPTIONS} ${PREVENT} ARG" + ifthenelse "${package}" "apt-get install ${OPTIONS} ${PREVENT// /- }- ARG" done for command in "${commands[@]}"; do ifthenelse "${command}" "ARG" @@ -305,7 +323,7 @@ gpgcheck=0 EOF fi INSTALL_TOOL=$((docker exec ${DOCKER_ID} test -x /usr/bin/zypper && echo zypper install -y) || (docker exec ${DOCKER_ID} test -x /usr/bin/dnf && echo dnf install -y) || (docker exec ${DOCKER_ID} test -x /usr/bin/yum && echo yum install -y) || (docker exec ${DOCKER_ID} test -x /usr/sbin/urpmi && echo urpmi --auto)) - if test "$INSTALL_TOOL" = "urpmi --auto"; then + if test "$INSTALL_TOOL" = "urpmi --auto" -o "$INSTALL_TOOL" = "zypper install -y"; then LSB_RELEASE=lsb-release else LSB_RELEASE=/usr/bin/lsb_release @@ -321,8 +339,8 @@ EOF docker exec -i ${DOCKER_ID} rm rpm-key done for repo in "${repos[@]}"; do - INSTALL_REPO=$((docker exec ${DOCKER_ID} test -x /usr/bin/zypper && echo zypper ar) || (docker exec ${DOCKER_ID} test -x /usr/bin/dnf && echo dnf config-manager --add-repo) || (docker exec ${DOCKER_ID} test -x /usr/bin/yum && echo wget -O/etc/yum.repos.d/additional$i.repo) || (docker exec ${DOCKER_ID} test -x /usr/sbin/urpmi && echo false)) - ifthenelse "${repo}" "${INSTALL_REPO} 'ARG'" + INSTALL_REPO=$((docker exec ${DOCKER_ID} test -x /usr/bin/zypper && echo zypper ar) || (docker exec ${DOCKER_ID} test -x /usr/bin/dnf && echo dnf config-manager --add-repo) || (docker exec ${DOCKER_ID} test -x /usr/bin/yum && echo yum-config-manager --add-repo) || (docker exec ${DOCKER_ID} test -x /usr/sbin/urpmi && echo false)) + ifthenelse "${repo}" "${INSTALL_REPO} ARG" ((++i)) done for package in "${packages[@]}"; do @@ -340,3 +358,17 @@ for f in "${flags[@]}"; do done docker exec -u $(id -u):$(id -g) ${DOCKER_ID} ./bootstrap.sh -t "${targets}" ${host} "${FLAGS[@]}" + +# last check: try to install built deb or rpm files (if not already cleaned up) +# not supported in trusty and jessie +if test "$mode" = deb -a "${img//trusty/}" = "${img}" -a "${img//jessie/}" = "${img}"; then + if test "${targets//deb/}" != "${targets}" && ls *.deb > /dev/null 2> /dev/null; then + docker exec ${DOCKER_ID} bash -c "apt-get install ${OPTIONS} ${PREVENT// /- }- /workdir/*.deb" + fi +fi +if test "$mode" = rpm -a "${targets//rpm/}" != "${targets}"; then + if ls *.rpm > /dev/null 2> /dev/null; then + docker exec ${DOCKER_ID} bash -c "${INSTALL_TOOL} /workdir/*.rpm" + fi +fi +echo "done." diff --git a/mac-create-app-bundle.sh b/mac-create-app-bundle.sh index 8eb3598..e517657 100755 --- a/mac-create-app-bundle.sh +++ b/mac-create-app-bundle.sh @@ -59,7 +59,7 @@ while [ $found -ne 0 ]; do cd "${target}" for file in $(find . -type f); do for lib in $(otool -L ${file} | tail -n +2 \ - | egrep '/usr/local/|/opt/local/|'"${HOME}" \ + | egrep '/usr/local/|/opt/local/|/opt/X11/|'"${HOME}" \ | grep -v $file | awk '{print $1}'); do found=1 test -f ${lib##*/} \ diff --git a/resolve-rpmbuilddeps.sh b/resolve-rpmbuilddeps.sh index 56bfd4f..08b4645 100755 --- a/resolve-rpmbuilddeps.sh +++ b/resolve-rpmbuilddeps.sh @@ -97,12 +97,12 @@ 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}${DEPS}"; then + if test -n "${FILES// /}${DEPS// /}"; then schroot -c ${SCHROOTNAME} -u root -- ${INSTALL_TOOL} ${FILES} ${DEPS} 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}${DEPS}"; then + if test -n "${FILES// /}${DEPS// /}"; then ${INSTALL_TOOL} ${FILES} ${DEPS} fi fi @@ -112,7 +112,7 @@ 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') fi -if test -n "${FILES}"; then +if test -n "${FILES// /}"; then echo "**** ERROR: Cannot install: " $FILES exit 1 fi