Merge branch 'optional_utils' into 'master'

Make build system more static linking friendly

See merge request pulseaudio/pulseaudio!679
This commit is contained in:
BtbN 2025-10-02 16:22:45 +00:00
commit 7ed1efd15a
8 changed files with 81 additions and 72 deletions

View file

@ -1,12 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libpulse-mainloop-glib
Description: PulseAudio GLib 2.0 Main Loop Wrapper
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lpulse-mainloop-glib @PTHREAD_LIBS@
Libs.private: -L${libdir}/pulseaudio -lpulsecommon-@PA_MAJORMINOR@
Cflags: -I${includedir} -D_REENTRANT
Requires: libpulse glib-2.0

View file

@ -1,12 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libpulse-simple
Description: PulseAudio Simplified Synchronous Client Interface
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lpulse-simple @PTHREAD_LIBS@
Libs.private: -L${libdir}/pulseaudio -lpulsecommon-@PA_MAJORMINOR@
Cflags: -I${includedir} -D_REENTRANT
Requires: libpulse

View file

@ -1,12 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
modlibexecdir=@modlibexecdir@
Name: libpulse
Description: PulseAudio Client Interface
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lpulse @PTHREAD_LIBS@
Libs.private: -L${libdir}/pulseaudio -lpulsecommon-@PA_MAJORMINOR@
Cflags: -I${includedir} -D_REENTRANT

View file

