Add prefix (le_) for man pages

This will:
- avoid overlapping (since there is util.h.3 page)
- group everything under some prefix (man le_<TAB><TAB> will show everything)

Fixes: #1099
This commit is contained in:
Azat Khuzhin 2020-10-04 19:55:52 +03:00
parent 3012c43808
commit 21b91692da
3 changed files with 50 additions and 4 deletions

17
cmake/RenameDoxygen.cmake Normal file
View File

@ -0,0 +1,17 @@
# Add prefix "le_" for manual pages
message(STATUS "Rename man pages in ${CMAKE_BINARY_DIR}")
# Remove old pages to avoid stalled copies
file(GLOB LIBEVENT_MAN_PAGES RELATIVE ${CMAKE_BINARY_DIR} le_*)
list(LENGTH LIBEVENT_MAN_PAGES LEN)
if (${LEN} GREATER 0)
file(REMOVE ${LIBEVENT_MAN_PAGES})
endif()
# Create new
file(GLOB LIBEVENT_MAN_PAGES RELATIVE ${CMAKE_BINARY_DIR} *)
list(FILTER LIBEVENT_MAN_PAGES EXCLUDE REGEX ^le_.*$)
foreach(MAN_PAGE ${LIBEVENT_MAN_PAGES})
file(RENAME ${CMAKE_BINARY_DIR}/${MAN_PAGE} ${CMAKE_BINARY_DIR}/le_${MAN_PAGE})
endforeach()

View File

@ -95,10 +95,17 @@ macro(UseDoxygen)
)
endif()
# Install manual into <prefix>/share/man/man3
if ("${DOXYGEN_GENERATE_MAN}" STREQUAL "YES")
set(MAN_PAGES_DIR ${PROJECT_BINARY_DIR}/${DOXYGEN_OUTPUT_DIRECTORY}/man/man3)
# Add prefix "le_" for manual pages
add_custom_target(doxygen-rename-man-pages ALL
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/RenameDoxygen.cmake
DEPENDS doxygen
WORKING_DIRECTORY ${MAN_PAGES_DIR})
# Install manual into <prefix>/share/man/man3
install(DIRECTORY
${PROJECT_BINARY_DIR}/${DOXYGEN_OUTPUT_DIRECTORY}/man/man3
${MAN_PAGES_DIR}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man
COMPONENT doc
)

View File

@ -18,9 +18,31 @@ clean-local:
-rm -rf $(DX_CLEANFILES)
if ENABLE_DOXYGEN_MAN
man3_MAN_DIR = @DX_DOCDIR@/man/man3
# add "le_" prefix for man pages
#
# XXX: we cannot clean old man pages here since
# doxygen-rename-man-pages will be called twice:
# - for make
# - for make install
# (cmake works differently)
#
# Once this will be solved add the following to the target:
#
# -rm -fr $(man3_MAN_DIR)/le_*
doxygen-rename-man-pages: doxygen-doc
echo "Rename man pages in $(man3_MAN_DIR)"
@for p in $(man3_MAN_DIR)/*; do \
p=`basename $$p`; \
p_strip=$${p/le_/}; \
if [ ! "$$p_strip" = "$$p" ]; then continue; fi; \
mv '$(man3_MAN_DIR)/'$$p '$(man3_MAN_DIR)/'le_$$p; \
done
# integrate doxygen with automake targets
man3_MANS = @DX_DOCDIR@/man/man3/*
$(man3_MANS): doxygen-doc
man3_MANS = $(man3_MAN_DIR)/*
$(man3_MANS): doxygen-doc doxygen-rename-man-pages
endif ENABLE_DOXYGEN_MAN
# Docs will be installed. It may be one or more docs supported