mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-09-08 22:36:40 -04:00
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4051 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
59 lines
2.0 KiB
CMake
59 lines
2.0 KiB
CMake
set (ASCIIDOC_MANS
|
|
man1/wsjtx.1.txt
|
|
)
|
|
|
|
find_program (A2X_EXECUTABLE NAMES a2x a2x.py)
|
|
if (NOT A2X_EXECUTABLE)
|
|
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
message (SEND_ERROR "Failed to find a2x which is required for release builds on *nix platforms.")
|
|
else (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
message (WARNING "Failed to find a2x skipping manpage generation.")
|
|
endif (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
endif ()
|
|
find_program (GZIP_EXECUTABLE NAMES gzip)
|
|
find_program (SED_EXECUTABLE NAMES sed)
|
|
|
|
set (XSLTPROC_OPTS
|
|
"-param man.endnotes.list.enabled 0 -param man.endnotes.are.numbered 0"
|
|
)
|
|
set (A2X_OPTS
|
|
--format=manpage
|
|
--xsltproc-opts=${XSLTPROC_OPTS}
|
|
--doctype=manpage
|
|
--no-xmllint
|
|
)
|
|
|
|
set (MANPAGES)
|
|
if (A2X_EXECUTABLE AND GZIP_EXECUTABLE AND SED_EXECUTABLE)
|
|
file (MAKE_DIRECTORY man)
|
|
foreach (f IN LISTS ASCIIDOC_MANS)
|
|
get_filename_component (d "${f}" PATH)
|
|
string (SUBSTRING "${d}" 3 -1 section)
|
|
if (NOT section MATCHES "[1-9]")
|
|
message (SEND_ERROR "Invalid man section ${section} in ${f}")
|
|
endif (NOT section MATCHES "[1-9]")
|
|
get_filename_component (filename "${f}" NAME_WE)
|
|
set (f "${CMAKE_CURRENT_SOURCE_DIR}/${f}")
|
|
set (d "man/${d}")
|
|
set (o "${d}/${filename}.${section}")
|
|
add_custom_command (OUTPUT "${o}.gz"
|
|
COMMAND ${CMAKE_COMMAND} ARGS -E make_directory "${d}"
|
|
COMMAND ${A2X_EXECUTABLE} ARGS ${A2X_OPTS} -D "${d}" "${f}"
|
|
COMMAND ${GZIP_EXECUTABLE} ARGS -f9 "${o}"
|
|
COMMAND ${SED_EXECUTABLE} ARGS -e "'s@.so @&man${section}/@'" -i.orig "${d}/*.${section}"
|
|
COMMAND ${GZIP_EXECUTABLE} ARGS -f9 "${d}/*.${section}"
|
|
DEPENDS "${f}"
|
|
COMMENT "Generating ${o}.gz"
|
|
)
|
|
list (APPEND MANPAGES "${o}.gz")
|
|
endforeach ()
|
|
|
|
install (
|
|
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/man
|
|
DESTINATION ${WSJT_MANPAGE_DESTINATION}
|
|
PATTERN "*.orig" EXCLUDE
|
|
)
|
|
endif (A2X_EXECUTABLE AND GZIP_EXECUTABLE AND SED_EXECUTABLE)
|
|
|
|
add_custom_target (manpages DEPENDS ${MANPAGES})
|