man/produce_html: use shlib
authorng0 <ng0@n0.is>
Mon, 25 Nov 2019 21:51:56 +0000 (21:51 +0000)
committerng0 <ng0@n0.is>
Mon, 25 Nov 2019 21:51:56 +0000 (21:51 +0000)
doc/man/Makefile.am
doc/man/produce_html.sh [deleted file]
doc/man/produce_html.sh.in [new file with mode: 0755]

index e60d114134cfb9f9528880acf52e1387e3be3051..69e42bc9d574c6ff4d768e5f00c9120437bd63e9 100644 (file)
@@ -5,6 +5,8 @@ do_subst = $(SED) -e 's,[@]SYSCONFDIR[@],$(sysconfdir),g'
 gnunet.conf.5: gnunet.conf.5.in Makefile
        $(do_subst) < $(srcdir)/gnunet.conf.5.in > gnunet.conf.5
 
+do_subst_pkgdatadir = $(SED) -e 's,[@]pkgdatadir[@],$(pkgdatadir),g'
+
 CLEANFILES = gnunet.conf.5
 
 if TEXI2MDOC_GENERATION
@@ -25,8 +27,13 @@ if HAVE_MANDOC
 # that this is the most portable way to achieve what
 # I want and that the alternatives are depressing and
 # nonfunctional.
+produce_html.sh: produce_html.sh.in Makefile
+       $(do_subst_pkgdatadir) < $(srcdir)/produce_html.sh.in > produce_html.sh
+
+CLEANFILES += produce_html.sh
+
 .PHONY: man-html
-man-html:
+man-html: produce_html.sh
        $(SH) $(srcdir)/produce_html.sh
 
 htmldocdir = $(datadir)/doc/gnunet/manhtml/
@@ -96,4 +103,5 @@ endif
 
 EXTRA_DIST = ${man_MANS} \
  gnunet.conf.5.in \
+ produce_html.sh.in \
  README
diff --git a/doc/man/produce_html.sh b/doc/man/produce_html.sh
deleted file mode 100755 (executable)
index ce6dea3..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-existence()
-{
-    command -v "$1" >/dev/null 2>&1
-}
-
-if existence mandoc;
-then
-    for f in `find . -name \*\.[1-9]`;
-    do
-        mandoc -T html $f > $f.html;
-    done
-fi
diff --git a/doc/man/produce_html.sh.in b/doc/man/produce_html.sh.in
new file mode 100755 (executable)
index 0000000..3f45207
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. @pkgdatadir@/existence.sh
+
+if existence mandoc;
+then
+    for f in `find . -name \*\.[1-9]`;
+    do
+        mandoc -T html $f > $f.html;
+    done
+fi