Skip to content

Commit 8c45b56

Browse files
authored
Merge pull request #2976 from jimklimov/issue-nut-website-60
Fix generation of `docs/man/linkman*.txt` files
2 parents f260d28 + 30b1bd5 commit 8c45b56

File tree

8 files changed

+279
-57
lines changed

8 files changed

+279
-57
lines changed

Makefile.am

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,9 @@ all-recursive/scripts: all/scripts/Windows
442442
# tweak paths not using ${prefix} so `make distcheck` fails for it as
443443
# it does not play with a `DESTDIR` either.
444444

445-
DISTCHECK_FLAGS = --with-all --with-ssl --with-doc=auto --with-pynut=app --with-nut_monitor=force CXXFLAGS='@NUT_CONFIG_CXXFLAGS@' CFLAGS='@NUT_CONFIG_CFLAGS@' CPPFLAGS='@NUT_CONFIG_CPPFLAGS@' LDFLAGS='@NUT_CONFIG_LDFLAGS@'
446-
DISTCHECK_LIGHT_FLAGS = --with-all=auto --with-ssl=auto --with-doc=auto --with-pynut=app --with-nut_monitor=force CXXFLAGS='@NUT_CONFIG_CXXFLAGS@' CFLAGS='@NUT_CONFIG_CFLAGS@' CPPFLAGS='@NUT_CONFIG_CPPFLAGS@' LDFLAGS='@NUT_CONFIG_LDFLAGS@'
447-
DISTCHECK_LIGHT_MAN_FLAGS = --with-all=auto --with-ssl=auto --with-doc=man --with-pynut=app --with-nut_monitor=force CXXFLAGS='@NUT_CONFIG_CXXFLAGS@' CFLAGS='@NUT_CONFIG_CFLAGS@' CPPFLAGS='@NUT_CONFIG_CPPFLAGS@' LDFLAGS='@NUT_CONFIG_LDFLAGS@'
445+
DISTCHECK_FLAGS = --with-all --with-ssl --with-doc=auto --enable-docs-man-for-progs-built-only=no --with-pynut=app --with-nut_monitor=force CXXFLAGS='@NUT_CONFIG_CXXFLAGS@' CFLAGS='@NUT_CONFIG_CFLAGS@' CPPFLAGS='@NUT_CONFIG_CPPFLAGS@' LDFLAGS='@NUT_CONFIG_LDFLAGS@'
446+
DISTCHECK_LIGHT_FLAGS = --with-all=auto --with-ssl=auto --with-doc=auto --enable-docs-man-for-progs-built-only=no --with-pynut=app --with-nut_monitor=force CXXFLAGS='@NUT_CONFIG_CXXFLAGS@' CFLAGS='@NUT_CONFIG_CFLAGS@' CPPFLAGS='@NUT_CONFIG_CPPFLAGS@' LDFLAGS='@NUT_CONFIG_LDFLAGS@'
447+
DISTCHECK_LIGHT_MAN_FLAGS = --with-all=auto --with-ssl=auto --with-doc=man --enable-docs-man-for-progs-built-only=no --with-pynut=app --with-nut_monitor=force CXXFLAGS='@NUT_CONFIG_CXXFLAGS@' CFLAGS='@NUT_CONFIG_CFLAGS@' CPPFLAGS='@NUT_CONFIG_CPPFLAGS@' LDFLAGS='@NUT_CONFIG_LDFLAGS@'
448448
DISTCHECK_VALGRIND_FLAGS = --with-all=auto --with-ssl=auto --with-doc=skip --with-valgrind CXXFLAGS='@NUT_CONFIG_CXXFLAGS@ -g' CFLAGS='@NUT_CONFIG_CFLAGS@ -g' CPPFLAGS='@NUT_CONFIG_CPPFLAGS@' LDFLAGS='@NUT_CONFIG_LDFLAGS@' --with-pynut=app --with-nut_monitor=force
449449

450450
# Note: this rule uses envvar DISTCHECK_FLAGS expanded at run-time

ci_build.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,6 +1534,10 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-al
15341534
CONFIG_OPTS+=("--enable-inplace-runtime")
15351535
fi
15361536

1537+
# If we end up building and/or installing documentation, do
1538+
# parse all files (even if we do not build some programs here)
1539+
CONFIG_OPTS+=("--enable-docs-man-for-progs-built-only=no")
1540+
15371541
# TODO: Consider `--enable-maintainer-mode` to add recipes that
15381542
# would quickly regenerate Makefile(.in) if you edit Makefile.am
15391543
# TODO: Resolve port-collision reliably (for multi-executor agents)
@@ -2540,6 +2544,10 @@ bindings)
25402544
*) CONFIG_OPTS+=("--with-doc=skip") ;;
25412545
esac
25422546

