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(
'waypipe',
'c',
license: 'MIT/Expat',
meson_version: '>=0.48.0',
meson_version: '>=0.46.0',
default_options: [
'c_std=c11',
'warning_level=2',
......@@ -18,9 +18,10 @@ version = '"@0@"'.format(meson.project_version())
add_project_arguments('-DWAYPIPE_VERSION=@0@'.format(version), language: 'c')
# Make build reproducible if possible
if cc.get_id() == 'gcc'
r = run_command('python3', '-c', 'import os.path; print(os.path.join(os.path.relpath(\'@0@\', \'@1@\'),\'\'))'.format(meson.source_root(), meson.build_root()))
relative_dir = r.stdout().strip()
if cc.has_argument('-fmacro-prefix-map=/prefix/to/hide=')
prefix_finder = 'import os.path; print(os.path.join(os.path.relpath(\'@0@\', \'@1@\'),\'\'))'
r = run_command('python3', '-c', prefix_finder.format(meson.source_root(), meson.build_root()))
relative_dir = r.stdout().strip()
add_project_arguments(
'-fmacro-prefix-map=@0@='.format(relative_dir),
language: 'c',
......@@ -36,9 +37,9 @@ else
)
endif
wayland_client = dependency('wayland-client', version: '>=1.17')
wayland_protos = dependency('wayland-protocols', version: '>=1.17')
wayland_server = dependency('wayland-server', version: '>=1.17')
wayland_client = dependency('wayland-client', version: '>=1.15') # WAYLAND_DISPLAY=path
wayland_protos = dependency('wayland-protocols', version: '>=1.15') # WAYLAND_DISPLAY=path
wayland_server = dependency('wayland-server', version: '>=1.12') # xdg-shell
libffi = dependency('libffi')
rt = cc.find_library('rt')
......@@ -56,18 +57,20 @@ executable(
install: true
)
scdoc = dependency('scdoc', version: '>=1.9.4', native: true)
scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true)
sh = find_program('sh', native: true)
mandir = get_option('mandir')
custom_target(
'waypipe.1',
input: 'waypipe.scd',
output: 'waypipe.1',
command: [
sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.path(), 'waypipe.1')
],
install: true,
install_dir: '@0@/man1'.format(mandir)
)
scdoc = dependency('scdoc', version: '>=1.9.4', native: true, required: false)
if scdoc.found()
scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true)
sh = find_program('sh', native: true)
mandir = get_option('mandir')
custom_target(
'waypipe.1',
input: 'waypipe.scd',
output: 'waypipe.1',
command: [
sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.path(), 'waypipe.1')
],
install: true,
install_dir: '@0@/man1'.format(mandir)
)
endif
......@@ -42,7 +42,7 @@ endforeach
lib_protocols = static_library(
'protocols',
protocols_src,
dependencies: []
dependencies: [wayland_client] # for the header files, only
)
protos = declare_dependency(
link_with: lib_protocols,
......
Markdown is supported
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