build-sys: meson: allow building client libraries only

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/540>
This commit is contained in:
Igor V. Kovalenko 2021-04-18 13:13:52 +03:00 committed by PulseAudio Marge Bot
parent 1a73fb9eb9
commit 424580a901
9 changed files with 291 additions and 188 deletions

View file

@ -1,19 +1,26 @@
# man page name, section, [aliases] # man page name, section, [aliases]
manpages = [ manpages = []
if get_option('daemon')
manpages += [
['default.pa', '5'], ['default.pa', '5'],
['pacat', '1', ['paplay', 'parec', 'parecord', 'pamon']],
['pacmd', '1'], ['pacmd', '1'],
['pactl', '1'],
['padsp', '1'],
['pasuspender', '1'], ['pasuspender', '1'],
['pax11publish', '1'],
['pulse-cli-syntax', '5'], ['pulse-cli-syntax', '5'],
['pulse-client.conf', '5'],
['pulse-daemon.conf', '5'], ['pulse-daemon.conf', '5'],
['pulseaudio', '1'], ['pulseaudio', '1'],
['start-pulseaudio-x11', '1'], ['start-pulseaudio-x11', '1'],
] ]
endif
manpages += [
['pacat', '1', ['paplay', 'parec', 'parecord', 'pamon']],
['pactl', '1'],
['padsp', '1'],
['pax11publish', '1'],
['pulse-client.conf', '5'],
]
# FIXME: Add esdcompat if HAVE_ESOUND # FIXME: Add esdcompat if HAVE_ESOUND
#manpages += ['esdcompat', '1'], #manpages += ['esdcompat', '1'],

View file