@ -611,7 +611,7 @@ if glib_dep.found()
cdata.set('HAVE_GLIB20', 1) # to match the AM_CONDITIONAL for CMake file generation
endif
sndfile_dep = dependency('sndfile', version : '>= 1.0.20')
sndfile_dep = dependency('sndfile', version : '>= 1.0.20', required : get_option('sndfile'))
libsystemd_dep = dependency('libsystemd', required : get_option('systemd'))
if libsystemd_dep.found()
@ -650,6 +650,14 @@ if get_option('client')
endif
endif
# Utils dependencies
if get_option('utils')
if not sndfile_dep.found()
error('Utils enabled but sndfile disabled or not found!')
endif
endif
# Daemon and module dependencies
if get_option('daemon')
@ -828,6 +836,10 @@ if get_option('daemon')
cdata.set('HAVE_GSTLDAC', 1)
cdata.set('HAVE_GSTAPTX', 1)
endif
if not sndfile_dep.found()
error('Daemon enabled but sndfile disabled or not found!')
endif
endif
# These are required for the CMake file generation
@ -863,38 +875,44 @@ if get_option('client')
# pkg-config files
pc_cdata = configuration_data()
pc_cdata.set('prefix', prefix)
pc_cdata.set('exec_prefix', prefix)
pc_cdata.set('libdir', libdir)
pc_cdata.set('includedir', includedir)
pc_cdata.set('modlibexecdir', modlibexecdir)
pc_cdata.set('PACKAGE_VERSION', pa_version_str)
pc_cdata.set('PA_MAJORMINOR', pa_version_major_minor)
# FIXME: the line below is wrong. Currently the meson thread dep lacks documentation,
# and doesn't allow introspection, ie. none of get_pkgconfig_variable() or
# get_configtool_variable() work with it, so we have no way to get this flag right,
# unless we do all the work ourselves. See current work in glib, also meson #553.
pc_cdata.set('PTHREAD_LIBS', '-pthread')
pc_files = [
'libpulse.pc',
'libpulse-simple.pc',
]
extra_libs = ['-pthread']
extra_cflags = ['-D_REENTRANT']
pkg = import('pkgconfig')
pkg.generate(libpulse,
name : 'libpulse',
description : 'PulseAudio Client Interface',
version : pa_version_str,
install_dir : pkgconfigdir,
libraries : extra_libs,
extra_cflags : extra_cflags,
variables : [
'modlibexecdir=@0@'.format(modlibexecdir)
],
)
pkg.generate(libpulse_simple,
name : 'libpulse-simple',
description : 'PulseAudio Simplified Synchronous Client Interface',
version : pa_version_str,
install_dir : pkgconfigdir,
libraries : extra_libs,
extra_cflags : extra_cflags,
)
if glib_dep.found()
pc_files += 'libpulse-mainloop-glib.pc'
pkg.generate(libpulse_mainloop_glib,
name : 'libpulse-mainloop-glib',
description : 'PulseAudio GLib 2.0 Main Loop Wrapper',
version : pa_version_str,
install_dir : pkgconfigdir,
libraries : extra_libs,
extra_cflags : extra_cflags,
)
endif
foreach file : pc_files
configure_file(
input : file + '.in',
output : file,
configuration : pc_cdata,
install_dir : pkgconfigdir)
endforeach
# CMake files
m4 = find_program('m4', required: true)
@ -962,6 +980,7 @@ summary = [
'Enable X11: @0@'.format(x11_dep.found()),
'Enable D-Bus: @0@'.format(dbus_dep.found()),
'Enable GLib 2: @0@'.format(glib_dep.found()),
'Enable libsndfile: @0@'.format(sndfile_dep.found()),
'Enable systemd integration: @0@'.format(libsystemd_dep.found()),
'Enable FFTW: @0@'.format(fftw_dep.found()),
'Enable IPv6: @0@'.format(get_option('ipv6')),
@ -1035,6 +1054,10 @@ message('\n '.join(summary))
# Sanity checks
if not get_option('daemon') and not get_option('client')
error('You disabled daemon and client. There is nothing to build!')
endif
if get_option('daemon') and not speex_dep.found() and not webrtc_dep.found() and not get_option('adrian-aec')
error('At least one echo canceller implementation must be available!')
endif

View file

@ -4,6 +4,9 @@ option('daemon',
option('client',
type : 'boolean', value : true,
description : 'Build and install pulseaudio client libraries and utilities')
option('utils',
type : 'boolean', value : true,
description : 'Build and install pulseaudio cli utilities')
option('doxygen',
type : 'boolean', value : true,
description : 'Enable building and installation of documentation generated with doxygen')
@ -147,6 +150,9 @@ option('oss-output',
option('samplerate',
type : 'feature', value : 'disabled',
description : 'Optional libsamplerate support (DEPRECATED)')
option('sndfile',
type : 'feature', value : 'auto',
description : 'Optional libsndfile support')
option('soxr',
type : 'feature', value : 'auto',
description : 'Optional SoXR support (resampling)')

View file

@ -65,7 +65,6 @@ libpulsecommon_sources = [
'pulsecore/time-smoother_2.c',
'pulsecore/tokenizer.c',
'pulsecore/usergroup.c',
'pulsecore/sndfile-util.c',
]
libpulsecommon_headers = [
@ -145,7 +144,6 @@ libpulsecommon_headers = [
'pulsecore/time-smoother_2.h',
'pulsecore/tokenizer.h',
'pulsecore/usergroup.h',
'pulsecore/sndfile-util.h',
'pulsecore/socket.h',
]
@ -160,6 +158,15 @@ if dbus_dep.found()
]
endif
if sndfile_dep.found()
libpulsecommon_sources += [
'pulsecore/sndfile-util.c',
]
libpulsecommon_headers += [
'pulsecore/sndfile-util.h',
]
endif
if x11_dep.found()
libpulsecommon_sources += [
'pulse/client-conf-x11.c',
@ -198,7 +205,7 @@ if not get_option('client')
libpulse_dep = dependency('libpulse', required : true)
libpulse_simple_dep = dependency('libpulse-simple', required : true)
else
libpulsecommon = shared_library('pulsecommon-' + pa_version_major_minor,
libpulsecommon = library('pulsecommon-' + pa_version_major_minor,
libpulsecommon_sources,
libpulsecommon_headers,
include_directories : [configinc, topinc],
@ -227,4 +234,6 @@ endif
if get_option('tests')
subdir('tests')
endif
subdir('utils')
if get_option('utils')
subdir('utils')
endif

View file

@ -80,7 +80,7 @@ else
versioning_link_args = []
endif
libpulse = shared_library('pulse',
libpulse = library('pulse',
libpulse_sources,
libpulse_headers,
version : libpulse_version,
@ -101,7 +101,7 @@ install_headers(
subdir : 'pulse'
)
libpulse_simple = shared_library('pulse-simple',
libpulse_simple = library('pulse-simple',
'simple.c',
'simple.h',
version : libpulse_simple_version,
@ -116,7 +116,7 @@ libpulse_simple = shared_library('pulse-simple',
libpulse_simple_dep = declare_dependency(link_with: libpulse_simple)
if glib_dep.found()
libpulse_mainloop_glib = shared_library('pulse-mainloop-glib',
libpulse_mainloop_glib = library('pulse-mainloop-glib',
'glib-mainloop.c',
'glib-mainloop.h',
version : libpulse_mainloop_glib_version,

View file

@ -45,8 +45,6 @@ libpulsecore_sources = [
'sink-input.c',
'sioman.c',
'socket-server.c',
'sound-file-stream.c',
'sound-file.c',
'source.c',
'source-output.c',
'start-child.c',
@ -103,8 +101,6 @@ libpulsecore_headers = [
'sink.h',
'sioman.h',
'socket-server.h',
'sound-file-stream.h',
'sound-file.h',
'source-output.h',
'source.h',
'start-child.h',
@ -139,6 +135,17 @@ if samplerate_dep.found()
libpulsecore_sources += ['resampler/libsamplerate.c']
endif
if sndfile_dep.found()
libpulsecore_sources += [
'sound-file-stream.c',
'sound-file.c',
]
libpulsecore_headers += [
'sound-file-stream.h',
'sound-file.h',
]
endif
if soxr_dep.found()
libpulsecore_sources += ['resampler/soxr.c']
endif