Commit 065233ab authored by Manuel Stoeckl's avatar Manuel Stoeckl
Browse files

Improve build portability

* Make scdoc optional; documentation is not strictly necessary
* Explicitly test for fmacro-prefix-map support
* Test for the minimum possible versions of wayland dependencies
* Reduce required meson version
parent f73e15a0
...@@ -2,7 +2,7 @@ project( ...@@ -2,7 +2,7 @@ project(
'waypipe', 'waypipe',
'c', 'c',
license: 'MIT/Expat', license: 'MIT/Expat',
meson_version: '>=0.48.0', meson_version: '>=0.46.0',
default_options: [ default_options: [
'c_std=c11', 'c_std=c11',
'warning_level=2', 'warning_level=2',
...@@ -18,9 +18,10 @@ version = '"@0@"'.format(meson.project_version()) ...@@ -18,9 +18,10 @@ version = '"@0@"'.format(meson.project_version())
add_project_arguments('-DWAYPIPE_VERSION=@0@'.format(version), language: 'c') add_project_arguments('-DWAYPIPE_VERSION=@0@'.format(version), language: 'c')
# Make build reproducible if possible # Make build reproducible if possible
if cc.get_id() == 'gcc' if cc.has_argument('-fmacro-prefix-map=/prefix/to/hide=')
r = run_command('python3', '-c', 'import os.path; print(os.path.join(os.path.relpath(\'@0@\', \'@1@\'),\'\'))'.format(meson.source_root(), meson.build_root())) prefix_finder = 'import os.path; print(os.path.join(os.path.relpath(\'@0@\', \'@1@\'),\'\'))'
relative_dir = r.stdout().strip() r = run_command('python3', '-c', prefix_finder.format(meson.source_root(), meson.build_root()))
relative_dir = r.stdout().strip()
add_project_arguments( add_project_arguments(
'-fmacro-prefix-map=@0@='.format(relative_dir), '-fmacro-prefix-map=@0@='.format(relative_dir),
language: 'c', language: 'c',
...@@ -36,9 +37,9 @@ else ...@@ -36,9 +37,9 @@ else
) )
endif endif
wayland_client = dependency('wayland-client', version: '>=1.17') wayland_client = dependency('wayland-client', version: '>=1.15') # WAYLAND_DISPLAY=path
wayland_protos = dependency('wayland-protocols', version: '>=1.17') wayland_protos = dependency('wayland-protocols', version: '>=1.15') # WAYLAND_DISPLAY=path
wayland_server = dependency('wayland-server', version: '>=1.17') wayland_server = dependency('wayland-server', version: '>=1.12') # xdg-shell
libffi = dependency('libffi') libffi = dependency('libffi')
rt = cc.find_library('rt') rt = cc.find_library('rt')
...@@ -56,18 +57,20 @@ executable( ...@@ -56,18 +57,20 @@ executable(
install: true install: true
) )
scdoc = dependency('scdoc', version: '>=1.9.4', native: true) scdoc = dependency('scdoc', version: '>=1.9.4', native: true, required: false)
scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true) if scdoc.found()
sh = find_program('sh', native: true) scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true)
mandir = get_option('mandir') sh = find_program('sh', native: true)
custom_target( mandir = get_option('mandir')
'waypipe.1', custom_target(
input: 'waypipe.scd', 'waypipe.1',
output: 'waypipe.1', input: 'waypipe.scd',
command: [ output: 'waypipe.1',
sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.path(), 'waypipe.1') command: [
], sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.path(), 'waypipe.1')
install: true, ],
install_dir: '@0@/man1'.format(mandir) install: true,
) install_dir: '@0@/man1'.format(mandir)
)
endif
...@@ -42,7 +42,7 @@ endforeach ...@@ -42,7 +42,7 @@ endforeach
lib_protocols = static_library( lib_protocols = static_library(
'protocols', 'protocols',
protocols_src, protocols_src,
dependencies: [] dependencies: [wayland_client] # for the header files, only
) )
protos = declare_dependency( protos = declare_dependency(
link_with: lib_protocols, link_with: lib_protocols,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment