You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/net-wireless/uhd/files/uhd_man_pages_optional_comp...

77 lines
3.3 KiB

diff --git a/host/docs/CMakeLists.txt b/host/docs/CMakeLists.txt
index 240a534db..7a7108f00 100644
--- a/host/docs/CMakeLists.txt
+++ b/host/docs/CMakeLists.txt
@@ -144,34 +144,49 @@ set(man_page_sources
########################################################################
# Setup man pages
########################################################################
-find_package(GZip)
+option(ENABLE_MAN_PAGE_COMPRESSION "Compress man pages if installed." ON)
# No elegant way in CMake to reverse a boolean
if(NOT WIN32)
set(NOT_WIN32 TRUE)
endif(NOT WIN32)
-LIBUHD_REGISTER_COMPONENT("Man Pages" ENABLE_MAN_PAGES ON "GZIP_FOUND;NOT_WIN32" OFF OFF)
+set(MAN_PAGES_DEPS "NOT_WIN32")
+
+message(STATUS "")
+if(ENABLE_MAN_PAGE_COMPRESSION)
+ message(STATUS "Compress man pages enabled; looking for compression program")
+ find_package(GZip)
+ list(APPEND MAN_PAGES_DEPS "GZIP_FOUND")
+else(ENABLE_MAN_PAGE_COMPRESSION)
+ message(STATUS "Compress man pages disabled")
+endif(ENABLE_MAN_PAGE_COMPRESSION)
+
+LIBUHD_REGISTER_COMPONENT("Man Pages" ENABLE_MAN_PAGES ON "${MAN_PAGES_DEPS}" OFF OFF)
if(ENABLE_MAN_PAGES)
- #Generate man pages
- foreach(manfile ${man_page_sources})
- #make the gzip file depend on the text file
- string(REPLACE ".1" "" PROGRAM_NAME "${manfile}")
- set(gzfile "${CMAKE_CURRENT_BINARY_DIR}/${manfile}.gz")
- set(manfile "${CMAKE_CURRENT_SOURCE_DIR}/${manfile}")
- add_custom_command(
- OUTPUT ${gzfile}
- DEPENDS ${manfile}
- COMMAND ${GZIP_EXECUTABLE} -9 -cf ${manfile} > ${gzfile}
- COMMENT "Generating ${PROGRAM_NAME} man page"
- )
-
- #make the man page target depend on the gz file
- list(APPEND man_page_gz_files ${gzfile})
- UHD_INSTALL(FILES ${gzfile} DESTINATION ${PKG_MAN_DIR} COMPONENT manpages)
- endforeach(manfile ${man_page_sources})
-
- #make the man pages a build-time dependency
- add_custom_target(man_page_gzips ALL DEPENDS ${man_page_gz_files})
+ #Generate man pages; either compressed or not
+ if(ENABLE_MAN_PAGE_COMPRESSION)
+ # compress man pages
+ foreach(manfile ${man_page_sources})
+ #make the gzip file depend on the text file
+ string(REPLACE ".1" "" PROGRAM_NAME "${manfile}")
+ set(gzfile "${CMAKE_CURRENT_BINARY_DIR}/${manfile}.gz")
+ set(manfile "${CMAKE_CURRENT_SOURCE_DIR}/${manfile}")
+ add_custom_command(
+ OUTPUT ${gzfile}
+ DEPENDS ${manfile}
+ COMMAND ${GZIP_EXECUTABLE} -9 -cf ${manfile} > ${gzfile}
+ COMMENT "Generating ${PROGRAM_NAME} man page"
+ )
+ #make the man page target depend on the gz file
+ list(APPEND man_page_gz_files ${gzfile})
+ endforeach(manfile ${man_page_sources})
+ #make the man pages a build-time dependency
+ UHD_INSTALL(FILES ${man_page_gz_files} DESTINATION ${PKG_MAN_DIR} COMPONENT manpages)
+ add_custom_target(man_page_gzips ALL DEPENDS ${man_page_gz_files})
+ else(ENABLE_MAN_PAGE_COMPRESSION)
+ # uncompressed man pages; just install them
+ UHD_INSTALL(FILES ${man_page_sources} DESTINATION ${PKG_MAN_DIR} COMPONENT manpages)
+ endif(ENABLE_MAN_PAGE_COMPRESSION)
endif(ENABLE_MAN_PAGES)