forked from 3DTK/3DTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
travisdockerbuild.sh
executable file
·118 lines (104 loc) · 2.79 KB
/
travisdockerbuild.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/sh
set -eu
if [ "$#" -ne 2 ] && [ "$#" -ne 3 ]; then
echo "usage: $0 derivative distribution [compiler]" >&2
exit 1
fi
DERIV=$1
DIST=$2
CC=
if [ "$#" -gt 2 ]; then
CC=$3
fi
case "$DERIV" in
debian)
MIRROR="http://deb.debian.org/debian"
SECMIRROR="http://security.debian.org/debian-security"
COMP="main"
;;
ubuntu)
MIRROR="http://archive.ubuntu.com/ubuntu"
SECMIRROR="http://security.ubuntu.com/ubuntu"
COMP="main restricted universe multiverse"
;;
*)
echo "unknown derivative: $DERIV" >&2
exit 1
esac
CMAKEOPTS="-DCMAKE_VERBOSE_MAKEFILE=ON"
case "$DIST" in
jessie)
CMAKEOPTS="$CMAKEOPTS -DWITH_CGAL=OFF -DWITH_GLFW=OFF -DWITH_QT=OFF"
;;
trusty)
CMAKEOPTS="$CMAKEOPTS -DWITH_CGAL=OFF -DWITH_GLFW=OFF -DWITH_QT=OFF -DWITH_PYTHON=OFF -DWITH_LIBZIP=OFF"
;;
buster|sid)
CMAKEOPTS="$CMAKEOPTS -DWITH_ROS=ON"
;;
esac
cat > Dockerfile <<EOF
FROM $DERIV:$DIST
WORKDIR $(pwd)
COPY . .
RUN rm -f Dockerfile
RUN echo "deb $MIRROR $DIST $COMP" > /etc/apt/sources.list
RUN echo force-unsafe-io > /etc/dpkg/dpkg.cfg.d/force-unsafe-io
RUN echo 'Acquire::EnableSrvRecords "false";' > /etc/apt/apt.conf.d/90srvrecords
EOF
case "$DIST" in
jessie|stretch|buster)
cat >> Dockerfile <<EOF
RUN echo "deb $MIRROR $DIST-updates $COMP" >> /etc/apt/sources.list
RUN echo "deb $SECMIRROR $DIST/updates $COMP" >> /etc/apt/sources.list
EOF
;;
trusty|xenial|bionic)
cat >> Dockerfile <<EOF
RUN echo "deb $MIRROR $DIST-updates $COMP" >> /etc/apt/sources.list
RUN echo "deb $SECMIRROR $DIST-security $COMP" >> /etc/apt/sources.list
EOF
;;
esac
TAG="3dtk.docker.$DERIV.$DIST"
echo "travis_fold:start:docker_build"
docker build --tag="$TAG" .
echo "travis_fold:end:docker_build"
GENERATOR=Ninja
if [ "$DIST" = "trusty" ]; then
GENERATOR="Unix Makefiles"
fi
APT="apt-get install --yes --no-install-recommends -o Debug::pkgProblemResolver=yes"
{
echo "set -exu";
echo "export DEBIAN_FRONTEND=noninteractive";
echo "export DEBCONF_NONINTERACTIVE_SEEN=true";
echo "echo travis_fold:start:docker_setup";
echo "dpkg -l";
echo "cat /etc/apt/sources.list";
echo "apt-get update";
echo "apt-get dist-upgrade --yes";
echo "$APT equivs";
if [ "$DIST" != "trusty" ]; then
echo "$APT ninja-build";
fi
if [ -z "$CC" ]; then
echo "equivs-build doc/equivs/control.$DERIV.$DIST";
else
echo "equivs-build doc/equivs/control.$DERIV.$DIST.$CC";
fi
case "$DIST" in
trusty|jessie)
echo "dpkg --install --force-depends ./3dtk-build-deps_1.0_all.deb";
echo "$APT --fix-broken";
;;
*)
echo "$APT ./3dtk-build-deps_1.0_all.deb";
;;
esac
echo "echo travis_fold:end:docker_setup";
echo "mkdir .build";
echo "cmake -H. -B.build $CMAKEOPTS -G \"$GENERATOR\"";
echo "cmake --build .build";
echo "CTEST_OUTPUT_ON_FAILURE=true cmake --build .build --target test";
} | docker run --interactive --rm "$TAG" sh -