wayland/meson.build
Matt Turner 618663c791 meson: Add option to control building wayland-scanner
Wayland requires a binary, wayland-scanner, to be run during the build
process. For any configuration other than native builds (including
cross compiling and even 32-bit x86 builds on an x86-64 build machine)
Wayland's build process builds and uses its own wayland-scanner.

For any builds using a cross file, wayland-scanner is built for the host
machine and therefore cannot be executed during the build of the Wayland
libraries. Instead builds using a cross file must execute the build
machine's wayland-scanner (typically /usr/bin/wayland-scanner).

As such, to build Wayland's libraries for a non-native ABI a package
manager must build and install /usr/bin/wayland-scanner first. But then
the build for the native ABI then rebuilds wayland-scanner itself and
doesn't use the system's, and worse, wants to install its own, which
conflicts with the /usr/bin/wayland-scanner already installed!

So, add the -Dscanner=... option to control whether to install
wayland-scanner.

Signed-off-by: Matt Turner <mattst88@gmail.com>
2020-03-13 10:25:24 -07:00

103 lines
2.1 KiB
Meson

project(
'wayland', 'c', 'cpp',
version: '1.18.90',
license: 'MIT',
meson_version: '>= 0.47.0',
default_options: [
'warning_level=2',
'buildtype=debugoptimized'
]
)
config_h = configuration_data()
config_h.set_quoted('PACKAGE', meson.project_name())
config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
compiler_flags = [
'-Wno-unused-parameter',
'-Wstrict-prototypes',
'-Wmissing-prototypes',
'-fvisibility=hidden',
]
cc = meson.get_compiler('c')
add_project_arguments(
cc.get_supported_arguments(compiler_flags),
language: 'c'
)
foreach h: [ 'sys/prctl.h' ]
config_h.set('HAVE_' + h.underscorify().to_upper(), cc.has_header(h))
endforeach
have_funcs = [
'accept4',
'mkostemp',
'posix_fallocate',
'prctl',
'memfd_create',
'strndup',
]
foreach f: have_funcs
config_h.set('HAVE_' + f.underscorify().to_upper(), cc.has_function(f))
endforeach
if get_option('libraries')
ffi_dep = dependency('libffi')
decls = [
{ 'header': 'sys/signalfd.h', 'symbol': 'SFD_CLOEXEC' },
{ 'header': 'sys/timerfd.h', 'symbol': 'TFD_CLOEXEC' },
{ 'header': 'time.h', 'symbol': 'CLOCK_MONOTONIC' },
]
foreach d: decls
if not cc.has_header_symbol(d['header'], d['symbol'])
error('@0@ is needed to compile Wayland libraries'.format(d['symbol']))
endif
endforeach
endif
scanner_deps = [ dependency('expat') ]
if get_option('dtd_validation')
scanner_deps += dependency('libxml-2.0')
config_h.set('HAVE_LIBXML', 1)
endif
configure_file(
output: 'config.h',
configuration: config_h,
)
pkgconfig = import('pkgconfig')
wayland_protocol_xml = files('protocol/wayland.xml')
root_inc = include_directories('.')
protocol_inc = include_directories('protocol')
src_inc = include_directories('src')
subdir('src')
if get_option('libraries')
subdir('cursor')
subdir('egl')
subdir('tests')
if get_option('documentation')
subdir('doc')
endif
endif
if get_option('scanner')
install_data([
'wayland-scanner.mk',
'protocol/wayland.xml',
'protocol/wayland.dtd',
])
install_data(
[ 'wayland-scanner.m4' ],
install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'aclocal'),
)
endif