From 88e850fd4b1954c25257be37146d8faa0de25c52 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 21 Oct 2025 13:09:07 -0700 Subject: [PATCH 1/4] meson: fix usage as subproject the non project versions of these functions evaluate to global_ variants not project_. Signed-off-by: Rosen Penev --- meson.build | 4 ++-- src/pulse/meson.build | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 1aec95adc..57c929b58 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,6 @@ project('pulseaudio', 'c', version : run_command(find_program('git-version-gen'), join_paths(meson.current_source_dir(), '.tarball-version'), check : false).stdout().strip(), - meson_version : '>= 0.50.0', + meson_version : '>= 0.56.0', default_options : [ 'c_std=gnu11', 'cpp_std=c++17' ] ) @@ -171,7 +171,7 @@ cdata.set_quoted('DESKTOPFILEDIR', join_paths(datadir, 'applications')) cdata.set_quoted('PULSE_LOCALEDIR', localedir) cdata.set_quoted('GETTEXT_PACKAGE', 'pulseaudio') cdata.set('ENABLE_NLS', 1) -cdata.set('top_srcdir', meson.source_root()) +cdata.set('top_srcdir', meson.project_source_root()) # Platform specifics # First some defaults to keep config file generation happy diff --git a/src/pulse/meson.build b/src/pulse/meson.build index c132630f3..1cf878dfd 100644 --- a/src/pulse/meson.build +++ b/src/pulse/meson.build @@ -72,10 +72,10 @@ endif if host_machine.system() != 'windows' and host_machine.system() != 'darwin' run_target('update-map-file', - command : [ join_paths(meson.source_root(), 'scripts/generate-map-file.sh'), 'map-file', 'libpulse.def', - [ libpulse_headers, 'simple.h', join_paths(meson.build_root(), 'src', 'pulse', 'version.h') ] ]) + command : [ join_paths(meson.project_source_root(), 'scripts/generate-map-file.sh'), 'map-file', 'libpulse.def', + [ libpulse_headers, 'simple.h', join_paths(meson.project_build_root(), 'src', 'pulse', 'version.h') ] ]) - versioning_link_args = ['-Wl,-version-script=' + join_paths(meson.source_root(), 'src', 'pulse', 'map-file')] + versioning_link_args = ['-Wl,-version-script=' + join_paths(meson.project_source_root(), 'src', 'pulse', 'map-file')] else versioning_link_args = [] endif From a8d7d2f732b0e5ab09f9d46a2e86683a5296d842 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 21 Oct 2025 13:17:10 -0700 Subject: [PATCH 2/4] meson: doxygen and tests to feature options Allows build to continue without passing extra options. Signed-off-by: Rosen Penev --- doxygen/meson.build | 7 ++++++- meson.build | 4 +--- meson_options.txt | 4 ++-- src/meson.build | 4 +--- src/tests/meson.build | 4 ++++ 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/doxygen/meson.build b/doxygen/meson.build index afc0e4989..7659de35c 100644 --- a/doxygen/meson.build +++ b/doxygen/meson.build @@ -1,3 +1,8 @@ +doxygen = find_program('doxygen', required: get_option('doxygen')) +if not doxygen.found() + subdir_done() +endif + cdata.set('DOXYGEN_OUTPUT_DIRECTORY', meson.current_build_dir()) doxygen_conf = configure_file( @@ -7,4 +12,4 @@ doxygen_conf = configure_file( ) run_target('doxygen', - command : ['doxygen', doxygen_conf]) + command : [doxygen, doxygen_conf]) diff --git a/meson.build b/meson.build index 57c929b58..5f80831a7 100644 --- a/meson.build +++ b/meson.build @@ -840,9 +840,7 @@ check_dep = dependency('check', version : '>= 0.9.10', required : get_option('te # Subdirs -if get_option('doxygen') - subdir('doxygen') -endif +subdir('doxygen') if get_option('client') subdir('po') endif diff --git a/meson_options.txt b/meson_options.txt index 0ab985d2a..7cf4606a5 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -5,7 +5,7 @@ option('client', type : 'boolean', value : true, description : 'Build and install pulseaudio client libraries and utilities') option('doxygen', - type : 'boolean', value : true, + type : 'feature', description : 'Enable building and installation of documentation generated with doxygen') option('gcov', type : 'boolean', value : false, @@ -14,7 +14,7 @@ option('man', type : 'boolean', description : 'Enable building and installation of man pages') option('tests', - type : 'boolean', + type : 'feature', description : 'Enable unit tests') option('system_user', diff --git a/src/meson.build b/src/meson.build index 2069d2803..943ad4990 100644 --- a/src/meson.build +++ b/src/meson.build @@ -224,7 +224,5 @@ if get_option('daemon') subdir('daemon') subdir('modules') endif -if get_option('tests') - subdir('tests') -endif +subdir('tests') subdir('utils') diff --git a/src/tests/meson.build b/src/tests/meson.build index bbdd23130..06b191693 100644 --- a/src/tests/meson.build +++ b/src/tests/meson.build @@ -1,3 +1,7 @@ +if not check_dep.found() + subdir_done() +endif + # Note that a few tests have dependencies on src/modules. # # The syntax for tests declaration is: From b0adc7a482456245fcfacf2920a65cb0a3fd0eda Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 21 Oct 2025 13:19:58 -0700 Subject: [PATCH 3/4] meson: avoid deprecated get_pkgconfig_variable Signed-off-by: Rosen Penev --- meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 5f80831a7..6f856a949 100644 --- a/meson.build +++ b/meson.build @@ -123,7 +123,7 @@ bashcompletiondir = get_option('bashcompletiondir') if bashcompletiondir == '' bash_completion_dep = dependency('bash-completion', required : false) if bash_completion_dep.found() - bashcompletiondir = bash_completion_dep.get_pkgconfig_variable('completionsdir') + bashcompletiondir = bash_completion_dep.get_variable(pkgconfig : 'completionsdir') else bashcompletiondir = join_paths(datadir, 'bash-completion', 'completions') endif @@ -733,7 +733,7 @@ if get_option('daemon') systemd_dep = dependency('systemd', required : get_option('systemd')) if systemd_dep.found() and systemduserunitdir == '' - systemduserunitdir = systemd_dep.get_pkgconfig_variable('systemduserunitdir') + systemduserunitdir = systemd_dep.get_variable(pkgconfig: 'systemduserunitdir') endif libelogind_dep = dependency('libelogind', required : get_option('elogind')) From 6791debca4ea414d2d279f2d6e8275bd1d55792d Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 21 Oct 2025 15:52:16 -0700 Subject: [PATCH 4/4] meson: add native to add_languages Fixes warning. Signed-off-by: Rosen Penev --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 6f856a949..0ac420c94 100644 --- a/meson.build +++ b/meson.build @@ -439,7 +439,7 @@ endif # Code coverage if get_option('gcov') - add_languages('cpp') + add_languages('cpp', native: false) add_project_arguments('--coverage', language: ['c', 'cpp']) add_project_link_arguments('--coverage', language: ['c', 'cpp']) endif