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
This commit is contained in:
Iñigo Martínez 2018-01-26 10:08:09 +01:00
parent 9a2996b362
commit 67533bffdc
2 changed files with 19 additions and 10 deletions

View File

@ -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
)

View File

@ -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,