aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/jenkins_common.sh
blob: 085ca1e45d0d42a019f7be961d9b4591ca48a608 (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
#!/bin/sh

# this is a common helper script that is shared among all BTS model
# specific helper scripts like jenkins_sysmobts.sh.  You shouldn't call
# this directly, but rather indirectly via the bts-specific scripts

if ! [ -x "$(command -v osmo-deps.sh)" ]; then
	echo "Error: We need to have scripts/osmo-deps.sh from http://git.osmocom.org/osmo-ci/ in PATH !"
	exit 2
fi

set -ex

base="$PWD"
deps="$base/deps"
inst="$deps/install"

export deps inst

osmo-clean-workspace.sh

mkdir -p "$deps"

verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]")

# generic project build function, usage:
# build "PROJECT-NAME" "CONFIGURE OPTIONS"
build_bts() {
    set +x
    echo
    echo
    echo
    echo " =============================== $1 ==============================="
    echo
    set -x

    cd $deps
    osmo-deps.sh libosmocore
    cd $base
    shift

    # Manuals: build
    conf_flags="$*"
    if [ "$WITH_MANUALS" = "1" ]; then
        conf_flags="$conf_flags --enable-manuals"
        osmo-build-dep.sh osmo-gsm-manuals
        export PATH="$inst/bin:$PATH"
    fi

    autoreconf --install --force
    ./configure $conf_flags
    $MAKE $PARALLEL_MAKE
    $MAKE check || cat-testlogs.sh
    DISTCHECK_CONFIGURE_FLAGS="$conf_flags" $MAKE $PARALLEL_MAKE distcheck || cat-testlogs.sh

    # Manuals: publish
    if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then
        $MAKE -C "$base/doc/manuals" publish
    fi

    $MAKE $PARALLEL_MAKE maintainer-clean
}