summaryrefslogtreecommitdiff
path: root/.travis/autotools-linux
blob: 96c110ab5d2391fba457abeb06cce636b4c5f777 (plain)
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
#!/bin/sh

ACTION="$1"

set -eu

CACHEDIR="$HOME/cache"
NPROC=`nproc`

travis_install() {
  # Install vanilla NaCl only.
  [ -f "$CACHEDIR/lib/amd64/libnacl.a" ] || {
    curl https://hyperelliptic.org/nacl/nacl-20110221.tar.bz2 | tar jx
    cd nacl-20110221  # pushd
    "./do"
    # "make install"
    mkdir -p "$CACHEDIR/include"; mv build/*/include/* "$CACHEDIR/include"
    mkdir -p "$CACHEDIR/lib"    ; mv build/*/lib/* "$CACHEDIR/lib"
    cd -  # popd
  }
}

travis_script() {
  . ".travis/flags-$CC.sh"

  add_ld_flag -Wl,-z,defs

  # Make compilation error on a warning
  add_flag -Werror

  add_config_flag --with-nacl-libs="$CACHEDIR/lib/amd64"
  add_config_flag --with-nacl-headers="$CACHEDIR/include/amd64"
  add_config_flag --disable-ipv6
  add_config_flag --enable-nacl
  add_config_flag --enable-daemon
  add_config_flag --enable-logging
  add_config_flag --with-log-level=TRACE

  autoreconf -fi
  mkdir -p _build
  cd _build  # pushd
  ../configure $CONFIG_FLAGS || (cat config.log && false)
  make "-j$NPROC" -k CFLAGS="$C_FLAGS" LDFLAGS="$LD_FLAGS"
  make -j50 -k distcheck DISTCHECK_CONFIGURE_FLAGS="$CONFIG_FLAGS" || (cat tox-*/_build/build/test-suite.log && false)
  cd -  # popd
}

if [ "-z" "$ACTION" ]; then
  "travis_script"
else
  "travis_$ACTION"
fi