summaryrefslogtreecommitdiff
path: root/automated/bin/fetch_skipgen.sh
blob: ac76a550eae673b97aad11184959d0c2a4305f78 (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
#!/bin/sh
set -e

# Retrieve a given version of skipgen from
# https://github.com/Linaro/skipgen/releases and copy to the
# arm64/armeabi/x86_64/i386 directories.

if [ -z "$1" ]; then
    echo "Usage: ${0} <skipgen_version_number>"
    echo "For example:"
    echo "    ${0} 0.2.1"
    echo ""
    echo "Be sure to not include the leaving 'v'."
    echo ""
    exit 1
fi

SKIPGEN_VERSION=$1
ROOT_PATH=$(dirname "$0")
ARCHS="arm64 armeabi x86_64 i386"

for arch in ${ARCHS}; do

    # Translate test-definition arch names to skipgen arch names
    skipgen_arch=""
    case ${arch} in
        arm64)
            skipgen_arch="arm64"
            ;;
        armeabi)
            skipgen_arch="armv7"
            ;;
        x86_64)
            skipgen_arch="amd64"
            ;;
        i386)
            skipgen_arch="386"
            ;;
        *)
            echo "Unknown architecture ${arch}"
            exit 1
            ;;
    esac

    # Fetch tar file, save in /tmp
    wget -O "/tmp/skipgen_${SKIPGEN_VERSION}_linux_${skipgen_arch}.tar.gz" \
        "https://github.com/Linaro/skipgen/releases/download/v${SKIPGEN_VERSION}/skipgen_${SKIPGEN_VERSION}_linux_${skipgen_arch}.tar.gz"
    # Extract skipgen binary from tar, save in the local arch folder
    tar xvzf "/tmp/skipgen_${SKIPGEN_VERSION}_linux_${skipgen_arch}.tar.gz" -C "${ROOT_PATH}/${arch}/" skipgen
    # Remove tmp file
    rm -f "/tmp/skipgen_${SKIPGEN_VERSION}_linux_${skipgen_arch}.tar.gz"

done