File: cross-gcc-dev-helpers.sh

package info (click to toggle)
cross-gcc 14
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 224 kB
  • sloc: sh: 523; makefile: 136
file content (61 lines) | stat: -rw-r--r-- 1,601 bytes parent folder | download | duplicates (2)
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
# THIS HELPER SCRIPT NEED TO WORK WITH BOTH ZSH AND BASH



# Which gcc releases we know about/support. Each version listed here as a key
# has a corresponding gcc-$ver-source package in Debian
declare -A known_debian_gcc_releases # maps from release version to debian version

# These lines are modified by auto_build_all.sh. Do NOT change the structure of
# these so that the script can keep working
known_debian_gcc_releases[4.9]="4.9.2-10"
known_debian_gcc_releases[5]="5-20150127-1"


# bash and zsh get associative array keys differently
declare -a known_gcc_releases
if [ -n "$ZSH_VERSION" ]; then
    known_gcc_releases=${(k)known_debian_gcc_releases[@]}
else
    known_gcc_releases=${!known_debian_gcc_releases[@]}
fi


# takes a single commandline argument: gcc release version. If we know about
# this release, we exit successfully
function validate_gcc_source_release
{
    local query_ver=$1

    if [ -z "$query_ver" ]; then
        echo "validate_gcc_source_release needs an argument" > /dev/stderr
        return 1;
    fi


    if [ -n "${known_debian_gcc_releases[$query_ver]}" ]; then
        return 0;
    else
        return 1;
    fi
}

function get_debian_release
{
    local gcc_release=$1

    if [ -z "$gcc_release" ]; then
        echo "get_debian_release needs an argument" > /dev/stderr
        return 1;
    fi

    local debian_release=${known_debian_gcc_releases[$gcc_release]}

    if [ -z "debian_release" ]; then
        echo "Unknown debian release for gcc release '$gcc_release'" > /dev/stderr
        return 1;
    fi

    echo "$debian_release";
    return 0;
}