summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/ccache/ccache/0001-doc-allow-disabling-docs-man-page-generation.patch
blob: 51ca0e82f6dd2eaa9fdd4a3eaa2e3ae6c93805e3 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
From aebabafe085dd1b84027a1e31e5566c82528bd62 Mon Sep 17 00:00:00 2001
From: Bastian Krause <bst@pengutronix.de>
Date: Tue, 4 May 2021 11:41:56 +0200
Subject: [PATCH] doc: allow disabling docs/man page generation

The assumption that HTML documentation and manual pages should be
generated if the required tools (asciidoc) are present is not always
true. So add a cmake option that allows disabling the docs/man page
generation. The default is to generate docs/man pages like before.

Origin: https://github.com/ccache/ccache/pull/844
Upstream-Status: Submitted
Signed-off-by: Bastian Krause <bst@pengutronix.de>
---
 doc/CMakeLists.txt | 128 +++++++++++++++++++++++----------------------
 1 file changed, 66 insertions(+), 62 deletions(-)

diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index c5ce224d..74b7831b 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -1,70 +1,74 @@
+option(BUILD_DOCS "Indicates whether HTML documentation and manual pages should be built or not" ON)
+
 find_program(ASCIIDOC_EXE asciidoc)
 mark_as_advanced(ASCIIDOC_EXE) # Don't show in CMake UIs
 
-if(NOT ASCIIDOC_EXE)
-  message(WARNING "Could not find asciidoc; documentation will not be generated")
-else()
-  #
-  # HTML documentation
-  #
-  function(generate_html adoc_file)
-    get_filename_component(base_name "${adoc_file}" NAME_WE)
-    set(html_file "${base_name}.html")
-    add_custom_command(
-      OUTPUT "${html_file}"
-      COMMAND
-        ${ASCIIDOC_EXE}
-          -o "${html_file}"
-          -a revnumber="${CCACHE_VERSION}"
-          -a toc
-          -b xhtml11
-          "${CMAKE_SOURCE_DIR}/${adoc_file}"
-      MAIN_DEPENDENCY "${CMAKE_SOURCE_DIR}/${adoc_file}"
-    )
-    set(html_files "${html_files}" "${html_file}" PARENT_SCOPE)
-  endfunction()
+if (BUILD_DOCS)
+  if(NOT ASCIIDOC_EXE)
+    message(WARNING "Could not find asciidoc; documentation will not be generated")
+  else()
+    #
+    # HTML documentation
+    #
+    function(generate_html adoc_file)
+      get_filename_component(base_name "${adoc_file}" NAME_WE)
+      set(html_file "${base_name}.html")
+      add_custom_command(
+        OUTPUT "${html_file}"
+        COMMAND
+          ${ASCIIDOC_EXE}
+            -o "${html_file}"
+            -a revnumber="${CCACHE_VERSION}"
+            -a toc
+            -b xhtml11
+            "${CMAKE_SOURCE_DIR}/${adoc_file}"
+        MAIN_DEPENDENCY "${CMAKE_SOURCE_DIR}/${adoc_file}"
+      )
+      set(html_files "${html_files}" "${html_file}" PARENT_SCOPE)
+    endfunction()
 
-  generate_html(LICENSE.adoc)
-  generate_html(doc/AUTHORS.adoc)
-  generate_html(doc/MANUAL.adoc)
-  generate_html(doc/NEWS.adoc)
+    generate_html(LICENSE.adoc)
+    generate_html(doc/AUTHORS.adoc)
+    generate_html(doc/MANUAL.adoc)
+    generate_html(doc/NEWS.adoc)
 
-  add_custom_target(doc-html DEPENDS "${html_files}")
-  set(doc_files "${html_files}")
+    add_custom_target(doc-html DEPENDS "${html_files}")
+    set(doc_files "${html_files}")
 
-  #
-  # Man page
-  #
-  find_program(A2X_EXE a2x)
-  mark_as_advanced(A2X_EXE) # Don't show in CMake UIs
-  if(NOT A2X_EXE)
-    message(WARNING "Could not find a2x; man page will not be generated")
-  else()
-    # MANUAL.adoc -> MANUAL.xml -> man page
-    add_custom_command(
-      OUTPUT MANUAL.xml
-      COMMAND
-        ${ASCIIDOC_EXE}
-          -o -
-          -a revnumber=${CCACHE_VERSION}
-          -d manpage
-          -b docbook "${CMAKE_SOURCE_DIR}/doc/MANUAL.adoc"
-        | perl -pe 's!<literal>\(.*?\)</literal>!<emphasis role="strong">\\1</emphasis>!g'
-            >MANUAL.xml
-      MAIN_DEPENDENCY "${CMAKE_SOURCE_DIR}/doc/MANUAL.adoc"
-    )
-    add_custom_command(
-      OUTPUT ccache.1
-      COMMAND ${A2X_EXE} --doctype manpage --format manpage MANUAL.xml
-      MAIN_DEPENDENCY MANUAL.xml
-    )
-    add_custom_target(doc-man-page DEPENDS ccache.1)
-    install(
-      FILES "${CMAKE_CURRENT_BINARY_DIR}/ccache.1"
-      DESTINATION "${CMAKE_INSTALL_MANDIR}/man1"
-    )
-    set(doc_files "${doc_files}" ccache.1)
-  endif()
+    #
+    # Man page
+    #
+    find_program(A2X_EXE a2x)
+    mark_as_advanced(A2X_EXE) # Don't show in CMake UIs
+    if(NOT A2X_EXE)
+      message(WARNING "Could not find a2x; man page will not be generated")
+    else()
+      # MANUAL.adoc -> MANUAL.xml -> man page
+      add_custom_command(
+        OUTPUT MANUAL.xml
+        COMMAND
+          ${ASCIIDOC_EXE}
+            -o -
+            -a revnumber=${CCACHE_VERSION}
+            -d manpage
+            -b docbook "${CMAKE_SOURCE_DIR}/doc/MANUAL.adoc"
+          | perl -pe 's!<literal>\(.*?\)</literal>!<emphasis role="strong">\\1</emphasis>!g'
+              >MANUAL.xml
+        MAIN_DEPENDENCY "${CMAKE_SOURCE_DIR}/doc/MANUAL.adoc"
+      )
+      add_custom_command(
+        OUTPUT ccache.1
+        COMMAND ${A2X_EXE} --doctype manpage --format manpage MANUAL.xml
+        MAIN_DEPENDENCY MANUAL.xml
+      )
+      add_custom_target(doc-man-page DEPENDS ccache.1)
+      install(
+        FILES "${CMAKE_CURRENT_BINARY_DIR}/ccache.1"
+        DESTINATION "${CMAKE_INSTALL_MANDIR}/man1"
+      )
+      set(doc_files "${doc_files}" ccache.1)
+    endif()
 
-  add_custom_target(doc ALL DEPENDS "${doc_files}")
+    add_custom_target(doc ALL DEPENDS "${doc_files}")
+  endif()
 endif()
-- 
2.29.2