2014-04-19 22:39:48 -04:00
|
|
|
set (ASCIIDOC_MANS
|
|
|
|
man1/wsjtx.1.txt
|
2015-11-17 20:28:12 -05:00
|
|
|
man1/wsprd.1.txt
|
2014-09-05 14:36:10 -04:00
|
|
|
man1/jt65code.1.txt
|
2015-03-04 08:21:41 -05:00
|
|
|
man1/rigctl-wsjtx.1.txt
|
2014-09-25 10:45:36 -04:00
|
|
|
man1/rigctld-wsjtx.1.txt
|
2019-01-22 15:23:17 -05:00
|
|
|
man1/rigctlcom-wsjtx.1.txt
|
2015-06-05 09:44:52 -04:00
|
|
|
man1/message_aggregator.1.txt
|
2015-11-26 13:53:24 -05:00
|
|
|
man1/udp_daemon.1.txt
|
2014-04-19 22:39:48 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
find_program (A2X_EXECUTABLE NAMES a2x a2x.py)
|
|
|
|
if (NOT A2X_EXECUTABLE)
|
2014-04-20 08:46:34 -04:00
|
|
|
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
2014-04-21 07:49:20 -04:00
|
|
|
message (SEND_ERROR "Failed to find a2x which is an optional requirement for non-debug
|
2014-04-21 07:38:17 -04:00
|
|
|
builds on *nix platforms.
|
|
|
|
|
|
|
|
You can choose to skip manpage generation and this error by setting
|
|
|
|
the CMake option WSJT_SKIP_MANPAGES to ON. This option is designed for
|
2014-04-21 07:49:20 -04:00
|
|
|
those that are building for their own use, package builders should not
|
|
|
|
opt to skip manpage generation since package building requires the
|
2014-04-21 07:38:17 -04:00
|
|
|
manpages.")
|
|
|
|
|
2014-04-20 08:46:34 -04:00
|
|
|
else (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
message (WARNING "Failed to find a2x skipping manpage generation.")
|
|
|
|
endif (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
2014-04-19 22:39:48 -04:00
|
|
|
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
|
2015-06-05 07:33:56 -04:00
|
|
|
-a VERSION=${wsjtx_VERSION}
|
2014-04-19 22:39:48 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
set (MANPAGES)
|
2014-04-20 08:46:34 -04:00
|
|
|
if (A2X_EXECUTABLE AND GZIP_EXECUTABLE AND SED_EXECUTABLE)
|
2014-04-19 22:39:48 -04:00
|
|
|
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]")
|
2014-10-09 00:15:01 -04:00
|
|
|
get_filename_component (filename "${f}" NAME)
|
|
|
|
get_filename_component (filename_we "${f}" NAME_WE)
|
2014-04-19 22:39:48 -04:00
|
|
|
set (f "${CMAKE_CURRENT_SOURCE_DIR}/${f}")
|
|
|
|
set (d "man/${d}")
|
2014-10-09 00:15:01 -04:00
|
|
|
set (o "${d}/${filename_we}.${section}.gz")
|
|
|
|
add_custom_command (OUTPUT "${o}"
|
2014-04-19 22:39:48 -04:00
|
|
|
COMMAND ${CMAKE_COMMAND} ARGS -E make_directory "${d}"
|
2014-10-09 00:15:01 -04:00
|
|
|
COMMAND ${CMAKE_COMMAND} ARGS -E copy "${f}" "${d}"
|
|
|
|
COMMAND ${A2X_EXECUTABLE} ARGS ${A2X_OPTS} "${d}/${filename}"
|
|
|
|
COMMAND ${CMAKE_COMMAND} ARGS -E remove "${d}/${filename}"
|
2014-09-27 15:38:21 -04:00
|
|
|
#
|
2014-10-11 12:20:49 -04:00
|
|
|
# the following edit command is used to make the alias manpages
|
|
|
|
# compatible with Debian packaging rules when a2x generates alias
|
|
|
|
# pages baseed in the section directory instead of the man parent
|
|
|
|
# directory
|
2014-09-27 15:38:21 -04:00
|
|
|
#
|
2014-10-11 12:20:49 -04:00
|
|
|
COMMAND ${SED_EXECUTABLE} ARGS -e '/^.so [^\\/]*$$/s@.so @&man${section}\\/@' -i.orig "${d}/*.${section}"
|
2014-04-20 08:46:34 -04:00
|
|
|
COMMAND ${GZIP_EXECUTABLE} ARGS -f9 "${d}/*.${section}"
|
2014-10-09 00:15:01 -04:00
|
|
|
DEPENDS "${f}" "${previous_output}"
|
|
|
|
COMMENT "Generating ${o}"
|
2014-04-19 22:39:48 -04:00
|
|
|
)
|
2014-10-09 00:15:01 -04:00
|
|
|
list (APPEND MANPAGES "${o}")
|
|
|
|
|
|
|
|
# use this as a dependency in the next iteration to serialize so
|
|
|
|
# that gzips don't overlap in parallel builds
|
|
|
|
set (previous_output "${o}")
|
2014-04-19 22:39:48 -04:00
|
|
|
endforeach ()
|
|
|
|
|
|
|
|
install (
|
2017-03-28 09:03:48 -04:00
|
|
|
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/man/
|
|
|
|
DESTINATION ${CMAKE_INSTALL_MANDIR}
|
2014-04-20 10:28:02 -04:00
|
|
|
PATTERN "*.orig" EXCLUDE
|
2014-04-21 08:21:44 -04:00
|
|
|
#COMPONENT Runtime
|
2014-04-19 22:39:48 -04:00
|
|
|
)
|
2014-04-20 08:46:34 -04:00
|
|
|
endif (A2X_EXECUTABLE AND GZIP_EXECUTABLE AND SED_EXECUTABLE)
|
2014-04-19 22:39:48 -04:00
|
|
|
|
|
|
|
add_custom_target (manpages DEPENDS ${MANPAGES})
|