From ea6d602ccacee5f4bdf45b9f58eb0dc5320f3c07 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Sun, 10 Dec 2023 04:26:59 +0100
Subject: [PATCH] ladspa: Make RDF parsing truely optional

If the ladspa plugin is enabled explicitly or via auto-features, the
liblrdf dependency can not be disabled.

As the RDF parsing currently provides hardly any features, the possibility
to disable it fairly useful.

Fixes: #3168
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5794>
---
 subprojects/gst-plugins-bad/ext/ladspa/meson.build | 11 +++++------
 subprojects/gst-plugins-bad/meson_options.txt      |  1 +
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/subprojects/gst-plugins-bad/ext/ladspa/meson.build b/subprojects/gst-plugins-bad/ext/ladspa/meson.build
index afc477b605..946ef9b2d6 100644
--- a/subprojects/gst-plugins-bad/ext/ladspa/meson.build
+++ b/subprojects/gst-plugins-bad/ext/ladspa/meson.build
@@ -12,18 +12,17 @@ if get_option('ladspa').disabled()
   subdir_done()
 endif
 
-# This is an optional dep, but we make it optional only in auto mode
-lrdf_dep = dependency('lrdf', required : get_option('ladspa'))
-if lrdf_dep.found()
-  ladspa_cargs = ['-DHAVE_LRDF']
-endif
-
 have_ladspa_h = cc.has_header('ladspa.h')
 if not have_ladspa_h and get_option('ladspa').enabled()
   error('ladspa plugin is enabled but ladspa.h not found')
 endif
 
 if have_ladspa_h
+  lrdf_dep = dependency('lrdf', required : get_option('ladspa-rdf'))
+  if lrdf_dep.found()
+    ladspa_cargs = ['-DHAVE_LRDF']
+  endif
+
   gstladspa = library('gstladspa',
     ladspa_sources,
     c_args : gst_plugins_bad_args + ladspa_cargs,
diff --git a/subprojects/gst-plugins-bad/meson_options.txt b/subprojects/gst-plugins-bad/meson_options.txt
index 29057e0bd5..7154bf840a 100644
--- a/subprojects/gst-plugins-bad/meson_options.txt
+++ b/subprojects/gst-plugins-bad/meson_options.txt
@@ -129,6 +129,7 @@ option('ipcpipeline', type : 'feature', value : 'auto', description : 'Inter-pro
 option('iqa', type : 'feature', value : 'auto', description : 'Image quality assessment plugin (AGPL - only built if gpl option is also enabled!)')
 option('kms', type : 'feature', value : 'auto', description : 'KMS video sink plugin')
 option('ladspa', type : 'feature', value : 'auto', description : 'LADSPA plugin bridge')
+option('ladspa-rdf', type : 'feature', value : 'auto', description : 'LADSPA plugin bridge RDF support')
 option('lc3', type : 'feature', value : 'auto', description : 'LC3 (Bluetooth) LE audio codec plugin')
 option('ldac', type : 'feature', value : 'auto', description : 'LDAC bluetooth audio codec plugin')
 option('libde265', type : 'feature', value : 'auto', description : 'HEVC/H.265 video decoder plugin')