From 82ae47758ff9305675624589dfb7bea5928ae956 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Fri, 11 Jun 2021 09:06:58 +0300 Subject: [PATCH] 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. --- build/makefile_base.mak | 6 +++++- configure.sh | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/build/makefile_base.mak b/build/makefile_base.mak index 057af91a..c9f14bc0 100644 --- a/build/makefile_base.mak +++ b/build/makefile_base.mak @@ -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) diff --git a/configure.sh b/configure.sh index 8e8121b7..d836b44c 100755 --- a/configure.sh +++ b/configure.sh @@ -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= Set the name of the build that displays when used in Steam" "$1" "" + "$1" " --container-engine= Which container Docker-compatible container engine to use," + "$1" " e.g. podman. Defaults to docker." + "$1" "" "$1" " --docker-opts='' Extra options to pass to Docker when invoking the runtime." "$1" "" "$1" " Steam Runtime"