chiark / gitweb /
build: build-depend on, and build our own, usvg and bundle-sources
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 14 Apr 2021 15:11:57 +0000 (16:11 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 14 Apr 2021 20:40:36 +0000 (21:40 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Makefile
docs/build.rst

index 653f40009c7e3ca18903c22b1fd4fb23c2bc683b..e9a5bd1c3a278998df694d7fc7f3b9b589842841 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -41,7 +41,6 @@ BUNDLED_SOURCES += $(BUNDLED_SOURCES_FILES)
 CARGO ?= cargo
 TARGET_DIR ?= target
 
-USVG ?= usvg
 USVG_OPTIONS = "--sans-serif-family=DejaVu Sans"
 
 WASM_BINDGEN = $(TARGET_DIR)/debug/wasm-bindgen
@@ -96,17 +95,14 @@ WASM_PACKED=$(TARGET_DIR)/packed-wasm
 #---------- local programs ----------
 
 define lp
-$(if $(wildcard $(BUILD_SUBDIR)/$2),
-$(shell echo >&2 'Makefile: lp: Using program $4 from $(BUILD_SUBDIR)/$2')
-$1 := $(abspath $(BUILD_SUBDIR)/$2/target/$3/$4)
-$(abspath $(BUILD_SUBDIR)/$2/target/$3/$4):; cd ../$2 && $$(CARGO) build $(call cr,$3)
-BUNDLED_SOURCES_DIRS += $2
-BUNDLED_SOURCES_LINKS += $2/
-)
+stamp/cargo.$2: $(call rsrcs, ! -name \*.rs)
+       $$(CARGO) build $(call cr,$3) -p $2
+       $$(stamp)
+$1 := $(abspath $(TARGET_DIR)/$3/$4)
 endef
 
 $(eval $(call lp,BUNDLE_SOURCES,bundle-sources,debug,bundle-rust-sources))
-$(eval $(call lp,USVG,resvg,release,usvg))
+$(eval $(call lp,USVG,usvg,release,usvg))
 
 #---------- variables defining bits of source etc. ----------
 
@@ -250,7 +246,7 @@ bundled-sources:: $(addprefix bundled-sources/, $(BUNDLED_SOURCES_DIRS))
 TARGET_BUNDLED=$(TARGET_DIR)/bundled-sources
 
 $(addprefix bundled-sources/, $(BUNDLED_SOURCES_DIRS)): \
-bundled-sources/%: $(wildcard $(BUNDLE_SOURCES))
+bundled-sources/%: stamp/cargo.bundle-sources
        set -e; d=$(abspath $(TARGET_BUNDLED)); \
        $(NAILING_CARGO_JUST_RUN) mkdir -p $$d; \
        $(if $(filter-out otter,$*), cd ../$*;) \
@@ -274,12 +270,13 @@ bundled-sources::
 #---------- svg processing ----------
 
 LIBRARIES ?= $(basename $(wildcard library/*.toml))
+USVG_DEP = stamp/cargo.usvg
 
 include $(addsuffix /files.make, $(LIBRARIES))
 
 USVG_PROCESSOR = usvg-processor
 LIBRARY_PROCESS_SVG = ./$(USVG_PROCESSOR) $@ $(wordlist 1,2,$^) '$(USVG_CMD) $(USVG_OPTIONS)'
-$(LIBRARY_FILES): $(USVG_PROCESSOR) $(USVG_BINARY) $(MAKEFILE_DEP)
+$(LIBRARY_FILES): $(USVG_PROCESSOR) $(USVG_DEP) $(MAKEFILE_DEP)
 
 # actual command for each of $(LIBRARY_FILES) is in one of the files.make
 
index 25dc043983b96d4e6057962fa3f5bdc2abfa0ae9..98008ecb99dd6ab28d5bf6abc6446782c8aa0cbb 100644 (file)
@@ -46,21 +46,9 @@ Setup
 
      rustup default nightly-2021-04-13
 
-4. Install the ``usvg`` SVG launderer, which we need for shape libraries::
-
-     cargo install usvg
-
-   This will put it in ``~/.cargo/bin``, which you presumably have on
-   your ``PATH`` (or the above ``rustup`` and ``cargo`` runes wouldn't work).
-
-
    **If you just want to edit and preview the shape libraries (ie the piece shapes) you can stop here.**
 
-5. Install some more build tools::
-
-     cargo install bundle-sources
-
-6. Install the webdriver binary from Mozilla.  Visit
+4. Install the webdriver binary from Mozilla.  Visit
 
      https://github.com/mozilla/geckodriver/releases/tag/v0.28.0
 
@@ -99,9 +87,7 @@ executed - and, therefore, trusted:
  * Rustup (the Rust downloader/installer) - this is pretty safe
  * Rust itself - again, pretty safe
  * Otter itself - well, I wrote this; up to you.
- * 450 transitive dependencies of otter (from crates.io)
- * 50 transitive dependencies of bundle-sources
- * the transitive dependencies of resvg
+ * 475 transitive dependencies of otter (from crates.io)
  * a geckodriver binary directly from mozilla
 
 You will have trusted the integrity of the following:
@@ -149,11 +135,6 @@ approaches.  In practice, it seems to me that once I'm using Rocket
 and WASM and resvg and so on, there is not that much to be gained
 by trying to prune the dependencies of the otter package itself.
 
-bundle-rust-sources
-```````````````````
-
-This is mine, but it needs to be properly released.
-
 geckodriver (for the automated in-browser tests)
 ````````````````````````````````````````````````