chiark / gitweb /
Makefile: Provide an example big bundle
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 17 May 2021 15:49:01 +0000 (16:49 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 17 May 2021 15:49:01 +0000 (16:49 +0100)
We mangle the wikimedia files, ad-hoc.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
.gitignore
Makefile

index 8a34775784f684a6ddd94852b1f3fa8d8be0ae96..48a9034b6bbd7ea8d4d73f748331cae23a1a678d 100644 (file)
@@ -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
index 15845e321606ce65b565cf653bdcf2479b2285e2..bf41f9658bcbc2f61910a40892fc0ebe386e6720 100644 (file)
--- 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 --