From 92b5dd3e07b24e7d95cc7c2780c0429878cc695b Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 13 Sep 2020 23:46:50 +0100 Subject: [PATCH] wip library generation Signed-off-by: Ian Jackson --- Makefile | 12 +++++++++--- library/wikimedia.toml | 2 +- usvg-processor | 25 +++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 4 deletions(-) create mode 100755 usvg-processor diff --git a/Makefile b/Makefile index fd74ab40..befb0926 100644 --- a/Makefile +++ b/Makefile @@ -8,11 +8,11 @@ SHELL=/bin/bash -default: debug +default: debug libraries CARGO ?= cargo CARGO_TARGET_DIR ?= target -USVG ?= USVG +USVG ?= usvg ifneq (,$(wildcard(../Cargo.nail))) NAILING_CARGO = nailing-cargo @@ -23,7 +23,7 @@ BUNDLE_SOURCES_DIR = ../bundle-sources BUNDLE_SOURCES = ../Build/bundle-sources/target/debug/bundle-rust-sources USVG_BINARY = ../resvg/target/release/usvg -USVG = $(NAILING_CARGO) -- $(USVG) +USVG = $(NAILING_CARGO) --- $(USVG_BINARY) # To build usvg # zealot:resvg$ nailing-cargo build -p usvg --release @@ -34,6 +34,12 @@ $(BUNDLE_SOURCES): endif endif +include $(wildcard library/*/files.make) + +LIBRARY_PROCESS_SVG = ./usvg-processor $@ $^ '$(USVG)' + +libraries: $(LIBRARY_FILES) + debug release:: %: $(CARGO_TARGET_DIR)/%/server templates/script.js extra-% @echo Built $@. .PHONY: $(CARGO_TARGET_DIR)/debug/server diff --git a/library/wikimedia.toml b/library/wikimedia.toml index cb17ecda..d09b80b8 100644 --- a/library/wikimedia.toml +++ b/library/wikimedia.toml @@ -18,7 +18,7 @@ data_url_hashprefix = true outline.Circle = { } size = [45] scale = 0.20 -shift = [22.5, 22.5] +centre = [22.5, 22.5] category = "chess" stem_prefix = "Chess_" files = """ diff --git a/usvg-processor b/usvg-processor new file mode 100755 index 00000000..51e82849 --- /dev/null +++ b/usvg-processor @@ -0,0 +1,25 @@ +#!/usr/bin/perl -w + +use strict; + +die unless @ARGV == 4; +our ($out, $in, $lic, $usvg) = @ARGV; + +open STDOUT, '>', "$out.tmp" or die $!; +open L, '<', $lic or die $!; +open STDIN, "<", $in or die $!; + +sub add_lic () { + while () { + next unless m{^\s*SPDX-License-Identifier:\s+(\S.*?)\s*$}; + print "\n" or die $!; + return; + } + die "no spdx in $lic ?"; +} + +add_lic(); + +flush STDOUT or die $!; +$!=0; $?=0; system qw(sh -ec), "exec $usvg -c -" and die "exec usvg: $? $!"; +rename "$out.tmp", $out or die $!; -- 2.30.2