forked from bpftrace/bpftrace
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support building without asciidoctor
Do not build bpftrace manpage and print a warning when asciidoctor is missing instead of failing to configure. Fixes bpftrace#1976
- Loading branch information
1 parent
cee9167
commit 76a41f3
Showing
1 changed file
with
20 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,26 @@ | ||
find_program(GZIP gzip REQUIRED) | ||
find_program(ASCIIDOCTOR asciidoctor REQUIRED) | ||
find_program(ASCIIDOCTOR asciidoctor) | ||
file(GLOB FILES *.adoc) | ||
set(GZFILES "") | ||
foreach(FIL ${FILES}) | ||
get_filename_component(NAME ${FIL} NAME_WE) | ||
set(MANPAGE_FILE ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.8) | ||
set(GZ_MANPAGE_FILE "${MANPAGE_FILE}.gz") | ||
if(NOT "${ASCIIDOCTOR}" STREQUAL "ASCIIDOCTOR-NOTFOUND") | ||
foreach(FIL ${FILES}) | ||
get_filename_component(NAME ${FIL} NAME_WE) | ||
set(MANPAGE_FILE ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.8) | ||
set(GZ_MANPAGE_FILE "${MANPAGE_FILE}.gz") | ||
|
||
add_custom_command(OUTPUT ${MANPAGE_FILE} | ||
COMMAND ${ASCIIDOCTOR} ${FIL} -b manpage -o - > ${MANPAGE_FILE} | ||
DEPENDS ${FIL}) | ||
add_custom_command(OUTPUT ${MANPAGE_FILE} | ||
COMMAND ${ASCIIDOCTOR} ${FIL} -b manpage -o - > ${MANPAGE_FILE} | ||
DEPENDS ${FIL}) | ||
|
||
add_custom_command(OUTPUT ${GZ_MANPAGE_FILE} | ||
COMMAND ${GZIP} -c ${MANPAGE_FILE} > ${GZ_MANPAGE_FILE} | ||
DEPENDS ${MANPAGE_FILE}) | ||
add_custom_command(OUTPUT ${GZ_MANPAGE_FILE} | ||
COMMAND ${GZIP} -c ${MANPAGE_FILE} > ${GZ_MANPAGE_FILE} | ||
DEPENDS ${MANPAGE_FILE}) | ||
|
||
list(APPEND GZFILES ${GZ_MANPAGE_FILE}) | ||
endforeach() | ||
add_custom_target(adoc_man DEPENDS ${GZFILES}) | ||
install(FILES ${GZFILES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man8) | ||
list(APPEND GZFILES ${GZ_MANPAGE_FILE}) | ||
endforeach() | ||
add_custom_target(adoc_man DEPENDS ${GZFILES}) | ||
install(FILES ${GZFILES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man8) | ||
else() | ||
message(WARNING "asciidoctor not found, building without bpftrace manpage") | ||
add_custom_target(adoc_man) | ||
endif() |