3 # Copyright © 2015-2016 Collabora Ltd.
5 # Permission is hereby granted, free of charge, to any person
6 # obtaining a copy of this software and associated documentation files
7 # (the "Software"), to deal in the Software without restriction,
8 # including without limitation the rights to use, copy, modify, merge,
9 # publish, distribute, sublicense, and/or sell copies of the Software,
10 # and to permit persons to whom the Software is furnished to do so,
11 # subject to the following conditions:
13 # The above copyright notice and this permission notice shall be
14 # included in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 # OS distribution in which we are testing
32 # Typical values: ubuntu, debian; maybe fedora in future
33 : "${ci_distro:=ubuntu}"
36 # If non-empty, this is the name of a Docker image. ci-install.sh will
37 # fetch it with "docker pull" and use it as a base for a new Docker image
38 # named "ci-image" in which we will do our testing.
42 # Either "native", or an Autoconf --host argument to cross-compile
44 : "${ci_host:=native}"
47 # Used internally by ci-install.sh. If yes, we are inside the Docker image
48 # (ci_docker is empty in this case).
49 : "${ci_in_docker:=no}"
52 # OS suite (release, branch) in which we are testing.
53 # Typical values for ci_distro=debian: sid, jessie
54 # Typical values for ci_distro=fedora might be 25, rawhide
55 : "${ci_suite:=xenial}"
58 # One of debug, reduced, legacy, production
59 : "${ci_variant:=production}"
61 if [ $(id -u) = 0 ]; then
67 if [ -n "$ci_docker" ]; then
69 -e "s/@ci_distro@/${ci_distro}/" \
70 -e "s/@ci_docker@/${ci_docker}/" \
71 -e "s/@ci_suite@/${ci_suite}/" \
72 < tools/ci-Dockerfile.in > Dockerfile
73 exec docker build -t ci-image .
78 # Don't ask questions, just do it
79 sudo="$sudo env DEBIAN_FRONTEND=noninteractive"
81 # Debian Docker images use httpredir.debian.org but it seems to be
82 # unreliable; use a CDN instead
83 $sudo sed -i -e 's/httpredir\.debian\.org/deb.debian.org/g' \
88 # Ubuntu 16.04 didn't have the wine32, wine64 packages
100 # Ubuntu 14.04 didn't have the wine32, wine64 packages
112 $sudo dpkg --add-architecture i386
115 # assume the host or container is x86_64 already
119 $sudo apt-get -qq -y update
126 binutils-mingw-w64-i686
134 binutils-mingw-w64-x86-64
141 if [ "$ci_host/$ci_variant/$ci_suite" = "native/production/buster" ]; then
166 gnome-desktop-testing
189 # Debian 9 'stretch' didn't have the ducktype package
193 # assume Ubuntu 18.04 'bionic', Debian 10 'buster' or newer
201 $sudo apt-get -qq -y --no-install-recommends install "${packages[@]}"
203 if [ "$ci_in_docker" = yes ]; then
204 # Add the user that we will use to do the build inside the
205 # Docker container, and let them use sudo
206 adduser --disabled-password --gecos "" user
207 echo "user ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/nopasswd
208 chmod 0440 /etc/sudoers.d/nopasswd
211 # manual package setup
214 # autoconf-archive in Debian 8 and Ubuntu 16.04 is too old,
215 # use the one from Debian 9 instead
216 wget http://deb.debian.org/debian/pool/main/a/autoconf-archive/autoconf-archive_20160916-1_all.deb
217 $sudo dpkg -i autoconf-archive_*_all.deb
218 rm autoconf-archive_*_all.deb
224 mirror=http://repo.msys2.org/mingw/${ci_host%%-*}
225 if [ "${ci_host%%-*}" = i686 ]; then
226 mingw="$(pwd)/mingw32"
228 mingw="$(pwd)/mingw64"
230 install -d "${mingw}"
240 libwinpthread-git-8.0.0.5814.9dbf4cc1-1 \
244 wget ${mirror}/mingw-w64-${ci_host%%-*}-${pkg}-any.pkg.tar.xz
245 tar -xvf mingw-w64-${ci_host%%-*}-${pkg}-any.pkg.tar.xz
248 # limit access rights
249 if [ "$ci_in_docker" = yes ]; then
250 chown -R user "${mingw}"
255 # Make sure we have a messagebus user, even if the dbus package
257 $sudo adduser --system --quiet --home /nonexistent --no-create-home \
258 --disabled-password --group messagebus
262 echo "Don't know how to set up ${ci_distro}" >&2
267 # vim:set sw=4 sts=4 et: