aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2020-03-05 12:04:36 -0800
committerMatt Turner <mattst88@gmail.com>2020-03-13 10:25:24 -0700
commit618663c791092bb82dc0a153a4a2fe97582a54bc (patch)
tree093358daf79b24ea4c967387e7ac943579d11887
parentmeson: Require wayland-scanner of a matching version (diff)
downloadwayland-618663c791092bb82dc0a153a4a2fe97582a54bc.tar
wayland-618663c791092bb82dc0a153a4a2fe97582a54bc.tar.gz
wayland-618663c791092bb82dc0a153a4a2fe97582a54bc.tar.bz2
wayland-618663c791092bb82dc0a153a4a2fe97582a54bc.tar.lz
wayland-618663c791092bb82dc0a153a4a2fe97582a54bc.tar.xz
wayland-618663c791092bb82dc0a153a4a2fe97582a54bc.tar.zst
wayland-618663c791092bb82dc0a153a4a2fe97582a54bc.zip
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>
-rw-r--r--meson.build27
-rw-r--r--meson_options.txt4
-rw-r--r--src/meson.build85
-rw-r--r--tests/meson.build22
4 files changed, 80 insertions, 58 deletions
diff --git a/meson.build b/meson.build
index 26b084f..540dee8 100644
--- a/meson.build
+++ b/meson.build
@@ -84,19 +84,20 @@ if get_option('libraries')
subdir('cursor')
subdir('egl')
subdir('tests')
+ if get_option('documentation')
+ subdir('doc')
+ endif
endif
-if get_option('documentation')
- subdir('doc')
-endif
-
-install_data([
- 'wayland-scanner.mk',
- 'protocol/wayland.xml',
- 'protocol/wayland.dtd',
-])
+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'),
-)
+ install_data(
+ [ 'wayland-scanner.m4' ],
+ install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'aclocal'),
+ )
+endif
diff --git a/meson_options.txt b/meson_options.txt
index 76314f7..de588d1 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -2,6 +2,10 @@ option('libraries',
description: 'Compile Wayland libraries',
type: 'boolean',
value: 'true')
+option('scanner',
+ description: 'Compile wayland-scanner binary',
+ type: 'boolean',
+ value: 'true')
option('documentation',
description: 'Build the documentation (requires Doxygen, dot, xmlto, xsltproc)',
type: 'boolean',
diff --git a/src/meson.build b/src/meson.build
index cf92321..a61d40f 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -4,12 +4,6 @@ wayland_version_h.set('WAYLAND_VERSION', meson.project_version())
wayland_version_h.set('WAYLAND_VERSION_MAJOR', wayland_version[0].to_int())
wayland_version_h.set('WAYLAND_VERSION_MINOR', wayland_version[1].to_int())
wayland_version_h.set('WAYLAND_VERSION_MICRO', wayland_version[2].to_int())
-configure_file(
- input: 'wayland-version.h.in',
- output: 'wayland-version.h',
- configuration: wayland_version_h,
- install_dir: join_paths(get_option('prefix'), get_option('includedir'))
-)
wayland_util = static_library(
'wayland-util',
@@ -21,40 +15,48 @@ wayland_util_dep = declare_dependency(
include_directories: include_directories('.')
)
-# wayland-scanner
+if get_option('scanner')
+ # wayland-scanner
-configure_file(
- input: '../protocol/wayland.dtd',
- output: 'wayland.dtd.embed',
- copy: true
-)
+ configure_file(
+ input: 'wayland-version.h.in',
+ output: 'wayland-version.h',
+ configuration: wayland_version_h,
+ )
-wayland_scanner_sources = [ 'scanner.c', 'dtddata.S' ]
-wayland_scanner_includes = [ root_inc, protocol_inc ]
+ configure_file(
+ input: '../protocol/wayland.dtd',
+ output: 'wayland.dtd.embed',
+ copy: true
+ )
-wayland_scanner = executable(
- 'wayland-scanner',
- wayland_scanner_sources,
- c_args: [ '-include', 'config.h' ],
- include_directories: wayland_scanner_includes,
- dependencies: [ scanner_deps, wayland_util_dep, ],
- install: true
-)
+ wayland_scanner_sources = [ 'scanner.c', 'dtddata.S' ]
+ wayland_scanner_includes = [ root_inc, protocol_inc ]
-pkgconfig.generate(
- name: 'Wayland Scanner',
- description: 'Wayland scanner',
- version: meson.project_version(),
- variables: [
- 'datarootdir=' + join_paths('${prefix}', get_option('datadir')),
- 'pkgdatadir=' + join_paths('${datarootdir}', meson.project_name()),
- 'bindir=' + join_paths('${prefix}', get_option('bindir')),
- 'wayland_scanner=${bindir}/wayland-scanner'
- ],
- filebase: 'wayland-scanner'
-)
+ wayland_scanner = executable(
+ 'wayland-scanner',
+ wayland_scanner_sources,
+ c_args: [ '-include', 'config.h' ],
+ include_directories: wayland_scanner_includes,
+ dependencies: [ scanner_deps, wayland_util_dep, ],
+ install: true
+ )
-if meson.is_cross_build()
+ pkgconfig.generate(
+ name: 'Wayland Scanner',
+ description: 'Wayland scanner',
+ version: meson.project_version(),
+ variables: [
+ 'datarootdir=' + join_paths('${prefix}', get_option('datadir')),
+ 'pkgdatadir=' + join_paths('${datarootdir}', meson.project_name()),
+ 'bindir=' + join_paths('${prefix}', get_option('bindir')),
+ 'wayland_scanner=${bindir}/wayland-scanner'
+ ],
+ filebase: 'wayland-scanner'
+ )
+endif
+
+if meson.is_cross_build() or not get_option('scanner')
scanner_dep = dependency('wayland-scanner', native: true, version: meson.project_version())
wayland_scanner_for_build = find_program(scanner_dep.get_pkgconfig_variable('wayland_scanner'))
else
@@ -62,6 +64,19 @@ else
endif
if get_option('libraries')
+ # wayland libraries
+
+ # Duplicated inside the "if get_option('scanner')" block above since we
+ # still need the wayland-version.h to build the scanner, but do not want
+ # to install it. Meson 0.50 adds "install: bool" which will let us
+ # deduplicate this block.
+ configure_file(
+ input: 'wayland-version.h.in',
+ output: 'wayland-version.h',
+ configuration: wayland_version_h,
+ install_dir: join_paths(get_option('prefix'), get_option('includedir'))
+ )
+
mathlib_dep = cc.find_library('m', required: false)
threads_dep = dependency('threads', required: false)
diff --git a/tests/meson.build b/tests/meson.build
index f1af7b4..224f48d 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -76,16 +76,18 @@ test(
sed_path = find_program('sed').path()
-test(
- 'scanner-test',
- find_program('scanner-test.sh'),
- env: [
- 'TEST_DATA_DIR=@0@/data'.format(meson.current_source_dir()),
- 'TEST_OUTPUT_DIR=@0@/output'.format(meson.current_build_dir()),
- 'SED=@0@'.format(sed_path),
- 'WAYLAND_SCANNER=@0@'.format(wayland_scanner.full_path()),
- ],
-)
+if get_option('scanner')
+ test(
+ 'scanner-test',
+ find_program('scanner-test.sh'),
+ env: [
+ 'TEST_DATA_DIR=@0@/data'.format(meson.current_source_dir()),
+ 'TEST_OUTPUT_DIR=@0@/output'.format(meson.current_build_dir()),
+ 'SED=@0@'.format(sed_path),
+ 'WAYLAND_SCANNER=@0@'.format(wayland_scanner.full_path()),
+ ],
+ )
+endif
tests = {
'array-test': [],