Template to bootstrap configure/automake projects for C++, libtool, Qt, NodeJS, PHP, Shell-Scripts, etc. Extends autotools, by building packages for Debian and RPM, specifying generic library dependencies, creating desktop applications with icons, etc. https://mrw.sh/development/bootstrap-build-environment
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.9 KiB

#! /bin/bash -ex
## @id $Id$
## Resolve Debian Build Dependencies
## Installs all the required packages
## Call: ./resolve-debbuilddeps 'name of build schroot'
## e.g. call: ./resolve-debbuilddeps trusty_amd64
## 1 2 3 4 5 6 7 8
## 45678901234567890123456789012345678901234567890123456789012345678901234567890
SCHROOTNAME="$1"
if test -e debian/control.in -a ! -e debian/control; then
sed 's,@[^@]*@, dummytext,g' debian/control.in > debian/control
trap "rm debian/control" INT TERM EXIT
fi
if test -n "${SCHROOTNAME}"; then
schroot -c "${SCHROOTNAME}" -u root -d / -- apt-get install -y dpkg-dev
DEPS=$(schroot -c "${SCHROOTNAME}" -- dpkg-checkbuilddeps 2>&1 || true)
else
apt-get install -y dpkg-dev
apt-get update
DEPS=$(dpkg-checkbuilddeps 2>&1 || true)
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}"
continue;
fi
success=0
for p in ${pa//|/ }; 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 apt-get -y install ${p}; then
success=1
break;
fi
fi
done
if test ${success} -eq 0; then
echo "**** Error: Installation Failed: ${pa}"
exit 1
fi
done
success=0
if test -n "${SCHROOTNAME}"; then
if schroot -c "${SCHROOTNAME}" -u root -d / -- apt-get -y install ${TO_INSTALL}; then
success=1
fi
else
if apt-get -y install ${TO_INSTALL}; then
success=1
fi
fi
if test ${success} -eq 0; then
echo "**** Error: Installation Failed: ${pa}"
exit 1
fi
echo "**** Success: All Dependencies Resolved"