From 33e1959d3feb3c4c8c0939b4f0106496807ae928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Tue, 3 Nov 2015 13:36:24 +0000 Subject: [PATCH] should now work fr any ubuntu distributon --- ax_init_standard_project.m4 | 12 ++++++++++++ configure.ac | 8 +------- debian/control.in | 2 +- resolve-debbuilddeps.sh | 11 +++++++++-- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/ax_init_standard_project.m4 b/ax_init_standard_project.m4 index 5baecf4..c02825e 100644 --- a/ax_init_standard_project.m4 +++ b/ax_init_standard_project.m4 @@ -696,3 +696,15 @@ AC_DEFUN([AX_CHECK_VALID_LD_FLAG], [ AC_SUBST(LDFLAGS) AC_MSG_RESULT([$newflag in $LDFLAGS]) ]) + +# Check if a package exists in the current distribution, if yes, require it +# in debian/control.in append @DEB_DEPEND_IFEXISTS@ to Build-Depends +# - parameter: +# $1 = package name +AC_DEFUN([AX_DEB_DEPEND_IFEXISTS], [ + pkg=$1 + if test -n "$(apt-cache policy -q ${pkg} 2> /dev/null)"; then + DEB_DEPEND_IFEXISTS+=", ${pkg}" + fi + AC_SUBST(DEB_DEPEND_IFEXISTS) +]) diff --git a/configure.ac b/configure.ac index 4d0fd0e..09b415a 100644 --- a/configure.ac +++ b/configure.ac @@ -166,13 +166,7 @@ AC_SUBST(BOOST_THREAD_LIB) AM_CONDITIONAL(HAVE_BOOST_THREAD, test -n "$BOOST_THREAD_LIB") # special dependencies for specific distros -DIST_BUILDDEPENDS=$( - case $(lsb_release -cs) in - (precise|lucid|wheezy|squeeze);; - (*) echo "libiberty-dev, ";; - esac -) -AC_SUBST(DIST_BUILDDEPENDS) +AX_DEB_DEPEND_IFEXISTS(libiberty-dev) # thread options THREADS="-pthread -D_MT" diff --git a/debian/control.in b/debian/control.in index c3ba895..c855412 100644 --- a/debian/control.in +++ b/debian/control.in @@ -1,7 +1,7 @@ Source: @PACKAGE_NAME@ Priority: extra Maintainer: @AUTHOR@ -Build-Depends: debhelper, subversion, pkg-config, automake, libtool, autotools-dev, lsb-release , doxygen, graphviz, mscgen, libcppunit-dev, libz-dev, libiberty-dev | libiberty, binutils-dev +Build-Depends: debhelper, subversion, pkg-config, automake, libtool, autotools-dev, lsb-release , doxygen, graphviz, mscgen, libcppunit-dev, libz-dev, binutils-dev @DEB_DEPEND_IFEXISTS@ Package: @PACKAGE_NAME@ Section: libs diff --git a/resolve-debbuilddeps.sh b/resolve-debbuilddeps.sh index 7297f60..fe44d0d 100755 --- a/resolve-debbuilddeps.sh +++ b/resolve-debbuilddeps.sh @@ -24,9 +24,17 @@ function install() { fi } +TO_INSTALL= + if test -e debian/control.in -a ! -e debian/control; then - sed 's,@[^@]*@, dummytext,g' debian/control.in > debian/control + for f in $(sed -n 's, *AX_DEB_DEPEND_IFEXISTS(\([^)]*\)).*,\1,p' configure.ac); do + if test -n "$(apt-cache policy -q ${f})" && ! dpkg -l "${f}"; then + TO_INSTALL+=" ${f}" + fi + done trap "rm debian/control" INT TERM EXIT + sed 's,@DEB_DEPEND_IFEXISTS@,,g' debian/control.in | \ + sed 's,@[^@]*@, dummytext,g' > debian/control fi if test -n "${SCHROOTNAME}"; then @@ -38,7 +46,6 @@ else fi DEPS=$(echo "$DEPS" | sed -n '/Unmet build dependencies/ { s,.*Unmet build dependencies: ,,g; s, ([^)]*),,g; s, *| *,|,g; p}') -TO_INSTALL= for pa in ${DEPS}; do if test ${pa//|/} = ${pa}; then TO_INSTALL+=" ${pa}"