ccache: restore usage of asciidoc for manpage

We don't want to use ruby because that brings rust through
librsvg and graphviz into the build, which is bad for base-chroot
builds.
This commit is contained in:
q66 2022-01-06 17:26:09 +01:00
parent 547001c5d0
commit 848f6625fd
2 changed files with 80 additions and 1 deletions

View File

@ -0,0 +1,79 @@
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -1,54 +1,37 @@
-find_program(ASCIIDOCTOR_EXE asciidoctor)
-mark_as_advanced(ASCIIDOCTOR_EXE) # Don't show in CMake UIs
+find_program(ASCIIDOC_EXE asciidoc)
+mark_as_advanced(ASCIIDOC_EXE) # Don't show in CMake UIs
-if(NOT ASCIIDOCTOR_EXE)
+if(NOT ASCIIDOC_EXE)
message(WARNING "Could not find asciidoctor; documentation will not be generated")
else()
- function(generate_doc backend adoc_file output_file)
- get_filename_component(base_name "${adoc_file}" NAME_WE)
- add_custom_command(
- OUTPUT "${output_file}"
- COMMAND
- ${ASCIIDOCTOR_EXE}
- -o "${output_file}"
- -a revnumber="${CCACHE_VERSION}"
- -a icons=font
- -a toc=left
- -a sectanchors
- -a stylesheet="${CMAKE_CURRENT_SOURCE_DIR}/ccache-doc.css"
- -b "${backend}"
- "${CMAKE_SOURCE_DIR}/${adoc_file}"
- MAIN_DEPENDENCY "${CMAKE_SOURCE_DIR}/${adoc_file}"
- DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/ccache-doc.css"
- )
- set(doc_files "${doc_files}" "${output_file}" PARENT_SCOPE)
- endfunction()
-
- #
- # HTML documentation
- #
- generate_doc(html LICENSE.adoc LICENSE.html)
- generate_doc(html doc/AUTHORS.adoc AUTHORS.html)
- generate_doc(html doc/MANUAL.adoc MANUAL.html)
- generate_doc(html doc/NEWS.adoc NEWS.html)
- add_custom_target(doc-html DEPENDS "${doc_files}")
-
#
# Man page
#
- generate_doc(manpage doc/MANUAL.adoc ccache.1.tmp)
+ find_program(A2X_EXE a2x)
+ mark_as_advanced(A2X_EXE) # Don't show in CMake UIs
+ # MANUAL.adoc -> MANUAL.xml -> man page
+ add_custom_command(
+ OUTPUT MANUAL.xml
+ COMMAND
+ ${ASCIIDOC_EXE}
+ -o -
+ -a revnumber=${CCACHE_VERSION}
+ -d manpage
+ -b docbook "${CMAKE_SOURCE_DIR}/doc/MANUAL.adoc"
+ | perl -pe 's!<literal>\(.*?\)</literal>!<emphasis role="strong">\\1</emphasis>!g'
+ >MANUAL.xml
+ MAIN_DEPENDENCY "${CMAKE_SOURCE_DIR}/doc/MANUAL.adoc"
+ )
add_custom_command(
OUTPUT ccache.1
- # Convert monospace to bold since that's typically rendered better when
- # viewing the man page.
- COMMAND perl -pe "'s!\\\\f\\(CR(.*?)\\\\fP!\\\\fB\\1\\\\fP!g'" ccache.1.tmp >ccache.1
- MAIN_DEPENDENCY ccache.1.tmp
+ COMMAND ${A2X_EXE} --doctype manpage --format manpage MANUAL.xml
+ MAIN_DEPENDENCY MANUAL.xml
)
+ add_custom_target(doc-man-page DEPENDS ccache.1)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/ccache.1"
DESTINATION "${CMAKE_INSTALL_MANDIR}/man1"
)
- add_custom_target(doc-man-page DEPENDS ccache.1)
- add_custom_target(doc ALL DEPENDS doc-html doc-man-page)
+ add_custom_target(doc ALL DEPENDS ccache.1)
endif()

View File

@ -4,7 +4,7 @@ version=4.5.1
revision=2
build_style=cmake
configure_args="-DENABLE_TESTING=OFF -DREDIS_STORAGE_BACKEND=OFF"
hostmakedepends="ruby-asciidoctor perl"
hostmakedepends="asciidoc perl"
makedepends="libzstd-devel zlib-devel"
short_desc="Fast C/C++ Compiler Cache"
maintainer="Enno Boland <gottox@voidlinux.org>"