0001-build-Add-man_pages-build-options.patch 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. From 5a54c5bb1c9609b7bffe6b3e05f934030e4e990e Mon Sep 17 00:00:00 2001
  2. From: Jens Georg <mail@jensge.org>
  3. Date: Sat, 26 Dec 2020 18:40:51 +0100
  4. Subject: [PATCH] build: Add man_pages build options
  5. Check if xsltproc runs succesfully and fail otherwise
  6. Fixes #192
  7. [Retrieved from:
  8. https://gitlab.gnome.org/GNOME/rygel/-/commit/5a54c5bb1c9609b7bffe6b3e05f934030e4e990e]
  9. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  10. ---
  11. doc/man/meson.build | 98 +++++++++++++++++++++++++++------------------
  12. doc/meson.build | 5 ++-
  13. meson_options.txt | 1 +
  14. 3 files changed, 64 insertions(+), 40 deletions(-)
  15. diff --git a/doc/man/meson.build b/doc/man/meson.build
  16. index ef3fcfbf5..4c92eab2b 100644
  17. --- a/doc/man/meson.build
  18. +++ b/doc/man/meson.build
  19. @@ -1,43 +1,63 @@
  20. xsltproc = find_program('xsltproc', required: false)
  21. if xsltproc.found()
  22. - xlstproc_flags = [
  23. - '--nonet',
  24. - '--stringparam', 'man.output.quietly', '1',
  25. - '--stringparam', 'funcsynopsis.style', 'ansi',
  26. - '--stringparam', 'man.authors.section.enabled', '1',
  27. - '--stringparam', 'man.copyright.section.enabled', '1',
  28. - ]
  29. -
  30. - xsltproc_args = [
  31. - xsltproc,
  32. - xlstproc_flags,
  33. - '-o', '@OUTPUT@',
  34. - 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
  35. - '@INPUT@',
  36. - ]
  37. -
  38. - man_input_files = [
  39. - 'rygel.xml',
  40. - 'rygel.conf.xml'
  41. - ]
  42. -
  43. - man_output_files = [
  44. - 'rygel.1',
  45. - 'rygel.conf.5'
  46. - ]
  47. -
  48. - custom_target('man 1 pages',
  49. - input: 'rygel.xml',
  50. - output: 'rygel.1',
  51. - command: xsltproc_args,
  52. - install: true,
  53. - install_dir: join_paths(get_option('mandir'), 'man1'))
  54. -
  55. - custom_target('man 5 pages',
  56. - input: 'rygel.conf.xml',
  57. - output: 'rygel.conf.5',
  58. - command: xsltproc_args,
  59. - install: true,
  60. - install_dir: join_paths(get_option('mandir'), 'man5'))
  61. + stylesheet = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
  62. +
  63. + xlstproc_flags = [
  64. + '--nonet',
  65. + '--stringparam', 'man.output.quietly', '1',
  66. + '--stringparam', 'funcsynopsis.style', 'ansi',
  67. + '--stringparam', 'man.authors.section.enabled', '1',
  68. + '--stringparam', 'man.copyright.section.enabled', '1',
  69. + ]
  70. +
  71. + xsltproc_args = [
  72. + xsltproc,
  73. + xlstproc_flags,
  74. + '-o', '@OUTPUT@',
  75. + stylesheet,
  76. + '@INPUT@',
  77. + ]
  78. +
  79. + man_input_files = [
  80. + 'rygel.xml',
  81. + 'rygel.conf.xml'
  82. + ]
  83. +
  84. + man_output_files = [
  85. + 'rygel.1',
  86. + 'rygel.conf.5'
  87. + ]
  88. +
  89. + r = run_command(
  90. + [
  91. + xsltproc,
  92. + xlstproc_flags,
  93. + '-o', '/dev/null',
  94. + stylesheet,
  95. + 'rygel.xml'
  96. + ]
  97. + )
  98. +
  99. + if (r.returncode() == 0)
  100. + custom_target(
  101. + 'man 1 pages',
  102. + input: 'rygel.xml',
  103. + output: 'rygel.1',
  104. + command: xsltproc_args,
  105. + install: true,
  106. + install_dir: join_paths(get_option('mandir'), 'man1')
  107. + )
  108. +
  109. + custom_target(
  110. + 'man 5 pages',
  111. + input: 'rygel.conf.xml',
  112. + output: 'rygel.conf.5',
  113. + command: xsltproc_args,
  114. + install: true,
  115. + install_dir: join_paths(get_option('mandir'), 'man5')
  116. + )
  117. + else
  118. + error('Cannot bulid man pages, failed to run xsltproc')
  119. + endif
  120. endif
  121. diff --git a/doc/meson.build b/doc/meson.build
  122. index 41c733e50..91c08fae5 100644
  123. --- a/doc/meson.build
  124. +++ b/doc/meson.build
  125. @@ -1,2 +1,5 @@
  126. -subdir('man')
  127. +if get_option('man_pages')
  128. + subdir('man')
  129. +endif
  130. +
  131. subdir('reference')
  132. diff --git a/meson_options.txt b/meson_options.txt
  133. index cb604c4e9..c60ff1a9a 100644
  134. --- a/meson_options.txt
  135. +++ b/meson_options.txt
  136. @@ -1,5 +1,6 @@
  137. option('uninstalled', type: 'boolean', value: 'false', description: 'Run Rygel from build directory only')
  138. option('api-docs', type: 'boolean', value: 'false', description: 'Build the API documentation')
  139. +option('man_pages', type: 'boolean', value: 'true', description: 'Build the man pages')
  140. option('systemd-user-units-dir', type : 'string', value : 'auto', description : 'Where to install the systemd user unit (use special values "auto" or "none", or pass a path')
  141. option('plugins', type : 'array', choices : ['external', 'gst-launch', 'lms', 'media-export', 'mpris', 'playbin', 'ruih', 'tracker', 'tracker3'])
  142. option('engines', type : 'array', choices : ['simple', 'gstreamer'])
  143. --
  144. GitLab