[tracker-miners/sam/safe-auto-build-options: 1/3] build: Remove generic_media_extractor=auto build option




commit 08c1560703bcb7e222b9e32e41197eeab5a1d724
Author: Sam Thursfield <sam thursfield codethink co uk>
Date:   Tue Aug 30 18:39:05 2022 +0200

    build: Remove generic_media_extractor=auto build option
    
    An 'auto' option is unhelpful to packagers and developers, for rationale
    see: https://blogs.gnome.org/mcatanzaro/2022/07/15/best-practices-for-build-options/
    
    The default is now 'gstreamer', which is the most widely used and tested
    backend. Configure will fail if the necessary GStreamer libraries are
    not available.

 meson.build       | 36 +++++++++++++-----------------------
 meson_options.txt |  4 ++--
 2 files changed, 15 insertions(+), 25 deletions(-)
---
diff --git a/meson.build b/meson.build
index cb757cd9b..b0dde707a 100644
--- a/meson.build
+++ b/meson.build
@@ -51,9 +51,6 @@ else
   tracker_sparql_uninstalled_dir = tracker_subproject.get_variable('tracker_sparql_uninstalled_dir')
 endif
 
-avcodec = dependency('libavcodec', version: '>= 0.8.4', required: false)
-avformat = dependency('libavformat', version: '>= 0.8.4', required: false)
-avutil = dependency('libavutil', version: '>= 0.8.4', required: false)
 dbus = dependency('dbus-1', version: '>= 1.3.1')
 exempi = dependency('exempi-2.0', version: '>= 2.1.0', required: get_option('xmp'))
 gexiv2 = dependency('gexiv2', required: get_option('raw'))
@@ -64,7 +61,6 @@ gmodule = dependency('gmodule-2.0', version: '>=' + glib_required)
 gobject = dependency('gobject-2.0', version: '>=' + glib_required)
 gstreamer = dependency('gstreamer-1.0', required: false)
 gstreamer_audio = dependency('gstreamer-audio-1.0', required: false)
-gstreamer_pbutils = dependency('gstreamer-pbutils-1.0', required: false)
 gstreamer_tag = dependency('gstreamer-tag-1.0', required: false)
 gupnp_dlna = dependency('gupnp-dlna-2.0', version: '>= 0.9.4', required: false)
 gupnp_dlna_gst = dependency('gupnp-dlna-gst-2.0', version: '>= 0.9.4', required: false)
@@ -244,34 +240,28 @@ endif
 # Check for tracker-extract: gstreamer/etc
 ####################################################################
 
-generic_media_handler = []
-generic_media_handler_name = 'none'
+generic_media_handler_name = get_option('generic_media_extractor')
 
-if get_option('generic_media_extractor') == 'auto'
-  if gstreamer.found() and gstreamer_tag.found()
-    generic_media_handler = [gstreamer, gstreamer_tag]
-    generic_media_handler_name = 'gstreamer'
-  elif avcodec.found() and avformat.found() and avutil.found()
-    generic_media_handler = [avcodec, avformat, avutil]
-    generic_media_handler_name = 'libav'
-  else
-    generic_media_handler_name = 'none'
-    generic_media_handler = []
-  endif
-elif get_option('generic_media_extractor') == 'gstreamer'
-  if gstreamer.found() and gstreamer_tag.found()
-    generic_media_handler = [gstreamer, gstreamer_tag]
-    generic_media_handler_name = 'gstreamer'
+if generic_media_handler_name  == 'gstreamer'
+  gstreamer_pbutils = dependency('gstreamer-pbutils-1.0', required: false)
+
+  if gstreamer.found() and gstreamer_pbutils.found()
+    generic_media_handler = [gstreamer, gstreamer_pbutils]
   else
     error('GStreamer media handler was enabled but required GStreamer libraries were not found')
   endif
-elif get_option('generic_media_extractor') == 'libav'
+elif generic_media_handler_name == 'libav'
+  avcodec = dependency('libavcodec', version: '>= 0.8.4', required: false)
+  avformat = dependency('libavformat', version: '>= 0.8.4', required: false)
+  avutil = dependency('libavutil', version: '>= 0.8.4', required: false)
+
   if avcodec.found() and avformat.found() and avutil.found()
     generic_media_handler = [avcodec, avformat, avutil]
-    generic_media_handler_name = 'libav'
   else
     error('libav media handler was enabled but required libav libraries were not found')
   endif
+else
+  generic_media_handler = []
 endif
 
 ###########################################################################
diff --git a/meson_options.txt b/meson_options.txt
index d0e3095a1..0173bba71 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -78,8 +78,8 @@ option('battery_detection', type: 'combo', choices: ['auto', 'hal', 'upower', 'n
        description: 'Enable upower or HAL for battery/mains power detection')
 option('charset_detection', type: 'combo', choices: ['auto', 'enca', 'icu', 'none'], value: 'auto',
        description: 'Enable enca or libicu for charset detection in MP3s')
-option('generic_media_extractor', type: 'combo', choices: ['auto', 'gstreamer', 'libav', 'none'], value: 
'auto',
-       description: 'Enables one of the (gstreamer, libav, auto) generic media extractor backends')
+option('generic_media_extractor', type: 'combo', choices: ['gstreamer', 'libav', 'none'], value: 'gstreamer',
+       description: 'Enables one of the (gstreamer, libav) generic media extractor backends')
 option('gstreamer_backend', type: 'combo', choices: ['discoverer', 'gupnp'], value: 'discoverer',
        description: 'When GStreamer is used, this enables one of the (discoverer, gupnp) GStreamer backends')
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]