]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
build-sys: make man pages optional, add --disable-asciidoc
authorKarel Zak <kzak@redhat.com>
Tue, 6 Apr 2021 15:17:42 +0000 (17:17 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 6 Apr 2021 15:22:36 +0000 (17:22 +0200)
* don't use dist_noinst_DATA= for generated man pages (use man_MANS=)

* make asciidoctor optional

* add --disable-asciidoc to explicitly disable man pages

Addresses: https://github.com/karelzak/util-linux/issues/1257
Signed-off-by: Karel Zak <kzak@redhat.com>
Makefile.am
configure.ac
sys-utils/Makemodule.am

index 48e89559b907253b291c03d03b16cad5dd002499..aa2041f2ccb7ee2f9f99be01d849e933edf3b350 100644 (file)
@@ -28,12 +28,6 @@ LDADD = $(LTLIBINTL)
 
 LIB_FUZZING_ENGINE ?= -fsanitize=fuzzer
 
-# Automake (at least up to 1.10) mishandles dist_man_MANS inside conditionals.
-# Unlike with other dist primaries, the files are not distributed if the
-# conditional is false.
-# Work the bug around until it is fixed:
-dist_noinst_DATA = $(dist_man_MANS)
-
 # Paths to in-tree libraries (use ul_ prefix to avoid possible collisions) Note
 # that blkid.h, libmount.h, libfdisk.h and libsmartcols.h are generated and
 # stored in build dirs.
@@ -52,7 +46,6 @@ noinst_PROGRAMS =
 EXTRA_LTLIBRARIES =
 usrbin_exec_PROGRAMS =
 usrsbin_exec_PROGRAMS =
-dist_man_MANS =
 man_MANS =
 pkgconfig_DATA =
 usrlib_exec_LTLIBRARIES =
@@ -196,18 +189,19 @@ $(PATHFILES): Makefile
        @ mv $@.tmp $@
 
 
+CLEANFILES += $(MANPAGES) $(MANLINKS)
+EXTRA_DIST += $(MANPAGES:=.adoc) $(MANPAGES_EXTRA)
+
+if ENABLE_ASCIIDOC
+man_MANS += $(MANPAGES) $(MANLINKS)
+
+$(MANPAGES): $(MANPAGES_EXTRA) Makefile
+
 asciidoc_man_cmd = $(ASCIIDOCTOR) \
        -b manpage \
        -a 'VERSION=$(VERSION)' \
        -a 'ADJTIME_PATH=$(ADJTIME_PATH)'
 
-dist_man_MANS += $(MANPAGES) $(MANLINKS)
-
-CLEANFILES += $(dist_man_MANS)
-EXTRA_DIST += $(MANPAGES:=.adoc) $(MANPAGES_EXTRA)
-
-$(MANPAGES): $(MANPAGES_EXTRA) Makefile
-
 SUFFIXES = .1.adoc .3.adoc .5.adoc .8.adoc .1 .3 .5 .8
 .1.adoc.1 .3.adoc.3 .5.adoc.5 .8.adoc.8:
        $(AM_V_GEN) test -f ./$@ || \
@@ -216,8 +210,11 @@ SUFFIXES = .1.adoc .3.adoc .5.adoc .8.adoc .1 .3 .5 .8
                                    --destination-dir $(abs_builddir)/$$(dirname $@) $<
 
 $(MANLINKS): $(MANPAGES)
+gen-man: $(man_MANS)
 
-gen-man: $(dist_man_MANS)
+else
+gen-man:
+endif
 
 
 # Arrange so that .tarball-version appears only in the distribution
@@ -283,6 +280,7 @@ DISTCHECK_CONFIGURE_FLAGS = \
        --with-bashcompletiondir=$$dc_install_base/$(bashcompletiondir) \
        --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
 
+
 BUILT_SOURCES = .version
 .version:
        echo $(VERSION) > $@-t && mv $@-t $@
index 946222676e08e52c5a7e765328ed8c76ebfc942a..909be6dbcb511769375db5138346157ae5fb5df9 100644 (file)
@@ -232,7 +232,23 @@ PKG_INSTALLDIR(['${usrlib_execdir}/pkgconfig'])
 
 GTK_DOC_CHECK([1.10])
 AC_PATH_PROG([XSLTPROC], [xsltproc])
-AC_PATH_PROG([ASCIIDOCTOR], [asciidoctor])
+
+
+AC_ARG_ENABLE([asciidoc],
+  AS_HELP_STRING([--disable-asciidoc], [do not generate man pages from asciidoc]),
+  [], [enable_asciidoc=check]
+)
+
+AS_IF([test "x$enable_asciidoc" = xno], [
+  AM_CONDITIONAL([ENABLE_ASCIIDOC], [false])
+], [
+  AC_PATH_PROG([ASCIIDOCTOR], [asciidoctor])
+  AS_IF([test "x$enable_asciidoc" = xyes && "x$ASCIIDOCTOR" = x], [
+    AC_MSG_ERROR([AsciiDoc requested but asciidoctor not found])
+  ])
+  AM_CONDITIONAL([ENABLE_ASCIIDOC], [test  "x$ASCIIDOCTOR" != x])
+])
+
 
 linux_os=no
 bsd_os=no
index baad296ecf24d42fe234853c5f8bf323cb91c359..b96e0063052c305b0f33479e0cfb76434ca6529f 100644 (file)
@@ -222,7 +222,10 @@ if ARCH_HPPA
 SETARCH_LINKS += parisc parisc64 parisc32
 endif
 
+if ENABLE_ASCIIDOC
 SETARCH_MAN_LINKS = $(addprefix sys-utils/,$(SETARCH_LINKS:=.8))
+endif
+
 man_MANS += $(SETARCH_MAN_LINKS)
 CLEANFILES += $(SETARCH_MAN_LINKS)