From 485bae5eb00c0f5d3d91bd8bf1b302896571f4ed Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Wed, 10 Mar 2021 15:36:27 -0300 Subject: [PATCH] meson: Use `feature` options everywhere it makes sense --- .cirrus.yml | 2 +- .gitlab-ci.yml | 18 ++-- man/meson.build | 2 +- meson.build | 115 +++++++++----------- meson_options.txt | 145 +++++++++++++------------- spa/examples/meson.build | 2 +- spa/meson.build | 44 +++----- spa/plugins/alsa/meson.build | 2 +- spa/plugins/bluez5/meson.build | 28 ++++- spa/plugins/meson.build | 34 +++--- spa/plugins/support/meson.build | 6 +- src/daemon/meson.build | 4 +- src/daemon/systemd/meson.build | 4 +- src/daemon/systemd/system/meson.build | 2 +- src/daemon/systemd/user/meson.build | 2 +- src/examples/meson.build | 4 +- src/gst/meson.build | 6 +- src/meson.build | 8 +- src/modules/meson.build | 2 +- src/tools/meson.build | 5 +- 20 files changed, 211 insertions(+), 224 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index e55d11fcb..9c0bd52c2 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -11,7 +11,7 @@ task: build_script: - mkdir build - cd build - - meson setup -Dalsa=false -Dpipewire-alsa=false -Dbluez5=false -Djack=false -Dpipewire-jack=false -Dpipewire-pulseaudio=false -Dv4l2=false -Dsystemd=false .. + - meson setup -Dalsa=disabled -Dpipewire-alsa=disabled -Dbluez5=disabled -Djack=disabled -Dpipewire-jack=disabled -Dpipewire-pulseaudio=disabled -Dv4l2=disabled -Dsystemd=disabled .. - ninja test_script: - cd build diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4de99763e..d35e14ac6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -54,15 +54,15 @@ include: - export XDG_RUNTIME_DIR="$(mktemp -p $PWD -d xdg-runtime-XXXXXX)" script: - meson "$BUILD_DIR" . --prefix="$PREFIX" - -Ddocs=true - -Dinstalled_tests=true - -Dsystemd-system-service=true - -Dbluez5-backend-hsphfpd=true - -Daudiotestsrc=true - -Dtest=true - -Dvideotestsrc=true - -Dvolume=true - -Dvulkan=true + -Ddocs=enabled + -Dinstalled_tests=enabled + -Dsystemd-system-service=enabled + -Dbluez5-backend-hsphfpd=enabled + -Daudiotestsrc=enabled + -Dtest=enabled + -Dvideotestsrc=enabled + -Dvolume=enabled + -Dvulkan=enabled -Dsdl2=enabled -Dsndfile=enabled - ninja -C "$BUILD_DIR" diff --git a/man/meson.build b/man/meson.build index 5506a356d..2f3fdab23 100644 --- a/man/meson.build +++ b/man/meson.build @@ -19,7 +19,7 @@ manpages = [ [ 'pw-mon', '1' ] ] -if get_option('pipewire-jack') +if not get_option('pipewire-jack').disabled() manpages += [[ 'pw-jack', '1' ]] endif diff --git a/meson.build b/meson.build index 391f31533..6f2a20f39 100644 --- a/meson.build +++ b/meson.build @@ -171,7 +171,7 @@ elif cc.links( dependencies : libatomic, name : '8-byte __atomic_store_n with libatomic') atomic_dep = libatomic -elif get_option('pipewire-jack') +elif get_option('pipewire-jack').enabled() # Currently only required for the JACK backend error('8-byte atomic operations are required for pipewire-jack') endif @@ -277,43 +277,12 @@ if cc.has_function('getrandom', prefix : '#include ') cdata.set('HAVE_GETRANDOM', 1) endif -if get_option('systemd') - systemd = dependency('systemd', required: false) - systemd_dep = dependency('libsystemd', required: false) - if systemd.found() and systemd_dep.found() - cdata.set('HAVE_SYSTEMD', 1) - else - warning('systemd integration was enabled, but systemd is not available') - endif +systemd = dependency('systemd', required: get_option('systemd')) +systemd_dep = dependency('libsystemd',required: get_option('systemd')) +if systemd.found() and systemd_dep.found() + cdata.set('HAVE_SYSTEMD', 1) endif -if get_option('bluez5') - if get_option('bluez5-backend-hsp-native') - cdata.set('HAVE_BLUEZ_5_BACKEND_HSP_NATIVE', 1) - cdata.set('HAVE_BLUEZ_5_BACKEND_NATIVE', 1) - endif - if get_option('bluez5-backend-hfp-native') - cdata.set('HAVE_BLUEZ_5_BACKEND_HFP_NATIVE', 1) - cdata.set('HAVE_BLUEZ_5_BACKEND_NATIVE', 1) - endif - if get_option('bluez5-backend-ofono') - cdata.set('HAVE_BLUEZ_5_BACKEND_OFONO', 1) - endif - if get_option('bluez5-backend-hsphfpd') - cdata.set('HAVE_BLUEZ_5_BACKEND_HSPHFPD', 1) - endif -endif - -if get_option('gstreamer') - if get_option('gstreamer-device-provider') - cdata.set('HAVE_GSTREAMER_DEVICE_PROVIDER', 1) - endif -endif - -configure_file(input : 'config.h.meson', - output : 'config.h', - configuration : cdata) - configinc = include_directories('.') pipewire_inc = include_directories('src') @@ -341,19 +310,35 @@ sdl_dep = dependency('sdl2', required : get_option('sdl2')) ncurses_dep = dependency('ncurses', required : false) sndfile_dep = dependency('sndfile', version : '>= 1.0.20', required : get_option('sndfile')) -if get_option('gstreamer') - glib_dep = dependency('glib-2.0', version : '>=2.32.0') -endif +gst_option = get_option('gstreamer') +gst_deps_def = { + 'glib-2.0': {'version': '>=2.32.0'}, + 'gobject-2.0': {}, + 'gmodule-2.0': {}, + 'gio-2.0': {}, + 'gio-unix-2.0': {}, + 'gstreamer-1.0': {'version': '>= 1.10.0'}, + 'gstreamer-plugins-base-1.0': {}, + 'gstreamer-video-1.0': {}, + 'gstreamer-audio-1.0': {}, + 'gstreamer-allocators-1.0': {}, +} -if get_option('gstreamer') - gobject_dep = dependency('gobject-2.0') - gmodule_dep = dependency('gmodule-2.0') - gio_dep = [dependency('gio-2.0'), dependency('gio-unix-2.0')] - gst_dep = [dependency('gstreamer-1.0', version : '>= 1.10.0'), - dependency('gstreamer-plugins-base-1.0'), - dependency('gstreamer-video-1.0'), - dependency('gstreamer-audio-1.0'), - dependency('gstreamer-allocators-1.0'),] +gst_dep = [] +foreach depname, kwargs: gst_deps_def + dep = dependency(depname, required: gst_option, kwargs: kwargs) + if not dep.found() + gst_dep = [] + if get_option('gstreamer-device-provider').enabled() + error('`gstreamer-device-provider` is enabled but `@0@` was not found.'.format(depname)) + endif + break + endif + gst_dep += [dep] +endforeach + +if not get_option('gstreamer-device-provider').disabled() + cdata.set('HAVE_GSTREAMER_DEVICE_PROVIDER', 1) endif # On FreeBSD, epoll-shim library is required for eventfd() and timerfd() @@ -365,44 +350,38 @@ libinotify_dep = (build_machine.system() == 'freebsd' ? dependency('libinotify', required: true) : dependency('', required: false)) -alsa_dep = (get_option('pipewire-alsa') - ? dependency('alsa', version : '>=1.1.7') - : dependency('', required: false)) +alsa_dep = dependency('alsa', version : '>=1.1.7', required: get_option('pipewire-alsa')) installed_tests_metadir = join_paths(pipewire_datadir, 'installed-tests', pipewire_name) installed_tests_execdir = join_paths(pipewire_libexecdir, 'installed-tests', pipewire_name) -installed_tests_enabled = get_option('installed_tests') +installed_tests_enabled = not get_option('installed_tests').disabled() installed_tests_template = files('template.test.in') subdir('po') subdir('spa') subdir('src') -if get_option('pipewire-jack') +configure_file(input : 'config.h.meson', + output : 'config.h', + configuration : cdata) + +if not get_option('pipewire-jack').disabled() subdir('pipewire-jack') endif -if get_option('pipewire-alsa') +if not get_option('pipewire-alsa').disabled() subdir('pipewire-alsa/alsa-plugins') subdir('pipewire-alsa/conf') endif -if get_option('docs') - doxygen = find_program('doxygen', required : false) - if doxygen.found() - subdir('doc') - else - warning('Documentation was enabled, but doxygen is not available') - endif +doxygen = find_program('doxygen', required : get_option('docs')) +if doxygen.found() + subdir('doc') endif -if get_option('man') - xmltoman = find_program('xmltoman', required : false) - if xmltoman.found() - subdir('man') - else - warning('Man page generation was enabled, but xmltoman is not available') - endif +xmltoman = find_program('xmltoman', required : get_option('man')) +if xmltoman.found() + subdir('man') endif setenv = find_program('pw-uninstalled.sh') diff --git a/meson_options.txt b/meson_options.txt index ce364d93a..1b5bb5504 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,154 +1,155 @@ option('docs', description: 'Build documentation', - type: 'boolean', - value: false) + type: 'feature', + value: 'disabled') option('examples', description: 'Build examples', - type: 'boolean', - value: true) + type: 'feature', + value: 'enabled') option('media-session', description: 'Build and install pipewire-media-session', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('man', description: 'Build manpages', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('tests', description: 'Build tests', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto', + yield : true) option('installed_tests', description: 'Install manual and automated test executables', - type: 'boolean', - value: false) + type: 'feature', + value: 'disabled') option('gstreamer', description: 'Build GStreamer plugins', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('gstreamer-device-provider', description: 'Build GStreamer device provider plugin', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('systemd', description: 'Enable systemd integration', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('systemd-system-service', description: 'Install systemd system service file', - type: 'boolean', - value: false) + type: 'feature', + value: 'auto') option('systemd-user-service', description: 'Install systemd user service file', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('pipewire-alsa', description: 'Enable pipewire-alsa integration', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('pipewire-jack', description: 'Enable pipewire-jack integration', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('libjack-path', description: 'Where to install the libjack.so library', type: 'string') option('spa-plugins', description: 'Enable spa plugins integration', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('alsa', description: 'Enable alsa spa plugin integration', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('audiomixer', description: 'Enable audiomixer spa plugin integration', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('audioconvert', description: 'Enable audioconvert spa plugin integration', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('bluez5', description: 'Enable bluez5 spa plugin integration', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('bluez5-backend-hsp-native', description: 'Enable HSP in native backend in bluez5 spa plugin', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('bluez5-backend-hfp-native', description: 'Enable HFP in native backend in bluez5 spa plugin', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('bluez5-backend-ofono', description: 'Enable oFono HFP backend in bluez5 spa plugin', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('bluez5-backend-hsphfpd', description: 'Enable hsphfpd backend in bluez5 spa plugin', - type: 'boolean', - value: false) + type: 'feature', + value: 'auto') option('control', description: 'Enable control spa plugin integration', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('audiotestsrc', description: 'Enable audiotestsrc spa plugin integration', - type: 'boolean', - value: false) + type: 'feature', + value: 'auto') option('ffmpeg', description: 'Enable ffmpeg spa plugin integration', - type: 'boolean', - value: false) + type: 'feature', + value: 'disabled') option('jack', description: 'Enable jack spa plugin integration', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('support', description: 'Enable support spa plugin integration', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('evl', description: 'Enable EVL support spa plugin integration', - type: 'boolean', - value: false) + type: 'feature', + value: 'disabled') option('test', description: 'Enable test spa plugin integration', - type: 'boolean', - value: false) + type: 'feature', + value: 'disabled') option('v4l2', description: 'Enable v4l2 spa plugin integration', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('libcamera', description: 'Enable libcamera spa plugin integration', type: 'boolean', value: false) option('videoconvert', description: 'Enable videoconvert spa plugin integration', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('videotestsrc', description: 'Enable videotestsrc spa plugin integration', - type: 'boolean', - value: false) + type: 'feature', + value: 'auto') option('volume', description: 'Enable volume spa plugin integration', - type: 'boolean', - value: false) + type: 'feature', + value: 'auto') option('vulkan', description: 'Enable vulkan spa plugin integration', - type: 'boolean', - value: false) + type: 'feature', + value: 'auto') option('pw-cat', description: 'Build pw-cat/pw-play/pw-record', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('udev', description: 'Enable Udev integration', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto') option('udevrulesdir', type : 'string', description : 'Directory for udev rules (defaults to /lib/udev/rules.d)') diff --git a/spa/examples/meson.build b/spa/examples/meson.build index fa4c9a760..d79931dd6 100644 --- a/spa/examples/meson.build +++ b/spa/examples/meson.build @@ -6,7 +6,7 @@ if sdl_dep.found() install : installed_tests_enabled, install_dir : join_paths(installed_tests_execdir, 'examples', 'spa')) - if get_option('libcamera') and libcamera_dep.found() + if libcamera_dep.found() executable('local-libcamera', 'local-libcamera.c', include_directories : [configinc, spa_inc], c_args : ['-D_GNU_SOURCE'], diff --git a/spa/meson.build b/spa/meson.build index 47fa19f93..b246b90cc 100644 --- a/spa/meson.build +++ b/spa/meson.build @@ -9,7 +9,7 @@ spa_inc = include_directories('include') subdir('include') -if get_option('spa-plugins') +if not get_option('spa-plugins').disabled() udevrulesdir = get_option('udevrulesdir') if udevrulesdir == '' # absolute path, otherwise meson prepends the prefix @@ -17,42 +17,28 @@ if get_option('spa-plugins') endif # common dependencies - if get_option('alsa') or get_option('v4l2') - libudev_dep = dependency('libudev') - endif + libudev_dep = dependency('libudev', required: get_option('alsa').enabled() or get_option('v4l2').enabled() or get_option('udev').enabled()) # plugin-specific dependencies - if get_option('alsa') - alsa_dep = dependency('alsa') - endif - if get_option('bluez5') - bluez_dep = dependency('bluez', version : '>= 4.101') - sbc_dep = dependency('sbc') - ldac_dep = dependency('ldacBT-enc', required : false) - ldac_abr_dep = dependency('ldacBT-abr', required : false) - aptx_dep = dependency('libopenaptx', required : false) - fdk_aac_dep = dependency('fdk-aac', required : false) - endif - if get_option('ffmpeg') - avcodec_dep = dependency('libavcodec') - avformat_dep = dependency('libavformat') - endif - if get_option('jack') - jack_dep = dependency('jack', version : '>= 1.9.10') - endif - if get_option('vulkan') - vulkan_dep = dependency('vulkan', version : '>= 1.1.69') - endif - if get_option('libcamera') - libcamera_dep = dependency('camera') - endif + alsa_dep = dependency('alsa', required: get_option('alsa')) + bluez_dep = dependency('bluez', version : '>= 4.101', required: get_option('bluez5')) + sbc_dep = dependency('sbc', required: get_option('bluez5')) + ldac_dep = dependency('ldacBT-enc', required : false) + ldac_abr_dep = dependency('ldacBT-abr', required : false) + aptx_dep = dependency('libopenaptx', required : false) + fdk_aac_dep = dependency('fdk-aac', required : false) + avcodec_dep = dependency('libavcodec', required: get_option('ffmpeg')) + avformat_dep = dependency('libavformat', required: get_option('ffmpeg')) + jack_dep = dependency('jack', version : '>= 1.9.10', required: get_option('jack')) + vulkan_dep = dependency('vulkan', version : '>= 1.1.69', required: get_option('vulkan')) + libcamera_dep = dependency('camera', required: get_option('libcamera')) subdir('plugins') endif subdir('tools') subdir('tests') -if get_option('examples') +if not get_option('examples').disabled() subdir('examples') endif diff --git a/spa/plugins/alsa/meson.build b/spa/plugins/alsa/meson.build index 49830b318..eaaf31102 100644 --- a/spa/plugins/alsa/meson.build +++ b/spa/plugins/alsa/meson.build @@ -42,7 +42,7 @@ executable('test-timer', install : false, ) -if get_option('udev') and libudev_dep.found() +if libudev_dep.found() install_data(alsa_udevrules, install_dir : udevrulesdir, ) diff --git a/spa/plugins/bluez5/meson.build b/spa/plugins/bluez5/meson.build index 8ef10910b..de51659a6 100644 --- a/spa/plugins/bluez5/meson.build +++ b/spa/plugins/bluez5/meson.build @@ -1,3 +1,24 @@ +bluez5_deps = [ dbus_dep, sbc_dep, bluez_dep ] +foreach dep: bluez5_deps + if not dep.found() + subdir_done() + endif +endforeach + +if not get_option('bluez5-backend-hsp-native').disabled() + cdata.set('HAVE_BLUEZ_5_BACKEND_HSP_NATIVE', 1) + cdata.set('HAVE_BLUEZ_5_BACKEND_NATIVE', 1) +endif +if not get_option('bluez5-backend-hfp-native').disabled() + cdata.set('HAVE_BLUEZ_5_BACKEND_HFP_NATIVE', 1) + cdata.set('HAVE_BLUEZ_5_BACKEND_NATIVE', 1) +endif +if not get_option('bluez5-backend-ofono').disabled() + cdata.set('HAVE_BLUEZ_5_BACKEND_OFONO', 1) +endif +if not get_option('bluez5-backend-hsphfpd').disabled() + cdata.set('HAVE_BLUEZ_5_BACKEND_HSPHFPD', 1) +endif bluez5_sources = ['plugin.c', 'a2dp-codecs.c', @@ -11,7 +32,6 @@ bluez5_sources = ['plugin.c', 'bluez5-dbus.c'] bluez5_args = [ '-D_GNU_SOURCE' ] -bluez5_deps = [ dbus_dep, sbc_dep, bluez_dep ] if ldac_dep.found() bluez5_sources += [ 'a2dp-codec-ldac.c' ] @@ -33,15 +53,15 @@ if fdk_aac_dep.found() bluez5_deps += fdk_aac_dep endif -if get_option('bluez5-backend-hsp-native') or get_option('bluez5-backend-hfp-native') +if not get_option('bluez5-backend-hsp-native').disabled() or not get_option('bluez5-backend-hfp-native').disabled() bluez5_sources += ['backend-native.c'] endif -if get_option('bluez5-backend-ofono') +if not get_option('bluez5-backend-ofono').disabled() bluez5_sources += ['backend-ofono.c'] endif -if get_option('bluez5-backend-hsphfpd') +if not get_option('bluez5-backend-hsphfpd').disabled() bluez5_sources += ['backend-hsphfpd.c'] endif diff --git a/spa/plugins/meson.build b/spa/plugins/meson.build index bcff8e937..1651e5532 100644 --- a/spa/plugins/meson.build +++ b/spa/plugins/meson.build @@ -1,48 +1,46 @@ -if get_option('alsa') +if alsa_dep.found() subdir('alsa') endif -if get_option('audioconvert') +if not get_option('audioconvert').disabled() subdir('audioconvert') endif -if get_option('audiomixer') +if not get_option('audiomixer').disabled() subdir('audiomixer') endif -if get_option('control') +if not get_option('control').disabled() subdir('control') endif -if get_option('audiotestsrc') +if not get_option('audiotestsrc').disabled() subdir('audiotestsrc') endif -if get_option('bluez5') - subdir('bluez5') -endif -if get_option('ffmpeg') +subdir('bluez5') +if avcodec_dep.found() and avformat_dep.found() subdir('ffmpeg') endif -if get_option('jack') +if jack_dep.found() subdir('jack') endif -if get_option('support') +if not get_option('support').disabled() subdir('support') endif -if get_option('test') +if not get_option('test').disabled() subdir('test') endif -if get_option('videoconvert') +if not get_option('videoconvert').disabled() subdir('videoconvert') endif -if get_option('videotestsrc') +if not get_option('videotestsrc').disabled() subdir('videotestsrc') endif -if get_option('volume') +if not get_option('volume').disabled() subdir('volume') endif -if get_option('vulkan') +if vulkan_dep.found() subdir('vulkan') endif -if get_option('v4l2') +if libudev_dep.found() and not get_option('v4l2').disabled() subdir('v4l2') endif -if get_option('libcamera') +if libcamera_dep.found() subdir('libcamera') endif diff --git a/spa/plugins/support/meson.build b/spa/plugins/support/meson.build index d7f6541aa..841e4b7f1 100644 --- a/spa/plugins/support/meson.build +++ b/spa/plugins/support/meson.build @@ -15,10 +15,10 @@ spa_support_lib = shared_library('spa-support', install_dir : join_paths(spa_plugindir, 'support')) -if get_option('evl') +if not get_option('evl').disabled() evl_inc = include_directories('/usr/evl/include') evl_lib = cc.find_library('evl', - dirs: ['/usr/evl/lib/']) + dirs: ['/usr/evl/lib/'], required: get_option('evl')) spa_evl_sources = ['evl-system.c', 'evl-plugin.c'] @@ -42,7 +42,7 @@ spa_dbus_lib = shared_library('spa-dbus', install_dir : join_paths(spa_plugindir, 'support')) -if get_option('systemd') and systemd_dep.found() +if systemd_dep.found() spa_journal_sources = ['journal.c'] spa_journal_lib = shared_library('spa-journal', diff --git a/src/daemon/meson.build b/src/daemon/meson.build index d9966b850..098eb1360 100644 --- a/src/daemon/meson.build +++ b/src/daemon/meson.build @@ -77,9 +77,9 @@ executable('pipewire-pulse', # ) #endif -if get_option('media-session') +if not get_option('media-session').disabled() subdir('media-session.d') endif -if get_option('systemd') and systemd.found() +if systemd.found() subdir('systemd') endif diff --git a/src/daemon/systemd/meson.build b/src/daemon/systemd/meson.build index 8051b0f5b..89ad2f6dc 100644 --- a/src/daemon/systemd/meson.build +++ b/src/daemon/systemd/meson.build @@ -1,6 +1,6 @@ -if get_option('systemd-system-service') +if not get_option('systemd-system-service').disabled() subdir('system') endif -if get_option('systemd-user-service') +if not get_option('systemd-user-service').disabled() subdir('user') endif diff --git a/src/daemon/systemd/system/meson.build b/src/daemon/systemd/system/meson.build index ee0bfdf9e..1db96bc03 100644 --- a/src/daemon/systemd/system/meson.build +++ b/src/daemon/systemd/system/meson.build @@ -12,7 +12,7 @@ configure_file(input : 'pipewire.service.in', configuration : systemd_config, install_dir : systemd_system_services_dir) -if get_option('media-session') +if not get_option('media-session').disabled() configure_file(input : 'pipewire-media-session.service.in', output : 'pipewire-media-session.service', configuration : systemd_config, diff --git a/src/daemon/systemd/user/meson.build b/src/daemon/systemd/user/meson.build index 0a5e5042f..e4fd68769 100644 --- a/src/daemon/systemd/user/meson.build +++ b/src/daemon/systemd/user/meson.build @@ -22,7 +22,7 @@ configure_file(input : 'pipewire-pulse.service.in', configuration : systemd_config, install_dir : systemd_user_services_dir) -if get_option('media-session') +if not get_option('media-session').disabled() configure_file(input : 'pipewire-media-session.service.in', output : 'pipewire-media-session.service', configuration : systemd_config, diff --git a/src/examples/meson.build b/src/examples/meson.build index 7b2f1cd27..74f2366d7 100644 --- a/src/examples/meson.build +++ b/src/examples/meson.build @@ -65,7 +65,7 @@ executable('export-spa-device', dependencies : [pipewire_dep, mathlib], ) -if get_option('media-session') and alsa_dep.found() +if alsa_dep.found() executable('pipewire-media-session', 'media-session/access-flatpak.c', 'media-session/access-portal.c', @@ -94,6 +94,8 @@ if get_option('media-session') and alsa_dep.found() install: true, dependencies : [dbus_dep, pipewire_dep, alsa_dep, mathlib], ) +elif get_option('media-session').enabled() and not alsa_dep.found() + error('`media-session` is enabled but required dependency `alsa` not found.') endif executable('pw-reserve', diff --git a/src/gst/meson.build b/src/gst/meson.build index 66ea5261c..ad5a6b6f8 100644 --- a/src/gst/meson.build +++ b/src/gst/meson.build @@ -8,7 +8,7 @@ pipewire_gst_sources = [ 'gstpipewiresrc.c', ] -if get_option('gstreamer-device-provider') +if not get_option('gstreamer-device-provider').disabled() pipewire_gst_sources += [ 'gstpipewiredeviceprovider.c' ] endif @@ -31,7 +31,9 @@ pipewire_gst = shared_library('gstpipewire', pipewire_gst_sources, c_args : pipewire_gst_c_args, include_directories : [configinc, spa_inc], - dependencies : [gobject_dep, glib_dep, gio_dep, gst_dep, pipewire_dep], + dependencies : [gst_dep, pipewire_dep], install : true, install_dir : '@0@/gstreamer-1.0'.format(get_option('libdir')), ) + +plugins = [pipewire_gst] diff --git a/src/meson.build b/src/meson.build index 14e8ff389..db169c926 100644 --- a/src/meson.build +++ b/src/meson.build @@ -4,13 +4,11 @@ subdir('extensions') subdir('daemon') subdir('tools') subdir('modules') -if get_option('examples') +if not get_option('examples').disabled() subdir('examples') endif -if get_option('tests') +if not get_option('tests').disabled() subdir('tests') endif -if get_option('gstreamer') - subdir('gst') -endif +subdir('gst') diff --git a/src/modules/meson.build b/src/modules/meson.build index 8c9ccc85c..394ebfb28 100644 --- a/src/modules/meson.build +++ b/src/modules/meson.build @@ -69,7 +69,7 @@ pipewire_module_link_factory = shared_library('pipewire-module-link-factory', pipewire_module_protocol_deps = [mathlib, dl_lib, pipewire_dep] -if get_option('systemd') +if systemd_dep.found() pipewire_module_protocol_deps += systemd_dep endif diff --git a/src/tools/meson.build b/src/tools/meson.build index bc952114d..f95280027 100644 --- a/src/tools/meson.build +++ b/src/tools/meson.build @@ -54,7 +54,7 @@ if ncurses_dep.found() ) endif -if get_option('pw-cat') and sndfile_dep.found() +if not get_option('pw-cat').disabled() and sndfile_dep.found() pwcat_sources = [ 'pw-cat.c', @@ -80,5 +80,6 @@ if get_option('pw-cat') and sndfile_dep.found() cmd = 'ln -fs @0@ $DESTDIR@1@'.format('pw-cat', dst) meson.add_install_script('sh', '-c', cmd) endforeach - +elif not sndfile_dep.found() and get_option('pw-cat').enabled() + error('pw-cat is enabled but required dependency `sndfile` was not found.') endif