From 818a7110c1831be1b2ce5fcb2167504d0195e45c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 22 May 2022 20:27:04 +0100 Subject: [PATCH] Plumb usvg options from a file src/USVG_DEFAULT_ARGS.txt Rather than the Makefile. This will let us make the default arguments available to Rust code. Signed-off-by: Ian Jackson --- Makefile | 4 +--- src/USVG_DEFAULT_ARGS.txt | 5 +++++ usvg-processor | 12 +++++++++++- 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 src/USVG_DEFAULT_ARGS.txt diff --git a/Makefile b/Makefile index b354ed67..54e61d97 100644 --- a/Makefile +++ b/Makefile @@ -39,8 +39,6 @@ BUNDLED_SOURCES += $(BUNDLED_SOURCES_FILES) TARGET_DIR ?= target -USVG_OPTIONS = "--sans-serif-family=DejaVu Sans" - WASM_BINDGEN = $(TARGET_DIR)/debug/wasm-bindgen WASM_BINDGEN_OPTIONS = \ --remove-name-section --remove-producers-section \ @@ -343,7 +341,7 @@ bundled-sources:: #---------- svg processing ---------- LIBRARIES ?= $(basename $(wildcard library/*.toml)) -USVG_DEP = stamp/cargo.usvg +USVG_DEP = stamp/cargo.usvg src/USVG_DEFAULT_ARGS.txt include $(addsuffix /files.make, $(LIBRARIES)) diff --git a/src/USVG_DEFAULT_ARGS.txt b/src/USVG_DEFAULT_ARGS.txt new file mode 100644 index 00000000..755206dc --- /dev/null +++ b/src/USVG_DEFAULT_ARGS.txt @@ -0,0 +1,5 @@ +# One argument per line +# Lines starting with #, and empty lines, are ignored + +--sans-serif-family +DejaVu Sans diff --git a/usvg-processor b/usvg-processor index 58f3042a..41db5d3f 100755 --- a/usvg-processor +++ b/usvg-processor @@ -26,7 +26,17 @@ sub add_lic () { add_lic(); flush STDOUT or die $!; -my $cmd = "$usvg - -c"; +my $cmd = "$usvg"; + +open OPTS, "src/USVG_DEFAULT_ARGS.txt" or die $!; +while () { + s/^\s*$//; s/\s*$//; + next unless m/^[^#]/; + $cmd .= " '$_'"; +} + +$cmd .= " - -c"; + my $cmd_m = "$cmd <$in >$out.tmp"; print STDERR "+ $cmd_m\n"; -- 2.30.2