This repository has been archived by the owner on May 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmeson.build
112 lines (97 loc) · 3.31 KB
/
meson.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
project('drm_info', 'c',
version: '2.3.0',
license: 'MIT',
meson_version: '>=0.49.0',
default_options: [
'c_std=c11',
'warning_level=2',
],
)
warning('Heads up! This project has migrated to gitlab.freedesktop.org:')
warning('https://gitlab.freedesktop.org/emersion/drm_info')
cc = meson.get_compiler('c')
add_project_arguments('-D_POSIX_C_SOURCE=200809L', language: 'c')
jsonc = dependency('json-c', version: '>=0.14', fallback: ['json-c', 'json_c_dep'])
libpci = dependency('libpci', required: get_option('libpci'))
libdrm = dependency('libdrm',
fallback: ['libdrm', 'ext_libdrm'],
default_options: [
'intel=disabled',
'radeon=disabled',
'amdgpu=disabled',
'nouveau=disabled',
'vmwgfx=disabled',
'omap=disabled',
'exynos=disabled',
'freedreno=disabled',
'tegra=disabled',
'vc4=disabled',
'etnaviv=disabled',
'cairo-tests=disabled',
'man-pages=disabled',
'valgrind=disabled',
],
)
inc = []
# libdrm pretty consistently pulls in the linux userspace API headers.
# We want a new libdrm to get all of the #defines in those headers, but
# we don't actually need to link against a new version of libdrm itself.
#
# We need to make sure we don't use any new libdrm functions, but those
# are added very infrequently, so this is unlikely to be an issue.
if libdrm.version().version_compare('<2.4.113')
if libdrm.type_name() == 'internal'
error('libdrm subproject out of date. Run `meson subprojects update`.')
endif
msg = [
'System libdrm version does not have latest Linux DRM headers.',
'Attempting to use headers from meson subproject if present.',
'If this fails, update your system libdrm or run `meson subprojects download`.',
]
foreach s : msg
warning(s)
endforeach
fourcc_h = meson.current_source_dir() / 'subprojects/libdrm/include/drm/drm_fourcc.h'
inc += include_directories('subprojects/libdrm/include/drm')
libdrm = libdrm.partial_dependency(link_args: true)
elif libdrm.type_name() == 'internal'
fourcc_h = meson.current_source_dir() / 'subprojects/libdrm/include/drm/drm_fourcc.h'
else
fourcc_h = libdrm.get_pkgconfig_variable('includedir') / 'libdrm/drm_fourcc.h'
endif
if libpci.found()
add_project_arguments('-DHAVE_LIBPCI', language: 'c')
endif
if libdrm.type_name() == 'internal' or cc.has_function('drmModeGetFB2', dependencies: [libdrm])
add_project_arguments('-DHAVE_GETFB2', language: 'c')
endif
python3 = import('python').find_installation()
tables_c = custom_target('tables_c',
output : 'tables.c',
command : [python3, files('fourcc.py'), fourcc_h, '@OUTPUT@'])
executable('drm_info',
['main.c', 'modifiers.c', 'json.c', 'pretty.c', tables_c],
include_directories: inc,
dependencies: [libdrm, libpci, jsonc],
install: true,
)
scdoc = dependency('scdoc', native: true, required: get_option('man-pages'))
if scdoc.found()
man_pages = ['drm_info.1.scd']
sh = find_program('sh', native: true)
foreach src : man_pages
topic = src.split('.')[0]
section = src.split('.')[1]
output = topic + '.' + section
custom_target(
output,
input: src,
output: output,
command: [
sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc.get_pkgconfig_variable('scdoc'), output)
],
install: true,
install_dir: get_option('mandir') / 'man' + section
)
endforeach
endif