Build with AsciiDoc as well as Asciidoctor

This commit is contained in:
Přemysl Eric Janouch 2022-08-24 01:09:02 +02:00
parent a2a72c8b92
commit 3cf3c0215e
Signed by: p
GPG Key ID: A0420B94F92B9493
2 changed files with 21 additions and 10 deletions

View File

@ -97,20 +97,31 @@ install (FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
# Generate documentation from text markup # Generate documentation from text markup
find_program (ASCIIDOCTOR_EXECUTABLE asciidoctor) find_program (ASCIIDOCTOR_EXECUTABLE asciidoctor)
if (NOT ASCIIDOCTOR_EXECUTABLE) find_program (A2X_EXECUTABLE a2x)
message (FATAL_ERROR "asciidoctor not found") if (NOT ASCIIDOCTOR_EXECUTABLE AND NOT A2X_EXECUTABLE)
message (FATAL_ERROR "Neither asciidoctor nor a2x were found")
endif () endif ()
foreach (page ${PROJECT_NAME}) foreach (page ${PROJECT_NAME})
set (page_output "${PROJECT_BINARY_DIR}/${page}.1") set (page_output "${PROJECT_BINARY_DIR}/${page}.1")
list (APPEND project_MAN_PAGES "${page_output}") list (APPEND project_MAN_PAGES "${page_output}")
if (ASCIIDOCTOR_EXECUTABLE)
add_custom_command (OUTPUT ${page_output} add_custom_command (OUTPUT ${page_output}
COMMAND ${ASCIIDOCTOR_EXECUTABLE} -b manpage COMMAND ${ASCIIDOCTOR_EXECUTABLE} -b manpage
-a release-version=${PROJECT_VERSION} -a release-version=${PROJECT_VERSION}
"${PROJECT_SOURCE_DIR}/${page}.adoc"
-o "${page_output}" -o "${page_output}"
"${PROJECT_SOURCE_DIR}/${page}.adoc"
DEPENDS ${page}.adoc DEPENDS ${page}.adoc
COMMENT "Generating man page for ${page}" VERBATIM) COMMENT "Generating man page for ${page}" VERBATIM)
elseif (A2X_EXECUTABLE)
add_custom_command (OUTPUT ${page_output}
COMMAND ${A2X_EXECUTABLE} --doctype manpage --format manpage
-a release-version=${PROJECT_VERSION}
-D "${PROJECT_BINARY_DIR}"
"${PROJECT_SOURCE_DIR}/${page}.adoc"
DEPENDS ${page}.adoc
COMMENT "Generating man page for ${page}" VERBATIM)
endif ()
endforeach () endforeach ()
add_custom_target (docs ALL DEPENDS ${project_MAN_PAGES}) add_custom_target (docs ALL DEPENDS ${project_MAN_PAGES})

View File

@ -34,7 +34,7 @@ a package with the latest development version from Archlinux's AUR.
Building Building
-------- --------
Build dependencies: CMake, pkg-config, asciidoctor, Build dependencies: CMake, pkg-config, asciidoctor or asciidoc,
liberty (included), http-parser (included) + liberty (included), http-parser (included) +
Runtime dependencies: libev, Jansson, cURL, openssl, Runtime dependencies: libev, Jansson, cURL, openssl,
readline or libedit >= 2013-07-12, readline or libedit >= 2013-07-12,