diff mbox series

build: image: improve zip build recipe

Message ID 20211204172628.710545-1-mans0n@gorani.run
State Accepted
Delegated to: Sungbo Eo
Headers show
Series build: image: improve zip build recipe | expand

Commit Message

Sungbo Eo Dec. 4, 2021, 5:26 p.m. UTC
* clean before build
* specify executable path
* allow adding extra options for zip
* use basename of $@

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
---
Actually I failed to reproduce any evidence that `$(STAGING_DIR_HOST)/bin/zip` is indeed necessary.
But I added it for consistency with other recipes.

Ref:
b993b68b6ca8 ("build: introduce $(MKHASH)")
33411ee9190b ("target/x86/image: use qemu-img from STAGING_DIR_HOST")
26a016731d1f ("firmware-utils: mksercommfw: overhaul image creation")
---
 include/image-commands.mk | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/include/image-commands.mk b/include/image-commands.mk
index f0557936c9..4c5fe32e24 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -524,12 +524,14 @@  define Build/xor-image
 endef
 
 define Build/zip
+	rm -rf $@.tmp
 	mkdir $@.tmp
-	mv $@ $@.tmp/$(1)
+	mv $@ $@.tmp/$(word 1,$(1))
 
-	zip -j -X \
+	$(STAGING_DIR_HOST)/bin/zip -j -X \
 		$(if $(SOURCE_DATE_EPOCH),--mtime="$(SOURCE_DATE_EPOCH)") \
-		$@ $@.tmp/$(if $(1),$(1),$@)
+		$(wordlist 2,$(words $(1)),$(1)) \
+		$@ $@.tmp/$(if $(word 1,$(1)),$(word 1,$(1)),$$(basename $@))
 	rm -rf $@.tmp
 endef