Skip to content
Snippets Groups Projects
Unverified Commit 50adb097 authored by Matthias Schiffer's avatar Matthias Schiffer Committed by GitHub
Browse files

build: make GluonSrcDiet simpler and more robust (#2033)

- If luasrcdiet fails for a Lua script, this is a bug that should be
  noticed rather than including the unminified script
- Use .tmp suffix for temporary file rather than .o
- Replace chmod + stat + mv with simpler cp + rm to overwrite file while
  preserving file mode
parent 1956696d
No related branches found
No related tags found
No related merge requests found
...@@ -61,14 +61,14 @@ endef ...@@ -61,14 +61,14 @@ endef
define GluonSrcDiet define GluonSrcDiet
rm -rf $(2) rm -rf $(2)
$(CP) $(1) $(2) $(CP) $(1) $(2)
ifdef CONFIG_GLUON_MINIFY ifdef CONFIG_GLUON_MINIFY
$(FIND) $(2) -type f | while read src; do \ # Use cp + rm instead of mv to preserve destination permissions
if luasrcdiet --noopt-binequiv -o "$$$$src.o" "$$$$src"; then \ set -e; $(FIND) $(2) -type f | while read src; do \
chmod $$$$(stat -c%a "$$$$src") "$$$$src.o"; \ luasrcdiet --noopt-binequiv -o "$$$$src.tmp" "$$$$src"; \
mv "$$$$src.o" "$$$$src"; \ cp "$$$$src.tmp" "$$$$src"; \
fi; \ rm "$$$$src.tmp"; \
done done
endif endif
endef endef
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment