-
Notifications
You must be signed in to change notification settings - Fork 21
/
travis.sh
executable file
·121 lines (103 loc) · 2.82 KB
/
travis.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
119
120
121
#!/bin/sh
set -ex
linux_32_before_install() {
# Build worker is 64-bit only by default it seems.
sudo dpkg --add-architecture i386
# explicitly pull the key
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 762E3157
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
# Compilers
if [ "${CXX}" = "g++" ]; then
COMPILER_PACKAGE="g++-${VERSION}-multilib"
fi
# apt-get update fails because Chrome is 64-bit only.
sudo rm -f /etc/apt/sources.list.d/google-chrome.list
sudo apt-get -qq update
# The 64-bit versions of the first 7 dependencies are part of the initial
# build image. libgtk2.0-dev:i386 requires the 32-bit versions of
# the dependencies, and the 2 versions conflict. So those
# dependencies must be explicitly installed.
sudo apt-get -y install \
gir1.2-freedesktop:i386 \
gir1.2-gdkpixbuf-2.0:i386 \
gir1.2-glib-2.0:i386 \
libcairo2-dev:i386 \
libfontconfig1-dev:i386 \
libfreetype6-dev:i386 \
libpng-dev:i386 \
libgdk-pixbuf2.0-dev:i386 \
libpng12-dev:i386 \
libgirepository-1.0-1:i386 \
libglib2.0-dev:i386 \
libgtk2.0-dev:i386 \
libpango1.0-dev:i386 \
libxft-dev:i386 \
libpulse-dev:i386 \
git-buildpackage \
python-dateutil \
python-pkg-resources \
dh-make \
build-essential \
fakeroot \
${COMPILER_PACKAGE}
}
linux_32_script() {
# TODO where are they?
BUILD_TMP=$(mktemp -d)
for i in objcopy strip objdump; do
ln -sv /usr/bin/$i ${BUILD_TMP}/i686-linux-gnu-$i
done
export PATH="${BUILD_TMP}:${PATH}"
export CC=${CC}-${VERSION} CXX=${CXX}-${VERSION}
if [ "x${TRAVIS_TAG}" != "x" ]; then
# generate changelog since last time it was touched
git checkout -b master
gbp dch --spawn-editor=never -R -U low -a --upstream-tag=${TRAVIS_TAG} -N ${TRAVIS_TAG}
fi
dpkg-buildpackage -d -b -us -uc -ai386
}
linux_64_before_install() {
# Compilers
if [ "${CXX}" = "g++" ]; then
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
COMPILER_PACKAGE="g++-${VERSION}"
fi
sudo apt-get -qq update
sudo apt-get -y install \
libgtk2.0-dev \
libpulse-dev \
${COMPILER_PACKAGE}
}
linux_64_script() {
mkdir build
cd build
# Prevents warning spam
export CC=${CC}-${VERSION} CXX=${CXX}-${VERSION}
cmake \
-DCMAKE_BUILD_TYPE=Release \
..
# Documentation says 1.5 cores, so 2 or 3 threads should work ok.
make -j3 install
}
linux_after_success() {
for file in ../*.deb; do
mv -v "${file}" "${file%%.deb}-${CC}-${VERSION}-${TARGET_DISTRIB}.deb"
done
ccache -s
}
# Just in case I do manual testing and accidentally insert "rm -rf /"
# Run manually with:
# TARGET_DISTRIB=[ubuntu|debian] TRAVIS_OS_NAME=linux BITS=32 VERSION=8 CC=gcc CXX=g++ ./travis.sh [before_script | script]
case "${1}" in
before_install|script)
${TRAVIS_OS_NAME}_${BITS}_${1}
;;
before_script)
;;
after_success)
${TRAVIS_OS_NAME}_${1}
;;
*)
echo "Unknown command" && false
;;
esac