docs: gzip manpages
authorMichael Wallner <mike@php.net>
Tue, 18 Feb 2020 07:02:23 +0000 (08:02 +0100)
committerMichael Wallner <mike@php.net>
Tue, 18 Feb 2020 07:02:23 +0000 (08:02 +0100)
CMakeConfig.txt
docs/CMakeLists.txt

index 5f1b47abd37942e20b09465e51af7ee001b791b7..3acae1cb2aca874618351a9c4ac4bae773e5093b 100644 (file)
@@ -37,7 +37,10 @@ set(ENABLE_MEMASLAP ON
 set(ENABLE_DTRACE OFF
     CACHE BOOL "enable dtrace support")
 
-# sphinx
+# docs / sphinx
+
+set(GZIP_MAN ON
+    CACHE BOOL "gzip manpages")
 
 set(SPHINX_OPTIONS ""
     CACHE STRING "additional sphinx-build command line options")
index 269fae0444572f16ad530e4ccbefef0b6976ac7d..07709dd07b69a117bf0ccf234af0f747bbe437b2 100644 (file)
@@ -55,12 +55,29 @@ else()
             BYPRODUCTS ${SPHINX_MAN_DIR}
             )
 
+    set(MAN_EXT "")
+    if(GZIP_MAN)
+        find_program(PIGZ pigz)
+        if(PIGZ)
+            set(GZIP ${PIGZ})
+        else()
+            find_package(UnixCommands)
+        endif()
+        if(GZIP)
+            set(MAN_EXT ".gz")
+            add_custom_target(man_gz ALL
+                    ${GZIP} -rkf ${SPHINX_MAN_DIR}
+                    DEPENDS man
+                    )
+        endif()
+    endif()
+
     install(DIRECTORY ${SPHINX_MAN_DIR}/
             DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
-            FILES_MATCHING PATTERN *.1
+            FILES_MATCHING PATTERN *.1${MAN_EXT}
             )
     install(DIRECTORY ${SPHINX_MAN_DIR}/
             DESTINATION ${CMAKE_INSTALL_MANDIR}/man3
-            FILES_MATCHING PATTERN *.3
+            FILES_MATCHING PATTERN *.3${MAN_EXT}
             )
 endif()