@ -881,6 +881,8 @@ summary = [
# 'CFLAGS: @0@'.format(${CFLAGS}), # 'CFLAGS: @0@'.format(${CFLAGS}),
# 'CPPFLAGS: @0@'.format(${CPPFLAGS}), # 'CPPFLAGS: @0@'.format(${CPPFLAGS}),
# 'LIBS: @0@'.format(${LIBS}), # 'LIBS: @0@'.format(${LIBS}),
'',
'Enable pulseaudio daemon: @0@'.format(get_option('daemon')),
'', '',
'Enable memfd shared memory: @0@'.format(cdata.has('HAVE_MEMFD')), 'Enable memfd shared memory: @0@'.format(cdata.has('HAVE_MEMFD')),
'Enable X11: @0@'.format(x11_dep.found()), 'Enable X11: @0@'.format(x11_dep.found()),

View file

@ -1,3 +1,6 @@
option('daemon',
type : 'boolean', value : true,
description : 'Enable building and installation of pulseaudio daemon and supporting configuration files')
option('gcov', option('gcov',
type : 'boolean', value : false, type : 'boolean', value : false,
description : 'Enable optional gcov coverage analysis') description : 'Enable optional gcov coverage analysis')

View file

@ -1,13 +1,20 @@
if bashcompletiondir != 'no' if bashcompletiondir != 'no'
aliases = [ aliases = []
'pacat',
if get_option('daemon')
aliases += [
'pacmd', 'pacmd',
'pasuspender',
]
endif
aliases += [
'pacat',
'pactl', 'pactl',
'padsp', 'padsp',
'paplay', 'paplay',
'parec', 'parec',
'parecord', 'parecord',
'pasuspender',
] ]
install_data('pulseaudio', install_dir : bashcompletiondir) install_data('pulseaudio', install_dir : bashcompletiondir)

View file

@ -206,9 +206,11 @@ libpulsecommon = shared_library('pulsecommon-' + pa_version_major_minor,
libpulsecommon_dep = declare_dependency(link_with: libpulsecommon) libpulsecommon_dep = declare_dependency(link_with: libpulsecommon)
subdir('pulse') subdir('pulse')
if get_option('daemon')
subdir('pulsecore') subdir('pulsecore')
subdir('daemon') subdir('daemon')
subdir('modules') subdir('modules')
endif
if get_option('tests') if get_option('tests')
subdir('tests') subdir('tests')
endif endif

View file

@ -7,17 +7,39 @@
# Default tests # Default tests
default_tests = [ default_tests = []
default_tests += [
[ 'channelmap-test', 'channelmap-test.c',
[ check_dep, libpulse_dep ] ],
[ 'core-util-test', 'core-util-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep ] ],
[ 'get-binary-name-test', 'get-binary-name-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep ] ],
[ 'hashmap-test', 'hashmap-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep ] ],
[ 'json-test', 'json-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep ] ],
[ 'mainloop-test', 'mainloop-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep ] ],
[ 'proplist-test', 'proplist-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep ] ],
[ 'thread-mainloop-test', 'thread-mainloop-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep ] ],
[ 'utf8-test', 'utf8-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep ] ],
[ 'volume-test', 'volume-test.c',
[ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep ] ],
]
if get_option('daemon')
default_tests += [
[ 'asyncmsgq-test', 'asyncmsgq-test.c', [ 'asyncmsgq-test', 'asyncmsgq-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'asyncq-test', 'asyncq-test.c', [ 'asyncq-test', 'asyncq-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'channelmap-test', 'channelmap-test.c',
[ check_dep, libpulse_dep ] ],
[ 'close-test', 'close-test.c', [ 'close-test', 'close-test.c',
[ libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'core-util-test', 'core-util-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep ] ],
[ 'cpu-mix-test', [ 'cpu-mix-test.c', 'runtime-test-util.h' ], [ 'cpu-mix-test', [ 'cpu-mix-test.c', 'runtime-test-util.h' ],
[ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'cpu-remap-test', [ 'cpu-remap-test.c', 'runtime-test-util.h' ], [ 'cpu-remap-test', [ 'cpu-remap-test.c', 'runtime-test-util.h' ],
@ -28,20 +50,12 @@ default_tests = [
[ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'format-test', 'format-test.c', [ 'format-test', 'format-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'get-binary-name-test', 'get-binary-name-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep ] ],
[ 'hashmap-test', 'hashmap-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep ] ],
[ 'hook-list-test', 'hook-list-test.c', [ 'hook-list-test', 'hook-list-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'json-test', 'json-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep ] ],
[ 'lfe-filter-test', 'lfe-filter-test.c', [ 'lfe-filter-test', 'lfe-filter-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'lock-autospawn-test', 'lock-autospawn-test.c', [ 'lock-autospawn-test', 'lock-autospawn-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'mainloop-test', 'mainloop-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep ] ],
[ 'memblock-test', 'memblock-test.c', [ 'memblock-test', 'memblock-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'memblockq-test', 'memblockq-test.c', [ 'memblockq-test', 'memblockq-test.c',
@ -50,7 +64,7 @@ default_tests = [
[ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'mult-s16-test', [ 'mult-s16-test.c', 'runtime-test-util.h' ], [ 'mult-s16-test', [ 'mult-s16-test.c', 'runtime-test-util.h' ],
[ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'proplist-test', 'proplist-test.c', [ 'proplist-modargs-test', 'proplist-modargs-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'queue-test', 'queue-test.c', [ 'queue-test', 'queue-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
@ -62,14 +76,8 @@ default_tests = [
[ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'strlist-test', 'strlist-test.c', [ 'strlist-test', 'strlist-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'thread-mainloop-test', 'thread-mainloop-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'thread-test', 'thread-test.c', [ 'thread-test', 'thread-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'utf8-test', 'utf8-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep ] ],
[ 'volume-test', 'volume-test.c',
[ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep ] ],
] ]
if host_machine.system() != 'windows' if host_machine.system() != 'windows'
@ -88,6 +96,8 @@ if host_machine.system() != 'darwin'
] ]
endif endif
endif
if cc.has_header('sys/eventfd.h') if cc.has_header('sys/eventfd.h')
default_tests += [ default_tests += [
[ 'srbchannel-test', 'srbchannel-test.c', [ 'srbchannel-test', 'srbchannel-test.c',
@ -95,6 +105,7 @@ if cc.has_header('sys/eventfd.h')
] ]
endif endif
if get_option('daemon')
if alsa_dep.found() if alsa_dep.found()
default_tests += [ default_tests += [
[ 'alsa-mixer-path-test', 'alsa-mixer-path-test.c', [ 'alsa-mixer-path-test', 'alsa-mixer-path-test.c',
@ -102,6 +113,7 @@ if alsa_dep.found()
libalsa_util ] libalsa_util ]
] ]
endif endif
endif
if glib_dep.found() if glib_dep.found()
default_tests += [ default_tests += [
@ -112,8 +124,17 @@ if glib_dep.found()
endif endif
# No-run tests # No-run tests
norun_tests = []
norun_tests = [ norun_tests += [
[ 'pacat-simple', 'pacat-simple.c',
[ libpulse_dep, libpulse_simple_dep ] ],
[ 'parec-simple', 'parec-simple.c',
[ libpulse_dep, libpulse_simple_dep ] ],
]
if get_option('daemon')
norun_tests += [
[ 'flist-test', 'flist-test.c', [ 'flist-test', 'flist-test.c',
[ libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'ipacl-test', 'ipacl-test.c', [ 'ipacl-test', 'ipacl-test.c',
@ -122,10 +143,6 @@ norun_tests = [
[ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'mcalign-test', 'mcalign-test.c', [ 'mcalign-test', 'mcalign-test.c',
[ libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'pacat-simple', 'pacat-simple.c',
[ libpulse_dep, libpulse_simple_dep ] ],
[ 'parec-simple', 'parec-simple.c',
[ libpulse_dep, libpulse_simple_dep ] ],
[ 'remix-test', 'remix-test.c', [ 'remix-test', 'remix-test.c',
[ libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'rtstutter', 'rtstutter.c', [ 'rtstutter', 'rtstutter.c',
@ -160,6 +177,8 @@ if cc.has_header_symbol('signal.h', 'SIGXCPU')
] ]
endif endif
endif
if cc.has_function('pthread_setaffinity_np', dependencies : thread_dep) if cc.has_function('pthread_setaffinity_np', dependencies : thread_dep)
norun_tests += [ norun_tests += [
[ 'atomic-test', 'atomic-test.c', [ 'atomic-test', 'atomic-test.c',
@ -207,6 +226,8 @@ foreach t : default_tests + norun_tests
endif endif
endforeach endforeach
if get_option('daemon')
# These tests need a running pulseaudio daemon # These tests need a running pulseaudio daemon
daemon_tests = [ daemon_tests = [
@ -251,3 +272,5 @@ run_target('test-daemon',
run_target('test-daemon-long', run_target('test-daemon-long',
command : [ test_daemon_meson_sh ] + daemon_test_long_names command : [ test_daemon_meson_sh ] + daemon_test_long_names
) )
endif

View file

@ -0,0 +1,73 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
***/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <check.h>
#include <pulse/proplist.h>
#include <pulse/xmalloc.h>
#include <pulsecore/macro.h>
#include <pulsecore/core-util.h>
#include <pulsecore/modargs.h>
START_TEST (proplist_modargs_test) {
pa_modargs *ma;
pa_proplist *a;
char *v;
const char *x[] = { "foo", NULL };
ma = pa_modargs_new("foo='foobar=waldo foo2=\"lj\\\"dhflh\" foo3=\"kjlskj\\'\"'", x);
fail_unless(ma != NULL);
a = pa_proplist_new();
fail_unless(a != NULL);
fail_unless(pa_modargs_get_proplist(ma, "foo", a, PA_UPDATE_REPLACE) >= 0);
pa_log_debug("%s", v = pa_proplist_to_string(a));
pa_xfree(v);
pa_proplist_free(a);
pa_modargs_free(ma);
}
END_TEST
int main(int argc, char *argv[]) {
int failed = 0;
Suite *s;
TCase *tc;
SRunner *sr;
if (!getenv("MAKE_CHECK"))
pa_log_set_level(PA_LOG_DEBUG);
s = suite_create("Property List");
tc = tcase_create("propertylist");
tcase_add_test(tc, proplist_modargs_test);
suite_add_tcase(s, tc);
sr = srunner_create(s);
srunner_run_all(sr, CK_NORMAL);
failed = srunner_ntests_failed(sr);
srunner_free(sr);
return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}

View file

@ -25,16 +25,13 @@
#include <pulse/proplist.h> #include <pulse/proplist.h>
#include <pulse/xmalloc.h> #include <pulse/xmalloc.h>
#include <pulsecore/macro.h> #include <pulsecore/log.h>
#include <pulsecore/core-util.h> #include <pulsecore/core-util.h>
#include <pulsecore/modargs.h>
START_TEST (proplist_test) { START_TEST (proplist_test) {
pa_modargs *ma;
pa_proplist *a, *b, *c, *d; pa_proplist *a, *b, *c, *d;
char *s, *t, *u, *v; char *s, *t, *u, *v;
const char *text; const char *text;
const char *x[] = { "foo", NULL };
a = pa_proplist_new(); a = pa_proplist_new();
fail_unless(pa_proplist_sets(a, PA_PROP_MEDIA_TITLE, "Brandenburgische Konzerte") == 0); fail_unless(pa_proplist_sets(a, PA_PROP_MEDIA_TITLE, "Brandenburgische Konzerte") == 0);
@ -80,19 +77,6 @@ START_TEST (proplist_test) {
pa_proplist_free(d); pa_proplist_free(d);
pa_log_debug("%s", v); pa_log_debug("%s", v);
pa_xfree(v); pa_xfree(v);
ma = pa_modargs_new("foo='foobar=waldo foo2=\"lj\\\"dhflh\" foo3=\"kjlskj\\'\"'", x);
fail_unless(ma != NULL);
a = pa_proplist_new();
fail_unless(a != NULL);
fail_unless(pa_modargs_get_proplist(ma, "foo", a, PA_UPDATE_REPLACE) >= 0);
pa_log_debug("%s", v = pa_proplist_to_string(a));
pa_xfree(v);
pa_proplist_free(a);
pa_modargs_free(ma);
} }
END_TEST END_TEST

View file

@ -42,6 +42,7 @@ executable('pactl',
c_args : pa_c_args, c_args : pa_c_args,
) )
if get_option('daemon')
if host_machine.system() != 'windows' if host_machine.system() != 'windows'
pasuspender_sources = [ pasuspender_sources = [
'pasuspender.c', 'pasuspender.c',
@ -71,6 +72,7 @@ if host_machine.system() != 'windows'
c_args : pa_c_args, c_args : pa_c_args,
) )
endif endif
endif
if x11_dep.found() if x11_dep.found()
pax11publish_sources = [ pax11publish_sources = [