updated build system

master
Marc Wäckerlin 7 years ago
parent deb3761bf3
commit 6a5f1c78bc
  1. 52
      ChangeLog
  2. 15
      ax_init_standard_project.m4
  3. 47
      bootstrap.sh
  4. 5
      build-in-docker.conf
  5. 90
      build-in-docker.sh
  6. 2
      resolve-debbuilddeps.sh
  7. 37
      resolve-rpmbuilddeps.sh

@ -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,

@ -196,9 +196,9 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [
CHANGELOG=$(<ChangeLog)
AC_SUBST(CHANGELOG)
_AM_SUBST_NOTMAKE([CHANGELOG])
DEB_CHANGELOG=$(sed '/^[[^\t]]/{h;N;d};/^\t\* /{s,,,;H;g;s,^,\t* ,;s,\n\([[^ ]]*\) *, \1\n\t ,}' ChangeLog)
DEB_CHANGELOG=$(sed '/^[[^\t]]/{h;N;d};s,\t, ,g;/^ \* /{s,,,;H;g;s,^, * ,;s,\n\([[^ ]]*\) *, \1\n ,}' ChangeLog)
if test -z "$DEB_CHANGELOG"; then
DEB_CHANGELOG=" * see file ChangeLog and project management web site"
DEB_CHANGELOG=" * see file ChangeLog and project management web site"
fi
AC_SUBST(DEB_CHANGELOG)
_AM_SUBST_NOTMAKE([DEB_CHANGELOG])
@ -206,8 +206,8 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [
AUTHOR_NAME=$(echo $AUTHOR | sed 's, *[[<(]].*$,,')
AUTHOR_URL=$(echo $AUTHOR | sed 's,.*(\(http[[^)]]*\)).*,\1,')
AUTHOR_MAIL=$(echo $AUTHOR | sed 's,.*<\(.*@.*\)>.*,\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

@ -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 <<EOF
Source: @PACKAGE_NAME@
Priority: extra
@ -1534,9 +1536,15 @@ else
fi)
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: gnupg, ${VCSDEPENDS} make, automake, autoconf, rpm-build$(
BuildRequires: gnupg, ${VCSDEPENDS_RPM} make, automake, autoconf, rpm-build$(
if testtag AX_USE_CXX; then
echo -n ", binutils-devel, gcc-c++"
fi
if testtag AX_USE_LIBTOOL; then
echo -n ", libtool";
fi
if testtag AX_USE_DOXYGEN; then
echo -n ", doxygen, default-jre-headless";
echo -n ", doxygen, java-openjdk";
fi
if testtag AX_USE_PERLDOC; then
echo -n ", libpod-tree-perl";
@ -1545,11 +1553,28 @@ BuildRequires: gnupg, ${VCSDEPENDS} make, automake, autoconf, rpm-build$(
%if 0%{?fedora} != 20
$(if testtag AX_USE_DOXYGEN; then echo -n "BuildRequires: graphviz"; fi)
%endif
%if 0%{?fedora} || 0%{?rhel} || 0%{?rhl} || 0%{?centos} || 0%{?centos_ver} || 0%{?centos_version}
BuildRequires: pkgconfig, redhat-lsb$(
if testtag AX_USE_CPPUNIT; then
echo -n ", cppunit-devel";
fi)
%if 0%{?fedora} || 0%{?rhel} || 0%{?rhl} || 0%{?centos} || 0%{?centos_ver} || 0%{?centos_version} || 0%{?mageia}
BuildRequires: which, pkgconfig$(
if testtag AX_USE_LIBTOOL; then
echo -n ", cppunit-devel"
fi
)
%if 0%{?rhel} > 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 <<EOF
#!/bin/bash -e
if test -n "$VCS" -a -d .$VCS -a -e -x $(which ${VCS}2cl); then
if test -n "$VCS" -a -d ".$VCS" -a -e -x "\$(which ${VCS}2cl)"; then
$(case "$VCS" in
(svn) echo " ${VCS}2cl";;
(git) echo " ${VCS}2cl > ChangeLog";;

@ -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")

@ -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 <type> mode: apt or yum, default: ${mode}"
echo " -m, --mode <type> mode: deb, rpm, win, default: ${mode}"
echo " -i, --image <image> use given docker image instead of ${img}"
echo " -a, --arch <arch> build for given hardware architecture"
echo " -t, --targets targets specify build targets, default: ${targets}"
echo " --host <target-arch> host for cross compiling, e.g. i686-w64-mingw32"
echo " -f, --flag <flag> add flag to ./bootstrap.sh or ./configure"
echo " -r, --repo <url> add given apt repository"
echo " -k, --key <url> add public key from url"
echo " -e, --env <var>=<val> 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' <<EOF
@ -242,10 +273,29 @@ enabled=1
gpgcheck=0
EOF
fi
docker exec ${DOCKER_ID} yum install -y rpm-build
docker exec ${DOCKER_ID} groupadd -g $(id -g) build
docker exec ${DOCKER_ID} useradd -g $(id -g) -u $(id -u) build
docker exec ${DOCKER_ID} ./resolve-rpmbuilddeps.sh || true
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))
docker exec ${DOCKER_ID} ${INSTALL_TOOL} rpm-build automake libtool subversion gcc-c++ pkgconfig wget /usr/bin/lsb_release
i=0
for key in "${keys[@]}"; do
wget -Orpm-key "$key"
docker exec -i ${DOCKER_ID} rpm --import rpm-key
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 true))
ifthenelse "${repo}" "${INSTALL_REPO} ARG"
((++i))
done
docker exec ${DOCKER_ID} ./resolve-rpmbuilddeps.sh
;;
(win)
if [[ "${img}" =~ "ubuntu" ]]; then
docker exec ${DOCKER_ID} locale-gen ${LANG}
docker exec ${DOCKER_ID} update-locale LANG=${LANG}
fi
docker exec ${DOCKER_ID} apt-get update ${OPTIONS}
docker exec ${DOCKER_ID} apt-get install -y mingw-w64
docker exec ${DOCKER_ID} ./resolve-debbuilddeps.sh
;;
esac
docker exec -u $(id -u):$(id -g) ${DOCKER_ID} ./bootstrap.sh -t "${targets}"
docker exec -u $(id -u):$(id -g) ${DOCKER_ID} ./bootstrap.sh -t "${targets}" ${host} ${flags[@]}

@ -35,7 +35,7 @@ TO_INSTALL=
if test -e debian/control.in -a ! -e debian/control; then
for f in $(sed -n 's, *AX_DEB_DEPEND_IFEXISTS(\([^)]*\)).*,\1,p' configure.ac); do
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
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

@ -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

Loading…
Cancel
Save