From 95eca6d91912620a8a36b55ae32f72a32bc2475b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= <tim@centricular.com>
Date: Sun, 3 Nov 2024 17:30:40 +0000
Subject: [PATCH] meson: bail out earlier in docs subdir if docs are disabled

The gst_dep.get_variable('libexecdir') may fail in some scenarios
(e.g. building a module alone inside an uninstalled devenv) and
it shouldn't really be reached in the first place if docs are
disabled via options.

Also to avoid confusing meson messages when cross-compiling or
doing a static build.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7818>
---
 subprojects/gst-devtools/docs/meson.build         | 4 ++++
 subprojects/gst-editing-services/docs/meson.build | 4 ++++
 subprojects/gst-libav/docs/meson.build            | 4 ++++
 subprojects/gst-plugins-bad/docs/meson.build      | 4 ++++
 subprojects/gst-plugins-base/docs/meson.build     | 4 ++++
 subprojects/gst-plugins-good/docs/meson.build     | 4 ++++
 subprojects/gst-plugins-ugly/docs/meson.build     | 4 ++++
 subprojects/gst-rtsp-server/docs/meson.build      | 4 ++++
 subprojects/gstreamer-vaapi/docs/meson.build      | 4 ++++
 9 files changed, 36 insertions(+)

diff --git a/subprojects/gst-devtools/docs/meson.build b/subprojects/gst-devtools/docs/meson.build
index bff332831b..874fb83200 100644
--- a/subprojects/gst-devtools/docs/meson.build
+++ b/subprojects/gst-devtools/docs/meson.build
@@ -1,5 +1,9 @@
 build_hotdoc = false
 
+if get_option('doc').disabled()
+  subdir_done()
+endif
+
 if meson.is_cross_build()
     if get_option('doc').enabled()
         error('Documentation enabled but building the doc while cross building is not supported yet.')
diff --git a/subprojects/gst-editing-services/docs/meson.build b/subprojects/gst-editing-services/docs/meson.build
index ee02280829..50839ec924 100644
--- a/subprojects/gst-editing-services/docs/meson.build
+++ b/subprojects/gst-editing-services/docs/meson.build
@@ -1,5 +1,9 @@
 build_hotdoc = false
 
+if get_option('doc').disabled()
+  subdir_done()
+endif
+
 if meson.is_cross_build()
     if get_option('doc').enabled()
         error('Documentation enabled but building the doc while cross building is not supported yet.')
diff --git a/subprojects/gst-libav/docs/meson.build b/subprojects/gst-libav/docs/meson.build
index 22fb9b7629..bb744a6ee5 100644
--- a/subprojects/gst-libav/docs/meson.build
+++ b/subprojects/gst-libav/docs/meson.build
@@ -1,5 +1,9 @@
 build_hotdoc = false
 
+if get_option('doc').disabled()
+  subdir_done()
+endif
+
 if meson.is_cross_build()
     if get_option('doc').enabled()
         error('Documentation enabled but building the doc while cross building is not supported yet.')
diff --git a/subprojects/gst-plugins-bad/docs/meson.build b/subprojects/gst-plugins-bad/docs/meson.build
index e85fd6f56c..380c44503a 100644
--- a/subprojects/gst-plugins-bad/docs/meson.build
+++ b/subprojects/gst-plugins-bad/docs/meson.build
@@ -1,5 +1,9 @@
 build_hotdoc = false
 
+if get_option('doc').disabled()
+  subdir_done()
+endif
+
 if meson.is_cross_build()
     if get_option('doc').enabled()
         error('Documentation enabled but building the doc while cross building is not supported yet.')
diff --git a/subprojects/gst-plugins-base/docs/meson.build b/subprojects/gst-plugins-base/docs/meson.build
index 009a59a8c2..3a24caf4ea 100644
--- a/subprojects/gst-plugins-base/docs/meson.build
+++ b/subprojects/gst-plugins-base/docs/meson.build
@@ -1,5 +1,9 @@
 build_hotdoc = false
 
+if get_option('doc').disabled()
+  subdir_done()
+endif
+
 if meson.is_cross_build()
     if get_option('doc').enabled()
         error('Documentation enabled but building the doc while cross building is not supported yet.')
diff --git a/subprojects/gst-plugins-good/docs/meson.build b/subprojects/gst-plugins-good/docs/meson.build
index 07dc6c329d..67c58af4fe 100644
--- a/subprojects/gst-plugins-good/docs/meson.build
+++ b/subprojects/gst-plugins-good/docs/meson.build
@@ -1,5 +1,9 @@
 build_hotdoc = false
 
+if get_option('doc').disabled()
+  subdir_done()
+endif
+
 if static_build
     if get_option('doc').enabled()
         error('Documentation enabled but not supported when building statically.')
diff --git a/subprojects/gst-plugins-ugly/docs/meson.build b/subprojects/gst-plugins-ugly/docs/meson.build
index ae3e46d5f9..af312e55ab 100644
--- a/subprojects/gst-plugins-ugly/docs/meson.build
+++ b/subprojects/gst-plugins-ugly/docs/meson.build
@@ -1,5 +1,9 @@
 build_hotdoc = false
 
+if get_option('doc').disabled()
+  subdir_done()
+endif
+
 if meson.is_cross_build()
     if get_option('doc').enabled()
         error('Documentation enabled but building the doc while cross building is not supported yet.')
diff --git a/subprojects/gst-rtsp-server/docs/meson.build b/subprojects/gst-rtsp-server/docs/meson.build
index eb5c80fb18..d3fc8918e3 100644
--- a/subprojects/gst-rtsp-server/docs/meson.build
+++ b/subprojects/gst-rtsp-server/docs/meson.build
@@ -1,5 +1,9 @@
 build_hotdoc = false
 
+if get_option('doc').disabled()
+  subdir_done()
+endif
+
 if meson.is_cross_build()
     if get_option('doc').enabled()
         error('Documentation enabled but building the doc while cross building is not supported yet.')
diff --git a/subprojects/gstreamer-vaapi/docs/meson.build b/subprojects/gstreamer-vaapi/docs/meson.build
index 2ddb741b18..cefede17ad 100644
--- a/subprojects/gstreamer-vaapi/docs/meson.build
+++ b/subprojects/gstreamer-vaapi/docs/meson.build
@@ -1,5 +1,9 @@
 build_hotdoc = false
 
+if get_option('doc').disabled()
+  subdir_done()
+endif
+
 if meson.is_cross_build()
     if get_option('doc').enabled()
         error('Documentation enabled but building the doc while cross building is not supported yet.')