blob: e9dacc3c2e2149399c03b50c0832adf66d20f588 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# Use pod2man to generate manual pages from .pod files
# Usage: pod2man(<podfile> <release-string> <man-section> <heading-center-text>)
#
# E.g.: pod2man("/path/to/file/mypod.pod" "1.2.3" 1 "My Manual Pages")
find_program(POD2MAN pod2man)
if(NOT POD2MAN)
message(STATUS "Could not find pod2man - man pages disabled")
endif()
find_program(GZIP gzip)
if(NOT GZIP)
message(STATUS "Could not find gzip - man pages uncompressed")
endif()
macro(pod2man PODFILE_FULL RELEASE SECTION CENTER)
get_filename_component(PODFILE ${PODFILE_FULL} NAME)
string(REPLACE "." ";" PODFILE_LIST ${PODFILE})
list(GET PODFILE_LIST 0 NAME)
list(GET PODFILE_LIST 1 LANG)
string(TOUPPER ${NAME} NAME_UPCASE)
if(${LANG} STREQUAL "pod")
set(LANG "")
endif()
if(NOT EXISTS ${PODFILE_FULL})
message(FATAL ERROR "Could not find pod file ${PODFILE_FULL} to generate man page")
endif(NOT EXISTS ${PODFILE_FULL})
if(POD2MAN)
if(LANG)
set(MANPAGE_TARGET "man-${NAME}-${LANG}")
set(MANFILE_TEMP "${CMAKE_CURRENT_BINARY_DIR}/${NAME}.${LANG}.tmp")
set(MANFILE_FULL "${CMAKE_CURRENT_BINARY_DIR}/${NAME}.${LANG}.${SECTION}")
set(MANFILE_FULL_GZ "${CMAKE_CURRENT_BINARY_DIR}/${NAME}.${LANG}.${SECTION}.gz")
set(MANFILE_DEST "${SHARE_INSTALL}/man/${LANG}/man${SECTION}")
else()
set(MANPAGE_TARGET "man-${NAME}")
set(MANFILE_TEMP "${CMAKE_CURRENT_BINARY_DIR}/${NAME}.tmp")
set(MANFILE_FULL "${CMAKE_CURRENT_BINARY_DIR}/${NAME}.${SECTION}")
set(MANFILE_FULL_GZ "${CMAKE_CURRENT_BINARY_DIR}/${NAME}.${SECTION}.gz")
set(MANFILE_DEST "${SHARE_INSTALL}/man/man${SECTION}")
endif()
add_custom_command(
OUTPUT ${MANFILE_TEMP}
COMMAND ${POD2MAN} --utf8 --section="${SECTION}" --center="${CENTER}"
--release="${RELEASE}" --name="${NAME_UPCASE}" "${PODFILE_FULL}" "${MANFILE_TEMP}"
)
add_custom_command(
OUTPUT ${MANFILE_FULL}
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/fix-roff-punct "${MANFILE_TEMP}" > ${MANFILE_FULL}
DEPENDS ${MANFILE_TEMP}
)
if(GZIP AND WITH_MANPAGE_COMPRESSION)
add_custom_command(
OUTPUT ${MANFILE_FULL_GZ}
COMMAND ${GZIP} -f -k --best -n "${MANFILE_FULL}"
DEPENDS ${MANFILE_FULL}
)
add_custom_target(${MANPAGE_TARGET} ALL
DEPENDS ${MANFILE_FULL_GZ}
)
install(
FILES ${MANFILE_FULL_GZ}
RENAME ${NAME}.${SECTION}.gz
DESTINATION ${MANFILE_DEST}
)
else()
add_custom_target(${MANPAGE_TARGET} ALL
DEPENDS ${MANFILE_FULL}
)
install(
FILES ${MANFILE_FULL}
RENAME ${NAME}.${SECTION}
DESTINATION ${MANFILE_DEST}
)
endif()
endif()
endmacro(pod2man PODFILE NAME SECTION CENTER)
|