1 # Travis CI configuration file
8 # Set to 10 instead of 1 to avoid problems when the most recent commits have [skip ci]
11 # Install autopoint on Ubuntu (needed for gettext)
12 # This is ignored on bionic for some reason (see below).
19 # More configurations are configured in the matrix section
38 - env: CONFIG=normal DIST=bionic
42 - env: CONFIG=normal DIST=bionic
46 - env: CONFIG=clang6 DIST=xenial
55 - env: CONFIG=clang8 DIST=xenial
62 - llvm-toolchain-trusty-8
66 - env: CONFIG=clang9 DIST=xenial
74 - deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main
76 - https://apt.llvm.org/llvm-snapshot.gpg.key
80 - env: CONFIG=clang10 DIST=xenial
88 - deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main
90 - https://apt.llvm.org/llvm-snapshot.gpg.key
94 - env: CONFIG=gcc8 DIST=xenial
102 - ppa:ubuntu-toolchain-r/test
106 - env: CONFIG=gcc9 DIST=xenial
114 - ppa:ubuntu-toolchain-r/test
118 - env: CONFIG=arm-cross DIST=xenial
126 - gcc-4.8-arm-linux-gnueabihf
127 - libc6-dev-armhf-cross
128 - env: CONFIG=musl DIST=xenial
137 - env: CONFIG=sanitize DIST=xenial
145 - deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main
147 - https://apt.llvm.org/llvm-snapshot.gpg.key
152 # Required for -fsanitize=undefined
153 # see https://github.com/travis-ci/travis-ci/issues/9033
155 - env: CONFIG=coverage DIST=xenial
168 - env: CONFIG=normal DIST=bionic
173 - env: CONFIG=normal DIST=bionic
180 # The apt addons section is ignored on bionic for some reason
181 - if [ "$DIST" = "bionic" ] ; then sudo apt-get install -y autopoint gettext libtool; fi
185 if [ "$CONFIG" = "coverage" ] ; then
187 pip install --user cpp-coveralls
189 git clone --depth=1 https://github.com/libexif/libexif-testsuite.git
192 ln -s "$TRAVIS_BUILD_DIR" src/libexif
196 # Failmalloc for improved test coverage
197 if [ ! -e "$HOME/failmalloc/lib/libfailmalloc.so.0" ] ; then
198 curl -fsSORL --retry 8 https://download.savannah.nongnu.org/releases/failmalloc/failmalloc-1.0.tar.gz
199 tar xaf failmalloc-1.0.tar.gz
201 # Fix compiling with modern glibc
202 sed -i -e 's/\(__malloc_initialize_hook\)/volatile \1/' failmalloc.c
203 # Disable failmalloc on program exit so system code can run unimpeded
204 sed -i -e '/failmalloc_init/,${/failmalloc_install/aatexit(failmalloc_uninstall);
206 ./configure --prefix="$HOME/failmalloc" --disable-dependency-tracking
210 cd "$TRAVIS_BUILD_DIR"
214 # Ensure brew gettext is in the PATH so autopoint is found on OS X
215 - PATH="$PATH:/usr/local/opt/gettext/bin" autoreconf -sivf
216 - if [ "$CONFIG" = "normal" ] ; then CFLAGS='-Wall -Wextra -O3'; fi
217 - if [ "$CONFIG" = "c90" ] ; then CFLAGS='-std=iso9899:1990 -D_XOPEN_SOURCE=500 -Wall -Wextra -O3'; fi
218 - if [ "$CONFIG" = "stackprotect" ] ; then CFLAGS='-g -O0 -fstack-protector-all'; fi
219 - if [ "$CONFIG" = "disable-nls" ] ; then CFLAGS='-Wall -Wextra -O3'; CONFIGURE_OPTS='--disable-nls'; fi
220 - if [ "$CONFIG" = "clang6" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=clang-6.0; fi
221 - if [ "$CONFIG" = "clang8" ] ; then CFLAGS='-Wall -Wextra -Wno-error=switch -O3'; MAKE_OPTS="CFLAGS+=-Werror CFLAGS+=${CFLAGS// / CFLAGS+=}"; export CC=clang-8; fi
222 - if [ "$CONFIG" = "clang9" ] ; then CFLAGS='-Wall -Wextra -Wno-error=switch -O3'; MAKE_OPTS="CFLAGS+=-Werror CFLAGS+=${CFLAGS// / CFLAGS+=}"; export CC=clang-9; fi
223 - if [ "$CONFIG" = "clang10" ] ; then CFLAGS='-Wall -Wextra -Wno-error=switch -O3'; MAKE_OPTS="CFLAGS+=-Werror CFLAGS+=${CFLAGS// / CFLAGS+=}"; export CC=clang-10; fi
224 - if [ "$CONFIG" = "gcc8" ] ; then CFLAGS='-Wall -Wextra -Wno-error=switch -Wno-error=implicit-fallthrough -O3'; MAKE_OPTS="CFLAGS+=-Werror CFLAGS+=${CFLAGS// / CFLAGS+=}"; export CC=gcc-8; fi
225 - if [ "$CONFIG" = "gcc9" ] ; then CFLAGS='-Wall -Wextra -Wno-error=switch -Wno-error=implicit-fallthrough -O3'; MAKE_OPTS="CFLAGS+=-Werror CFLAGS+=${CFLAGS// / CFLAGS+=}"; export CC=gcc-9; fi
226 - if [ "$CONFIG" = "arm-cross" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=arm-linux-gnueabihf-gcc-4.8; CONFIGURE_OPTS='--host=arm-linux-gnueabihf'; fi
227 - if [ "$CONFIG" = "musl" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=musl-gcc; CONFIGURE_OPTS='--disable-shared'; fi
228 - if [ "$CONFIG" = "sanitize" ] ; then CFLAGS='-g -Wall -Wextra -fsanitize=address -fsanitize=undefined -fsanitize-address-use-after-scope'; export CC=clang-10; export ASAN_OPTIONS=strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1:detect_leaks=1; fi
229 - if [ "$CONFIG" = "coverage" ] ; then cd "$HOME"/libexif-testsuite; CFLAGS=--coverage; CONFIGURE_OPTS="LDFLAGS=--coverage --with-failmalloc=$HOME/failmalloc/lib"; fi
230 - ./configure --prefix="$HOME"/install --disable-dependency-tracking CFLAGS="$CFLAGS" $CONFIGURE_OPTS || { tail -n 300 config.log; false; }
232 - make V=1 $MAKE_OPTS
233 # Skip tests when cross compiling.
234 - if [ "$CONFIG" != "arm-cross" ] ; then make V=1 $MAKE_OPTS check || { tail -n 300 test*/test-suite.log src/libexif/test*/test-suite.log; false; }; fi
235 - make V=1 $MAKE_OPTS install
237 - if [ "$CONFIG" = "coverage" ] ; then cd "$TRAVIS_BUILD_DIR"; fi
240 - if [ "$CONFIG" = "coverage" ] ; then coveralls --build-root libexif --exclude test --exclude contrib --gcov-options '\-lp'; fi