From ed44b3f321821462d5c45576e1b2c17b181383ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Mon, 10 Sep 2018 21:43:30 +0000 Subject: [PATCH] add check whether built package can be installed; fixed typo in debian development dependencie --- ax_check_qt.m4 | 33 +++++++++++++------- ax_init_standard_project.m4 | 49 ++++++++++++++++++----------- bootstrap.sh | 12 +++++--- build-in-docker.sh | 61 ++++++++++++++++++++++++++----------- configure.ac | 2 +- debian/control.in | 2 +- mac-create-app-bundle.sh | 27 ++++++++-------- 7 files changed, 120 insertions(+), 66 deletions(-) diff --git a/ax_check_qt.m4 b/ax_check_qt.m4 index e0eecf2..58627ee 100644 --- a/ax_check_qt.m4 +++ b/ax_check_qt.m4 @@ -119,10 +119,17 @@ AC_DEFUN([AX_CHECK_QT], [ AC_DEFINE([HAVE_$1]) QTDIR=$(${PKG_CONFIG} --variable=prefix Qt5Core) qt_host_bins=$(${PKG_CONFIG} --variable=host_bins Qt5Core) - if test -d "${qt_host_bins}"; then - QT_PLUGIN_PATH=${qt_host_bins}/../plugins - else - QT_PLUGIN_PATH=${QTDIR}/share/qt5/plugins + qt_libdir=$(${PKG_CONFIG} --variable=libdir Qt5Core) + if test -d "${qt_libdir}" -a -d "${qt_libdir}/plugins"; then + QT_PLUGIN_PATH="${qt_libdir}/plugins" + elif test -d "${qt_libdir}/qt5" -a -d "${qt_libdir}/qt5/plugins"; then + QT_PLUGIN_PATH="${qt_libdir}/qt5/plugins" + elif test -d "${qt_host_bins}" -a -d "${qt_host_bins}/../plugins"; then + QT_PLUGIN_PATH="${qt_host_bins}/../plugins" + elif test -d "${QTDIR}/plugins; then + QT_PLUGIN_PATH="${QTDIR}/plugins" + elif test -d "${QTDIR}/share/qt5/plugins; then + QT_PLUGIN_PATH="${QTDIR}/share/qt5/plugins" fi MOC_FLAGS+=" -DHAVE_$1=1 ${[$1]5_CFLAGS}" [$1]_CPPFLAGS="${[$1]5_CFLAGS}" @@ -166,10 +173,17 @@ AC_DEFUN([AX_CHECK_QT], [ AC_DEFINE([HAVE_$1]) QTDIR=$(${PKG_CONFIG} --variable=prefix QtCore) qt_host_bins=$(${PKG_CONFIG} --variable=host_bins QtCore) - if test -d "${qt_host_bins}"; then - QT_PLUGIN_PATH=${qt_host_bins}/../plugins - else - QT_PLUGIN_PATH=${QTDIR}/share/qt/plugins + qt_libdir=$(${PKG_CONFIG} --variable=libdir QtCore) + if test -d "${qt_libdir}" -a -d "${qt_libdir}/plugins"; then + QT_PLUGIN_PATH="${qt_libdir}/plugins" + elif test -d "${qt_libdir}/qt5" -a -d "${qt_libdir}/qt5/plugins"; then + QT_PLUGIN_PATH="${qt_libdir}/qt5/plugins" + elif test -d "${qt_host_bins}" -a -d "${qt_host_bins}/../plugins"; then + QT_PLUGIN_PATH="${qt_host_bins}/../plugins" + elif test -d "${QTDIR}/plugins; then + QT_PLUGIN_PATH="${QTDIR}/plugins" + elif test -d "${QTDIR}/share/qt5/plugins; then + QT_PLUGIN_PATH="${QTDIR}/share/qt5/plugins" fi MOC_FLAGS+=" -DHAVE_$1=1 ${$1_CFLAGS}" [$1]_CPPFLAGS="${[$1]_CFLAGS}" @@ -214,9 +228,6 @@ AC_DEFUN([AX_CHECK_QT], [ AX_CHECK_VALID_CXX_FLAG([-Wl,-subsystem,windows], [windows console flag]) fi test "x$prefix" = xNONE && prefix=$ac_default_prefix - if test "${QT_PLUGIN_PATH}" = "${QT_PLUGIN_PATH#${prefix}}"; then - QT_PLUGIN_PATH=${prefix}${QT_PLUGIN_PATH#/usr} - fi AC_ARG_WITH([qt-plugin-path], [AS_HELP_STRING([--with-qt-plugin-path=PATH], [define a different qt plugin path, current @<:@default=check@:>@])], diff --git a/ax_init_standard_project.m4 b/ax_init_standard_project.m4 index b13fb76..39b798c 100644 --- a/ax_init_standard_project.m4 +++ b/ax_init_standard_project.m4 @@ -218,8 +218,17 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [ AX_SUBST(AUTHOR_URL) AX_SUBST(AUTHOR_MAIL) AX_SUBST(PACKAGER) - PROJECT_URL="${PROJECT_URL:-${AUTHOR_URL}/projects/${PACKAGE_NAME}}" - SOURCE_DOWNLOAD="${SOURCE_DOWNLOAD:-${AUTHOR_URL}/downloads/${PACKAGE_NAME}}" + PROJECT_URL="${PROJECT_URL:-${AUTHOR_URL}}" + for path in . .. ../.. ../../..; do + if test -d ${path}/.svn; then + PROJECT_URL="$(LANG= svn info | sed -n 's,^Repository Root: ,,p')" + break + elif test -d ${path}/.git; then + PROJECT_URL="$(git remote get-url origin)" + break + fi + done + SOURCE_DOWNLOAD="${SOURCE_DOWNLOAD:-${PROJECT_URL}}" AX_SUBST(PROJECT_URL) AX_SUBST(SOURCE_DOWNLOAD) VENDOR=$((lsb_release -is 2>/dev/null || echo unknown) | tr ' ' '_') @@ -365,12 +374,13 @@ AC_DEFUN([AX_USE_CXX], [ #### Begin: Appended by $0 %.app: % -rm -r [\$][@] - \$(MAKE) DESTDIR=[\$][\$](pwd)/[\$][@]/tmp install + \$(MAKE) DESTDIR=[\$][\$](pwd)/tmp install QTDIR="\${QTDIR}" \ QT_PLUGINS="\${QT_PLUGINS}" \ QT_PLUGIN_PATH="\${QT_PLUGIN_PATH}" \ \${top_builddir}/mac-create-app-bundle.sh \ - [\$][@] [\$][<] [\$][\$](pwd)/[\$][@]/tmp\${prefix} + [\$][@] [\$][<] [\$][\$](pwd)/tmp[\$]{prefix} + -rm -rf tmp maintainer-clean-cxx-targets: -rm makefile.in @@ -857,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 @@ -1082,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 @@ -1131,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 ]) @@ -1151,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 @@ -1193,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 3527f9b..37a592b 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1352,7 +1352,7 @@ ${HEADER}AM_CPPFLAGS = -I\${top_srcdir}/src -I\${top_builddir}/src AM_LDFLAGS = -L\${abs_top_builddir}/src/.libs LDADD = -l${PACKAGE_NAME#lib} -exampledir = ${docdir}/examples +exampledir = \${docdir}/examples example_DATA = MAINTAINERCLEANFILES = makefile.in @@ -1605,8 +1605,8 @@ 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-tools | qt4-dev-tools"; fi)" + RUN_DEPENDS="$(if testtag AX_USE_NODEJS; then echo -n ", nodejs, npm,"; 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>&1; then docker exec ${DOCKER_ID} useradd -m -u $(id -u) -g $(id -g) -d"${HOME}" $(id -un) fi docker exec ${DOCKER_ID} chown $(id -u):$(id -g) "${HOME}" -case $mode in +if test -z "$mode"; then + case "$targets" in + (*deb*) mode=deb;; + (*rpm*) mode=rpm;; + (*) case "$img" in + (*ubuntu*|*debian*|*mint*) mode=deb;; + (*fedora*|*centos*|*mageia*) mode=rpm;; + (*mingw*|*win*) mode=win;; + (*) mode=deb;; + esac;; + esac +fi +case "$mode" in (deb|apt|win) - 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' 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 - + 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 + 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 + 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" @@ -281,7 +295,7 @@ case $mode in ;; (rpm|yum|dnf|zypper|urpmi) if [[ "$img" =~ "centos" ]]; then - docker exec ${DOCKER_ID} yum install -y redhat-lsb + docker exec ${DOCKER_ID} yum install -y redhat-lsb epel-release docker exec -i ${DOCKER_ID} bash -c 'cat > /etc/yum.repos.d/wandisco-svn.repo' < /dev/null 2> /dev/null; then + docker exec ${DOCKER_ID} bash -c "apt-get install ${OPTIONS} ${PREVENT} /workdir/*.deb" + fi +fi +if test "${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/configure.ac b/configure.ac index e2b6fd4..71a4ed5 100644 --- a/configure.ac +++ b/configure.ac @@ -28,7 +28,7 @@ AX_BUILD_EXAMPLES AX_CHECK_QT([QT], [QtNetwork QtGui], [QtWidgets]) AC_CONFIG_FILES([src/languages.qrc]) if test -z "${MINGW}"; then - AX_PKG_REQUIRE([PROXY], [libproxy-1.0], [], [libproxy libproxy1 lib64proxy]) + AX_PKG_REQUIRE([PROXY], [libproxy-1.0], [], [libproxy libproxy1 lib64proxy], [], [DEV_DIST_PKG=libproxy]) else LDFLAGS+=" -lwinhttp" HAVE_PROXY=0 diff --git a/debian/control.in b/debian/control.in index 1ccb9d1..cee36e6 100644 --- a/debian/control.in +++ b/debian/control.in @@ -1,7 +1,7 @@ Source: @PACKAGE_NAME@ Priority: extra Maintainer: @PACKAGER@ -Build-Depends: debhelper, fakeroot, svn2cl, subversion, subversion-tools, pkg-config, automake, libtool, autotools-dev, pandoc, lsb-release, doxygen, graphviz, mscgen, default-jre-headless|default-jre, 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 @DEB_BUILD_DEPEND@ @DEB_DEPEND_IFEXISTS@ +Build-Depends: gnupg, debhelper, fakeroot, svn2cl, subversion, subversion-tools, pkg-config, automake, libtool, autotools-dev, pandoc, lsb-release, doxygen, graphviz, mscgen, default-jre-headless|default-jre, 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 @DEB_BUILD_DEPEND@ @DEB_DEPEND_IFEXISTS@ Package: @PACKAGE_NAME@ Section: libs diff --git a/mac-create-app-bundle.sh b/mac-create-app-bundle.sh index 7ff4573..8eb3598 100755 --- a/mac-create-app-bundle.sh +++ b/mac-create-app-bundle.sh @@ -17,14 +17,12 @@ if test "$(uname -s)" != "Darwin"; then exit 1 fi -cd ${0%/*} - project=${2:-$(sed -n 's/ *m4_define *( *x_package_name, *\(.*\) *).*/\1/p' $(pwd)/configure.ac)} apptarget=${1:-${project}.app} -sources=${3:-$(pwd)/usr} +sources=${3:-$(pwd)/tmp} +! test -e "$apptarget" || rm -rf "$apptarget" test -n "$project" test -d "$sources" -! test -e "$apptarget" || rm -rf "$apptarget" target="$(pwd)/${apptarget}/Contents/MacOS" echo "Creating $apptarget for $project from $sources" @@ -32,7 +30,9 @@ echo "Creating $apptarget for $project from $sources" # Step 1: create and fill app directory structure mkdir -p ${apptarget}/Contents/{Resources,MacOS} ! test -d ${sources}/bin || \ - find ${sources}/bin -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/MacOS/ \; + find ${sources}/bin -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/MacOS/ \; +! test -d ${sources}/scripts || \ + find ${sources}/scripts -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/MacOS/ \; executablefile=${apptarget}/Contents/MacOS/${project} test -x $executablefile || executablefile=$(ls -1 ${apptarget}/Contents/MacOS/ | head -1) ! test -d ${sources}/lib || \ @@ -40,9 +40,9 @@ test -x $executablefile || executablefile=$(ls -1 ${apptarget}/Contents/MacOS/ | ! test -d ${sources}/share/${project} || \ find ${sources}/share/${project} -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/Resources/ \; ! test -d ${sources}/share || \ - find ${sources}/share -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/Resources/ \; + find ${sources}/share -mindepth 1 -maxdepth 1 -name ${project} -prune -o -exec cp -a {} ${apptarget}/Contents/Resources/ \; ! test -d ${sources} || \ - find ${sources} -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/Resources/ \; + find ${sources} -mindepth 1 -maxdepth 1 -name share -o -name bin -o -name lib -o -name scripts -prune -o -exec cp -a {} ${apptarget}/Contents/Resources/ \; # Step 2: copy qt plugins, if necessary for f in ${QT_PLUGINS}; do @@ -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 '/opt/local/|'"${HOME}" \ + | egrep '/usr/local/|/opt/local/|'"${HOME}" \ | grep -v $file | awk '{print $1}'); do found=1 test -f ${lib##*/} \ @@ -86,20 +86,19 @@ if test -n "${QTDIR}"; then fi fi -# Step 5: copy or create info.plist -infoplist=$(find ${apptarget}/Contents/Resources -name Info.plist) -if test -f "${infoplist}"; then - cp -a "${infoplist}" ${apptarget}/Contents/Info.plist +# Step 5: copy local or create new info.plist +if test -f Info.plist; then + cp -a Info.plist ${apptarget}/Contents/Info.plist else cat > ${apptarget}/Contents/Info.plist < - + CFBundleIdentifier ${project} CFBundleExecutable - ${executablefile##/} + ${executablefile##*/} EOF