From d7cddbdb611bd51f21e01d3ff8609989cd232e61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikl=C4=81vs=20Ko=C4=BCes=C5=86ikovs?= <89q1r14hd@relay.firefox.com> Date: Thu, 24 Jun 2021 16:54:36 +0300 Subject: [PATCH] meson: changes meson switches for controlling session manager Some distributions set --auto_features=enabled which messes with the internal logic of the build system when features are used for other purposes than pure dependency control. The only solution is to either avoid the value auto or change the type of the option to non-feature. This commit does the later by replacing -Dmedia-session, -Dwireplumber and -Dsession-manager with the new -Dsession-managers array and -Ddefault-session-manager combo options. Fixes #1333 Fixes #1336 --- .cirrus.yml | 2 +- meson_options.txt | 17 +++++------- src/daemon/meson.build | 38 +++++++++++++++++---------- src/daemon/systemd/system/meson.build | 2 +- src/daemon/systemd/user/meson.build | 2 +- src/examples/meson.build | 2 +- 6 files changed, 35 insertions(+), 28 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 4954373d9..fa3eb11c6 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -18,7 +18,7 @@ task: build_script: - mkdir build - cd build - - meson setup -Dalsa=enabled -Dpipewire-alsa=enabled -Dbluez5=disabled -Djack=disabled -Dmedia-session=enabled -Dpipewire-jack=disabled -Dpw-cat=enabled -Dv4l2=disabled -Dsdl2=enabled -Dsystemd=disabled .. + - meson setup -Dalsa=enabled -Dpipewire-alsa=enabled -Dbluez5=disabled -Djack=disabled -Dpipewire-jack=disabled -Dpw-cat=enabled -Dv4l2=disabled -Dsdl2=enabled -Dsystemd=disabled -Dsession-managers=media-session -Ddefault-session-manager=media-session .. - ninja test_script: - cd build diff --git a/meson_options.txt b/meson_options.txt index 9e3f0c06a..3ff30ad79 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -199,16 +199,13 @@ option('libusb', description: 'Enable code that depends on libusb', type: 'feature', value: 'auto') -option('media-session', - description: 'Build and install pipewire-media-session', - type: 'feature', - value: 'enabled') -option('wireplumber', - description: 'Build and install wireplumber (subproject)', - type: 'feature', - value: 'auto') -option('session-manager', - description : 'Session manager to build and use in the uninstalled environment', +option('session-managers', + description : 'Session managers to build (can be [] for none)', + type : 'array', + choices : ['media-session', 'wireplumber'], + value : ['media-session']) +option('default-session-manager', + description : 'Default session manager (leave as-is if none are built)', type : 'combo', choices : ['media-session', 'wireplumber'], value : 'media-session') diff --git a/src/daemon/meson.build b/src/daemon/meson.build index 7ed2d6242..51e1ac460 100644 --- a/src/daemon/meson.build +++ b/src/daemon/meson.build @@ -24,24 +24,34 @@ conf_config_uninstalled.set('pipewire_pulse_path', meson.build_root() / 'src' / 'daemon' / 'pipewire-pulse') conf_config_uninstalled.set('comment', '') -# Build WirePlumber if requested, and set it up in the config files -build_wp = get_option('wireplumber') -sm_choice = get_option('session-manager') +build_ms = get_option('session-managers').contains('media-session') +build_wp = get_option('session-managers').contains('wireplumber') +sm_choice = get_option('default-session-manager') -if build_wp.disabled() and (sm_choice == 'wireplumber') - error('option to build wireplumber is disabled, ' + +if sm_choice == 'media-session' + if get_option('session-managers') == [] + warning(' to use pw-uninstalled.sh manually edit pipewire-uninstalled.conf') + elif not build_ms + error('media-session is the chosen session manager but it won\'t be built') + endif +endif + +if not build_wp and (sm_choice == 'wireplumber') + error('building of the wireplumber subproject is disabled, ' + 'but the requested session-manager is wireplumber') -elif build_wp.enabled() or (build_wp.auto() and (sm_choice == 'wireplumber')) +elif build_wp wp_proj = subproject('wireplumber', required : true) - wp_bindir = wp_proj.get_variable('wireplumber_bin_dir', pipewire_bindir) + if sm_choice == 'wireplumber' + wp_bindir = wp_proj.get_variable('wireplumber_bin_dir', pipewire_bindir) - conf_config.set('session_manager_path', wp_bindir / 'wireplumber') + conf_config.set('session_manager_path', wp_bindir / 'wireplumber') - # wp-uninstalled.sh -b path/to/wp/build/root wireplumber - conf_config_uninstalled.set('session_manager_path', - meson.source_root() / 'subprojects' / 'wireplumber' / 'wp-uninstalled.sh') - conf_config_uninstalled.set('session_manager_args', - '-b ' + meson.build_root() / 'subprojects' / 'wireplumber' + ' wireplumber') + # wp-uninstalled.sh -b path/to/wp/build/root wireplumber + conf_config_uninstalled.set('session_manager_path', + meson.source_root() / 'subprojects' / 'wireplumber' / 'wp-uninstalled.sh') + conf_config_uninstalled.set('session_manager_args', + '-b ' + meson.build_root() / 'subprojects' / 'wireplumber' + ' wireplumber') + endif endif conf_files = [ @@ -106,7 +116,7 @@ custom_target('pipewire-uninstalled', #endif subdir('filter-chain') -if not get_option('media-session').disabled() +if build_ms subdir('media-session.d') endif if systemd.found() diff --git a/src/daemon/systemd/system/meson.build b/src/daemon/systemd/system/meson.build index eae646c1c..944c211fe 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 not get_option('media-session').disabled() +if get_option('session-managers').contains('media-session') 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 aa30a86fd..e4f996057 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 not get_option('media-session').disabled() +if get_option('session-managers').contains('media-session') 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 ac6bfb71d..041d7d1aa 100644 --- a/src/examples/meson.build +++ b/src/examples/meson.build @@ -56,7 +56,7 @@ executable('export-spa-device', dependencies : [pipewire_dep, mathlib], ) -if not get_option('media-session').disabled() and alsa_dep.found() +if get_option('session-managers').contains('media-session') and alsa_dep.found() sm_logind_src = [] sm_logind_dep = [] if systemd.found() and systemd_dep.found()