2547+
# If we end up building and/or installing documentation, do
2548+
# parse all files (even if we do not build some programs here)
2549+
CONFIG_OPTS+=("--enable-docs-man-for-progs-built-only=no")
2550+
25432551
detect_platform_PKG_CONFIG_PATH_and_FLAGS
25442552
if [ -n "$PKG_CONFIG_PATH" ] ; then
25452553
CONFIG_OPTS+=("PKG_CONFIG_PATH=${PKG_CONFIG_PATH}")

configure.ac

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2486,6 +2486,8 @@ dnl the usual builds can pass by default on systems without asciidoc.
24862486
NUT_ARG_WITH([docs], [build and install documentation (alias to --with-doc)], [man=auto])
24872487
NUT_ARG_WITH([doc], [build and install documentation (see docs/configure.txt for many variants of the option)], [${nut_with_docs}])
24882488

2489+
NUT_ARG_ENABLE([docs-man-for-progs-built-only], [build and install man pages (if enabled) only for built programs (yes, default) or all known pages (no)], [yes])
2490+
24892491
dnl Different OS distributions have different layouts of man page section
24902492
dnl numbers. The one we treat as default seems to be most wide-spread, in
24912493
dnl Linux and FreeBSD. For others, there are other defaults (see `man man`
@@ -3616,6 +3618,7 @@ dnl (so enable the Makefile recipes for those targets if tools are available)
36163618
NUT_CHECK_ASCIIDOC
36173619

36183620
DOC_INSTALL_DISTED_MANS=no
3621+
DOC_INSTALL_SELECTED_MANS=""
36193622
KNOWN_UNABLE_MANS=no
36203623

36213624
case "${nut_with_doc}" in
@@ -3691,12 +3694,14 @@ for nut_doc_build_target in $nut_doc_build_list; do
36913694
nut_doc_build_target_flag="yes"
36923695
;;
36933696
esac
3697+
36943698
case "${nut_doc_build_target_flag}" in
36953699
yes|no|auto|skip|dist-auto) ;;
36963700
"") nut_doc_build_target_flag="yes" ;;
36973701
*) rm -rf "${DOCTESTDIR}"
36983702
AC_MSG_ERROR([Invalid documentation format option: ${nut_doc_build_target}]) ;;
36993703
esac
3704+
37003705
AC_MSG_CHECKING([desire and ability to build ${nut_doc_build_target_base} documentation])
37013706
AC_MSG_RESULT([${nut_doc_build_target_flag}])
37023707

