build: image: improve zip build recipe
authorSungbo Eo <mans0n@gorani.run>
Sat, 4 Dec 2021 17:08:48 +0000 (02:08 +0900)
committerSungbo Eo <mans0n@gorani.run>
Sun, 12 Dec 2021 05:05:55 +0000 (14:05 +0900)
* clean before build
* specify executable path
* allow adding extra options for zip
* use basename of $@

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
include/image-commands.mk

index 97176f7d7b443b46066ce9c474e715fe3d3d4296..913e1c2411e03ecaba9c75ab0507a1ed9d240af1 100644 (file)
@@ -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