summaryrefslogtreecommitdiff
path: root/.travis/build.sh
blob: 3872893b87e64bc2459635c58aaa33c1be3ee9cc (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
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash

set -o errexit

KERNELSRC=""
CFLAGS="-Werror"

function install_kernel()
{
    wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.16.2.tar.gz
    tar xzvf linux-3.16.2.tar.gz > /dev/null
    cd linux-3.16.2
    make allmodconfig
    make net/openvswitch/
    KERNELSRC=$(pwd)
    echo "Installed kernel source in $(pwd)"
    cd ..
}

function install_dpdk()
{
    wget http://www.dpdk.org/browse/dpdk/snapshot/dpdk-1.7.0.tar.gz
    tar xzvf dpdk-1.7.0.tar.gz > /dev/null
    cd dpdk-1.7.0
    find ./ -type f | xargs sed -i 's/max-inline-insns-single=100/max-inline-insns-single=400/'
    sed -ri 's,(CONFIG_RTE_BUILD_COMBINE_LIBS=).*,\1y,' config/common_linuxapp
    make config CC=gcc T=x86_64-native-linuxapp-gcc
    make CC=gcc RTE_KERNELDIR=$KERNELSRC
    echo "Installed DPDK source in $(pwd)"
    cd ..
}

function configure_ovs()
{
    ./boot.sh && ./configure $*
}

if [ "$KERNEL" ] || [ "$DPDK" ]; then
    install_kernel
fi

[ "$DPDK" ] && {
    install_dpdk
    # Disregard bad function cassts until DPDK is fixed
    CFLAGS="$CFLAGS -Wno-error=bad-function-cast -Wno-error=cast-align"
}

configure_ovs $*


if [ $CC = "clang" ]; then
    make CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument"
else
    make CFLAGS="$CFLAGS" C=1
fi

if [ $TESTSUITE ]; then
    if ! make distcheck; then
        # testsuite.log is necessary for debugging.
        cat */_build/tests/testsuite.log
        exit 1
    fi
fi

exit 0