-
Notifications
You must be signed in to change notification settings - Fork 53
/
.travis.sh
executable file
·144 lines (130 loc) · 4.61 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/bin/sh
# This script only exists to support Travis CI. You should not be
# using this script.
export GCOV=gcov
CROSS_COMPILE=no
case "${CC}" in
"clang")
export CC=clang
export CXX=clang++
;;
"clang-"*)
export CC=clang-${CC#*-}
export CXX=clang++-${CC#*-}
;;
"gcc-"*)
export CC=gcc-${CC#*-}
export CXX=g++-${CC#*-}
export GCOV=gcov-${CC#*-}
;;
"x86_64-w64-mingw32-gcc")
export CC=x86_64-w64-mingw32-gcc
export CXX=x86_64-w64-mingw32-g++
export GCOV=x86_64-w64-mingw32-gcov
export RC_COMPILER=x86_64-w64-mingw32-windres
CROSS_COMPILE=yes
;;
"i686-w64-mingw32-gcc")
export CC=i686-w64-mingw32-gcc
export CXX=i686-w64-mingw32-g++
export GCOV=i686-w64-mingw32-gcov
export RC_COMPILER=i686-w64-mingw32-windres
CROSS_COMPILE=yes
;;
"icc")
# ICC doesn't work from pull requests because encrypted
# variables (which are used for the serial number) aren't
# available to pull requests, so unfortunately we need to skip
# it.
if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then
export CC=icc
export CXX=icpc
export GCOV=gcov
else
exit 0;
fi
;;
*)
CC="gcc"
export CC=gcc
export CXX=g++
export GCOV=gcov
;;
esac
if [ "${TRAVIS_BRANCH}" = "coverity" -a "${TRAVIS_OS_NAME}" = "linux" -a "${BUILD_TYPE}" = "debug" -a "${CC}" = "gcc-6" ]; then
BUILD_TYPE=coverity
COVERITY_SCAN_PROJECT_NAME="quixdb/squash"
COVERITY_TOOL_BASE="/tmp/coverity-scan-analysis"
fi
case "${1}" in
"configure")
COMMON_COMPILER_FLAGS="-Werror -fno-omit-frame-pointer -fstack-protector-all -D_FORTIFY_SOURCE=2"
case "${BUILD_TYPE}" in
"asan")
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} -DENABLE_SANITIZER=address"
;;
"tsan")
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} -DENABLE_SANITIZER=thread"
;;
"ubsan")
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} -DENABLE_SANITIZER=undefined"
;;
esac
CONFIGURE_FLAGS="-DFORCE_IN_TREE_DEPENDENCIES=yes"
if [ "${BUILD_TYPE}" = "release" ]; then
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} -DCMAKE_BUILD_TYPE=Release"
else
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} -DCMAKE_BUILD_TYPE=Debug"
fi
case "${BUILD_TYPE}" in
"coverage")
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} -DENABLE_COVERAGE=yes"
;;
"asan")
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} -DENABLE_DENSITY=no"
;;
esac
case "${CC}" in
"i686-w64-mingw32-gcc")
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} -DCMAKE_FIND_ROOT_PATH=/usr/i686-w64-mingw32"
;;
"x86_64-w64-mingw32-gcc")
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} -DCMAKE_FIND_ROOT_PATH=/usr/x86_64-w64-mingw32"
;;
esac
if [ "${CROSS_COMPILE}" = "yes" ]; then
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_SYSTEM_NAME=Windows -DDISABLE_UNIT_TESTS=yes -DENABLE_GIPFELI=no"
fi
case "${TRAVIS_OS_NAME}" in
"osx")
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} -DENABLE_MS_COMPRESS=no -DENABLE_NCOMPRESS=no -DENABLE_LZHAM=no"
# See https://github.com/ebiggers/libdeflate/issues/5#issuecomment-177718351
case "${CC}" in
"gcc-"*)
COMMON_COMPILER_FLAGS="${COMMON_COMPILER_FLAGS} -Wa,-q"
;;
esac
;;
esac
git submodule update --init --recursive
echo "cmake . ${CONFIGURE_FLAGS} -DCMAKE_C_FLAGS=\"${COMMON_COMPILER_FLAGS}\" -DCMAKE_CXX_FLAGS=\"${COMMON_COMPILER_FLAGS}\""
cmake . ${CONFIGURE_FLAGS} -DCMAKE_C_FLAGS="${COMMON_COMPILER_FLAGS}" -DCMAKE_CXX_FLAGS="${COMMON_COMPILER_FLAGS}"
;;
"make")
make VERBOSE=1
;;
"test")
if [ "x${CROSS_COMPILE}" != "xyes" ]; then
./tests/test-squash || exit 1
fi
case "${BUILD_TYPE}" in
"coverage")
coveralls --gcov "${GCOV}" -e CMakeFiles -e plugins -e examples -e tests -e squash/tinycthread
;;
esac
;;
*)
echo "Unknown step."
exit 1
;;
esac