From 368eebca61fcc543f066d04eec2e9e560d25d0c5 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 14 Apr 2021 16:11:57 +0100 Subject: [PATCH] build: build-depend on, and build our own, usvg and bundle-sources Signed-off-by: Ian Jackson --- Makefile | 19 ++++++++----------- docs/build.rst | 23 ++--------------------- 2 files changed, 10 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index 653f4000..e9a5bd1c 100644 --- 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 diff --git a/docs/build.rst b/docs/build.rst index 25dc0439..98008ecb 100644 --- a/docs/build.rst +++ b/docs/build.rst @@ -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) ```````````````````````````````````````````````` -- 2.30.2