[PATCH 09/13] build: Replace variables in man pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We can't use eg. @sysconfdir@ directly in the .pod file, because
pod2man(1) will interpret that as a variable name and format it
accordingly.

Instead, we use eg. SYSCONFDIR and use a subsequent sed(1) call
to turn it into the expected @sysconfdir@.
---
 daemon/Makefile.am | 10 ++++++++--
 src/Makefile.am    | 20 ++++++++++++++++----
 tools/Makefile.am  | 20 ++++++++++++++++----
 3 files changed, 40 insertions(+), 10 deletions(-)

diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 9a8b8d1..a4c4758 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -518,8 +518,14 @@ endif ! WITH_LIBVIRTD
 POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)"
 
 %.8.in: %.pod
-	$(AM_V_GEN)$(POD2MAN) --section=8 $< $@ \
-		&& if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi
+	$(AM_V_GEN)$(POD2MAN) --section=8 $< $@-t1 && \
+	if grep 'POD ERROR' $@-t1; then rm $@-t1; exit 1; fi && \
+	sed \
+		-e 's|SYSCONFDIR|\@sysconfdir\@|g' \
+		-e 's|LOCALSTATEDIR|\@localstatedir\@|g' \
+		< $@-t1 > $@-t2 && \
+	rm -f $@-t1 && \
+	mv $@-t2 $@
 
 %.8: %.8.in $(top_srcdir)/configure.ac
 	$(AM_V_GEN)sed \
diff --git a/src/Makefile.am b/src/Makefile.am
index 73e4026..aee9c6e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2563,12 +2563,24 @@ virtlogd.init: logging/virtlogd.init.in $(top_builddir)/config.status
 POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)"
 
 virtlockd.8.in: locking/virtlockd.pod
-	$(AM_V_GEN)$(POD2MAN) --section 8 $< $@ \
-		&& if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi
+	$(AM_V_GEN)$(POD2MAN) --section=8 $< $@-t1 && \
+	if grep 'POD ERROR' $@-t1; then rm $@-t1; exit 1; fi && \
+	sed \
+		-e 's|SYSCONFDIR|\@sysconfdir\@|g' \
+		-e 's|LOCALSTATEDIR|\@localstatedir\@|g' \
+		< $@-t1 > $@-t2 && \
+	rm -f $@-t1 && \
+	mv $@-t2 $@
 
 virtlogd.8.in: logging/virtlogd.pod
-	$(AM_V_GEN)$(POD2MAN) --section 8 $< $@ \
-		&& if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi
+	$(AM_V_GEN)$(POD2MAN) --section=8 $< $@-t1 && \
+	if grep 'POD ERROR' $@-t1; then rm $@-t1; exit 1; fi && \
+	sed \
+		-e 's|SYSCONFDIR|\@sysconfdir\@|g' \
+		-e 's|LOCALSTATEDIR|\@localstatedir\@|g' \
+		< $@-t1 > $@-t2 && \
+	rm -f $@-t1 && \
+	mv $@-t2 $@
 
 %.8: %.8.in $(top_srcdir)/configure.ac
 	$(AM_V_GEN)sed \
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 3ea25a4..254e667 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -280,12 +280,24 @@ endif WITH_WIN_ICON
 POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)"
 
 %.1.in: %.pod
-	$(AM_V_GEN)$(POD2MAN) $< $@ \
-		&& if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi
+	$(AM_V_GEN)$(POD2MAN) $< $@-t1 && \
+	if grep 'POD ERROR' $@-t1; then rm $@-t1; exit 1; fi && \
+	sed \
+		-e 's|SYSCONFDIR|\@sysconfdir\@|g' \
+		-e 's|LOCALSTATEDIR|\@localstatedir\@|g' \
+	< $@-t1 > $@-t2 && \
+	rm -f $@-t1 && \
+	mv $@-t2 $@
 
 %.8.in: %.pod
-	$(AM_V_GEN)$(POD2MAN) --section=8 $< $@ \
-		&& if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi
+	$(AM_V_GEN)$(POD2MAN) --section=8 $< $@-t1 && \
+	if grep 'POD ERROR' $@-t1; then rm $@-t1; exit 1; fi && \
+	sed \
+		-e 's|SYSCONFDIR|\@sysconfdir\@|g' \
+		-e 's|LOCALSTATEDIR|\@localstatedir\@|g' \
+		< $@-t1 > $@-t2 && \
+	rm -f $@-t1 && \
+	mv $@-t2 $@
 
 %.1: %.1.in $(top_srcdir)/configure.ac
 	$(AM_V_GEN)sed \
-- 
2.5.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]