[PATCH] build-sys: First pass at a meson-ified build system

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Dec 9, 2017 at 2:59 AM, Arun Raghavan <arun at arunraghavan.net> wrote:
> (Note: this patch depends on the symdef header removal work from a few
> days ago)
>
> This is a working implementation of a build with meson. The server,
> utils, and most modules build with this, and it is possible to run from
> a build tree and play/capture audio on ALSA devices.
>
> There are a number of FIXMEs, of course, and a number of features that
> need to be enabled (modules, dependencies, installation, etc.), but this
> should provide everything we need to get there relatively quickly.
>

This is nice. Build times should be greatly reduced. As a datapoint,
you can check how the systemd debian package takes about hallf the
time since version 234, when meson was introduced.

https://buildd.debian.org/status/logs.php?pkg=systemd&arch=amd64&suite=sid

> To use this, install meson (distro package, or mesonbuild.com) and run:
>
>   $ cd <pulseaudio src dir>
>   $ meson <builddir>
>   $ ninja -C <builddir>
> ---
>  meson.build                       | 218 ++++++++++++++++++++++++++++++++++++++
>  meson_options.txt                 |  13 +++
>  src/daemon/daemon-conf.c          |   4 +
>  src/daemon/main.c                 |   9 ++
>  src/daemon/meson.build            |  34 ++++++
>  src/meson.build                   | 194 +++++++++++++++++++++++++++++++++
>  src/modules/alsa/meson.build      |  31 ++++++
>  src/modules/meson.build           | 127 ++++++++++++++++++++++
>  src/modules/module-role-cork.c    |   2 +-
>  src/modules/module-role-ducking.c |   2 +-
>  src/pulse/meson.build             |  73 +++++++++++++
>  src/pulsecore/meson.build         | 170 +++++++++++++++++++++++++++++
>  src/pulsecore/module.c            |   4 +
>  src/utils/meson.build             |  67 ++++++++++++
>  14 files changed, 946 insertions(+), 2 deletions(-)
>  create mode 100644 meson.build
>  create mode 100644 meson_options.txt
>  create mode 100644 src/daemon/meson.build
>  create mode 100644 src/meson.build
>  create mode 100644 src/modules/alsa/meson.build
>  create mode 100644 src/modules/meson.build
>  create mode 100644 src/pulse/meson.build
>  create mode 100644 src/pulsecore/meson.build
>  create mode 100644 src/utils/meson.build
>
> diff --git a/meson.build b/meson.build
> new file mode 100644
> index 000000000..1b00dc1e0
> --- /dev/null
> +++ b/meson.build
> @@ -0,0 +1,218 @@
> +project('pulseaudio', 'c', 'cpp',
> +        version : '10.99.1',
> +        meson_version : '>= 0.31.0',
> +        default_options : [ 'c_std=gnu11', 'cpp_std=c++11' ]
> +        )
> +
> +pa_version = meson.project_version()
> +version_split = pa_version.split('.')
> +pa_version_major = version_split[0]
> +pa_version_minor = version_split[1]
> +pa_version_micro = version_split[2]
> +pa_version_major_minor = pa_version_major + '.' + pa_version_minor
> +
> +pa_api_version = 12
> +pa_protocol_version = 31
> +
> +apiversion = '1.0'
> +soversion = 0
> +# maintaining compatibility with the previous libtool versioning
> +# current = minor * 100 + micro
> +libversion = '@0 at .@1 at .0'.format(soversion, pa_version_minor.to_int() * 100 + pa_version_micro.to_int())

This gives 0.9901.0 instead of 0.20.2

