build: allow for changing subprojects with docs enabled
authorMatthew Waters <matthew@centricular.com>
Thu, 23 Apr 2020 03:48:22 +0000 (13:48 +1000)
committerMatthew Waters <matthew@centricular.com>
Thu, 23 Apr 2020 03:48:22 +0000 (13:48 +1000)
Fixes: https://gitlab.freedesktop.org/gstreamer/gst-build/-/issues/60
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/142>

meson.build

index c408d33..4302eef 100644 (file)
@@ -153,19 +153,41 @@ if meson.is_cross_build() or build_machine.system() == 'windows'
         error('Documentation enabled but building the doc while cross building or building on windows is not supported yet.')
     endif
 
+    documented_projects = ''
     message('Documentation not built as building the documentation while cross building or building on windows is not supported yet.')
 else
   hotdoc_p = find_program('hotdoc', required : get_option('doc'))
-  if hotdoc_p.found()
-    if documented_projects != ''
-        subproject('gst-docs', default_options: 'built_subprojects=' + documented_projects)
-      message('Gst docs subprojects: ' + documented_projects)
-    endif
-  else
+  if not hotdoc_p.found()
+    documented_projects = ''
     message('Not building documentation as hotdoc was not found')
   endif
 endif
 
+write_file_contents = '''
+import os
+import sys
+
+assert len(sys.argv) >= 3
+fname = sys.argv[1]
+contents = sys.argv[2]
+
+with open(fname, 'w') as f:
+    f.write(contents)
+'''
+
+configure_file(
+  output : 'GstDocumentedSubprojects',
+  command : [python3,
+             '-c', write_file_contents,
+             '@OUTPUT@',
+             documented_projects]
+)
+
+if documented_projects != ''
+  subproject('gst-docs')
+  message('Gst docs subprojects: ' + documented_projects)
+endif
+
 all_plugins_paths = []
 foreach plugin: all_plugins
   all_plugins_paths += plugin.full_path()