summaryrefslogtreecommitdiff
path: root/scripts/build/companion_tools/510-bison.sh
blob: 9379ea82ee3201dccc7916bcca463873f009760f (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
66
# Build script for bison

do_companion_tools_bison_get()
{
    CT_Fetch BISON
}

do_companion_tools_bison_extract()
{
    CT_ExtractPatch BISON
}

do_companion_tools_bison_for_build()
{
    CT_DoStep INFO "Installing bison for build"
    CT_mkdir_pushd "${CT_BUILD_DIR}/build-bison-build"
    do_bison_backend \
        host=${CT_BUILD} \
        prefix="${CT_BUILD_COMPTOOLS_DIR}" \
        cflags="${CT_CFLAGS_FOR_BUILD}" \
        ldflags="${CT_LDFLAGS_FOR_BUILD}"
    CT_Popd
    CT_EndStep
}

do_companion_tools_bison_for_host()
{
    CT_DoStep INFO "Installing bison for host"
    CT_mkdir_pushd "${CT_BUILD_DIR}/build-bison-host"
    do_bison_backend \
        host=${CT_HOST} \
        prefix="${CT_PREFIX_DIR}" \
        cflags="${CT_CFLAGS_FOR_HOST}" \
        ldflags="${CT_LDFLAGS_FOR_HOST}"
    CT_Popd
    CT_EndStep
}

do_bison_backend()
{
    local host
    local prefix
    local cflags
    local ldflags
    local -a extra_config

    for arg in "$@"; do
        eval "${arg// /\\ }"
    done

    CT_DoLog EXTRA "Configuring bison"
    CT_DoExecLog CFG \
                     CFLAGS="${cflags}" \
                     LDFLAGS="${ldflags}" \
                     ${CONFIG_SHELL} \
                     "${CT_SRC_DIR}/bison/configure" \
                     --host="${host}" \
                     --prefix="${prefix}" \
		     "${extra_config[@]}"

    CT_DoLog EXTRA "Building bison"
    CT_DoExecLog ALL make

    CT_DoLog EXTRA "Installing bison"
    CT_DoExecLog ALL make install
}