configure.sh: Add option to select container engine.

Configure will also test the container engine by trying to run the
selected SDK image.

This may make the first configure a bit slow, as it downloads the image,
but after that the SDK will be cached locally.
This commit is contained in:
Arkadiusz Hiler 2021-06-11 09:06:58 +03:00 committed by Andrew Eikum
parent 33814e973d
commit 82ae47758f
2 changed files with 24 additions and 1 deletions

View File

@ -68,7 +68,11 @@ ifneq ($(ROOTLESS_CONTAINER),1)
DOCKER_OPTS := -e HOME -e USER -e USERID=$(shell id -u) -u $(shell id -u):$(shell id -g) $(DOCKER_OPTS)
endif
DOCKER_BASE = docker run --rm -v $(SRC):$(SRC) -v $(OBJ):$(OBJ) \
ifeq ($(CONTAINER_ENGINE),)
CONTAINER_ENGINE := docker
endif
DOCKER_BASE = $(CONTAINER_ENGINE) run --rm -v $(SRC):$(SRC) -v $(OBJ):$(OBJ) \
-w $(OBJ) -e MAKEFLAGS \
$(DOCKER_OPTS) $(STEAMRT_IMAGE)

View File

@ -57,6 +57,13 @@ dependency_afdko() {
fi
}
check_container_engine() {
info "Making sure that the container engine is working."
if ! cmd $arg_container_engine run --rm $arg_protonsdk_image; then
die "Broken container engine. Please fix your $arg_container_engine setup."
fi
}
#
# Configure
#
@ -107,6 +114,10 @@ function configure() {
die "Missing dependencies, cannot continue."
fi
if [[ -n "$arg_container_engine" ]]; then
check_container_engine
fi
## Write out config
# Don't die after this point or we'll have rather unhelpfully deleted the Makefile
[[ ! -e "$MAKEFILE" ]] || rm "$MAKEFILE"
@ -122,6 +133,7 @@ function configure() {
echo "STEAMRT_NAME := $(escape_for_make "$steamrt_name")"
echo "STEAMRT_IMAGE := $(escape_for_make "$steamrt_image")"
echo "CONTAINER_ENGINE := $arg_container_engine"
if [[ -n "$arg_docker_opts" ]]; then
echo "DOCKER_OPTS := $arg_docker_opts"
fi
@ -145,6 +157,7 @@ arg_steamrt="soldier"
arg_protonsdk_image="registry.gitlab.steamos.cloud/proton/soldier/sdk:0.20210505.0-2"
arg_no_protonsdk=""
arg_build_name=""
arg_container_engine="docker"
arg_docker_opts=""
arg_help=""
invalid_args=""
@ -182,6 +195,9 @@ function parse_args() {
elif [[ $arg = --build-name ]]; then
arg_build_name="$val"
val_used=1
elif [[ $arg = --container-engine ]]; then
arg_container_engine="$val"
val_used=1
elif [[ $arg = --docker-opts ]]; then
arg_docker_opts="$val"
val_used=1
@ -236,6 +252,9 @@ usage() {
"$1" ""
"$1" " --build-name=<name> Set the name of the build that displays when used in Steam"
"$1" ""
"$1" " --container-engine=<engine> Which container Docker-compatible container engine to use,"
"$1" " e.g. podman. Defaults to docker."
"$1" ""
"$1" " --docker-opts='<options>' Extra options to pass to Docker when invoking the runtime."
"$1" ""
"$1" " Steam Runtime"