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
63 - ubuntu-toolchain-r-test
67 - env: CONFIG=clang9 DIST=xenial
75 - deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main
77 - https://apt.llvm.org/llvm-snapshot.gpg.key
81 - env: CONFIG=clang10 DIST=xenial
89 - deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main
91 - https://apt.llvm.org/llvm-snapshot.gpg.key
95 - env: CONFIG=gcc8 DIST=xenial
102 - ubuntu-toolchain-r-test
106 - env: CONFIG=gcc9 DIST=xenial
113 - ubuntu-toolchain-r-test
117 - env: CONFIG=arm-cross DIST=xenial
125 - gcc-4.8-arm-linux-gnueabihf
126 - libc6-dev-armhf-cross
127 - env: CONFIG=musl DIST=xenial
136 - env: CONFIG=sanitize DIST=xenial
144 - deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main
146 - https://apt.llvm.org/llvm-snapshot.gpg.key
151 # Required for -fsanitize=undefined
152 # see https://github.com/travis-ci/travis-ci/issues/9033
154 - env: CONFIG=coverage DIST=xenial
167 - env: CONFIG=normal DIST=bionic
172 - env: CONFIG=normal DIST=bionic
179 # The apt addons section is ignored on bionic for some reason
180 - if [ "$DIST" = "bionic" ] ; then sudo apt-get install -y autopoint gettext libtool; fi
184 if [ "$CONFIG" = "coverage" ] ; then
186 pip install --user cpp-coveralls
188 git clone --depth=1 https://github.com/libexif/libexif-testsuite.git
191 ln -s "$TRAVIS_BUILD_DIR" src/libexif
195 # Failmalloc for improved test coverage
196 if [ ! -e "$HOME/failmalloc/lib/libfailmalloc.so.0" ] ; then
197 curl -fsSORL --retry 8 https://download.savannah.nongnu.org/releases/failmalloc/failmalloc-1.0.tar.gz
198 tar xaf failmalloc-1.0.tar.gz
200 # Fix compiling with modern glibc
201 sed -i -e 's/\(__malloc_initialize_hook\)/volatile \1/' failmalloc.c
202 # Disable failmalloc on program exit so system code can run unimpeded
203 sed -i -e '/failmalloc_init/,${/failmalloc_install/aatexit(failmalloc_uninstall);
205 ./configure --prefix="$HOME/failmalloc" --disable-dependency-tracking
209 cd "$TRAVIS_BUILD_DIR"
213 # Ensure brew gettext is in the PATH so autopoint is found on OS X
214 - PATH="$PATH:/usr/local/opt/gettext/bin" autoreconf -sivf
215 - if [ "$CONFIG" = "normal" ] ; then CFLAGS='-Wall -Wextra -O3'; fi
216 - if [ "$CONFIG" = "c90" ] ; then CFLAGS='-std=iso9899:1990 -D_XOPEN_SOURCE=500 -Wall -Wextra -O3'; fi
217 - if [ "$CONFIG" = "stackprotect" ] ; then CFLAGS='-g -O0 -fstack-protector-all'; fi
218 - if [ "$CONFIG" = "disable-nls" ] ; then CFLAGS='-Wall -Wextra -O3'; CONFIGURE_OPTS='--disable-nls'; fi
219 - if [ "$CONFIG" = "clang6" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=clang-6.0; fi
220 - if [ "$CONFIG" = "clang8" ] ; then CFLAGS='-Wall -Wextra -Wno-error=switch -O3'; MAKE_OPTS="CFLAGS+=-Werror CFLAGS+=${CFLAGS// / CFLAGS+=}"; export CC=clang-8; fi
221 - if [ "$CONFIG" = "clang9" ] ; then CFLAGS='-Wall -Wextra -Wno-error=switch -O3'; MAKE_OPTS="CFLAGS+=-Werror CFLAGS+=${CFLAGS// / CFLAGS+=}"; export CC=clang-9; fi
222 - if [ "$CONFIG" = "clang10" ] ; then CFLAGS='-Wall -Wextra -Wno-error=switch -O3'; MAKE_OPTS="CFLAGS+=-Werror CFLAGS+=${CFLAGS// / CFLAGS+=}"; export CC=clang-10; fi
223 - 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
224 - 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
225 - if [ "$CONFIG" = "arm-cross" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=arm-linux-gnueabihf-gcc-4.8; CONFIGURE_OPTS='--host=arm-linux-gnueabihf'; fi
226 - if [ "$CONFIG" = "musl" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=musl-gcc; CONFIGURE_OPTS='--disable-shared'; fi
227 - 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
228 - if [ "$CONFIG" = "coverage" ] ; then cd "$HOME"/libexif-testsuite; CFLAGS=--coverage; CONFIGURE_OPTS="LDFLAGS=--coverage --with-failmalloc=$HOME/failmalloc/lib"; fi
229 - ./configure --prefix="$HOME"/install --disable-dependency-tracking CFLAGS="$CFLAGS" $CONFIGURE_OPTS || { tail -n 300 config.log; false; }
231 - make V=1 $MAKE_OPTS
232 # Skip tests when cross compiling.
233 - 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
234 - make V=1 $MAKE_OPTS install
236 - if [ "$CONFIG" = "coverage" ] ; then cd "$TRAVIS_BUILD_DIR"; fi
239 - if [ "$CONFIG" = "coverage" ] ; then coveralls --build-root libexif --exclude test --exclude contrib --gcov-options '\-lp'; fi