-
Notifications
You must be signed in to change notification settings - Fork 93
/
task.yaml
98 lines (76 loc) · 3.03 KB
/
task.yaml
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
environment:
DEB_BUILD_OPTIONS: "parallel=$( nproc ) noopt ${NOCHECK}"
NO_PKG_MANGLE: 1
systems: [ubuntu-*]
variants:
- -ubuntu*
- -debian*
summary: Build Ubuntu packages
execute: |
cd $SPREAD_PATH
apt-get install --yes software-properties-common
# Add Mir dev PPA for any out-of-archive packages needed
# (Currently: a newer version of WLCS)
add-apt-repository ppa:mir-team/dev
# to get dpkg-architecture and mk-build-deps
apt-get install \
--yes \
--no-install-recommends \
ccache \
devscripts \
dpkg-dev \
equivs
# set host and build environment up
source <( dpkg-architecture --print-set --host-arch ${ARCH} )
# if cross-building
if [ "${DEB_BUILD_ARCH}" != "${DEB_HOST_ARCH}" ]; then
# add host architecture
dpkg --add-architecture "${DEB_HOST_ARCH}"
# don't run tests
DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS} nocheck"
# limit existing apt sources to build architecture
sed -i "s/^deb \(\[arch=.*\] \)\?/deb [arch=${DEB_BUILD_ARCH}] /" \
/etc/apt/sources.list
case "${DEB_HOST_ARCH}" in
amd64|i386)
ARCHIVE_URL="http://archive.ubuntu.com/ubuntu"
;;
*)
ARCHIVE_URL="http://ports.ubuntu.com/ubuntu-ports"
;;
esac
# add host architecture apt sources
printf "deb [arch=${DEB_HOST_ARCH}] ${ARCHIVE_URL} \
%s main multiverse universe restricted\n" \
$(lsb_release -sc){,-security,-updates} \
> /etc/apt/sources.list.d/cross-${DEB_HOST_ARCH}.list
apt-get update
apt-get --yes install qemu-user-static binfmt-support
# Quirk for the eglexternalplatform-dev build dependency
sed -i 's/\(eglexternalplatform-dev\)/\1:all/' debian/control
fi
# Mark the "release" in the changelog
debchange --release "CI release"
# install dependencies
mk-build-deps \
--install \
--tool "apt-get --yes -o Debug::pkgProblemResolver=yes -o APT::Immediate-Configure=0"
# use clang
if [ "${CLANG}" -eq 1 ]; then
apt-get install --yes --no-install-recommends clang
echo "OVERRIDE_CONFIGURE_OPTIONS += -DCMAKE_C_COMPILER=clang" >> debian/opts.mk
echo "OVERRIDE_CONFIGURE_OPTIONS += -DCMAKE_CXX_COMPILER=clang++" >> debian/opts.mk
echo "OVERRIDE_CONFIGURE_OPTIONS += -DCMAKE_CXX_FLAGS=-fpch-validate-input-files-content" >> debian/opts.mk
fi
# enable valgrind
if [ "${VALGRIND}" -eq 1 ]; then
echo "OVERRIDE_CONFIGURE_OPTIONS += -DENABLE_MEMCHECK_OPTION=ON" >> debian/opts.mk
fi
# change the build type
echo "OVERRIDE_CONFIGURE_OPTIONS += -DCMAKE_BUILD_TYPE=${BUILD_TYPE}" >> debian/opts.mk
# use ccache
echo "OVERRIDE_CONFIGURE_OPTIONS += -DCMAKE_C_COMPILER_LAUNCHER=ccache" >> debian/opts.mk
echo "OVERRIDE_CONFIGURE_OPTIONS += -DCMAKE_CXX_COMPILER_LAUNCHER=ccache" >> debian/opts.mk
# build and run tests
debian/rules build
ccache --show-stats --zero-stats > ${CCACHE_DIR}/ccache.stats