summaryrefslogtreecommitdiff
path: root/etc/hstdp-2018.3a/tasks/001-packages.sh
blob: e948120d54e830b3be9abdaacbe01130c49e1744 (plain) (blame)
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
#!/bin/bash
set -e
set -x

prefix="${TOOLCHAIN}"
sysconfdir="${TOOLCHAIN_BUILD}/etc/${PIPELINE}"
reqdir=${sysconfdir}/pkgs
blddir=builds

export PATH="${prefix}/bin:${PATH}"
export CFLAGS="-I${prefix}/include"
export LDFLAGS="-L${prefix}/lib -Wl,-rpath=${prefix}/lib"
export PREFIX="${prefix}"

function pre()
{
    if [[ ! -d ${reqdir} ]]; then
        # Nothing there, but maybe that's on purpose.
        exit 0
    fi
    mkdir -p "${blddir}"
    pushd ${blddir} &>/dev/null
}

function build()
{
    pre
    # Iterate over binary package build scripts
    for req in ${reqdir}/*
    do
        chmod +x "${req}"
        "${req}"
    done
    post
}

function post()
{
    popd &>/dev/null
    [[ -d ${blddir} ]] && rm -rf "${blddir}"
}

build