summaryrefslogtreecommitdiffstats
path: root/taskcluster/scripts/misc/build-resourcemonitor.sh
blob: 6643079c76c198e8192dec8f5d7d87c424821d69 (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
#!/bin/bash
set -x -e -v

cd "$MOZ_FETCHES_DIR"/resource-monitor/ || exit 1
COMPRESS_EXT=zst

PATH="$MOZ_FETCHES_DIR/go/bin:$PATH"
export PATH

EXE_SUFFIX=""

case "$1" in
    linux64)   GOOS=linux; GOARCH=amd64 ;;
    macos64)   GOOS=darwin; GOARCH=amd64 ;;
    windows64) GOOS=windows; GOARCH=amd64; EXE_SUFFIX=".exe" ;;
    windows32) GOOS=windows; GOARCH=386;   EXE_SUFFIX=".exe" ;;
    *)
        echo "Unknown architecture $1 not recognized in build-resourcemonitor.sh" >&2
        exit 1
    ;;
esac

export GOOS
export GOARCH
export EXE_SUFFIX

echo "GOOS=$GOOS"
echo "GOARCH=$GOARCH"

go build .

STAGING_DIR="resource-monitor"
mv "resource-monitor${EXE_SUFFIX}" resource-monitor.tmp
mkdir "${STAGING_DIR}"

cp resource-monitor.tmp "${STAGING_DIR}/resource-monitor${EXE_SUFFIX}"

tar -acf "resource-monitor.tar.$COMPRESS_EXT" "${STAGING_DIR}"/
mkdir -p "$UPLOAD_DIR"
cp "resource-monitor.tar.$COMPRESS_EXT" "$UPLOAD_DIR"