From 68ff3ad8412ec2075c9844225475f750f8eb72bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Tue, 16 Aug 2022 18:03:03 +0200 Subject: [PATCH] treewide: meson.build: use `host_machine` instead of `build_machine` At the moment, cross compilation may not work in certain cases because checks are carried out against the build machine instead of the host machine. Replace uses of `build_machine` with `host_machine` to fix that. In native compilation, all three "machine objects" available in meson are the same, so this change should have no effect in that case. More: https://mesonbuild.com/Cross-compilation.html --- meson.build | 6 +++--- spa/plugins/meson.build | 2 +- src/modules/meson.build | 2 +- src/pipewire/meson.build | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index b6c01f191..3fb77f290 100644 --- a/meson.build +++ b/meson.build @@ -342,11 +342,11 @@ summary({'WebRTC Echo Canceling': webrtc_dep.found()}, bool_yn: true, section: ' cdata.set('HAVE_WEBRTC', webrtc_dep.found()) # On FreeBSD and MidnightBSD, epoll-shim library is required for eventfd() and timerfd() -epoll_shim_dep = (build_machine.system() == 'freebsd' or build_machine.system() == 'midnightbsd' +epoll_shim_dep = (host_machine.system() == 'freebsd' or host_machine.system() == 'midnightbsd' ? dependency('epoll-shim', required: true) : dependency('', required: false)) -libinotify_dep = (build_machine.system() == 'freebsd' or build_machine.system() == 'midnightbsd' +libinotify_dep = (host_machine.system() == 'freebsd' or host_machine.system() == 'midnightbsd' ? dependency('libinotify', required: true) : dependency('', required: false)) @@ -361,7 +361,7 @@ need_alsa = get_option('pipewire-alsa').enabled() or 'media-session' in get_opti alsa_dep = dependency('alsa', version : '>=1.1.7', required: need_alsa) summary({'pipewire-alsa': alsa_dep.found()}, bool_yn: true) -if build_machine.system() == 'freebsd' or build_machine.system() == 'midnightbsd' +if host_machine.system() == 'freebsd' or host_machine.system() == 'midnightbsd' # On FreeBSD and MidnightBSD the OpenSSL library may come from base or a package. # Check for a package first and fallback to the base library if we can't find it via pkgconfig openssl_lib = dependency('openssl', required: false) diff --git a/spa/plugins/meson.build b/spa/plugins/meson.build index b6a52bd84..6df938170 100644 --- a/spa/plugins/meson.build +++ b/spa/plugins/meson.build @@ -1,7 +1,7 @@ if alsa_dep.found() subdir('alsa') endif -if get_option('avb').require(build_machine.system() == 'linux', error_message: 'AVB support is only available on Linux').allowed() +if get_option('avb').require(host_machine.system() == 'linux', error_message: 'AVB support is only available on Linux').allowed() subdir('avb') endif if get_option('audioconvert').allowed() diff --git a/src/modules/meson.build b/src/modules/meson.build index 69090311c..3e0e3a3fd 100644 --- a/src/modules/meson.build +++ b/src/modules/meson.build @@ -527,7 +527,7 @@ pipewire_module_fallback_sink = shared_library('pipewire-module-fallback-sink', dependencies : [mathlib, dl_lib, rt_lib, pipewire_dep], ) -build_module_avb = get_option('avb').require(build_machine.system() == 'linux', error_message: 'AVB support is only available on Linux').allowed() +build_module_avb = get_option('avb').require(host_machine.system() == 'linux', error_message: 'AVB support is only available on Linux').allowed() if build_module_avb pipewire_module_avb = shared_library('pipewire-module-avb', [ 'module-avb.c', diff --git a/src/pipewire/meson.build b/src/pipewire/meson.build index f594c55f3..b19631a92 100644 --- a/src/pipewire/meson.build +++ b/src/pipewire/meson.build @@ -94,7 +94,7 @@ libpipewire_c_args = [ '-DOLD_MEDIA_SESSION_WORKAROUND=1' ] -if build_machine.system() != 'freebsd' and build_machine.system() != 'midnightbsd' +if host_machine.system() != 'freebsd' and host_machine.system() != 'midnightbsd' libpipewire_c_args += [ '-D_POSIX_C_SOURCE' ]