summaryrefslogtreecommitdiff
path: root/build/gitlab-ci
blob: 1280f2c4de25db2093a97bc67abce5ff76af57de (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
#!/bin/sh
# This script is used for testing the build, primarily for use
# with travis, but may be used by hand as well.

set -e
set -x

# Test autoconf build
autoconf_build()
{
    autoreconf -ivf

    mkdir autoconf-build
    cd autoconf-build
    echo "Running ../configure --prefix=$(pwd)/../autoconf-install) ${opts}"
    ../configure --prefix=$(pwd)/../autoconf-install ${opts}
    make
    make install
    make check
    make distcheck
}

# Test cmake build
cmake_build()
{
    PATH="$(pwd)/tools/bin:$PATH"
    if [ "$(uname -s)" = "Darwin" ]; then
        PATH="$(pwd)/tools/CMake.app/Contents/bin:$PATH"
    fi
    mkdir cmake-build
    cd cmake-build
    opts="-Dfatal-warnings=ON"
    echo "Running cmake -G "$1" -DCMAKE_BUILD_TYPE="$2" -DCMAKE_INSTALL_PREFIX=../cmake-install ${opts} .."
    cmake -G "$1" -DCMAKE_BUILD_TYPE="$2" -DCMAKE_INSTALL_PREFIX=../cmake-install ${opts} ..
    cmake --build .
    cmake --build . --target install
    ctest -V
}

build=$1
shift

case $build in
    autoconf)
        echo "Testing Autoconf build"
        autoconf_build "$@"
        ;;
    cmake)
        echo "Testing CMake build"
        cmake_build "$@"
        ;;
    *)
        echo "Invalid argument: \"$arg\"" >&2
        exit 1
        ;;
esac

exit 0