configure.sh: Move the default SDK build container image URI to Makefile.in.

Up until now ./configure.sh was baking in the default value into the
generated Makefile. Because of it if there was a change that requires a
newer version of the SDK the compilation would fail until the next
./configure.sh invocation does the update.

This is proved to be confusing - mysterious build errors without clear
explanation.

With this change the default value is a part of Makefile.in and if user
doesn't specify --proton-sdk-image it will be always used and always up
to date.

--proton-sdk-image overrides the default and stores it in the Makefile
just like it used to.
This commit is contained in:
Arkadiusz Hiler 2023-01-12 15:09:23 +02:00
parent 28aeb63901
commit b4bba7eec4
2 changed files with 20 additions and 10 deletions

View File

@ -42,6 +42,8 @@ else # (Rest of the file is the else)
# BUILD_NAME - Name of the build for manifests etc. # BUILD_NAME - Name of the build for manifests etc.
# STEAMRT_IMAGE - Name of the docker image to use for building # STEAMRT_IMAGE - Name of the docker image to use for building
STEAMRT_IMAGE ?= registry.gitlab.steamos.cloud/proton/sniper/sdk:0.20221017.1-0
ifeq ($(SRCDIR),) ifeq ($(SRCDIR),)
foo := $(error SRCDIR not set, do not include Makefile.in directly, run ./configure.sh to generate Makefile) foo := $(error SRCDIR not set, do not include Makefile.in directly, run ./configure.sh to generate Makefile)
endif endif

View File

@ -50,14 +50,14 @@ CONTAINER_MOUNT_OPTS=""
check_container_engine() { check_container_engine() {
stat "Trying $1." stat "Trying $1."
if ! cmd $1 run --rm $arg_protonsdk_image; then if ! cmd $1 run --rm $2; then
info "$1 is unable to run the container." info "$1 is unable to run the container."
return 1 return 1
fi fi
touch permission_check touch permission_check
local inner_uid="$($1 run -v "$(pwd):/test$CONTAINER_MOUNT_OPTS" \ local inner_uid="$($1 run -v "$(pwd):/test$CONTAINER_MOUNT_OPTS" \
--rm $arg_protonsdk_image \ --rm $2 \
stat --format "%u" /test/permission_check 2>&1)" stat --format "%u" /test/permission_check 2>&1)"
rm permission_check rm permission_check
@ -94,10 +94,16 @@ function escape_for_make() {
} }
function configure() { function configure() {
local steamrt_image="$1" local steamrt_image="$arg_protonsdk_image"
local srcdir local srcdir
srcdir="$(dirname "$0")" srcdir="$(dirname "$0")"
# nothing specified, getting the default value from the Makefile to test the
# container engine
if [[ -z $steamrt_image ]]; then
steamrt_image="$(sed -n 's/STEAMRT_IMAGE ?= //p' $SRCDIR/Makefile.in)"
fi
# Build name # Build name
local build_name="$arg_build_name" local build_name="$arg_build_name"
if [[ -n $build_name ]]; then if [[ -n $build_name ]]; then
@ -126,12 +132,12 @@ function configure() {
fi fi
if [[ -n "$arg_container_engine" ]]; then if [[ -n "$arg_container_engine" ]]; then
check_container_engine "$arg_container_engine" || die "Specified container engine \"$arg_container_engine\" doesn't work" check_container_engine "$arg_container_engine" "$steamrt_image" || die "Specified container engine \"$arg_container_engine\" doesn't work"
else else
stat "Trying to find usable container engine." stat "Trying to find usable container engine."
if check_container_engine docker; then if check_container_engine docker "$steamrt_image"; then
arg_container_engine="docker" arg_container_engine="docker"
elif check_container_engine podman; then elif check_container_engine podman "$steamrt_image"; then
arg_container_engine="podman" arg_container_engine="podman"
else else
die "${arg_container_engine:-Container engine discovery} has failed. Please fix your setup." die "${arg_container_engine:-Container engine discovery} has failed. Please fix your setup."
@ -151,8 +157,10 @@ function configure() {
echo "SRCDIR := $(escape_for_make "$srcdir")" echo "SRCDIR := $(escape_for_make "$srcdir")"
echo "BUILD_NAME := $(escape_for_make "$build_name")" echo "BUILD_NAME := $(escape_for_make "$build_name")"
# SteamRT # SteamRT was specified, baking it into the Makefile
echo "STEAMRT_IMAGE := $(escape_for_make "$steamrt_image")" if [[ -n $arg_protonsdk_image ]]; then
echo "STEAMRT_IMAGE := $(escape_for_make "$arg_protonsdk_image")"
fi
echo "ROOTLESS_CONTAINER := $ROOTLESS_CONTAINER" echo "ROOTLESS_CONTAINER := $ROOTLESS_CONTAINER"
echo "CONTAINER_ENGINE := $arg_container_engine" echo "CONTAINER_ENGINE := $arg_container_engine"
@ -179,7 +187,7 @@ function configure() {
# Parse arguments # Parse arguments
# #
arg_protonsdk_image="registry.gitlab.steamos.cloud/proton/sniper/sdk:0.20221017.1-0" arg_protonsdk_image=""
arg_build_name="" arg_build_name=""
arg_container_engine="" arg_container_engine=""
arg_docker_opts="" arg_docker_opts=""
@ -304,4 +312,4 @@ usage() {
parse_args "$@" || usage err parse_args "$@" || usage err
[[ -z $arg_help ]] || usage info [[ -z $arg_help ]] || usage info
configure "$arg_protonsdk_image" configure