> +
> +prefix = get_option('prefix')
> +datadir = join_paths(prefix, get_option('datadir'))
> +localstatedir = join_paths(prefix, get_option('localstatedir'))
> +sysconfdir = join_paths(prefix, get_option('sysconfdir'))
> +
> +cc = meson.get_compiler('c')
> +
> +cdata = configuration_data()
> +cdata.set_quoted('PACKAGE', 'pulseaudio')
> +cdata.set_quoted('PACKAGE_NAME', 'pulseaudio')
> +cdata.set_quoted('PACKAGE_VERSION', pa_version)
> +cdata.set_quoted('CANONICAL_HOST', host_machine.cpu())
> +cdata.set_quoted('PA_MACHINE_ID', join_paths(sysconfdir, 'machine-id'))
> +cdata.set_quoted('PA_MACHINE_ID_FALLBACK', join_paths(localstatedir, 'lib', 'dbus', 'machine-id'))
> +cdata.set_quoted('PA_SRCDIR', join_paths(meson.current_source_dir(), 'src'))
> +cdata.set_quoted('PA_BUILDDIR', meson.current_build_dir())
> +cdata.set_quoted('PA_SOEXT', '.so')
> +cdata.set_quoted('PA_DEFAULT_CONFIG_DIR', join_paths(sysconfdir, 'pulse'))
> +cdata.set_quoted('PA_BINARY', join_paths(prefix, get_option('bindir'), 'pulseaudio'))
> +cdata.set_quoted('PA_SYSTEM_RUNTIME_PATH', join_paths(localstatedir, 'run', 'pulse'))
> +cdata.set_quoted('PA_SYSTEM_CONFIG_PATH', join_paths(localstatedir, 'lib', 'pulse'))
> +cdata.set_quoted('PA_SYSTEM_STATE_PATH', join_paths(localstatedir, 'lib', 'pulse'))
> +cdata.set_quoted('PA_DLSEARCHPATH', join_paths(prefix, get_option('libdir'), 'pulse-' + pa_version_major_minor, 'modules'))
> +cdata.set_quoted('PA_SYSTEM_USER', get_option('system_user'))
> +cdata.set_quoted('PA_SYSTEM_GROUP', get_option('system_group'))
> +cdata.set_quoted('PA_ACCESS_GROUP', get_option('access_group'))
> +cdata.set_quoted('PA_CFLAGS', 'Not yet supported on meson')
> +cdata.set_quoted('PA_ALSA_PATHS_DIR', join_paths(datadir, 'pulseaudio', 'alsa-mixer', 'paths'))
> +cdata.set_quoted('PA_ALSA_PROFILE_SETS_DIR', join_paths(datadir, 'pulseaudio', 'alsa-mixer', 'profile-sets'))
> +cdata.set_quoted('DESKTOPFILEDIR', join_paths(datadir, 'applications'))
> +
> +# Headers
> +
> +check_headers = [
> +  'arpa/inet.h',
> +  'cpuid.h',
> +  'grp.h',
> +  'langinfo.h',
> +  'locale.h',
> +  'netdb.h',
> +  'netinet/in.h',
> +  'netinet/in_systm.h',
> +  'netinet/ip.h',
> +  'netinet/tcp.h',
> +  'pcreposix.h',
> +  'poll.h',
> +  'pwd.h',
> +  'regex.h',
> +  'sched.h',
> +  'sys/capability.h',
> +  'sys/ioctl.h',
> +  'sys/mman.h',
> +  'sys/prctl.h',
> +  'sys/resource.h',
> +  'sys/select.h',
> +  'sys/socket.h',
> +  'sys/un.h',

I notice at least the following are missing:

sys/wait.h
execinfo.h
sys/syscall.h
byteswap.h
sys/eventfd.h
linux/input.h
sys/conf.h

Some of these cause real problems. For example, waitpid is used even
though HAVE_SYS_WAIT_H is not defined.

> +  'valgrind/memcheck.h',
> +  'xlocale.h',
> +]
> +
> +foreach h : check_headers
> +  if cc.has_header(h)
> +    define = 'HAVE_' + h.underscorify().to_upper()
> +    cdata.set(define, 1)
> +  endif
> +endforeach
> +
> +# FIXME: move this to the above set
> +if cc.has_header('pthread.h')
> +  cdata.set('HAVE_PTHREAD', 1)
> +endif
> +
> +# Functions
> +
> +check_functions = [
> +  'accept4',
> +  'clock_gettime',
> +  'fchmod',
> +  'fchown',
> +  'fork',
> +  'fstat',
> +  'getaddrinfo',
> +  'gettimeofday',
> +  'getuid',
> +  'lstat',
> +  'mlock',
> +  'nanosleep',
> +  'paccept',
> +  'pipe',
> +  'pipe2',
> +  'posix_madvise',
> +  'readlink',
> +  'setegid',
> +  'seteuid',
> +  'setregid',
> +  'setreuid',
> +  'setresgid',
> +  'setresuid',
> +  'setsid',
> +  'sig2str',
> +  'sigaction',
> +  'strtod_l',
> +  'symlink',
> +  'sysconf',
> +  'uname',
> +]
> +
> +foreach f : check_functions
> +  if cc.has_function(f)
> +    define = 'HAVE_' + f.underscorify().to_upper()
> +    cdata.set(define, 1)
> +  endif
> +endforeach
> +
> +shm_dep = cc.find_library('rt', required : false)
> +if shm_dep.found()
> +  cdata.set('HAVE_SHM_OPEN', 1)
> +endif
> +
> +if cc.has_function('SYS_memfd_create', prefix : '#include <sys/syscall.h>')
> +  cdata.set('HAVE_MEMFD', 1)
> +endif

configure has the option to enable or disable this. This meson script
autodetects only. I think the ability to explicitly disable/enable
(and error out if dependencies are not found) is nice to keep when
moving to meson. That is, this should become something like:

want_memfd = get_option('memfd')
if want_memfd != 'false'
  has_memfd = cc.has_function('SYS_memfd_create', prefix : '#include
<sys/syscall.h>')
  if has_memfd
    cdata.set('HAVE_MEMFD', 1)
  elif want_memfd == 'true'
    error('Memfd was requested but it was not found')
  endif
endif

plus a meson_options.txt:

option('memfd', type: 'combo', choices: ['auto', 'true', 'false'],
  description: 'Enable Linux memfd shared memory')

This applies to a lot of the checks.

> +
> +# Types
> +
> +# FIXME: do we ever care about gid_t not being defined / smaller than an int?
> +cdata.set('GETGROUPS_T', 'gid_t')
> +
> +# Include paths
> +
> +configinc = include_directories('.')
> +topinc = include_directories('src')
> +
> +# CFLAGS
> +
> +pa_c_args = ['-DHAVE_CONFIG_H', '-D_GNU_SOURCE']
> +server_c_args = ['-D__INCLUDED_FROM_PULSE_AUDIO']
> +cdata.set('MESON_BUILD', 1)
> +
> +# Core Dependencies
> +
> +libm_dep = cc.find_library('m', required : true)

I don't think windows has a libm.

> +thread_dep = dependency('threads')
> +cap_dep = cc.find_library('cap', required : false)
> +
> +if get_option('database') == 'tdb'
> +  database_dep = dependency('tdb')
> +elif get_option('database') == 'gdbm'
> +  database_dep = cc.find_library('gdbm', required : true)
> +endif
> +
> +atomictest = '''void func() {
> +  volatile int atomic = 2;
> +  __sync_bool_compare_and_swap (&atomic, 2, 3);
> +}
> +'''
> +if cc.compiles(atomictest)
> +  cdata.set('HAVE_ATOMIC_BUILTINS', true)
> +else
> +  # FIXME: check if we need libatomic_ops
> +endif
> +
> +# FIXME: make sure it's >= 2.2
> +ltdl_dep = cc.find_library('ltdl', required : true)
> +# FIXME: can meson support libtool -dlopen/-dlpreopen things?
> +#        and do we still want to support this at all?
> +cdata.set('DISABLE_LIBTOOL_PRELOAD', 1)
> +
> +sndfile_dep = dependency('sndfile', version : '>= 1.0.20')
> +
> +dbus_dep = dependency('dbus-1', version : '>= 1.4.12', required : false)
> +if dbus_dep.found()
> +  cdata.set('HAVE_DBUS', 1)
> +endif

dbus_watch_get_unix_fd needs checking too.

> +
> +x11_dep = dependency('x11-xcb', required : false)
> +if x11_dep.found()
> +  cdata.set('HAVE_X11', 1)
> +endif
> +
> +alsa_dep = dependency('alsa', version : '>= 1.0.24', required : false)
> +if alsa_dep.found()
> +  cdata.set('HAVE_ALSA_UCM', 1)
> +endif
> +
> +# FIXME: support ORC
> +cdata.set('DISABLE_ORC', 1)
> +
> +# Module dependencies
> +udev_dep = dependency('libudev', version : '>= 143', required : false)
> +
> +# Now generate config.h from everything avove

s/avove/above/ :)

