Finalize binary packages using "include $(BIN_RULES)"

Rather than call a small macro without inputs or outputs,
": |> !bin |>", include a file that will perform some metadata checks
and invoke the !bin macro. In this way checks are extensible across
packages by simply adding them to the common $(BIN_RULES) file.
This commit is contained in:
Ehmry - 2019-04-19 09:56:43 +02:00
parent 11bc86a727
commit c5817f347a
6 changed files with 30 additions and 5 deletions

View File

@ -29,15 +29,26 @@ PUBLIC_BIN_DIR = $(PUBLIC_DIR)/bin
PUBLIC_PKG_DIR = $(PUBLIC_DIR)/pkg
RAW_DIR = $(DEPOT_RAW_DIR)/$(RAW_NAME)/current
# Destination for locally defined raw package
BIN_DIR = $(DEPOT_BIN_DIR)/$(BIN_NAME)/current
# Destination for locally defined binary package
PKG_DIR = $(DEPOT_BIN_DIR)/$(BIN_NAME)/current
# Destination for locally defined runtime package
!raw = |> ^ COLLECT %o^ \
echo $(RAW_DEPENDS) local/raw/$(RAW_NAME)/$(RAW_VERSION) | tr ' ' '\n' > %o; \
echo local/raw/$(RAW_NAME)/$(RAW_VERSION) > %o \
|> $(RAW_DIR)/.ARCHIVES $(DEPOT_DIR)/<raw-archives>
BIN_RULES = $(TUP_CWD)/errata/bin.tup
# Rules for finalizing a locally defined binary package
!bin = |> ^ COLLECT %o^ \
echo $(BIN_DEPENDS) local/src/$(BIN_NAME)/$(BIN_VERSION) | tr ' ' '\n' > %o; \
|> $(DEPOT_BIN_DIR)/$(BIN_NAME)/current/.ARCHIVES $(DEPOT_DIR)/<bin-archives>
|> $(BIN_DIR)/.ARCHIVES $(DEPOT_DIR)/<bin-archives>
# Macro invoked in BIN_RULES
AWK_LOCAL_ARCHIVES = awk -F '/' \
'{if ($1 != "local") {print $0} \

14
errata/bin.tup Normal file
View File

@ -0,0 +1,14 @@
ifeq ($(BIN_NAME),)
error BIN_NAME is empty
endif
ifeq ($(BIN_VERSION),)
error BIN_VERSION is empty
endif
: |> !bin |>
# Finalize the metadata with the macro defined in the
# ../Tuprules.tup. The macro cannot be defined here
# because the "include" directive is not available for
# relative paths during "include_rules" so this file
# cannot be included by intermediate Tuprules.tup.

View File

@ -4,4 +4,3 @@
: foreach $(NIM_SRC_DIR)/*.nim |> !nim_build |> {binary}
: foreach {binary} |> !collect_bin |>
: |> !bin |>

View File

@ -10,4 +10,4 @@ PKGS = genode-os genode-prg
$(LD) `pkg-config --libs $(PKGS)` %f -o %o |> %d {binary}
: {binary} |> !collect_bin |>
: |> !bin |>
include $(BIN_RULES)

View File

@ -10,7 +10,8 @@ PKGS = genode-os genode-prg
$(LD) `pkg-config --libs $(PKGS)` %f -o %o |> %d {binary}
: {binary} |> !collect_bin |>
: |> !bin |>
include $(BIN_RULES)
PKG_DEPENDS += _/src/$(TARGET_NAME)
: runtime |> !collect_pkg_runtime |>

View File

@ -1,5 +1,5 @@
<runtime ram="4M" caps="96" binary="nic_bus">
<provides> <nic/> </provides>
<content> <rom label="nic_bus"/> </content>
<config> <default-policy/></config>
<config ld_verbose="yes"> <default-policy/></config>
</runtime>