forked from iputils/iputils
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
travis: Switch to docker based builds
Adding 11 build covering base distros (Debian, Ubuntu, CentOS, Fedora, openSUSE), including aarch64 and ppc64le cross compilation (on Debian) and musl build (on Alpine Linux). Implements: iputils#169 Acked-by: Sami Kerola <[email protected]> Signed-off-by: Petr Vorel <[email protected]>
- Loading branch information
Showing
10 changed files
with
282 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,69 @@ | ||
os: linux | ||
dist: trusty | ||
sudo: false | ||
language: python | ||
python: 3.6 | ||
cache: | ||
apt: true | ||
ccache: true | ||
addons: | ||
apt: | ||
packages: | ||
- "python3-pip" | ||
- "libcap-dev" | ||
- "libidn2-0-dev" | ||
- "nettle-dev" | ||
- "xsltproc" | ||
- "docbook-xsl-ns" | ||
sudo: required | ||
language: c | ||
services: | ||
- docker | ||
|
||
matrix: | ||
include: | ||
- env: CC=gcc | ||
- env: CC=clang | ||
install: | ||
- set -e | ||
- export NINJA_LATEST="https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip" | ||
- wget "$NINJA_LATEST" | ||
- unzip -q ninja-linux.zip -d build | ||
- export PATH="$PWD/build:$PATH" | ||
- sudo ln -s $PWD/build /root | ||
- pip3 install meson | ||
include: | ||
# cross compilation | ||
# NOTE: cannot set cross compiler as compiler variable (meson tests also native build) | ||
- os: linux | ||
env: DISTRO=debian:unstable VARIANT=cross-compile.aarch64 | ||
compiler: gcc | ||
|
||
- os: linux | ||
env: DISTRO=debian:testing VARIANT=cross-compile.ppc64le | ||
compiler: gcc | ||
|
||
# musl (native) | ||
- os: linux | ||
# Message: WARNING: xsltproc: cannot process http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl | ||
# doc/meson.build:70:1: ERROR: Problem encountered: Docs cannot be built: xsltproc does not work correctly | ||
env: DISTRO=alpine:latest EXTRA_BUILD_OPTS='-DBUILD_HTML_MANS=false -DBUILD_MANS=false' | ||
compiler: gcc | ||
|
||
# glibc (gcc/clang) | ||
- os: linux | ||
env: DISTRO=opensuse/tumbleweed | ||
compiler: gcc | ||
|
||
- os: linux | ||
env: DISTRO=ubuntu:xenial | ||
compiler: clang | ||
|
||
- os: linux | ||
env: DISTRO=ubuntu:latest | ||
compiler: gcc | ||
|
||
- os: linux | ||
env: DISTRO=fedora:latest | ||
compiler: clang | ||
|
||
- os: linux | ||
env: DISTRO=centos:7 | ||
compiler: gcc | ||
|
||
- os: linux | ||
env: DISTRO=debian:testing | ||
compiler: gcc | ||
|
||
- os: linux | ||
env: DISTRO=debian:stable | ||
compiler: gcc | ||
|
||
- os: linux | ||
env: DISTRO=debian:oldstable | ||
compiler: clang | ||
|
||
before_install: | ||
- DIR="/usr/src/iputils" | ||
- printf "FROM $DISTRO\nRUN mkdir -p $DIR\nWORKDIR $DIR\nCOPY . $DIR\n" > Dockerfile | ||
- echo "cat Dockerfile"; cat Dockerfile | ||
- docker build -t iputils . | ||
|
||
script: | ||
- set -e | ||
- meson builddir -DBUILD_RARPD=true -DBUILD_TFTPD=true -DBUILD_TRACEROUTE6=true -DBUILD_HTML_MANS=true | ||
- ninja -C builddir | ||
- sudo sh -c 'PATH="/root/build:$PATH" make install' | ||
- INSTALL="${DISTRO%%:*}" | ||
- INSTALL="${INSTALL%%/*}" | ||
- DISTRO_VERSION="${DISTRO#*:}" | ||
- case $VARIANT in cross-compile*) BUILD="cross";; i386) BUILD="32";; *) BUILD="native";; esac | ||
- docker run -it iputils /bin/sh -c "cd travis && DISTRO_VERSION=\"$DISTRO_VERSION\" ./$INSTALL.sh && if [ \"$VARIANT\" ]; then ./$INSTALL.$VARIANT.sh; fi && CC=$CC EXTRA_BUILD_OPTS=\"$EXTRA_BUILD_OPTS\" ../build.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/sh | ||
|
||
CC="${CC:-gcc}" | ||
BUILD_DIR="${BUILD_DIR:-builddir}" | ||
PREFIX="${PREFIX:-$HOME/iputils-install}" | ||
|
||
# ninja-build is not detected causes build failing => symlink to ninja | ||
# needed for CentOS 7 but maybe for others | ||
if ! which ninja > /dev/null >&2; then | ||
if which ninja-build > /dev/null >&2; then | ||
ln -sv $(which ninja-build) /usr/local/bin/ninja | ||
else | ||
echo "ninja binary not found (tried ninja and $NINJA on $PATH)" >&2 | ||
exit 1 | ||
fi | ||
fi | ||
|
||
which meson > /dev/null 2>&1 || { echo "meson binary not found" >&2; exit 1; } | ||
|
||
BUILD_OPTS="-Dprefix=$PREFIX -DBUILD_RARPD=true -DBUILD_TFTPD=true -DBUILD_TRACEROUTE6=true $EXTRA_BUILD_OPTS" | ||
[ -z "$EXTRA_BUILD_OPTS" ] && BUILD_OPTS="$BUILD_OPTS -DBUILD_HTML_MANS=true" | ||
[ -f "meson.cross" ] && BUILD_OPTS="--cross-file $PWD/meson.cross $BUILD_OPTS" | ||
|
||
cd `dirname $0` | ||
|
||
echo "=== compiler version ===" | ||
$CC --version | ||
|
||
echo "=== meson version ===" | ||
meson --version | ||
|
||
echo "=== ninja version ===" | ||
ninja --version | ||
|
||
echo "=== build ===" | ||
echo "Build options: $BUILD_OPTS" | ||
meson $BUILD_DIR $BUILD_OPTS && \ | ||
make -j$(getconf _NPROCESSORS_ONLN) && make install | ||
ret=$? | ||
|
||
cat << EOF | ||
============ | ||
END OF BUILD | ||
============ | ||
EOF | ||
|
||
if [ $ret -ne 0 ]; then | ||
log="$DIR/meson-logs/meson-log.txt" | ||
if [ -f "$log" ]; then | ||
echo "=== START $log ===" | ||
cat $log | ||
echo "=== END $log ===" | ||
fi | ||
fi | ||
|
||
exit $ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/sh | ||
# Copyright (c) 2019 Petr Vorel <[email protected]> | ||
set -e | ||
|
||
apk update | ||
|
||
# NOTE: libidn2-dev is not in 3.10, only in edge | ||
apk add \ | ||
clang \ | ||
docbook-xml \ | ||
docbook-xsl \ | ||
gcc \ | ||
gettext-dev \ | ||
libcap-dev \ | ||
libxslt \ | ||
make \ | ||
meson \ | ||
musl-dev \ | ||
nettle-dev \ | ||
openssl-dev \ | ||
pkgconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fedora.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/sh | ||
# Copyright (c) 2019 Petr Vorel <[email protected]> | ||
set -e | ||
|
||
dpkg --add-architecture arm64 | ||
apt update | ||
|
||
apt install -y --no-install-recommends \ | ||
dpkg-dev \ | ||
gcc-aarch64-linux-gnu \ | ||
libc6-dev-arm64-cross \ | ||
libcap-dev:arm64 \ | ||
libidn2-0-dev:arm64 \ | ||
libssl-dev:arm64 | ||
|
||
cat <<EOF > meson.cross | ||
[binaries] | ||
c = 'aarch64-linux-gnu-gcc' | ||
pkgconfig = 'aarch64-linux-gnu-pkg-config' | ||
[host_machine] | ||
system = 'linux' | ||
cpu_family = 'aarch64' | ||
cpu = 'aarch64' | ||
endian = 'little' | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/sh | ||
# Copyright (c) 2019 Petr Vorel <[email protected]> | ||
set -e | ||
|
||
dpkg --add-architecture ppc64el | ||
apt update | ||
|
||
apt install -y --no-install-recommends \ | ||
dpkg-dev \ | ||
gcc-powerpc64le-linux-gnu \ | ||
libc6-dev-ppc64el-cross \ | ||
libcap-dev:ppc64el \ | ||
libidn2-0-dev:ppc64el \ | ||
libssl-dev:ppc64el | ||
|
||
cat <<EOF > meson.cross | ||
[binaries] | ||
c = 'powerpc64le-linux-gnu-gcc' | ||
pkgconfig = 'powerpc64le-linux-gnu-pkg-config' | ||
[host_machine] | ||
system = 'linux' | ||
cpu_family = 'ppc64' | ||
cpu = 'ppc64' | ||
endian = 'little' | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/sh | ||
# Copyright (c) 2019 Petr Vorel <[email protected]> | ||
set -e | ||
|
||
if [ "$DISTRO_VERSION" = "oldstable" ]; then | ||
cat <<EOF | tee /etc/apt/sources.list.d/stretch-backports.list | ||
deb http://http.debian.net/debian stretch-backports main contrib non-free | ||
EOF | ||
BACKPORT_REPO="stretch-backports" | ||
fi | ||
|
||
if [ "$DISTRO_VERSION" = "xenial" ]; then | ||
cat <<EOF | tee /etc/apt/sources.list.d/xenial-backports.list | ||
deb http://archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiverse | ||
EOF | ||
BACKPORT_REPO="xenial-backports" | ||
fi | ||
|
||
apt update | ||
|
||
apt install -y --no-install-recommends \ | ||
clang \ | ||
docbook-xsl-ns \ | ||
file \ | ||
gcc \ | ||
gettext \ | ||
libcap-dev \ | ||
libidn2-0-dev \ | ||
libssl-dev \ | ||
make \ | ||
meson \ | ||
nettle-dev \ | ||
pkg-config \ | ||
xsltproc | ||
|
||
if [ "$BACKPORT_REPO" ]; then | ||
apt install -y --no-install-recommends -t $BACKPORT_REPO meson | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/sh | ||
# Copyright (c) 2019 Petr Vorel <[email protected]> | ||
set -e | ||
|
||
yum -y install \ | ||
clang \ | ||
gcc \ | ||
gettext \ | ||
libcap-devel \ | ||
libxslt \ | ||
make \ | ||
nettle-devel \ | ||
openssl-devel \ | ||
pkg-config \ | ||
which | ||
|
||
yum -y install libidn2-devel docbook5-style-xsl || true | ||
|
||
# supported since Centos 7 (Centos 6 don't have python 3.5 meson dependency) | ||
if [ "$(basename $0)" = "centos.sh" ]; then | ||
yum -y install epel-release | ||
fi | ||
|
||
yum -y install meson ninja-build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/sh | ||
# Copyright (c) 2018 Petr Vorel <[email protected]> | ||
set -e | ||
|
||
zypper --non-interactive install --no-recommends \ | ||
clang \ | ||
docbook_5 \ | ||
docbook5-xsl-stylesheets \ | ||
gcc \ | ||
gettext-tools \ | ||
libcap-devel \ | ||
libcap-progs \ | ||
libidn2-devel \ | ||
libnettle-devel \ | ||
libxslt-tools \ | ||
make \ | ||
meson \ | ||
ninja \ | ||
openssl-devel \ | ||
pkg-config \ | ||
which |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
debian.sh |