@@ -3786,19 +3791,22 @@ dnl not fail if we have no tools to generate it (so add to SKIP list).
37863791
dnl Experimental support for --with-doc=man=dist-auto to prefer pre-disted docs if available, below
37873792
AC_MSG_CHECKING([if we can build ${nut_doc_build_target_base}])
37883793
can_build_doc_man=no
3789-
if test x"${nut_doc_build_target}" = x"man=dist-auto" || test "${nut_doc_build_target_flag}" = "dist-auto"; then
3794+
if test x"${nut_doc_build_target}" = x"man=dist-auto" || test x"${nut_doc_build_target_flag}" = x"dist-auto"; then
37903795
want_disted_doc_man=yes
37913796
fi
37923797
if test "${nut_have_asciidoc}" = yes ; then
37933798
( cd "$DOCTESTDIR" && ${A2X} --format manpage --destination-dir=. --xsltproc-opts="--nonet" "${abs_srcdir}"/docs/man/snmp-ups.txt && test -s snmp-ups.8 ) && can_build_doc_man=yes
37943799
rm -f "${DOCTESTDIR}"/snmp-ups.8
37953800
fi
3801+
can_install_doc_man=no
37963802
if test "${want_disted_doc_man}" = yes && ( test "${have_disted_doc_man}" = yes || test "${have_disted_doc_man}" = yes-placeholder ) ; then
37973803
AC_MSG_NOTICE([Requested, and can, install pre-built distributed copies of ${nut_doc_build_target_base} documentation])
37983804
DOC_SKIPBUILD_LIST="${DOC_SKIPBUILD_LIST} ${nut_doc_build_target_base}"
37993805
DOC_INSTALL_DISTED_MANS="yes"
3800-
dnl Avoid rebuilding existing build products due to their timestamp dependencies:
3806+
dnl Avoid rebuilding existing build products due to their timestamp dependencies;
3807+
dnl ignore "touch" errors due to e.g. read-only sources (distcheck, ISO image, etc.):
38013808
touch -r "${abs_srcdir}"/docs/man/Makefile.am "${abs_srcdir}"/docs/man/*.{1,2,3,4,5,6,7,8,9}* "${abs_srcdir}"/docs/man/*.{txt,xml,html,pdf} || true
3809+
can_install_doc_man=yes
38023810
else
38033811
if test "${can_build_doc_man}" = yes ; then
38043812
AC_MSG_RESULT(yes)
@@ -3807,6 +3815,7 @@ dnl not fail if we have no tools to generate it (so add to SKIP list).
38073815
dnl is satisfied that directory "man" exists:
38083816
[DOC_BUILD_LIST="${DOC_BUILD_LIST} man-man"],
38093817
[DOC_BUILD_LIST="${DOC_BUILD_LIST} ${nut_doc_build_target_base}"])
3818+
can_install_doc_man=yes
38103819
else
38113820
AC_MSG_RESULT(no)
38123821
DOC_CANNOTBUILD_LIST="${DOC_CANNOTBUILD_LIST} ${nut_doc_build_target_base}"
@@ -3815,17 +3824,36 @@ dnl not fail if we have no tools to generate it (so add to SKIP list).
38153824
AC_MSG_WARN([Unable to build ${nut_doc_build_target_base} documentation which you requested; will reflect on this below])
38163825
else
38173826
DOC_SKIPBUILD_LIST="${DOC_SKIPBUILD_LIST} ${nut_doc_build_target_base}"
3818-
if test "${nut_doc_build_target_flag}" = "auto" || test "${nut_doc_build_target_flag}" = "dist-auto" ; then
3827+
case "${nut_doc_build_target_flag}" in
3828+
no|skip) ;;
3829+
auto|dist-auto)
38193830
if test "${have_disted_doc_man}" = yes || test "${have_disted_doc_man}" = yes-placeholder ; then
38203831
AC_MSG_WARN([Unable to build ${nut_doc_build_target_base} documentation, but can install pre-built distributed copies])
38213832
DOC_INSTALL_DISTED_MANS="yes"
3833+
can_install_doc_man=yes
38223834
else
3823-
AC_MSG_WARN([Unable to build ${nut_doc_build_target_base} documentation, and unable to install pre-built distributed copies because they are absent])
3835+
AC_MSG_WARN([Unable to build ${nut_doc_build_target_base} documentation, and unable to install pre-built distributed copies because they are absent; will reflect on this below])
38243836
fi
3825-
fi # Other variants include "no", "skip"...
3837+
;;
3838+
*)
3839+
AC_MSG_ERROR([Unexpected flag value '${nut_doc_build_target_flag}' for ${nut_doc_build_target_base} documentation])
3840+
;;
3841+
esac
38263842
fi
38273843
fi
38283844
fi
3845+
3846+
if test "${can_install_doc_man}" = yes ; then
3847+
case "${nut_enable_docs_man_for_progs_built_only}" in
3848+
yes)
3849+
dnl Legacy default for auto builds: build/deliver only mans for built progs:
3850+
DOC_INSTALL_SELECTED_MANS="mans-progs-built"
3851+
;;
3852+
no)
3853+
DOC_INSTALL_SELECTED_MANS="mans-progs-all"
3854+
;;
3855+
esac
3856+
fi
38293857
;;
38303858

38313859
*) rm -rf "${DOCTESTDIR}"
@@ -3836,9 +3864,11 @@ done
38363864
rm -rf "${DOCTESTDIR}"
38373865

38383866
AS_IF([test x"${nut_enable_configure_debug}" = xyes], [
3839-
AC_MSG_NOTICE([(CONFIGURE-DEVEL-DEBUG) DOC_BUILD_LIST: '${DOC_BUILD_LIST}'])
3840-
AC_MSG_NOTICE([(CONFIGURE-DEVEL-DEBUG) DOC_CANNOTBUILD_LIST: '${DOC_CANNOTBUILD_LIST}'])
3841-
AC_MSG_NOTICE([(CONFIGURE-DEVEL-DEBUG) DOC_SKIPBUILD_LIST: '${DOC_SKIPBUILD_LIST}'])
3867+
AC_MSG_NOTICE([(CONFIGURE-DEVEL-DEBUG) DOC_BUILD_LIST: '${DOC_BUILD_LIST}'])
3868+
AC_MSG_NOTICE([(CONFIGURE-DEVEL-DEBUG) DOC_CANNOTBUILD_LIST: '${DOC_CANNOTBUILD_LIST}'])
3869+
AC_MSG_NOTICE([(CONFIGURE-DEVEL-DEBUG) DOC_SKIPBUILD_LIST: '${DOC_SKIPBUILD_LIST}'])
3870+
AC_MSG_NOTICE([(CONFIGURE-DEVEL-DEBUG) DOC_INSTALL_DISTED_MANS: '${DOC_INSTALL_DISTED_MANS}'])
3871+
AC_MSG_NOTICE([(CONFIGURE-DEVEL-DEBUG) DOC_INSTALL_SELECTED_MANS: '${DOC_INSTALL_SELECTED_MANS}'])
38423872
])
38433873

38443874
case "${nut_with_doc}" in
@@ -3880,7 +3910,7 @@ esac
38803910

38813911
AM_CONDITIONAL(WITH_PDF_NONASCII_TITLES, [test x"$can_build_doc_pdf_nonascii_titles" = xyes])
38823912

3883-
NUT_REPORT_FEATURE([would build specific documentation format(s)], [${nut_with_doc}], [${DOC_BUILD_LIST}],
3913+
NUT_REPORT_FEATURE([would build specific documentation format(s)], [${nut_with_doc}], [${DOC_BUILD_LIST} ${DOC_INSTALL_SELECTED_MANS}],
38843914
[WITH_DOCS], [Define to enable overall documentation generation], [-])
38853915

38863916
# To cater for less portable make's, precalculate the target list
@@ -3913,6 +3943,11 @@ AM_CONDITIONAL(WITH_MANS, test "${WITH_MANS}" = "yes")
39133943
AM_CONDITIONAL(SKIP_MANS, test "${SKIP_MANS}" = "yes")
39143944
AM_CONDITIONAL(KNOWN_UNABLE_MANS, test "${KNOWN_UNABLE_MANS}" = "yes")
39153945
AM_CONDITIONAL(DOC_INSTALL_DISTED_MANS, test "${DOC_INSTALL_DISTED_MANS}" = "yes")
3946+
dnl TOTHINK: Expand more flexibly? Currently we either (build and) install
3947+
dnl all known man pages, or only those for programs we currently build,
3948+
dnl so a boolean-ish toggle suffices.
3949+
dnl AM_CONDITIONAL(DOC_INSTALL_SELECTED_MANS_PROGS_ALL, test x"${DOC_INSTALL_SELECTED_MANS}" = x"mans-progs-all")
3950+
AM_CONDITIONAL(DOC_INSTALL_SELECTED_MANS_PROGS_BUILT, test x"${DOC_INSTALL_SELECTED_MANS}" = x"mans-progs-built")
39163951
dnl Reporting have_disted_doc_man not DOC_INSTALL_DISTED_MANS because the former has more values
39173952
AS_IF([test x"${have_disted_doc_man}" = x], [have_disted_doc_man="did not check"])
39183953
NUT_REPORT([can install pre-built documentation (release/dist tarball)], ["${have_disted_doc_man}"])

docs/configure.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,15 @@ Example valid formats of this flag:
361361

362362
Additional flags with regard to documentation generation include:
363363

364+
--enable-docs-man-for-progs-built-only=<yes|no>
365+
366+
Choose to build and install MAN pages only for the NUT programs being built
367+
in this run (this is the legacy default selection), or all known MAN pages
368+
(including for NUT programs and drivers not being built now). Should not
369+
affect the API manual pages (but note they may be impacted by `--with-dev`).
370+
371+
NOTE: You want this set to `no` when preparing NUT distribution tarballs.
372+
364373
--with-docs-man-section-api=<SN> (default: 3)
365374
--with-docs-man-section-cfg=<SN> (default: 5)
366375
--with-docs-man-section-cmd-sys=<SN> (default: 8, or 1m on Solaris/illumos)

docs/maintainer-guide.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ VERSION_FORCED_SEMVER:NUT_VERSION_FORCED_SEMVER='2.8.3'
237237
:; rm -f Makefile configure
238238
:; ./autogen.sh && \
239239
./configure --with-all --with-dev --with-doc --enable-spellcheck \
240+
--enable-docs-man-for-progs-built-only=no \
240241
--enable-warnings --enable-Werror --enable-maintainer-mode && \
241242
make -j 8 all && \
242243
make -j 8 spellcheck && \

docs/man/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
/tmp/
1212
/linkman-driver-names.txt
1313
/linkman-drivertool-names.txt
14+
/linkman-*.txt.tmp
1415
/.check-html-man
1516
/.check-man-pages
1617
/.check-man-txt

0 commit comments

Comments
 (0)