[libgnome-volume-control/wip/inigomartinez/optional-alsa] build: Make ALSA support optional



commit f507559c902fb9742709d54965406db4fb74c658
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Fri Jan 26 10:08:09 2018 +0100

    build: Make ALSA support optional
    
    ALSA support is not mandatory for libgnome-volume-control, but it
    can not be made optional.
    
    This patch makes the ALSA support optional by using an option.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=792919

 meson.build       |   23 +++++++++++++----------
 meson_options.txt |    6 ++++++
 2 files changed, 19 insertions(+), 10 deletions(-)
---
diff --git a/meson.build b/meson.build
index d719398..68386c3 100644
--- a/meson.build
+++ b/meson.build
@@ -12,7 +12,6 @@ gnome = import('gnome')
 pkglibdir = get_option('pkglibdir')
 pkgdatadir = get_option('pkgdatadir')
 
-alsa = dependency('alsa', required: false)
 gio = dependency('gio-2.0')
 gobject = dependency('gobject-2.0')
 libpulse = dependency('libpulse', version: '>= 2.0')
@@ -21,13 +20,6 @@ libpulse_glib = dependency('libpulse-mainloop-glib')
 cdata = configuration_data()
 cdata.set_quoted('GETTEXT_PACKAGE', get_option('package-name'))
 cdata.set_quoted('PACKAGE_VERSION', get_option('package-version'))
-cdata.set('HAVE_ALSA', alsa.found())
-
-config = configure_file(
-  input: 'config.h.meson',
-  output: 'config.h',
-  configuration: cdata
-)
 
 libgvc_inc = include_directories('.')
 
@@ -63,13 +55,18 @@ libgvc_no_gir_sources = [
 ]
 
 libgvc_deps = [
-  alsa,
   gio,
   gobject,
   libpulse,
   libpulse_glib
 ]
 
+enable_alsa = get_option('alsa')
+if enable_alsa
+  libgvc_deps += dependency('alsa')
+endif
+cdata.set('HAVE_ALSA', enable_alsa)
+
 static = get_option('static')
 with_introspection = get_option('with-introspection')
 
@@ -129,7 +126,7 @@ if with_introspection
   )
 endif
 
-if alsa.found()
+if enable_alsa
   executable('test-audio-device-selection',
     sources: 'test-audio-device-selection.c',
     link_with: libgvc,
@@ -143,3 +140,9 @@ libgvc_dep = declare_dependency(
   include_directories: libgvc_inc,
   dependencies: libgvc_deps
 )
+
+config = configure_file(
+  input: 'config.h.meson',
+  output: 'config.h',
+  configuration: cdata
+)
diff --git a/meson_options.txt b/meson_options.txt
index aa802b6..379a6c7 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -22,6 +22,12 @@ option('pkgdatadir',
   description: 'The private directory the gir file will be installed into.'
 )
 
+option('alsa',
+  type: 'boolean',
+  value: true,
+  description: 'Build ALSA support.'
+)
+
 option('static',
   type: 'boolean',
   value: false,


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