pkg: relocate package files

This commit is contained in:
Thomas Hobson 2021-03-13 19:50:05 +13:00
parent 5e400cb782
commit 98782b0a17
No known key found for this signature in database
GPG key ID: 9F1FD9D87950DB6F
2 changed files with 12 additions and 10 deletions

View file

@ -1,4 +1,4 @@
PACKAGES=$(shell find * -maxdepth 0 -type d)
PACKAGES=$(subst /,-,$(shell find * -maxdepth 1 -mindepth 1 -type d))
BUILD_PLATFORM=$(or ${PLATFORM},baremetal-$(shell grep -oP "^ID=\K.+" /etc/os-release))
help:
@ -9,14 +9,16 @@ help:
build build-all: $(addsuffix .pkg.tar.gz, ${PACKAGES})
%.pkg.tar.gz: %/ %/pkg-info.json
cd $< && chmod +x ./build.sh && ./build.sh
rm -f $@
tar czf $@ $* --transform='s|$*||'
define PKG_RULE
$(1).pkg.tar.gz: $(subst -,/,$(1))/ $(subst -,/,$(1))/pkg-info.json
cd $$< && chmod +x ./build.sh && ./build.sh
rm -f $$@
tar czf $$@ $$< --transform='s|$$<||'
endef
$(foreach pkg,$(PACKAGES),$(eval $(call PKG_RULE,$(pkg))))
%/pkg-info.json: %/metadata.json
jq '.build_platform="${BUILD_PLATFORM}"' $< > $@