summaryrefslogtreecommitdiff
path: root/net-wireless/uhd/files/uhd_man_pages_optional_compress.diff
blob: 5847d50c66f017620b28891b7ad77d92ff83d2de (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
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)