#!/usr/bin/make -f # resolve DEB_DISTRIBUTION DEB_VERSION_UPSTREAM include /usr/share/dpkg/pkg-info.mk # resolve if release is experimental DEB_SUITE_EXP = $(filter experimental% UNRELEASED,$(DEB_DISTRIBUTION)) # generate documentation unless nodoc requested DOCS_stem = README $(basename $(wildcard docs/*.md crates/*/*.md)) ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS))) DOCS = $(addsuffix .html,$(DOCS_stem)) $(addsuffix .txt,$(DOCS_stem)) DOCS += crates/usvg/docs/spec.html CHANGELOGS = CHANGELOG.html CHANGELOG.txt MANPAGES = debian/resvg.1 debian/usvg.1 endif export DEB_BUILD_MAINT_OPTIONS = hardening=+all export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic export DEB_CXXFLAGS_MAINT_APPEND = -Wall -pedantic # trust upstream optimization level unless explicitly disabled ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) export DEB_CFLAGS_MAINT_STRIP = -O2 export DEB_CXXFLAGS_MAINT_STRIP = -O2 endif # generate manual pages from output of clap-based Rust binary # arguments: 1:MANFILEPATH 2:COMMANDPATH 3:SUBCOMMAND(S) _help2man = \ $(eval suffix = $(lastword $(subst ., ,$(1))))\ $(eval stem = $(patsubst %.$(suffix),%,$(1)))\ help2man --section $(suffix) --no-info \ --version-string='$(DEB_VERSION_UPSTREAM)' \ --name $(shell $(2) $(3) --help | head --lines=1 | xargs -0 shell-quote --) \ --output '$(stem)$(if $(3),-$(subst $() ,-,$(strip $(3)))).$(suffix)' \ '$(2)$(if $(3), $(3))' \ || { $(2) $(3) --help; false; } #SONAME=libresvg.so.0 pods = $(wildcard debian/*.pod) manpages = $(pods:.pod=.1) #execute_after_dh_auto_install: # ln -sf $(SONAME) debian/tmp/usr/lib/*/libresvg.so TEST_BROKEN = \ render::structure_style_rule_specificity \ BINARY_FILES_ADD = \ crates/resvg/tests/tests/text/text/glyph-splitting.png %: dh $@ %.html: %.adoc asciidoctor -a webfonts! $< %.html: %.md cmark-gfm $< > $@ %.txt: %.md cmark-gfm --to plaintext $< > $@ # override binary files during build execute_after_dh_auto_configure: set -e; \ for f in $(BINARY_FILES_ADD); do \ cp -f debian/patches/*/$$(basename "$$f") "$$f"; \ done execute_after_dh_auto_build: $(DOCS) $(CHANGELOGS) override_dh_auto_test: dh_auto_test --buildsystem rust -- \ --no-fail-fast -- $(addprefix --skip ,$(TEST_BROKEN)) $(if $(DEB_SUITE_EXP),\ dh_auto_test --buildsystem rust -- --no-fail-fast || true) execute_after_dh_auto_install-arch: $(MANPAGES) override_dh_installchangelogs: dh_installchangelogs -- $(CHANGELOGS) # restore binary files overridden during build execute_after_dh_auto_clean: set -e; \ for f in $(BINARY_FILES_ADD); do \ rm -f "$$f"; \ done # build manpages debian/resvg.1: debian/%.1: debian/resvg/usr/bin/% $(call _help2man,$@,$<) debian/usvg.1: debian/%.1: debian/usvg/usr/bin/% $(call _help2man,$@,$<) #execute_after_dh_strip: # patchelf --set-soname $(SONAME) debian/libresvg*/usr/lib/*/$(SONAME)