> +configure_file(output : 'config.h', configuration : cdata)
> +
> +subdir('src')

Is there really a benefit to splitting the meson.build files?

> diff --git a/meson_options.txt b/meson_options.txt
> new file mode 100644
> index 000000000..233a1846b
> --- /dev/null
> +++ b/meson_options.txt
> @@ -0,0 +1,13 @@
> +option('system_user',
> +        type : 'string', value : 'pulse',
> +        description : 'User for running the PulseAudio daemon as a system-wide instance (pulse)')
> +option('system_group',
> +        type : 'string', value : 'pulse',
> +        description : 'Group for running the PulseAudio daemon as a system-wide instance (pulse)')
> +option('access_group',
> +        type : 'string', value : 'pulse-access',
> +        description : 'Group which is allowed access to a system-wide PulseAudio daemon (pulse-access)')
> +option('database',
> +        type : 'combo', value : 'tdb',
> +        choices : [ 'gdbm', 'tdb', 'simple' ],
> +        description : 'Database backend')
> diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c
> index 988312672..6a3957859 100644
> --- a/src/daemon/daemon-conf.c
> +++ b/src/daemon/daemon-conf.c
> @@ -157,7 +157,11 @@ pa_daemon_conf *pa_daemon_conf_new(void) {
>  #else
>      if (pa_run_from_build_tree()) {
>          pa_log_notice("Detected that we are run from the build tree, fixing search path.");
> +#ifdef MESON_BUILD
> +        c->dl_search_path = pa_xstrdup(PA_BUILDDIR PA_PATH_SEP "src" PA_PATH_SEP "modules");
> +#else
>          c->dl_search_path = pa_xstrdup(PA_BUILDDIR);
> +#endif

This can be avoided by having the modules be declared directly from
the top-level meson.build.t

>      } else
>          c->dl_search_path = pa_xstrdup(PA_DLSEARCHPATH);
>  #endif
> diff --git a/src/daemon/main.c b/src/daemon/main.c
> index 55af4eca6..a1dbd81f9 100644
> --- a/src/daemon/main.c
> +++ b/src/daemon/main.c
> @@ -98,6 +98,15 @@
>  #include "ltdl-bind-now.h"
>  #include "server-lookup.h"
>
> +#ifdef DISABLE_LIBTOOL_PRELOAD
> +/* FIXME: work around a libtool bug by making sure we have 2 elements. Bug has
> + * been reported: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=29576 */
> +const lt_dlsymlist lt_preloaded_symbols[] = {
> +    { "@PROGRAM@", NULL },
> +    { NULL, NULL }
> +};
> +#endif
> +
>  #ifdef HAVE_LIBWRAP
>  /* Only one instance of these variables */
>  int allow_severity = LOG_INFO;
> diff --git a/src/daemon/meson.build b/src/daemon/meson.build
> new file mode 100644
> index 000000000..3bf4a3b89
> --- /dev/null
> +++ b/src/daemon/meson.build
> @@ -0,0 +1,34 @@
> +pulseaudio_sources = [
> +  'caps.c',
> +  'cmdline.c',
> +  'cpulimit.c',
> +  'daemon-conf.c',
> +  'dumpmodules.c',
> +  'ltdl-bind-now.c',
> +  'main.c',
> +]
> +
> +pulseaudio_headers = [
> +  'caps.h',
> +  'cmdline.h',
> +  'cpulimit.h',
> +  'daemon-conf.h',
> +  'dumpmodules.h',
> +  'ltdl-bind-now.h',
> +]
> +
> +if dbus_dep.found()
> +  pulseaudio_sources += 'server-lookup.c'
> +  pulseaudio_headers += 'server-lookup.h'
> +endif
> +
> +# FIXME: man pages, dependencies
> +executable('pulseaudio',
> +  pulseaudio_sources,
> +  pulseaudio_headers,
> +  install: true,
> +  include_directories : [configinc, topinc],
> +  link_with : [libpulsecore, libpulsecommon, libpulse],
> +  dependencies : [ltdl_dep, cap_dep, dbus_dep],
> +  c_args : pa_c_args,
> +)
> diff --git a/src/meson.build b/src/meson.build
> new file mode 100644
> index 000000000..1cc3b40e8
> --- /dev/null
> +++ b/src/meson.build
> @@ -0,0 +1,194 @@
> +libpulsecommon_sources = [
> +  'pulse/client-conf.c',
> +  'pulse/fork-detect.c',
> +  'pulse/format.c',
> +  'pulse/json.c',
> +  'pulse/xmalloc.c',
> +  'pulse/proplist.c',
> +  'pulse/utf8.c',
> +  'pulse/channelmap.c',
> +  'pulse/sample.c',
> +  'pulse/util.c',
> +  'pulse/timeval.c',
> +  'pulse/rtclock.c',
> +  'pulse/volume.c',
> +  'pulsecore/authkey.c',
> +  'pulsecore/conf-parser.c',
> +  'pulsecore/core-error.c',
> +  'pulsecore/core-format.c',
> +  'pulsecore/core-rtclock.c',
> +  'pulsecore/core-util.c',
> +  'pulsecore/dynarray.c',
> +  'pulsecore/fdsem.c',
> +  'pulsecore/flist.c',
> +  'pulsecore/g711.c',
> +  'pulsecore/hashmap.c',
> +  'pulsecore/i18n.c',
> +  'pulsecore/idxset.c',
> +  'pulsecore/arpa-inet.c',
> +  'pulsecore/iochannel.c',
> +  'pulsecore/ioline.c',
> +  'pulsecore/ipacl.c',
> +  'pulsecore/lock-autospawn.c',
> +  'pulsecore/log.c',
> +  'pulsecore/ratelimit.c',
> +  'pulsecore/mcalign.c',
> +  'pulsecore/memblock.c',
> +  'pulsecore/memblockq.c',
> +  'pulsecore/memchunk.c',
> +  'pulsecore/mutex-posix.c',
> +  'pulsecore/native-common.c',
> +  'pulsecore/once.c',
> +  'pulsecore/packet.c',
> +  'pulsecore/parseaddr.c',
> +  'pulsecore/pdispatch.c',
> +  'pulsecore/pid.c',
> +  'pulsecore/pipe.c',
> +  'pulsecore/memtrap.c',
> +  'pulsecore/aupdate.c',
> +  'pulsecore/proplist-util.c',
> +  'pulsecore/pstream-util.c',
> +  'pulsecore/pstream.c',
> +  'pulsecore/queue.c',
> +  'pulsecore/random.c',
> +  'pulsecore/srbchannel.c',
> +  'pulsecore/sample-util.c',
> +  'pulsecore/semaphore-posix.c',
> +  'pulsecore/shm.c',
> +  'pulsecore/bitset.c',
> +  'pulsecore/socket-client.c',
> +  'pulsecore/socket-server.c',
> +  'pulsecore/socket-util.c',
> +  'pulsecore/strbuf.c',
> +  'pulsecore/strlist.c',
> +  'pulsecore/svolume_c.c',
> +  'pulsecore/svolume_mmx.c',
> +  'pulsecore/tagstruct.c',
> +  'pulsecore/thread-posix.c',
> +  'pulsecore/time-smoother.c',
> +  'pulsecore/tokenizer.c',
> +  'pulsecore/usergroup.c',
> +  'pulsecore/sndfile-util.c',
> +  'pulsecore/svolume_arm.c',
> +]
> +
> +libpulsecommon_headers = [
> +  'pulse/client-conf.h',
> +  'pulse/fork-detect.h',
> +  'pulse/format.h',
> +  'pulse/json.h',
> +  'pulse/xmalloc.h',
> +  'pulse/proplist.h',
> +  'pulse/utf8.h',
> +  'pulse/channelmap.h',
> +  'pulse/sample.h',
> +  'pulse/util.h',
> +  'pulse/timeval.h',
> +  'pulse/rtclock.h',
> +  'pulse/volume.h',
> +  'pulsecore/atomic.h',
> +  'pulsecore/authkey.h',
> +  'pulsecore/conf-parser.h',
> +  'pulsecore/core-error.h',
> +  'pulsecore/core-format.h',
> +  'pulsecore/core-rtclock.h',
> +  'pulsecore/core-util.h',
> +  'pulsecore/creds.h',
> +  'pulsecore/dynarray.h',
> +  'pulsecore/endianmacros.h',
> +  'pulsecore/fdsem.h',
> +  'pulsecore/flist.h',
> +  'pulsecore/g711.h',
> +  'pulsecore/hashmap.h',
> +  'pulsecore/i18n.h',
> +  'pulsecore/idxset.h',
> +  'pulsecore/arpa-inet.h',
> +  'pulsecore/iochannel.h',
> +  'pulsecore/ioline.h',
> +  'pulsecore/ipacl.h',
> +  'pulsecore/llist.h',
> +  'pulsecore/lock-autospawn.h',
> +  'pulsecore/log.h',
> +  'pulsecore/ratelimit.h',
> +  'pulsecore/macro.h',
> +  'pulsecore/mcalign.h',
> +  'pulsecore/mem.h',
> +  'pulsecore/memblock.h',
> +  'pulsecore/memblockq.h',
> +  'pulsecore/memchunk.h',
> +  'pulsecore/mutex.h',
> +  'pulsecore/native-common.h',
> +  'pulsecore/once.h',
> +  'pulsecore/packet.h',
> +  'pulsecore/parseaddr.h',
> +  'pulsecore/pdispatch.h',
> +  'pulsecore/pid.h',
> +  'pulsecore/pipe.h',
> +  'pulsecore/memtrap.h',
> +  'pulsecore/aupdate.h',
> +  'pulsecore/proplist-util.h',
> +  'pulsecore/pstream-util.h',
> +  'pulsecore/pstream.h',
> +  'pulsecore/queue.h',
> +  'pulsecore/random.h',
> +  'pulsecore/refcnt.h',
> +  'pulsecore/srbchannel.h',
> +  'pulsecore/sample-util.h',
> +  'pulsecore/semaphore.h',
> +  'pulsecore/shm.h',
> +  'pulsecore/bitset.h',
> +  'pulsecore/socket-client.h',
> +  'pulsecore/socket-server.h',
> +  'pulsecore/socket-util.h',
> +  'pulsecore/strbuf.h',
> +  'pulsecore/strlist.h',
> +  'pulsecore/tagstruct.h',
> +  'pulsecore/thread.h',
> +  'pulsecore/time-smoother.h',
> +  'pulsecore/tokenizer.h',
> +  'pulsecore/usergroup.h',
> +  'pulsecore/sndfile-util.h',
> +  'pulsecore/socket.h',
> +]
> +
> +if dbus_dep.found()
> +  libpulsecommon_sources += [
> +    'pulsecore/dbus-util.c',
> +    'pulsecore/rtkit.c',
> +  ]
> +  libpulsecommon_headers += [
> +    'pulsecore/dbus-util.h',
> +    'pulsecore/rtkit.h',
> +  ]
> +endif
> +
> +if x11_dep.found()
> +  libpulsecommon_sources += [
> +    'pulse/client-conf-x11.c',
> +    'pulsecore/x11prop.c',
> +  ]
> +  libpulsecommon_headers += [
> +    'pulse/client-conf-x11.h',
> +    'pulsecore/x11prop.h',
> +  ]
> +endif
> +
> +# FIXME: Do non-POSIX thread things
> +# FIXME: Do SIMD things
> +
> +libpulsecommon = shared_library('pulsecommon-' + pa_version_major_minor,
> +  libpulsecommon_sources,
> +  libpulsecommon_headers,
> +  include_directories : [configinc, topinc],
> +  c_args : [pa_c_args],
> +  install : true,
> +  dependencies : [libm_dep, thread_dep, shm_dep, sndfile_dep, dbus_dep, x11_dep],
> +  implicit_include_directories : false)
> +
> +libpulsecommon_dep = declare_dependency(link_with: libpulsecommon)
> +
> +subdir('pulse')
> +subdir('pulsecore')
> +subdir('daemon')
> +subdir('modules')
> +subdir('utils')
> diff --git a/src/modules/alsa/meson.build b/src/modules/alsa/meson.build
> new file mode 100644
> index 000000000..e2a45e2c7
> --- /dev/null
> +++ b/src/modules/alsa/meson.build
> @@ -0,0 +1,31 @@
> +libalsa_util_sources = [
> +  'alsa-util.c',
> +  'alsa-ucm.c',
> +  'alsa-mixer.c',
> +  'alsa-sink.c',
> +  'alsa-source.c',
> +  '../reserve-wrap.c',
> +]
> +
> +libalsa_util_headers = [
> +  'alsa-util.h',
> +  'alsa-ucm.h',
> +  'alsa-mixer.h',
> +  'alsa-sink.h',
> +  'alsa-source.h',
> +  '../reserve-wrap.h',
> +]
> +
> +if dbus_dep.found()
> +    libalsa_util_sources += [ '../reserve.c', '../reserve-monitor.c' ]
> +    libalsa_util_headers += [ '../reserve.h', '../reserve-monitor.h' ]
> +endif
> +
> +libalsa_util = static_library('libalsa_util',
> +  libalsa_util_sources,
> +  libalsa_util_headers,
> +  c_args : [pa_c_args, server_c_args],
> +  include_directories : [configinc, topinc],
> +  dependencies : [libpulse_dep, libpulsecore_dep, alsa_dep, dbus_dep],
> +  install : false
> +)
> diff --git a/src/modules/meson.build b/src/modules/meson.build
> new file mode 100644
> index 000000000..3d6b53fe8
> --- /dev/null
> +++ b/src/modules/meson.build
> @@ -0,0 +1,127 @@
> +# module name, sources, [headers, extra flags, extra deps, extra libs]
> +all_modules = [
> +  [ 'module-allow-passthrough', 'module-allow-passthrough.c' ],
> +  [ 'module-always-sink', 'module-always-sink.c' ],
> +  [ 'module-always-source', 'module-always-source.c' ],
> +  [ 'module-augment-properties', 'module-augment-properties.c' ],
> +  [ 'module-bluetooth-discover', 'bluetooth/module-bluetooth-discover.c' ],
> +  [ 'module-bluetooth-policy', 'bluetooth/module-bluetooth-policy.c' ],
> +#  [ 'module-bluez4-device', 'bluetooth/module-bluez4-device.c' ],
> +#  [ 'module-bluez4-discover', 'bluetooth/module-bluez4-discover.c' ],
> +#  [ 'module-bluez5-device', 'bluetooth/module-bluez5-device.c' ],
> +#  [ 'module-bluez5-discover', 'bluetooth/module-bluez5-discover.c' ],
> +#  [ 'module-bonjour-publish', 'macosx/module-bonjour-publish.c' ],
> +  [ 'module-card-restore', 'module-card-restore.c' ],
> +  [ 'module-cli', 'module-cli.c' ],
> +  [ 'module-cli-protocol-tcp', 'module-protocol-stub.c', [], ['-DUSE_PROTOCOL_CLI', '-DUSE_TCP_SOCKETS'] ],
> +  [ 'module-cli-protocol-unix', 'module-protocol-stub.c', [], ['-DUSE_PROTOCOL_CLI', '-DUSE_UNIX_SOCKETS'] ],
> +  [ 'module-combine', 'module-combine.c' ],
> +  [ 'module-combine-sink', 'module-combine-sink.c' ],
> +#  [ 'module-console-kit', 'module-console-kit.c' ],
> +#  [ 'module-coreaudio-detect', 'macosx/module-coreaudio-detect.c' ],
> +#  [ 'module-coreaudio-device', 'macosx/module-coreaudio-device.c' ],
> +#  [ 'module-dbus-protocol', 'module-dbus-protocol.c' ]
> +  [ 'module-default-device-restore', 'module-default-device-restore.c', [], [], [], libprotocol_native ],
> +  [ 'module-detect', 'module-detect.c' ],
> +  [ 'module-device-manager', 'module-device-manager.c' ],
> +  [ 'module-device-restore', 'module-device-restore.c', [], [], [dbus_dep], libprotocol_native ],
> +#  [ 'module-echo-cancel', 'module-echo-cancel.c' ],
> +  [ 'module-equalizer-sink', 'module-equalizer-sink.c', [], [], [dbus_dep] ],
> +  [ 'module-esound-compat-spawnfd', 'module-esound-compat-spawnfd.c' ],
> +  [ 'module-esound-compat-spawnpid', 'module-esound-compat-spawnpid.c' ],
> +#  [ 'module-esound-protocol-tcp', 'module-protocol-stub.c' ],
> +#  [ 'module-esound-protocol-unix', 'module-protocol-stub.c' ],
> +  [ 'module-esound-sink', 'module-esound-sink.c' ],
> +  [ 'module-filter-apply', 'module-filter-apply.c' ],
> +  [ 'module-filter-heuristics', 'module-filter-heuristics.c' ],
> +#  [ 'module-gconf', 'gconf/module-gconf.c' ],
> +  [ 'module-hal-detect', 'module-hal-detect-compat.c' ],
> +  [ 'module-http-protocol-tcp', 'module-protocol-stub.c', [], ['-DUSE_PROTOCOL_HTTP', '-DUSE_TCP_SOCKETS'] ],
> +  [ 'module-http-protocol-unix', 'module-protocol-stub.c', [], ['-DUSE_PROTOCOL_HTTP', '-DUSE_UNIX_SOCKETS'] ],
> +  [ 'module-intended-roles', 'module-intended-roles.c' ],
> +#  [ 'module-jackdbus-detect', 'jack/module-jackdbus-detect.c' ],
> +#  [ 'module-jack-sink', 'jack/module-jack-sink.c' ],
> +#  [ 'module-jack-source', 'jack/module-jack-source.c' ],
> +#  [ 'module-ladspa-sink', 'module-ladspa-sink.c' ],
> +#  [ 'module-lirc', 'module-lirc.c' ],
> +  [ 'module-loopback', 'module-loopback.c' ],
> +  [ 'module-match', 'module-match.c' ],
> +#  [ 'module-mmkbd-evdev', 'module-mmkbd-evdev.c' ],
> +  [ 'module-native-protocol-fd', 'module-native-protocol-fd.c' ],
> +  [ 'module-native-protocol-tcp', 'module-protocol-stub.c', [], ['-DUSE_PROTOCOL_NATIVE', '-DUSE_TCP_SOCKETS'], [], libprotocol_native ],
> +  [ 'module-native-protocol-unix', 'module-protocol-stub.c', [], ['-DUSE_PROTOCOL_NATIVE', '-DUSE_UNIX_SOCKETS'], [], libprotocol_native ],
> +  [ 'module-null-sink', 'module-null-sink.c' ],
> +  [ 'module-null-source', 'module-null-source.c' ],
> +#  [ 'module-oss', 'oss/module-oss.c' ],
> +  [ 'module-pipe-sink', 'module-pipe-sink.c' ],
> +  [ 'module-pipe-source', 'module-pipe-source.c' ],
> +  [ 'module-position-event-sounds', 'module-position-event-sounds.c' ],
> +#  [ 'module-raop-discover', 'raop/module-raop-discover.c' ],
> +#  [ 'module-raop-sink', 'raop/module-raop-sink.c' ],
> +  [ 'module-remap-sink', 'module-remap-sink.c' ],
> +  [ 'module-remap-source', 'module-remap-source.c' ],
> +  [ 'module-rescue-streams', 'module-rescue-streams.c' ],
> +  [ 'module-role-cork', ['module-role-cork.c', 'stream-interaction.c'], 'stream-interaction.h' ],
> +  [ 'module-role-ducking', ['module-role-ducking.c', 'stream-interaction.c'], 'stream-interaction.h' ],
> +  [ 'module-rtp-recv', 'rtp/module-rtp-recv.c' ],
> +  [ 'module-rtp-send', 'rtp/module-rtp-send.c' ],
> +  [ 'module-rygel-media-server', 'module-rygel-media-server.c', [], [], [dbus_dep] ],
> +  [ 'module-simple-protocol-tcp', 'module-protocol-stub.c', [], ['-DUSE_PROTOCOL_SIMPLE', '-DUSE_TCP_SOCKETS'] ],
> +  [ 'module-simple-protocol-unix', 'module-protocol-stub.c', [], ['-DUSE_PROTOCOL_SIMPLE', '-DUSE_UNIX_SOCKETS'] ],
> +  [ 'module-sine', 'module-sine.c' ],
> +  [ 'module-sine-source', 'module-sine-source.c' ],
> +#  [ 'module-solaris', 'module-solaris.c' ],
> +  [ 'module-stream-restore', 'module-stream-restore.c', [], [], [dbus_dep], libprotocol_native ],
> +  [ 'module-suspend-on-idle', 'module-suspend-on-idle.c' ],
> +  [ 'module-switch-on-connect', 'module-switch-on-connect.c' ],
> +  [ 'module-switch-on-port-available', 'module-switch-on-port-available.c' ],
> +  [ 'module-systemd-login', 'module-systemd-login.c' ],
> +  [ 'module-tunnel-sink', 'module-tunnel.c' ],
> +  [ 'module-tunnel-sink-new', 'module-tunnel-sink-new.c' ],
> +  [ 'module-tunnel-source', 'module-tunnel.c' ],
> +  [ 'module-tunnel-source-new', 'module-tunnel-source-new.c' ],
> +  [ 'module-virtual-sink', 'module-virtual-sink.c' ],
> +  [ 'module-virtual-source', 'module-virtual-source.c' ],
> +  [ 'module-virtual-surround-sink', 'module-virtual-surround-sink.c' ],
> +  [ 'module-volume-restore', 'module-volume-restore.c' ],
> +#  [ 'module-waveout', 'module-waveout.c' ],
> +#  [ 'module-x11-bell', 'x11/module-x11-bell.c' ],
> +#  [ 'module-x11-cork-request', 'x11/module-x11-cork-request.c' ],
> +#  [ 'module-x11-publish', 'x11/module-x11-publish.c' ],
> +#  [ 'module-x11-xsmp', 'x11/module-x11-xsmp.c' ],
> +#  [ 'module-zeroconf-discover', 'module-zeroconf-discover.c' ],
> +#  [ 'module-zeroconf-publish', 'module-zeroconf-publish.c' ],
> +]
> +
> +if alsa_dep.found()
> +  subdir('alsa')
> +  all_modules += [
> +    [ 'module-alsa-card', 'alsa/module-alsa-card.c', [], [], [alsa_dep], libalsa_util ],
> +    [ 'module-alsa-sink', 'alsa/module-alsa-sink.c', [], [], [alsa_dep], libalsa_util ],
> +    [ 'module-alsa-source', 'alsa/module-alsa-source.c', [], [], [alsa_dep], libalsa_util ],
> +  ]
> +endif
> +
> +if udev_dep.found()
> +  all_modules += [ [ 'module-udev-detect', 'module-udev-detect.c', [], [], [udev_dep] ] ]
> +endif
> +
> +foreach m : all_modules
> +  name = m[0]
> +  sources = m[1]
> +  headers = m.get(2, [])
> +  extra_flags = m.get(3, [])
> +  extra_deps = m.get(4, [])
> +  extra_libs = m.get(5, [])
> +
> +  mod = shared_module(name,
> +    sources,
> +    headers,
> +    include_directories : [configinc, topinc],
> +    c_args : [pa_c_args, server_c_args, '-DPA_MODULE_NAME=' + name.underscorify()] + extra_flags,
> +    install : true,
> +    dependencies : [thread_dep, libpulse_dep, libpulsecore_dep] + extra_deps,
> +    link_with : extra_libs,
> +    name_prefix : '',
> +    implicit_include_directories : false)
> +endforeach
> diff --git a/src/modules/module-role-cork.c b/src/modules/module-role-cork.c
> index b3c9d5f92..a13457eff 100644
> --- a/src/modules/module-role-cork.c
> +++ b/src/modules/module-role-cork.c
> @@ -23,7 +23,7 @@
>
>  #include <pulsecore/macro.h>
>  #include <pulsecore/core.h>
> -#include <stream-interaction.h>
> +#include "stream-interaction.h"
>
>  PA_MODULE_AUTHOR("Lennart Poettering");
>  PA_MODULE_DESCRIPTION("Mute & cork streams with certain roles while others exist");
> diff --git a/src/modules/module-role-ducking.c b/src/modules/module-role-ducking.c
> index a1308c2a7..1b2ecd735 100644
> --- a/src/modules/module-role-ducking.c
> +++ b/src/modules/module-role-ducking.c
> @@ -23,7 +23,7 @@
>
>  #include <pulsecore/macro.h>
>  #include <pulsecore/core.h>
> -#include <stream-interaction.h>
> +#include "stream-interaction.h"
>
>  PA_MODULE_AUTHOR("Flavio Ceolin <flavio.ceolin at profusion.mobi>");
>  PA_MODULE_DESCRIPTION("Apply a ducking effect based on streams roles");
> diff --git a/src/pulse/meson.build b/src/pulse/meson.build
> new file mode 100644
> index 000000000..d1d816ffd
> --- /dev/null
> +++ b/src/pulse/meson.build
> @@ -0,0 +1,73 @@
> +libpulse_sources = [
> +  'channelmap.c',
> +  'context.c',
> +  'direction.c',
> +  'error.c',
> +  'ext-device-manager.c',
> +  'ext-device-restore.c',
> +  'ext-stream-restore.c',
> +  'format.c',
> +  'introspect.c',
> +  'mainloop-api.c',
> +  'mainloop-signal.c',
> +  'mainloop.c',
> +  'operation.c',
> +  'proplist.c',
> +  'rtclock.c',
> +  'sample.c',
> +  'scache.c',
> +  'stream.c',
> +  'subscribe.c',
> +  'thread-mainloop.c',
> +  'timeval.c',
> +  'utf8.c',
> +  'util.c',
> +  'volume.c',
> +  'xmalloc.c',
> +]
> +
> +libpulse_headers = [
> +  'cdecl.h',
> +  'channelmap.h',
> +  'context.h',
> +  'def.h',
> +  'direction.h',
> +  'error.h',
> +  'ext-device-manager.h',
> +  'ext-device-restore.h',
> +  'ext-stream-restore.h',
> +  'format.h',
> +  'gccmacro.h',
> +  'internal.h',
> +  'introspect.h',
> +  'mainloop-api.h',
> +  'mainloop-signal.h',
> +  'mainloop.h',
> +  'operation.h',
> +  'proplist.h',
> +  'pulseaudio.h',
> +  'rtclock.h',
> +  'sample.h',
> +  'scache.h',
> +  'stream.h',
> +  'subscribe.h',
> +  'thread-mainloop.h',
> +  'timeval.h',
> +  'utf8.h',
> +  'util.h',
> +  'volume.h',
> +  'xmalloc.h',
> +]
> +
> +libpulse = shared_library('pulse',
> +  libpulse_sources,
> +  libpulse_headers,
> +  version : libversion,
> +  include_directories : [configinc, topinc],
> +  c_args : [pa_c_args],
> +  soversion : soversion,
> +  install : true,
> +  dependencies : [libm_dep, thread_dep, libpulsecommon_dep, dbus_dep],
> +  implicit_include_directories : false)
> +
> +libpulse_dep = declare_dependency(link_with: libpulse)
> diff --git a/src/pulsecore/meson.build b/src/pulsecore/meson.build
> new file mode 100644
> index 000000000..2d584dcbd
> --- /dev/null
> +++ b/src/pulsecore/meson.build
> @@ -0,0 +1,170 @@
> +libpulsecore_sources = [
> +  'asyncmsgq.c',
> +  'asyncq.c',
> +  'auth-cookie.c',
> +  'card.c',
> +  'cli-command.c',
> +  'cli-text.c',
> +  'client.c',
> +  'core-scache.c',
> +  'core-subscribe.c',
> +  'core.c',
> +  'cpu.c',
> +  'cpu-arm.c',
> +  'cpu-orc.c',
> +  'cpu-x86.c',
> +  'device-port.c',
> +  'ffmpeg/resample2.c',
> +  'filter/biquad.c',
> +  'filter/crossover.c',
> +  'filter/lfe-filter.c',
> +  'hook-list.c',
> +  'ltdl-helper.c',
> +  'mix.c',
> +  'modargs.c',
> +  'modinfo.c',
> +  'module.c',
> +  'msgobject.c',
> +  'namereg.c',
> +  'object.c',
> +  'play-memblockq.c',
> +  'play-memchunk.c',
> +  'remap.c',
> +  'resampler.c',
> +  'resampler/ffmpeg.c',
> +  'resampler/peaks.c',
> +  'resampler/trivial.c',
> +  'rtpoll.c',
> +  'sconv-s16be.c',
> +  'sconv-s16le.c',
> +  'sconv.c',
> +  'shared.c',
> +  'sink.c',
> +  'sink-input.c',
> +  'sioman.c',
> +  'sound-file-stream.c',
> +  'sound-file.c',
> +  'source.c',
> +  'source-output.c',
> +  'start-child.c',
> +  'stream-util.c',
> +  'thread-mq.c',
> +]
> +
> +libpulsecore_headers = [
> +  'asyncmsgq.h',
> +  'asyncq.h',
> +  'auth-cookie.h',
> +  'card.h',
> +  'cli-command.h',
> +  'cli-text.h',
> +  'client.h',
> +  'core.h',
> +  'core-scache.h',
> +  'core-subscribe.h',
> +  'cpu.h',
> +  'cpu-arm.h',
> +  'cpu-orc.h',
> +  'cpu-x86.h',
> +  'database.h',
> +  'device-port.h',
> +  'ffmpeg/avcodec.h',
> +  'ffmpeg/dsputil.h',
> +  'filter/biquad.h',
> +  'filter/crossover.h',
> +  'filter/lfe-filter.h',
> +  'hook-list.h',
> +  'ltdl-helper.h',
> +  'mix.h',
> +  'modargs.h',
> +  'modinfo.h',
> +  'module.h',
> +  'msgobject.h',
> +  'namereg.h',
> +  'object.h',
> +  'play-memblockq.h',
> +  'play-memchunk.h',
> +  'remap.h',
> +  'resampler.h',
> +  'rtpoll.h',
> +  'sconv.h',
> +  'sconv-s16be.h',
> +  'sconv-s16le.h',
> +  'shared.h',
> +  'sink-input.h',
> +  'sink.h',
> +  'sioman.h',
> +  'sound-file-stream.h',
> +  'sound-file.h',
> +  'source-output.h',
> +  'source.h',
> +  'start-child.h',
> +  'stream-util.h',
> +  'thread-mq.h',
> +  'typedefs.h',
> +]
> +
> +if get_option('database') == 'tdb'
> +  libpulsecore_sources += 'database-tdb.c'
> +  database_c_args = '-DHAVE_TDB'
> +elif get_option('database') == 'gdbm'
> +  libpulsecore_sources += 'database-gdbm.c'
> +  database_c_args = '-DHAVE_GDBM'
> +else
> +  libpulsecore_sources += 'database-simple.c'
> +  database_c_args = '-DHAVE_SIMPLEDB'
> +endif
> +
> +if dbus_dep.found()
> +  libpulsecore_sources += [
> +    'dbus-shared.c',
> +    'protocol-dbus.c',
> +  ]
> +  libpulsecore_headers += [
> +    'dbus-shared.h',
> +    'protocol-dbus.h',
> +  ]
> +endif
> +
> +# FIXME: walk through dependencies and add files
> +
> +# FIXME: SIMD support (ORC)
> +simd = import('unstable-simd')
> +libpulsecore_simd = simd.check('libpulsecore_simd',
> +  mmx : ['remap_mmx.c', 'svolume_mmx.c'],
> +  sse : ['remap_sse.c', 'sconv_sse.c', 'svolume_sse.c'],
> +  neon : ['remap_neon.c', 'sconv_neon.c', 'svolume_neon.c'],
> +  c_args : [pa_c_args],
> +  include_directories : [configinc, topinc],
> +  implicit_include_directories : false,
> +  compiler : cc)
> +libpulsecore_simd_lib = libpulsecore_simd[0]
> +cdata.merge_from(libpulsecore_simd[1])
> +
> +# FIXME: Implement Windows support
> +#'mutex-win32.c',
> +#'poll-win32.c',
> +#'semaphore-win32.c',
> +#'thread-win32.c',
> +
> +libpulsecore = shared_library('pulsecore-' + pa_version_major_minor,
> +  libpulsecore_sources,
> +  libpulsecore_headers,
> +  include_directories : [configinc, topinc],
> +  c_args : [pa_c_args, server_c_args],
> +  install : true,
> +  link_with : libpulsecore_simd_lib,
> +  dependencies : [libm_dep, libpulsecommon_dep, libpulse_dep, ltdl_dep, shm_dep, sndfile_dep, database_dep, dbus_dep, x11_dep],
> +  implicit_include_directories : false)
> +
> +libpulsecore_dep = declare_dependency(link_with: libpulsecore)
> +
> +# For modules that need protocol native functionality
> +libprotocol_native = static_library('protocol_native',
> +  'protocol-native.c',
> +  ['protocol-native.h', 'native-common.h'],
> +  c_args : [pa_c_args, server_c_args, database_c_args],
> +  include_directories : [configinc, topinc],
> +  dependencies : [libpulse_dep, libpulsecore_dep, dbus_dep],
> +  install : false
> +)

This one is shared in the autotools build.

> diff --git a/src/pulsecore/module.c b/src/pulsecore/module.c
> index 0478b6fb8..70b816072 100644
> --- a/src/pulsecore/module.c
> +++ b/src/pulsecore/module.c
> @@ -84,7 +84,11 @@ bool pa_module_exists(const char *name) {
>      state = NULL;
>      if (PA_UNLIKELY(pa_run_from_build_tree())) {
>          while ((p = pa_split(paths, ":", &state))) {
> +#ifdef MESON_BUILD
> +            pathname = pa_sprintf_malloc("%s" PA_PATH_SEP "src" PA_PATH_SEP "modules" PA_PATH_SEP "%s" PA_SOEXT, p, n);
> +#else
>              pathname = pa_sprintf_malloc("%s" PA_PATH_SEP ".libs" PA_PATH_SEP "%s" PA_SOEXT, p, n);
> +#endif
>              result = access(pathname, F_OK) == 0 ? true : false;
>              pa_log_debug("Checking for existence of '%s': %s", pathname, result ? "success" : "failure");
>              pa_xfree(pathname);
> diff --git a/src/utils/meson.build b/src/utils/meson.build
> new file mode 100644
> index 000000000..e407d0721
> --- /dev/null
> +++ b/src/utils/meson.build
> @@ -0,0 +1,67 @@
> +pacat_sources = [
> +  'pacat.c',
> +]
> +
> +# FIXME: man pages
> +executable('pacat',
> +  pacat_sources,
> +  install: true,
> +  include_directories : [configinc, topinc],
> +  link_with : [libpulsecommon, libpulse],
> +  dependencies : [sndfile_dep],
> +  c_args : pa_c_args,
> +)
> +
> +pactl_sources = [
> +  'pactl.c',
> +]
> +
> +# FIXME: man pages
> +executable('pactl',
> +  pactl_sources,
> +  install: true,
> +  include_directories : [configinc, topinc],
> +  link_with : [libpulsecommon, libpulse],
> +  dependencies : [sndfile_dep],
> +  c_args : pa_c_args,
> +)
> +
> +pasuspender_sources = [
> +  'pasuspender.c',
> +]
> +
> +# FIXME: man pages
> +executable('pasuspender',
> +  pasuspender_sources,
> +  install: true,
> +  include_directories : [configinc, topinc],
> +  link_with : [libpulsecommon, libpulse],
> +  c_args : pa_c_args,
> +)
> +
> +pacmd_sources = [
> +  'pacmd.c',
> +]
> +
> +# FIXME: man pages
> +executable('pacmd',
> +  pacmd_sources,
> +  install: true,
> +  include_directories : [configinc, topinc],
> +  link_with : [libpulsecommon, libpulse],
> +  c_args : pa_c_args,
> +)
> +
> +pax11publish_sources = [
> +  'pax11publish.c',
> +]
> +
> +# FIXME: man pages
> +executable('pax11publish',
> +  pax11publish_sources,
> +  install: true,
> +  include_directories : [configinc, topinc],
> +  link_with : [libpulsecommon, libpulse],
> +  dependencies : [x11_dep],
> +  c_args : pa_c_args,
> +)

Shouldn't this be conditional on x11_dep being found?


-- 

Saludos,
Felipe Sateler


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux