mirror of
https://github.com/swaywm/sway.git
synced 2026-04-30 06:46:24 -04:00
Add support code for localization of man pages
This commit is contained in:
parent
c19754a038
commit
ce35837b01
14 changed files with 197 additions and 45 deletions
|
|
@ -2,32 +2,64 @@ find_package(A2X)
|
|||
|
||||
if (A2X_FOUND)
|
||||
add_custom_target(man ALL)
|
||||
|
||||
function(add_manpage name section)
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section}
|
||||
COMMAND ${A2X_COMMAND}
|
||||
--no-xmllint
|
||||
--doctype manpage
|
||||
--format manpage
|
||||
-D ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt
|
||||
COMMENT Generating manpage for ${name}.${section}
|
||||
)
|
||||
|
||||
add_custom_target(man-${name}.${section}
|
||||
DEPENDS
|
||||
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section}
|
||||
)
|
||||
add_dependencies(man
|
||||
man-${name}.${section}
|
||||
)
|
||||
|
||||
install(
|
||||
FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section}
|
||||
DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/man/man${section}
|
||||
COMPONENT documentation
|
||||
)
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
function(add_manpage name section locale)
|
||||
if (NOT A2X_FOUND)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if (${locale} STREQUAL "en")
|
||||
set(
|
||||
input
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/man/${name}.${section}.txt
|
||||
)
|
||||
set(
|
||||
output
|
||||
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section}
|
||||
)
|
||||
set(
|
||||
destination
|
||||
${CMAKE_INSTALL_FULL_DATAROOTDIR}/man/man${section}
|
||||
)
|
||||
else()
|
||||
set(
|
||||
input
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/man/${name}.${section}.${locale}.txt
|
||||
)
|
||||
set(
|
||||
output
|
||||
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section}.${locale}
|
||||
)
|
||||
set(
|
||||
destination
|
||||
${CMAKE_INSTALL_FULL_DATAROOTDIR}/man/${locale}/man${section}
|
||||
)
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${output}
|
||||
COMMAND ${A2X_COMMAND}
|
||||
--no-xmllint
|
||||
--doctype manpage
|
||||
--format manpage
|
||||
-D ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
||||
${input}
|
||||
DEPENDS ${input}
|
||||
COMMENT Generating manpage for ${name}.${section}.${locale}
|
||||
)
|
||||
|
||||
add_custom_target(man-${name}.${section}.${locale}
|
||||
DEPENDS ${output}
|
||||
)
|
||||
add_dependencies(man
|
||||
man-${name}.${section}.${locale}
|
||||
)
|
||||
|
||||
install(
|
||||
FILES ${output}
|
||||
DESTINATION ${destination}
|
||||
COMPONENT documentation
|
||||
RENAME ${name}.${section}
|
||||
)
|
||||
endfunction()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue