summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-02-20 18:06:45 +0100
committerHarald Welte <laforge@gnumonks.org>2016-02-20 18:28:37 +0100
commit5fcea8028d907ec285ef4306b35997db7da953b2 (patch)
tree7ad0d62d969aae607b5cc975ba19b1393d2801b2 /build
parent593eaf617354291f14e99e2173ce97835b0e3c8b (diff)
Ensure the git version + commit date ends up in PDF
This is a bit awkward, as the 'revnumber' asciidoc variable so far doesn't seem to end up in the docbook-xml. We now put it into 'releaseinfo' which gets then put into \DBKreleeaseinfo by dblatex. makefile watermark fixup
Diffstat (limited to 'build')
-rw-r--r--build/Makefile.asciidoc.inc17
-rw-r--r--build/custom-dblatex.sty2
-rw-r--r--build/docinfo-releaseinfo.conf5
3 files changed, 23 insertions, 1 deletions
diff --git a/build/Makefile.asciidoc.inc b/build/Makefile.asciidoc.inc
index 73fa981..1a77419 100644
--- a/build/Makefile.asciidoc.inc
+++ b/build/Makefile.asciidoc.inc
@@ -1,5 +1,8 @@
BUILDDIR = $(TOPDIR)/build
+GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always --tags)
+GIT_DATE := $(shell date -d @`git log -n 1 "--pretty=%at" ../.` "+%Y-%b-%e")
+
# prepend the document name with the version numbe suffix
#DOCS_VER = $(foreach P, $(ASCIIDOCS), $(P)-v$(shell xmllint --recover --xpath "//revnumber[position()=last()]/text()" $(P)-docinfo.xml 2>/dev/null))
#PDFS = $(DOCS_VER:%=%.pdf)
@@ -11,7 +14,19 @@ ASCIIDOCSTYLE ?= $(BUILDDIR)/custom-dblatex.sty
cleanfiles += $(ASCIIDOCPDFS)
+ASCIIDOC_OPTS := -f $(BUILDDIR)/mscgen-filter.conf -f $(BUILDDIR)/diag-filter.conf -f $(BUILDDIR)/docinfo-releaseinfo.conf
+DBLATEX_OPTS := -s $(ASCIIDOCSTYLE) -P draft.mode=yes
+
+ifeq (,$(BUILD_RELEASE))
+ DBLATEX_OPTS += -P draft.watermark=1
+else
+ DBLATEX_OPTS += -P draft.watermark=0
+endif
+
+A2X_OPTS := -L --asciidoc-opts="$(ASCIIDOC_OPTS)" --dblatex-opts="$(DBLATEX_OPTS)" -a docinfo -a revnumber="$(GIT_VERSION)" -a revdate="$(GIT_DATE)"
+
+
all: $(ASCIIDOCPDFS)
$(ASCIIDOCPDFS): %.pdf: %.adoc %-docinfo.xml $(ASCIIDOCSTYLE) $(TOPDIR)/common/chapters/*.adoc
- a2x -L --asciidoc-opts="-f $(BUILDDIR)/mscgen-filter.conf -f $(BUILDDIR)/diag-filter.conf" --dblatex-opts=" -s $(ASCIIDOCSTYLE)" -a docinfo $< || asciidoc -f $(BUILDDIR)/mscgen-filter.conf -f $(BUILDDIR)/diag-filter.conf $<
+ a2x $(A2X_OPTS) $< || asciidoc -f $(BUILDDIR)/mscgen-filter.conf -f $(BUILDDIR)/diag-filter.conf $<
diff --git a/build/custom-dblatex.sty b/build/custom-dblatex.sty
index 80c1d5f..290f6a1 100644
--- a/build/custom-dblatex.sty
+++ b/build/custom-dblatex.sty
@@ -67,6 +67,8 @@
% left footer
\def\DBKpublisher{}
+\def\releasebox{\DBKreleaseinfo, \DBKdate}
+
\def\maketitle{
\DBKcover
\DBKcopyright
diff --git a/build/docinfo-releaseinfo.conf b/build/docinfo-releaseinfo.conf
new file mode 100644
index 0000000..b5bc642
--- /dev/null
+++ b/build/docinfo-releaseinfo.conf
@@ -0,0 +1,5 @@
+[+docinfo]
+# this ensures that the asciidoc 'revnumber' ends up in some docbook-xml
+# tag, from where we can then subsequently pick it up via the dblatex
+# stylesheet.
+<releaseinfo>{revnumber}</releaseinfo>