|
|
@ -10,18 +10,21 @@ mode="deb" |
|
|
|
img="ubuntu:latest" |
|
|
|
img="ubuntu:latest" |
|
|
|
repos=() |
|
|
|
repos=() |
|
|
|
keys=() |
|
|
|
keys=() |
|
|
|
envs=("-e LANG=${LANG}" "-e HOME=/home/$(id -un)" "-e TERM=xterm" "-e DEBIAN_FRONTEND=noninteractive" "-e DEBCONF_NONINTERACTIVE_SEEN=true") |
|
|
|
envs=("-e LANG=${LANG}" "-e HOME=${HOME}" "-e TERM=xterm" "-e DEBIAN_FRONTEND=noninteractive" "-e DEBCONF_NONINTERACTIVE_SEEN=true") |
|
|
|
dirs=("-v $(pwd):/workdir" "-v ${HOME}/.gnupg:/home/$(id -un)/.gnupg") |
|
|
|
dirs=("-v $(pwd):/workdir" "-v ${HOME}/.gnupg:${HOME}/.gnupg") |
|
|
|
packages=() |
|
|
|
packages=() |
|
|
|
targets="all check distcheck" |
|
|
|
targets="all check distcheck" |
|
|
|
commands=() |
|
|
|
commands=() |
|
|
|
arch=$((which dpkg > /dev/null 2> /dev/null && dpkg --print-architecture) || echo amd64) |
|
|
|
arch=$((which dpkg > /dev/null 2> /dev/null && dpkg --print-architecture) || echo amd64) |
|
|
|
|
|
|
|
host= |
|
|
|
|
|
|
|
flags=() |
|
|
|
wait=0 |
|
|
|
wait=0 |
|
|
|
if test -e ./build-in-docker.conf; then |
|
|
|
if test -e ./build-in-docker.conf; then |
|
|
|
# you can preconfigure the variables in file build-in-docker.conf |
|
|
|
# you can preconfigure the variables in file build-in-docker.conf |
|
|
|
# if you do so, add the file to EXTRA_DIST in makefile.am |
|
|
|
# if you do so, add the file to EXTRA_DIST in makefile.am |
|
|
|
source ./build-in-docker.conf |
|
|
|
source ./build-in-docker.conf |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
while test $# -gt 0; do |
|
|
|
while test $# -gt 0; do |
|
|
|
case "$1" in |
|
|
|
case "$1" in |
|
|
|
(-h|--help) |
|
|
|
(-h|--help) |
|
|
@ -30,10 +33,12 @@ while test $# -gt 0; do |
|
|
|
echo "OPTIONS:" |
|
|
|
echo "OPTIONS:" |
|
|
|
echo |
|
|
|
echo |
|
|
|
echo " -h, --help show this help" |
|
|
|
echo " -h, --help show this help" |
|
|
|
echo " -m, --mode <type> mode: deb, rpm, default: ${mode}" |
|
|
|
echo " -m, --mode <type> mode: deb, rpm, win, default: ${mode}" |
|
|
|
echo " -i, --image <image> use given docker image instead of ${img}" |
|
|
|
echo " -i, --image <image> use given docker image instead of ${img}" |
|
|
|
echo " -a, --arch <arch> build for given hardware architecture" |
|
|
|
echo " -a, --arch <arch> build for given hardware architecture" |
|
|
|
echo " -t, --targets targets specify build targets, default: ${targets}" |
|
|
|
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 " -r, --repo <url> add given apt repository" |
|
|
|
echo " -k, --key <url> add public key from url" |
|
|
|
echo " -k, --key <url> add public key from url" |
|
|
|
echo " -e, --env <var>=<val> set environment variable in docker" |
|
|
|
echo " -e, --env <var>=<val> set environment variable in docker" |
|
|
@ -44,7 +49,9 @@ while test $# -gt 0; do |
|
|
|
echo |
|
|
|
echo |
|
|
|
echo " The option -i must be after -m, because mode sets a new default image" |
|
|
|
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 -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 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 |
|
|
|
echo " The options -r -k -e -d -p -c can be repeated several times." |
|
|
|
echo " The options -r -k -e -d -p -c can be repeated several times." |
|
|
|
echo |
|
|
|
echo |
|
|
@ -79,6 +86,7 @@ while test $# -gt 0; do |
|
|
|
(rpm|zypper) img="opensuse:latest";; |
|
|
|
(rpm|zypper) img="opensuse:latest";; |
|
|
|
(yum) img="centos:latest";; |
|
|
|
(yum) img="centos:latest";; |
|
|
|
(dnf) img="fedora:latest";; |
|
|
|
(dnf) img="fedora:latest";; |
|
|
|
|
|
|
|
(win) img="ubuntu:latest"; host="${host:---host=i686-w64-mingw32}";; |
|
|
|
(*) |
|
|
|
(*) |
|
|
|
echo "**** ERROR: unknown mode '$1', try --help" 1>&2 |
|
|
|
echo "**** ERROR: unknown mode '$1', try --help" 1>&2 |
|
|
|
exit 1 |
|
|
|
exit 1 |
|
|
@ -91,15 +99,22 @@ while test $# -gt 0; do |
|
|
|
(-a|--arch) shift; |
|
|
|
(-a|--arch) shift; |
|
|
|
arch="$1" |
|
|
|
arch="$1" |
|
|
|
;; |
|
|
|
;; |
|
|
|
(-t|--targets) shift |
|
|
|
(-t|--targets) shift; |
|
|
|
targets="$1" |
|
|
|
targets="$1" |
|
|
|
if test "$1" = "deb" -o "$1" = "rpm"; then |
|
|
|
if test "$1" = "deb" -o "$1" = "rpm"; then |
|
|
|
# set mode to same value |
|
|
|
# set mode to same value |
|
|
|
set -- "-m" $@ |
|
|
|
set -- "-m" "$@" |
|
|
|
continue |
|
|
|
continue |
|
|
|
fi |
|
|
|
fi |
|
|
|
;; |
|
|
|
;; |
|
|
|
|
|
|
|
(--host) shift; |
|
|
|
|
|
|
|
host="--host=$1" |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
(-f|--flag) shift; |
|
|
|
|
|
|
|
flags+=("$1") |
|
|
|
|
|
|
|
;; |
|
|
|
(-r|--repo) shift; |
|
|
|
(-r|--repo) shift; |
|
|
|
|
|
|
|
echo "OPTION: $1" |
|
|
|
repos+=("$1") |
|
|
|
repos+=("$1") |
|
|
|
;; |
|
|
|
;; |
|
|
|
(-k|--key) shift; |
|
|
|
(-k|--key) shift; |
|
|
@ -214,6 +229,7 @@ fi |
|
|
|
if ! docker exec ${DOCKER_ID} getent passwd $(id -u) > /dev/null 2>&1; then |
|
|
|
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) |
|
|
|
docker exec ${DOCKER_ID} useradd -m -u $(id -u) -g $(id -g) -d"${HOME}" $(id -un) |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
docker exec ${DOCKER_ID} chown $(id -u):$(id -g) "${HOME}" |
|
|
|
case $mode in |
|
|
|
case $mode in |
|
|
|
(deb|apt) |
|
|
|
(deb|apt) |
|
|
|
if [[ "${img}" =~ "ubuntu" ]]; then |
|
|
|
if [[ "${img}" =~ "ubuntu" ]]; then |
|
|
@ -232,7 +248,7 @@ case $mode in |
|
|
|
docker exec ${DOCKER_ID} apt-get install ${OPTIONS} software-properties-common apt-transport-https dpkg-dev lsb-release || \ |
|
|
|
docker exec ${DOCKER_ID} apt-get install ${OPTIONS} software-properties-common apt-transport-https dpkg-dev lsb-release || \ |
|
|
|
docker exec ${DOCKER_ID} apt-get install ${OPTIONS} python-software-properties apt-transport-https dpkg-dev lsb-release; |
|
|
|
docker exec ${DOCKER_ID} apt-get install ${OPTIONS} python-software-properties apt-transport-https dpkg-dev lsb-release; |
|
|
|
for repo in "${repos[@]}"; do |
|
|
|
for repo in "${repos[@]}"; do |
|
|
|
ifthenelse "${repo}" "apt-add-repository ARG" |
|
|
|
ifthenelse "${repo}" "apt-add-repository 'ARG'" |
|
|
|
done |
|
|
|
done |
|
|
|
for key in "${keys[@]}"; do |
|
|
|
for key in "${keys[@]}"; do |
|
|
|
wget -O- "$key" \ |
|
|
|
wget -O- "$key" \ |
|
|
@ -270,10 +286,19 @@ EOF |
|
|
|
done |
|
|
|
done |
|
|
|
for repo in "${repos[@]}"; do |
|
|
|
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)) |
|
|
|
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" |
|
|
|
ifthenelse "${repo}" "${INSTALL_REPO} 'ARG'" |
|
|
|
((++i)) |
|
|
|
((++i)) |
|
|
|
done |
|
|
|
done |
|
|
|
docker exec ${DOCKER_ID} ./resolve-rpmbuilddeps.sh |
|
|
|
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 |
|
|
|
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[@]} |
|
|
|