image: add gzip-filename build recipe
[openwrt/openwrt.git] / include / image-commands.mk
index 41e1c9694852e60c6c2ce4d20619b9c727a492b3..ff8acf96c4f316570572eb3c736b9056045cc7f3 100644 (file)
@@ -306,9 +306,23 @@ define Build/fit
        @mv $@.new $@
 endef
 
+define Build/libdeflate-gzip
+       $(STAGING_DIR_HOST)/bin/libdeflate-gzip -f -12 -c $@ $(1) > $@.new
+       @mv $@.new $@
+endef
+
 define Build/gzip
-       gzip -f -9n -c $@ $(1) > $@.new
+       $(STAGING_DIR_HOST)/bin/gzip -f -9n -c $@ $(1) > $@.new
+       @mv $@.new $@
+endef
+
+define Build/gzip-filename
+       @mkdir -p $@.tmp
+       @cp $@ $@.tmp/$(word 1,$(1))
+       $(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $@.tmp/$(word 1,$(1)) $(word 2,$(1)))
+       $(STAGING_DIR_HOST)/bin/gzip -f -9 -N -c $@.tmp/$(word 1,$(1)) $(word 2,$(1)) > $@.new
        @mv $@.new $@
+       @rm -rf $@.tmp
 endef
 
 define Build/install-dtb