new script to resolve debian build dependencies

master
Marc Wäckerlin 9 years ago
parent b1d7d4bd2c
commit 5ff3469888
  1. 28
      ax_check_qt.m4
  2. 104
      ax_init_standard_project.m4
  3. 23
      bootstrap.sh
  4. 45
      resolve-debbuilddeps.sh

@ -38,6 +38,7 @@
AC_DEFUN([AX_CXX_QT_TOOL], [
PKG_PROG_PKG_CONFIG
if test -z "$HAVE_$1"; then
HAVE_$1=1
AC_MSG_CHECKING([for $2])
@ -61,7 +62,7 @@ AC_DEFUN([AX_CXX_QT_TOOL], [
fi
fi
AC_SUBST($1)
AM_CONDITIONAL(HAVE_$1, test $HAVE_$1 -eq 1)
AM_CONDITIONAL(HAVE_$1, test $HAVE_[$1] -eq 1)
if test $HAVE_$1 -eq 1; then
AC_MSG_RESULT([$$1])
else
@ -79,24 +80,6 @@ AC_DEFUN([AX_CXX_QT_TOOLS], [
AX_CXX_QT_TOOL(LRELEASE, lrelease)
])
AC_DEFUN([AX_CHECK_VALID_FLAG], [
AC_MSG_CHECKING([m4_default([$2], [for valid flag in "$1"])])
save_cppflags="$CPPFLAGS"
newflag="no"
for test_flag in $1; do
CPPFLAGS+=" ${test_flag}"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
newflag="$test_flag"
CPPFLAGS="$save_cppflags"
CPPFLAGS+=" ${test_flag}"
break;
])
CPPFLAGS="$save_cppflags"
done
AC_SUBST(CPPFLAGS)
AC_MSG_RESULT([$newflag])
])
AC_DEFUN([AX_CHECK_QT], [
qt_modules="$2"
qt_modules_optional="$3"
@ -148,8 +131,11 @@ AC_DEFUN([AX_CHECK_QT], [
fi
], [HAVE_$1=0])
])
AM_CONDITIONAL(HAVE_$1, test $HAVE_$1 -eq 1)
AX_CHECK_VALID_FLAG([-fPIC -fPIE], [position independent code flag])
AM_CONDITIONAL(HAVE_$1, test $HAVE_[$1] -eq 1)
AX_CHECK_VALID_CXX_FLAG([-fPIC -fPIE], [position independent code flag])
if test "${MINGW}" != "no"; then
AX_CHECK_VALID_CXX_FLAG([-Wl,-subsystem,windows], [windows console flag])
fi
AC_SUBST(QTDIR)
AC_SUBST(QT_PLUGIN_PATH)
AC_SUBST(CPPFLAGS)

@ -250,10 +250,10 @@ EOF
# use this in configure.ac to support HTML data for webservers
AC_DEFUN([AX_BUILD_HTML], [
AC_CONFIG_FILES([html/makefile])
AX_ADD_MAKEFILE_TARGET_DEP([maintainer-clean-am], [maintainer-clean-example-targets], [html/makefile.in])
test -f html/makefile.in && cat >> examples/html.in <<EOF
AX_ADD_MAKEFILE_TARGET_DEP([maintainer-clean-am], [maintainer-clean-html-targets], [html/makefile.in])
test -f html/makefile.in && cat >> html/makefile.in <<EOF
#### Begin: Appended by $0
maintainer-clean-example-targets:
maintainer-clean-html-targets:
-rm makefile.in
#### End: $0
EOF
@ -430,7 +430,7 @@ AC_DEFUN([AX_PKG_REQUIRE], [
], [
for x in ${$1_CFLAGS}; do
AC_MSG_NOTICE([search for $3 in ${x[#]-I}])
for f in $(find ${x[#]-I} -name "$3"); do
for f in $(find ${x[#]-I} -name "$3" 2> /dev/null); do
if test -f "$f"; then
$1_found=${tmp_package}
$1_CFLAGS+=" -I${f%/*}"
@ -446,7 +446,7 @@ AC_DEFUN([AX_PKG_REQUIRE], [
tmp_includedir=$(${PKG_CONFIG} --variable=includedir $tmp_package)
for x in ${tmp_includedir}; do
AC_MSG_NOTICE([search for $3 in $x])
for f in $(find ${x} -name "$3"); do
for f in $(find ${x} -name "$3" 2> /dev/null); do
if test -f "$f"; then
$1_found=${tmp_package}
$1_CFLAGS+=" -I${f%/*}"
@ -501,7 +501,7 @@ AC_DEFUN([AX_PKG_CHECK], [
], [
HAVE_$1=0
])
AM_CONDITIONAL(HAVE_$1, test $HAVE_$1 -eq 1)
AM_CONDITIONAL(HAVE_$1, test $HAVE_[$1] -eq 1)
AC_SUBST(HAVE_$1)
AC_SUBST(CPPFLAGS)
AC_SUBST(CXXFLAGS)
@ -532,3 +532,95 @@ AC_DEFUN([AX_REQUIRE_HEADER], [
], [])
], [])
])
# Check within a list of CPP-Flags for the first that is usable and
# configure it
# - parameter:
# $1 = white-space separated list of alternative flags
# $2 = module name (optional, if different from id)
AC_DEFUN([AX_CHECK_VALID_CPP_FLAG], [
AC_MSG_CHECKING([m4_default([$2], [for valid flag in "$1"])])
save_cppflags="$CPPFLAGS"
newflag="no"
for test_flag in $1; do
CPPFLAGS+=" ${test_flag}"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
newflag="$test_flag"
CPPFLAGS="$save_cppflags"
CPPFLAGS+=" ${test_flag}"
break;
])
CPPFLAGS="$save_cppflags"
done
AC_SUBST(CPPFLAGS)
AC_MSG_RESULT([$newflag in $CPPFLAGS])
])
# Check within a list of CXX-Flags for the first that is usable and
# configure it
# - parameter:
# $1 = white-space separated list of alternative flags
# $2 = module name (optional, if different from id)
AC_DEFUN([AX_CHECK_VALID_CXX_FLAG], [
AC_MSG_CHECKING([m4_default([$2], [for valid flag in "$1"])])
save_cxxflags="$CXXFLAGS"
newflag="no"
for test_flag in $1; do
CXXFLAGS+=" ${test_flag}"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
newflag="$test_flag"
CXXFLAGS="$save_cxxflags"
CXXFLAGS+=" ${test_flag}"
break;
])
CXXFLAGS="$save_cxxflags"
done
AC_SUBST(CXXFLAGS)
AC_MSG_RESULT([$newflag in $CXXFLAGS])
])
# Check within a list of C-Flags for the first that is usable and
# configure it
# - parameter:
# $1 = white-space separated list of alternative flags
# $2 = module name (optional, if different from id)
AC_DEFUN([AX_CHECK_VALID_C_FLAG], [
AC_MSG_CHECKING([m4_default([$2], [for valid flag in "$1"])])
save_cflags="$CFLAGS"
newflag="no"
for test_flag in $1; do
CFLAGS+=" ${test_flag}"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
newflag="$test_flag"
CFLAGS="$save_cflags"
CFLAGS+=" ${test_flag}"
break;
])
CFLAGS="$save_cflags"
done
AC_SUBST(CFLAGS)
AC_MSG_RESULT([$newflag in $CFLAGS])
])
# Check within a list of LD-Flags for the first that is usable and
# configure it
# - parameter:
# $1 = white-space separated list of alternative flags
# $2 = module name (optional, if different from id)
AC_DEFUN([AX_CHECK_VALID_LD_FLAG], [
AC_MSG_CHECKING([m4_default([$2], [for valid flag in "$1"])])
save_ldflags="$LDFLAGS"
newflag="no"
for test_flag in $1; do
LDFLAGS+=" ${test_flag}"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
newflag="$test_flag"
LDFLAGS="$save_ldflags"
LDFLAGS+=" ${test_flag}"
break;
])
LDFLAGS="$save_ldflags"
done
AC_SUBST(LDFLAGS)
AC_MSG_RESULT([$newflag in $LDFLAGS])
])

@ -103,8 +103,11 @@ 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
* resolve-debbuilddeps.sh - script to install debian package dependencies
* mac-create-app-bundle.sh - script to create apple mac os-x app-bundle
* AUTHORS - replace your name in AUTHORS before first run
* NEWS - empty file add your project's news
* README - add project description (first line is header, followed by an empty line)
* configure.ac - global configuration file template
* makefile.am - global makefile template
* src/makefile.am - if you enabled AX_USE_CXX
@ -149,6 +152,7 @@ FILES TO EDIT
The following files normally require editing:
* AUTHORS
* NEWS
* README
* configure.ac
* src/makefile.am
@ -178,6 +182,7 @@ FILES
* AUTHORS: First line is the main author and used in Debian and RPM
packaging, so there must be a GPG key that matches
to this line.
* NEWS: File to add project news.
* README: First line is a short description of your project, then an
empty line must follow. All remaining lines are a
long description of your project. this information
@ -380,6 +385,7 @@ copy ${MY_NAME}
copy ax_init_standard_project.m4
copy ax_cxx_compile_stdcxx_11.m4
copy ax_check_qt.m4
copy resolve-debbuilddeps.sh
copy mac-create-app-bundle.sh
AUTHOR=$(gpg -K | sed -n 's,uid *,,p' | sort | head -1)
if test -z "${AUTHOR}"; then
@ -388,6 +394,14 @@ fi
to AUTHORS <<EOF && notice "please edit AUTHORS"
$AUTHOR
EOF
to NEWS <<EOF && notice "please edit NEWS"
$(date) created ${DEFAULT_PROJECT_NAME}
EOF
to README <<EOF && notice "please edit README"
${DEFAULT_PROJECT_NAME}
add description for ${DEFAULT_PROJECT_NAME}
EOF
to configure.ac <<EOF && \
( notice "please edit configure.ac, then rerun $0"; exit 0 )
${HEADER}m4_define(x_package_name, ${DEFAULT_PROJECT_NAME}) # project's name
@ -682,7 +696,7 @@ EOF
Source: @PACKAGE_NAME@
Priority: extra
Maintainer: @AUTHOR@
Build-Depends: debhelper, subversion, pkg-config, autotools-dev, lsb-release $(if testtag AX_USE_DOXYGEN; then echo -n ", doxygen, graphviz, mscgen"; fi; if testtag AX_USE_CPPUNIT; then echo -n ", libcppunit-dev"; fi; if testtag AX_CXX_QT || testtag AX_CXX_CHECK_QT; then echo -n ", qtbase5-dev | libqt4-dev, qtbase5-dev-tools | qt4-dev-tools"; fi)
Build-Depends: debhelper, subversion, pkg-config, autotools-dev, lsb-release $(if testtag AX_USE_DOXYGEN; then echo -n ", doxygen, graphviz, mscgen"; fi; if testtag AX_USE_CPPUNIT; then echo -n ", libcppunit-dev"; fi; if testtag AX_CXX_QT || testtag AX_CXX_CHECK_QT; then echo -n ", qtbase5-dev | libqt4-dev, qtbase5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools,"; fi)
Package: @PACKAGE_NAME@
Section: $(if testtag AX_USE_LIBTOOL; then echo "libs"; fi)
@ -715,6 +729,7 @@ usr/lib/lib*.a
usr/lib/lib*.so
usr/lib/pkgconfig/*
usr/lib/*.la
usr/share/${PACKAGE_NAME}
usr/share/doc/${PACKAGE_NAME}/html
EOF
to --mode "u=rwx,g=rwx,o=rx" debian/rules <<EOF
@ -794,7 +809,7 @@ rm -rf \$RPM_BUILD_ROOT
$(if testtag AX_USE_LIBTOOL; then
echo '/usr/%_lib/@PACKAGE_NAME@.so.*'
else
echo /usr/bin/*
echo '/usr/bin/*'
fi)
%doc
$(if testtag AX_USE_LIBTOOL; then
@ -807,7 +822,7 @@ $(if testtag AX_USE_LIBTOOL; then
/usr/share/doc/packages/@PACKAGE_NAME@/README
EOF2
else
echo /usr/share/*
echo '/usr/share/*'
fi)
$(if testtag AX_USE_LIBTOOL; then
@ -830,6 +845,7 @@ This Package contains all files required for developement.
/usr/%_lib/pkgconfig
/usr/include/*
%doc
/usr/share/@PACKAGE_NAME@
/usr/share/doc/packages/@PACKAGE_NAME@/html
EOF2
fi)
@ -853,6 +869,7 @@ ${HEADER}prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=\${exec_prefix}/lib
includedir=\${prefix}/include
translationsdir=@datadir@/@PACKAGE_NAME@/translations
Name: @PACKAGE_NAME@
Description: @DESCRIPTION@

@ -0,0 +1,45 @@
#! /bin/bash -ex
## @id $Id$
## Resolve Debian Build Dependencies
## Installs all the required packages
## Call: ./resolve-builddeps 'name of build schroot'
## e.g. call: ./resolve-builddeps trusty_amd64
## 1 2 3 4 5 6 7 8
## 45678901234567890123456789012345678901234567890123456789012345678901234567890
SCHROOTNAME="$1"
svn update || true
./bootstrap -c
if test -n "${SCHROOTNAME}"; then
DEPS=$(schroot -c "${SCHROOTNAME}" -- dpkg-checkbuilddeps 2>&1)
else
DEPS=$(dpkg-checkbuilddeps 2>&1)
fi
DEPS=$(echo "$DEPS" | | sed -n '/Unmet build dependencies/ { s,.*Unmet build dependencies: ,,g; s, ([^)]*),,g; s, *| *,|,g; p}')
for pa in ${DEPS}; do
success=0
for p in $(echo "${pa}" | sed 's,|, ,g'); do
if test -n "${SCHROOTNAME}"; then
if schroot -c "${SCHROOTNAME}" -u root -d / -- apt-get -y install ${p}; then
success=1
break;
fi
else
if sudo apt-get -y install ${p}; then
success=1
break;
fi
fi
done
if test ${success} -eq 0; then
echo "**** Error: Installation Failed: ${pa}"
fi
done
echo "**** Success: All Dependencies Resolved"
Loading…
Cancel
Save