File: build-with-srt-docker.sh

package info (click to toggle)
mangohud 0.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 31,420 kB
  • sloc: cpp: 168,618; xml: 14,297; ansic: 11,907; python: 3,120; sh: 614; makefile: 13
file content (41 lines) | stat: -rwxr-xr-x 1,500 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/env bash
# Usage example: $0 master soldier 0.20210618.0
set -u

if [ $# -eq 2 ]; then
  echo Specify runtime version too
  exit 1
fi

SRCDIR=$PWD
BRANCH="${1:-master}"
# soldier 0.20210618.0 or newer
# scout 0.20210630.0 or newer
RUNTIME="${2:-soldier}"
VERSION="${3:-0.20210618.0}"
IMAGE="steamrt_${RUNTIME}_${VERSION}_amd64:mango-${RUNTIME}"
BASEURL="https://repo.steampowered.com/steamrt-images-${RUNTIME}/snapshots/${VERSION}"
CACHEDIR="./cache/steamrt-images-${RUNTIME}/snapshots/${VERSION}"

mkdir -p "${CACHEDIR}"

echo -e "\e[1mBuilding branch \e[92m${BRANCH}\e[39m using \e[92m${RUNTIME}:${VERSION}\e[39m runtime\e[0m"

if ! docker inspect --type=image ${IMAGE} 2>&1 >/dev/null ; then
  rm -fr ./cache/empty
  set -e
  mkdir -p ./cache/empty
  sed "s/%RUNTIME%/${RUNTIME}/g" steamrt.Dockerfile.in  > ./cache/steamrt.Dockerfile

  wget -P "${CACHEDIR}" -c ${BASEURL}/com.valvesoftware.SteamRuntime.Sdk-amd64,i386-${RUNTIME}-sysroot.tar.gz
  cp --reflink=always "${CACHEDIR}/com.valvesoftware.SteamRuntime.Sdk-amd64,i386-${RUNTIME}-sysroot.tar.gz" ./cache/empty/
  docker build -f ./cache/steamrt.Dockerfile -t ${IMAGE} ./cache/empty
fi

docker run --entrypoint=/bin/sh --rm -i -v "${SRCDIR}/srt-output:/output" ${IMAGE} << EOF
export RUNTIME=${RUNTIME}
export SRT_VERSION=${VERSION}
git clone git://github.com/flightlessmango/MangoHud.git . --branch ${BRANCH} --recurse-submodules --progress
./build-srt.sh clean build package release
cp -v build-srt/MangoHud*tar.gz /output/
EOF