makefile_base.mak: Replace container-test step with sudo test
The real use of this step is obtaining sudo access to avoid having sudo prompts buried in the build output when building in parallel, making it non-obvious why the build is hanging. Just warn that this may happen and obtain sudo immediately to mitigate. Building without -j will always build subprojects in serial and won't have this issue (similar to build_proton.sh)
This commit is contained in:
parent
e5efde2575
commit
c3a326be07
1 changed files with 25 additions and 6 deletions
|
@ -59,6 +59,10 @@ endif
|
||||||
export CC
|
export CC
|
||||||
export CXX
|
export CXX
|
||||||
|
|
||||||
|
# If set below, we're invoking some build steps in a container that requires sudo -- will test sudo and show a warning
|
||||||
|
# at build start.
|
||||||
|
USING_SUDO_CONTAINER :=
|
||||||
|
|
||||||
# Selected container mode shell
|
# Selected container mode shell
|
||||||
DOCKER_SHELL_BASE = sudo docker run --rm --init -v $(HOME):$(HOME) -w $(CURDIR) -e HOME=$(HOME) \
|
DOCKER_SHELL_BASE = sudo docker run --rm --init -v $(HOME):$(HOME) -w $(CURDIR) -e HOME=$(HOME) \
|
||||||
-v /etc/passwd:/etc/passwd:ro -u $(shell id -u):$(shell id -g) -h $(shell hostname) \
|
-v /etc/passwd:/etc/passwd:ro -u $(shell id -u):$(shell id -g) -h $(shell hostname) \
|
||||||
|
@ -69,12 +73,14 @@ DOCKER_SHELL_BASE = sudo docker run --rm --init -v $(HOME):$(HOME) -w $(CURDIR)
|
||||||
ifeq ($(STEAMRT64_MODE),docker)
|
ifeq ($(STEAMRT64_MODE),docker)
|
||||||
SELECT_DOCKER_IMAGE := $(STEAMRT64_IMAGE)
|
SELECT_DOCKER_IMAGE := $(STEAMRT64_IMAGE)
|
||||||
CONTAINER_SHELL64 := $(DOCKER_SHELL_BASE)
|
CONTAINER_SHELL64 := $(DOCKER_SHELL_BASE)
|
||||||
|
USING_SUDO_CONTAINER := 1
|
||||||
else ifneq ($(STEAMRT64_MODE),)
|
else ifneq ($(STEAMRT64_MODE),)
|
||||||
foo := $(error Unrecognized STEAMRT64_MODE $(STEAMRT64_MODE))
|
foo := $(error Unrecognized STEAMRT64_MODE $(STEAMRT64_MODE))
|
||||||
endif
|
endif
|
||||||
ifeq ($(STEAMRT32_MODE),docker)
|
ifeq ($(STEAMRT32_MODE),docker)
|
||||||
SELECT_DOCKER_IMAGE := $(STEAMRT32_IMAGE)
|
SELECT_DOCKER_IMAGE := $(STEAMRT32_IMAGE)
|
||||||
CONTAINER_SHELL32 := $(DOCKER_SHELL_BASE)
|
CONTAINER_SHELL32 := $(DOCKER_SHELL_BASE)
|
||||||
|
USING_SUDO_CONTAINER := 1
|
||||||
else ifneq ($(STEAMRT32_MODE),)
|
else ifneq ($(STEAMRT32_MODE),)
|
||||||
foo := $(error Unrecognized STEAMRT32_MODE $(STEAMRT32_MODE))
|
foo := $(error Unrecognized STEAMRT32_MODE $(STEAMRT32_MODE))
|
||||||
endif
|
endif
|
||||||
|
@ -96,15 +102,28 @@ ifndef CONTAINER_SHELL32
|
||||||
CONTAINER_SHELL32 := $(SHELL)
|
CONTAINER_SHELL32 := $(SHELL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(info Testing configured 64bit container)
|
# Using a sudo container? Make sure we have sudo and show warning
|
||||||
ifneq ($(shell $(CONTAINER_SHELL64) -c "echo hi"), hi)
|
ifeq ($(USING_SUDO_CONTAINER),1)
|
||||||
$(error "Cannot run commands in 64bit container")
|
$(info :: NOTE: Some build steps will run in a container, which invokes sudo automatically)
|
||||||
|
$(info :: If building in parallel (-j) this can result in sudo prompts buried in the output)
|
||||||
|
$(info :: Testing sudo access now)
|
||||||
|
ifneq ($(shell sudo echo hi),hi)
|
||||||
|
$(error Failed to invoke sudo)
|
||||||
endif
|
endif
|
||||||
$(info Testing configured 32bit container)
|
|
||||||
ifneq ($(shell $(CONTAINER_SHELL32) -c "echo hi"), hi)
|
|
||||||
$(error "Cannot run commands in 32bit container")
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Helper to test
|
||||||
|
.PHONY: test-container test-container32 test-container64
|
||||||
|
test-container: test-container64 test-container32
|
||||||
|
|
||||||
|
test-container64:
|
||||||
|
@echo >&2 ":: Testing 64-bit container"
|
||||||
|
$(CONTAINER_SHELL64) -c "echo Hello World!"
|
||||||
|
|
||||||
|
test-container32:
|
||||||
|
@echo >&2 ":: Testing 32-bit container"
|
||||||
|
$(CONTAINER_SHELL32) -c "echo Hello World!"
|
||||||
|
|
||||||
# Many of the configure steps below depend on the makefile itself, such that they are dirtied by changing the recipes
|
# Many of the configure steps below depend on the makefile itself, such that they are dirtied by changing the recipes
|
||||||
# that create them. This can be annoying when working on the makefile, building with NO_MAKEFILE_DEPENDENCY=1 disables
|
# that create them. This can be annoying when working on the makefile, building with NO_MAKEFILE_DEPENDENCY=1 disables
|
||||||
# this.
|
# this.
|
||||||
|
|
Loading…
Reference in a new issue