build: Do as much as possible inside of the SDK container.

Parts of the rules, including the magical ones created via
make/rules-*.mk, are executed inside of the container via SHELL
override, and parts are executed on the host side.

This makes reasoning about and debugging the rules much harder than it
should be. It also requirs the users to have certain programs installed
on the host in addition to docker/podman.

With this change `make` will act as a simple pass through to inside of
the container for the most part.

One notable exception is installation which still happens the host side.
This commit is contained in:
Arkadiusz Hiler
2023-02-14 16:07:44 +02:00
parent 9f8a37c0c1
commit 692ef0aa1f
11 changed files with 320 additions and 394 deletions
+311 -360
View File
File diff suppressed because it is too large Load Diff
+2 -8
View File
@@ -19,9 +19,9 @@ if [[ $(tput colors 2>/dev/null || echo 0) -gt 0 ]]; then
COLOR_CLEAR=$'\e[0m'
fi
sh_quote() {
sh_quote() {
local quoted
quoted="$(printf '%q ' "$@")"; [[ $# -eq 0 ]] || echo "${quoted:0:-1}";
quoted="$(printf '%q ' "$@")"; [[ $# -eq 0 ]] || echo "${quoted:0:-1}";
}
err() { echo >&2 "${COLOR_ERR}!!${COLOR_CLEAR} $*"; }
stat() { echo >&2 "${COLOR_STAT}::${COLOR_CLEAR} $*"; }
@@ -113,13 +113,7 @@ function configure() {
info "No build name specified, using default: $build_name"
fi
dependency_command find "findutils"
dependency_command make "GNU Make"
dependency_command rsync
dependency_command wget
dependency_command xz
dependency_command git
dependency_command python3
if [ "$MISSING_DEPENDENCIES" -ne 0 ]; then
die "Missing dependencies, cannot continue."
+2 -2
View File
@@ -7,7 +7,8 @@
define create-rules-autoconf
$(call create-rules-common,$(1),$(2),$(3),$(4))
ifeq ($(CONTAINER),1)
$$($(2)_SRC)/configure.ac: | $$(OBJ)/.$(1)-post-source
$$(OBJ)/.$(1)-pre-configure: $$($(2)_SRC)/configure.ac
@echo ":: autoreconfing $(1)..." >&2
cd "$$($(2)_SRC)" && autoreconf -fiv
@@ -35,7 +36,6 @@ $$(OBJ)/.$(1)-build$(3):
cd "$$($(2)_OBJ$(3))" && env $$($(2)_ENV$(3)) \
$$(MAKE) install
touch $$@
endif
endef
rules-autoconf = $(call create-rules-autoconf,$(1),$(call toupper,$(1)),$(2),$(3))
-2
View File
@@ -6,7 +6,6 @@
define create-rules-cargo
$(call create-rules-common,$(1),$(2),$(3))
ifeq ($(CONTAINER),1)
$$(OBJ)/.$(1)-configure$(3):
@echo ":: configuring $(3)bit $(1)..." >&2
touch $$@
@@ -22,7 +21,6 @@ $$(OBJ)/.$(1)-build$(3):
$$($(2)_CARGO_ARGS) \
$$($(2)_CARGO_ARGS$(3))
touch $$@
endif
endef
rules-cargo = $(call create-rules-cargo,$(1),$(call toupper,$(1)),$(2))
+1 -2
View File
@@ -7,7 +7,7 @@
define create-rules-cmake
$(call create-rules-common,$(1),$(2),$(3),$(4))
ifeq ($(CONTAINER),1)
$$($(2)_SRC)/CMakeLists.txt: | $$(OBJ)/.$(1)-post-source
$$(OBJ)/.$(1)-configure$(3): $$($(2)_SRC)/CMakeLists.txt
@echo ":: configuring $(3)bit $(1)..." >&2
rm -rf "$$($(2)_OBJ$(3))/CMakeCache.txt"
@@ -32,7 +32,6 @@ $$(OBJ)/.$(1)-build$(3):
cd "$$($(2)_OBJ$(3))" && env $$($(2)_ENV$(3)) \
$$(MAKE) install
touch $$@
endif
endef
rules-cmake = $(call create-rules-cmake,$(1),$(call toupper,$(1)),$(2),$(3))
+1 -10
View File
@@ -15,6 +15,7 @@ $(2)_INCDIR$(3) ?= $$($(2)_DST$(3))/include
$$(OBJ)/.$(1)-configure$(3): $$(shell mkdir -p $$($(2)_OBJ$(3)))
$$(OBJ)/.$(1)-configure$(3): CCACHE_BASEDIR = $$($(2)_SRC)
$$(OBJ)/.$(1)-configure$(3): $$(patsubst %,%-build$(3),$$($(2)_DEPENDS) $$($(2)_DEPENDS$(3)))
$$(OBJ)/.$(1)-configure$(3): | $$(OBJ)/.$(1)-post-source
$(1)-configure$(3): $$(OBJ)/.$(1)-configure$(3)
.INTERMEDIATE: $(1)-configure$(3)
@@ -30,13 +31,7 @@ $$(OBJ)/.$(1)-build$(3): CCACHE_BASEDIR = $$($(2)_SRC)
$$(OBJ)/.$(1)-build$(3): $$(OBJ)/.$(1)-source
$$(OBJ)/.$(1)-build$(3): $$(OBJ)/.$(1)-configure$(3)
ifeq ($(CONTAINER),)
$$(OBJ)/.$(1)-build$(3): container-build
$$(OBJ)/.$(1)-post-build$(3): container-build
$$(OBJ)/.$(1)-dist$(3): container-build
else
$$(OBJ)/.$(1)-post-build$(3): $$(OBJ)/.$(1)-build$(3)
endif
$(1)-build$(3): $$(OBJ)/.$(1)-build$(3)
.INTERMEDIATE: $(1)-build$(3)
@@ -48,7 +43,6 @@ all-build: $(1)-build
.PHONY: all-build
ifeq ($(CONTAINER),1)
$$(OBJ)/.$(1)-dist$(3): $$(OBJ)/.$(1)-build$(3)
$$(OBJ)/.$(1)-dist$(3): $$(OBJ)/.$(1)-post-build$(3)
@@ -78,7 +72,6 @@ $$(OBJ)/.$(1)-dist$(3):
xargs $(--verbose?) -0 -r -P$$(J) -n3 objcopy --file-alignment=4096 --set-section-flags .text=contents,alloc,load,readonly,code
touch $$@
endif
endif
$(1)-dist$(3): $$(OBJ)/.$(1)-dist$(3)
.INTERMEDIATE: $(1)-dist$(3)
@@ -99,8 +92,6 @@ all$(3) $(1): $(1)$(3)
all: $(1)
.PHONY: all
CONTAINERGOALS := $(CONTAINERGOALS) $(filter $(1),$(MAKECMDGOALS))
$(2)_INCFLAGS$(3) = $$(foreach d,$$($(2)_DEPS$(3)),-I$$($$(d)_INCDIR$(3)))
$(2)_LIBFLAGS$(3) = $$(foreach d,$$($(2)_DEPS$(3)),-L$$($$(d)_LIBDIR$(3))) \
$$(foreach d,$$($(2)_DEPS$(3)),-Wl,-rpath-link=$$($$(d)_LIBDIR$(3))) \
-2
View File
@@ -7,7 +7,6 @@
define create-rules-configure
$(call create-rules-common,$(1),$(2),$(3),$(4))
ifeq ($(CONTAINER),1)
$$(OBJ)/.$(1)-configure$(3):
@echo ":: configuring $(3)bit $(1)..." >&2
@@ -30,7 +29,6 @@ $$(OBJ)/.$(1)-build$(3):
cd "$$($(2)_OBJ$(3))" && env $$($(2)_ENV$(3)) \
$$(MAKE) install
touch $$@
endif
endef
CONFIGURE_ARCH32 = x86
+2 -2
View File
@@ -38,7 +38,8 @@ endef
export $(2)_MESON_CROSS$(3)
ifeq ($(CONTAINER),1)
$$($(2)_SRC)/meson.build: | $$(OBJ)/.$(1)-post-source
$$(OBJ)/.$(1)-configure$(3): $$($(2)_SRC)/meson.build
@echo ":: configuring $(3)bit $(1)..." >&2
rm -rf "$$($(2)_OBJ$(3))/meson-private/coredata.dat"
@@ -62,7 +63,6 @@ $$(OBJ)/.$(1)-build$(3):
env $$($(2)_ENV$(3)) \
ninja $$(filter -j%,$$(MAKEFLAGS)) -C "$$($(2)_OBJ$(3))" install $(-v?)
touch $$@
endif
endef
MESON_CPU32 = x86
-3
View File
@@ -15,7 +15,6 @@
define create-rules-source
$(2)_SRC = $$(OBJ)/src-$(1)
ifeq ($(CONTAINER),)
$(1)-rebuild:
.PHONY: $(1)-rebuild
@@ -29,7 +28,6 @@ $$(OBJ)/.$(1)-source: $$(shell echo -n 'syncing $(1)... ' >&2 && \
touch $$@
$$(OBJ)/.$(1)-post-source: $$(OBJ)/.$(1)-source
container-build: $$(OBJ)/.$(1)-post-source
$(1)-source: $$(OBJ)/.$(1)-post-source
.PHONY: $(1)-source
@@ -47,7 +45,6 @@ $(1)-distclean::
clean: $(1)-clean
distclean: $(1)-distclean
.PHONY: clean distclean
endif
endef
rules-source = $(call create-rules-source,$(1),$(call toupper,$(1)),$(2))
-2
View File
@@ -8,7 +8,6 @@ define create-rules-winemaker
$(call create-rules-common,$(1),$(2),$(3))
$(2)_OBJ$(3) := $$($(2)_OBJ$(3))/$(4)
ifeq ($(CONTAINER),1)
$$(OBJ)/.$(1)-configure$(3):
@echo ":: configuring $(3)bit $(1)..." >&2
rsync -arx "$$($(2)_SRC)/" "$$($(2)_OBJ$(3))/"
@@ -37,7 +36,6 @@ $$(OBJ)/.$(1)-build$(3):
mkdir -p $$($(2)_LIBDIR$(3))/$(LIBDIR_WINE_CROSS$(3))
cp -a $$($(2)_OBJ$(3))/$(4).fake $$($(2)_LIBDIR$(3))/$(LIBDIR_WINE_CROSS$(3))/$(4)
touch $$@
endif
endef
rules-winemaker = $(call create-rules-winemaker,$(1),$(call toupper,$(1)),$(2),$(3))
+1 -1
Submodule wine updated: 492470267a...c244422700