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
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
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
--- /dev/null
+#!/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 (<L>) {
+ next unless m{^\s*SPDX-License-Identifier:\s+(\S.*?)\s*$};
+ print "<!-- $out $1, see $lic-->\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 $!;