Added a Travis build with --disable-nls
[platform/upstream/libexif.git] / .travis.yml
1 # Travis CI configuration file
2
3 sudo: false
4
5 language: c
6
7 git:
8   depth: 1
9
10 # Install autopoint on Ubuntu (needed for gettext)
11 addons:
12   apt:
13     packages:
14     - autopoint
15
16 env:
17   # More configurations are configured in the matrix section
18   matrix:
19     - CONFIG=normal
20     - CONFIG=c90
21     - CONFIG=stackprotect
22     - CONFIG=disable-nls
23   global:
24     - MAKEFLAGS='-j 2'
25
26 compiler:
27   - clang
28   - gcc
29
30 os:
31   - linux
32   - osx
33
34 matrix:
35   include:
36   - env: CONFIG=clang6
37     os: linux
38     compiler: clang
39     addons:
40       apt:
41         sources:
42           - llvm-toolchain-trusty-6.0
43           - ubuntu-toolchain-r-test
44         packages:
45           - autopoint
46           - clang-6.0
47   - env: CONFIG=clang7
48     os: linux
49     compiler: clang
50     addons:
51       apt:
52         sources:
53           - llvm-toolchain-trusty-7
54           - ubuntu-toolchain-r-test
55         packages:
56           - autopoint
57           - clang-7
58   - env: CONFIG=gcc8
59     os: linux
60     compiler: gcc
61     addons:
62       apt:
63         sources:
64           - ubuntu-toolchain-r-test
65         packages:
66           - autopoint
67           - g++-8
68   - env: CONFIG=arm-cross
69     os: linux
70     compiler: gcc
71     addons:
72       apt:
73         packages:
74           - autopoint
75           - gcc-4.8-arm-linux-gnueabihf
76           - libc6-dev-armhf-cross
77   - env: CONFIG=musl
78     os: linux
79     compiler: gcc
80     addons:
81       apt:
82         packages:
83           - autopoint
84           - musl-tools
85   - env: CONFIG=sanitize
86     os: linux
87     compiler: clang
88     addons:
89       apt:
90         sources:
91           - llvm-toolchain-trusty-7
92           - ubuntu-toolchain-r-test
93         packages:
94           - autopoint
95           - clang-7
96           - libtool
97     # Required for -fsanitize=undefined
98     # see https://github.com/travis-ci/travis-ci/issues/9033
99     sudo: required
100   - env: CONFIG=coverage
101     os: linux
102     compiler: gcc
103     addons:
104       apt:
105         packages:
106           - autopoint
107           - libpopt-dev
108           - subversion
109     cache:
110       directories:
111         - $HOME/failmalloc
112
113 install:
114   - |
115     if [ "$CONFIG" = "coverage" ] ; then
116       set -e
117       pip install --user cpp-coveralls
118       cd "$HOME"
119       git clone --depth=1 https://github.com/libexif/libexif-testsuite.git
120       cd libexif-testsuite
121       mkdir src
122       ln -s "$TRAVIS_BUILD_DIR" src/libexif
123       ./build-config.sh
124       autoreconf -sivf
125       cd "$HOME"
126       # Failmalloc for improved test coverage
127       if [ ! -e "$HOME/failmalloc/lib/libfailmalloc.so.0" ] ; then
128         curl -fsSORL --retry 8 https://download.savannah.nongnu.org/releases/failmalloc/failmalloc-1.0.tar.gz
129         tar xaf failmalloc-1.0.tar.gz
130         cd failmalloc-1.0
131         sed -i -e 's/\(__malloc_initialize_hook\)/volatile \1/' failmalloc.c
132         ./configure --prefix="$HOME/failmalloc" --disable-dependency-tracking
133         make
134         make install
135       fi
136       cd "$TRAVIS_BUILD_DIR"
137     fi
138
139 script:
140   # Ensure brew gettext is in the PATH so autopoint is found on OS X
141   - PATH="$PATH:/usr/local/opt/gettext/bin" autoreconf -sivf
142   - if [ "$CONFIG" = "normal" ] ; then CFLAGS='-Wall -Wextra -O3'; fi
143   - if [ "$CONFIG" = "c90" ] ; then CFLAGS='-std=iso9899:1990 -D_XOPEN_SOURCE=500 -Wall -Wextra -O3'; fi
144   - if [ "$CONFIG" = "stackprotect" ] ; then CFLAGS='-g -O0 -fstack-protector-all'; fi
145   - if [ "$CONFIG" = "disable-nls" ] ; then CFLAGS='-Wall -Wextra -O3'; CONFIGURE_OPTS='--disable-nls'; fi
146   - if [ "$CONFIG" = "clang6" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=clang-6.0; fi
147   - if [ "$CONFIG" = "clang7" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=clang-7; fi
148   - if [ "$CONFIG" = "gcc8" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=gcc-8; fi
149   - if [ "$CONFIG" = "arm-cross" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=arm-linux-gnueabihf-gcc-4.8; CONFIGURE_OPTS='--host=arm-linux-gnueabihf'; fi
150   - if [ "$CONFIG" = "musl" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=musl-gcc; CONFIGURE_OPTS='--disable-shared'; fi
151   - if [ "$CONFIG" = "sanitize" ] ; then CFLAGS='-g -Wall -Wextra -fsanitize=address -fsanitize=undefined -fsanitize-address-use-after-scope'; export CC=clang-7; export ASAN_OPTIONS=strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1; fi
152   - if [ "$CONFIG" = "coverage" ] ; then cd "$HOME"/libexif-testsuite; CFLAGS=--coverage; CONFIGURE_OPTS="LDFLAGS=--coverage --with-failmalloc=$HOME/failmalloc/lib" ; fi
153   - ./configure --prefix="${HOME}"/install --disable-dependency-tracking CFLAGS="$CFLAGS" $CONFIGURE_OPTS || { tail -300 config.log; false; }
154
155   - make V=1
156   # Skip tests when cross compiling.
157   - if [ "$CONFIG" != "arm-cross" ] ; then make V=1 check || { tail -300 test*/test-suite.log; false; }; fi
158   - make V=1 install
159
160   - if [ "$CONFIG" = "coverage" ] ; then cd "$TRAVIS_BUILD_DIR"; fi
161
162 after_success:
163   - if [ "$CONFIG" = "coverage" ] ; then coveralls --build-root libexif --exclude test --exclude contrib --gcov-options '\-lp'; fi