From 00e497eec85d07145af5342e0260d21e1b054f0a Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 17 May 2021 16:49:01 +0100 Subject: [PATCH] Makefile: Provide an example big bundle We mangle the wikimedia files, ad-hoc. Signed-off-by: Ian Jackson --- .gitignore | 2 ++ Makefile | 36 +++++++++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 8a347757..48a9034b 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,8 @@ templates/otter_wasm.ns.d.ts templates/shapelib.html save/lock /examples/test-bundle.zip +/examples/big-bundle +/examples/big-bundle.zip /library/*/files.make /library/*/*.usvg /library/*/*.coloured.svg diff --git a/Makefile b/Makefile index 15845e32..bf41f965 100644 --- a/Makefile +++ b/Makefile @@ -157,6 +157,7 @@ cargo-wasm-debug cargo-wasm-release:: \ cargo-%: stamp/cargo.% examples: examples/test-bundle.zip +examples: examples/big-bundle.zip .PHONY: examples cargo-wasm: cargo-wasm-release @@ -325,10 +326,38 @@ EXAMPLE_BUNDLE_INPUT_DEPS := $(shell \ cd examples/test-bundle/ && find \! \( -name '*~' -o -name '.*' \) \ ) -examples/test-bundle.zip: $(MAKEFILE_DEP) \ +examples/%.zip: $(MAKEFILE_DEP) + set -e; rm -f $@.tmp; cd examples/$*/; \ + zip $(ZIPFLAGS) -DXy ../$(notdir $@).tmp $(ZIP_INPUTS) + mv -f $@.tmp $@ + +examples/test-bundle.zip: ZIP_INPUTS=$(EXAMPLE_BUNDLE_INPUT_DEPS) \ $(addprefix examples/test-bundle/, $(EXAMPLE_BUNDLE_INPUT_DEPS)) - set -e; rm -f $@.tmp; cd examples/test-bundle/; \ - zip -DXy ../$(notdir $@).tmp $(EXAMPLE_BUNDLE_INPUT_DEPS) + +examples/big-bundle.zip: examples/big-bundle/otter.toml +examples/big-bundle.zip: ZIPFLAGS+= -0 -r -q +examples/big-bundle.zip: ZIP_INPUTS=. +examples/big-bundle/otter.toml: $(LIBRARY_FILES) $(MAKEFILE_DEP) + rm -rf examples/big-bundle + mkdir examples/big-bundle + cp -rl library examples/big-bundle/. + set -ex; cd examples/big-bundle/library/; for x in '' .toml; do \ + mv wikimedia$$x duped-example$$x; done + set -e; cd examples/big-bundle/library; for d in */.; do \ + cd $$d; \ + for f in *.coloured.svg; do \ + if test -f $$f; then \ + mv $$f $${f%.coloured.svg}.svg; \ + fi; \ + done; \ + for f in chess-*_c*.svg; do \ + if test -f $$f; then \ + mv -v $$f $${f/_c/w}; \ + fi; \ + done; \ + cd ..; \ + done + echo 'title = "Autogenerated large test bundle"' >$@.tmp mv -f $@.tmp $@ #---------- webdriver tests (wdt) ---------- @@ -409,6 +438,7 @@ deploy: for-deploy bundled-sources assets libraries clean-for-retest: rm -f templates/script.js library/*/*.usvg stamp/* rm -rf $(LIBRARY_CLEAN) + rm -rf examples/big-bundle examples/big-bundle.zip rm -f examples/test-bundle.zip find * \( -name '*~' -o -name '*.tmp' \) -print0 | xargs -0r rm -- -- 2.30.2