xref: /aosp_15_r20/external/libdrm/meson.build (revision 7688df22e49036ff52a766b7101da3a49edadb8c)
1*7688df22SAndroid Build Coastguard Worker# Copyright © 2017-2018 Intel Corporation
2*7688df22SAndroid Build Coastguard Worker
3*7688df22SAndroid Build Coastguard Worker# Permission is hereby granted, free of charge, to any person obtaining a copy
4*7688df22SAndroid Build Coastguard Worker# of this software and associated documentation files (the "Software"), to deal
5*7688df22SAndroid Build Coastguard Worker# in the Software without restriction, including without limitation the rights
6*7688df22SAndroid Build Coastguard Worker# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7*7688df22SAndroid Build Coastguard Worker# copies of the Software, and to permit persons to whom the Software is
8*7688df22SAndroid Build Coastguard Worker# furnished to do so, subject to the following conditions:
9*7688df22SAndroid Build Coastguard Worker
10*7688df22SAndroid Build Coastguard Worker# The above copyright notice and this permission notice shall be included in
11*7688df22SAndroid Build Coastguard Worker# all copies or substantial portions of the Software.
12*7688df22SAndroid Build Coastguard Worker
13*7688df22SAndroid Build Coastguard Worker# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14*7688df22SAndroid Build Coastguard Worker# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15*7688df22SAndroid Build Coastguard Worker# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16*7688df22SAndroid Build Coastguard Worker# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17*7688df22SAndroid Build Coastguard Worker# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18*7688df22SAndroid Build Coastguard Worker# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19*7688df22SAndroid Build Coastguard Worker# SOFTWARE.
20*7688df22SAndroid Build Coastguard Worker
21*7688df22SAndroid Build Coastguard Worker# The versioning should always stay at 2.4.x. If bumping away from this,
22*7688df22SAndroid Build Coastguard Worker# you must ensure that all users of patch_ver are changed such that DSO versions
23*7688df22SAndroid Build Coastguard Worker# continuously increment (e.g. blindly bumping from 2.4.122 to 2.5.0 would
24*7688df22SAndroid Build Coastguard Worker# roll the libdrm DSO versioning from libdrm.so.2.122.0 back to libdrm.so.2.0.0
25*7688df22SAndroid Build Coastguard Worker# which would be bad)
26*7688df22SAndroid Build Coastguard Workerproject(
27*7688df22SAndroid Build Coastguard Worker  'libdrm',
28*7688df22SAndroid Build Coastguard Worker  ['c'],
29*7688df22SAndroid Build Coastguard Worker  version : '2.4.124',
30*7688df22SAndroid Build Coastguard Worker  license : 'MIT',
31*7688df22SAndroid Build Coastguard Worker  meson_version : '>= 0.59',
32*7688df22SAndroid Build Coastguard Worker  default_options : ['buildtype=debugoptimized', 'c_std=c11'],
33*7688df22SAndroid Build Coastguard Worker)
34*7688df22SAndroid Build Coastguard Worker
35*7688df22SAndroid Build Coastguard Workerpatch_ver = meson.project_version().split('.')[2]
36*7688df22SAndroid Build Coastguard Worker
37*7688df22SAndroid Build Coastguard Workerif ['windows', 'darwin'].contains(host_machine.system())
38*7688df22SAndroid Build Coastguard Worker  error('unsupported OS: @0@'.format(host_machine.system()))
39*7688df22SAndroid Build Coastguard Workerendif
40*7688df22SAndroid Build Coastguard Worker
41*7688df22SAndroid Build Coastguard Workerpkg = import('pkgconfig')
42*7688df22SAndroid Build Coastguard Worker
43*7688df22SAndroid Build Coastguard Workerconfig = configuration_data()
44*7688df22SAndroid Build Coastguard Worker
45*7688df22SAndroid Build Coastguard Workerconfig.set10('UDEV', get_option('udev'))
46*7688df22SAndroid Build Coastguard Workerwith_freedreno_kgsl = get_option('freedreno-kgsl')
47*7688df22SAndroid Build Coastguard Workerwith_install_tests = get_option('install-test-programs')
48*7688df22SAndroid Build Coastguard Workerwith_tests = get_option('tests')
49*7688df22SAndroid Build Coastguard Worker
50*7688df22SAndroid Build Coastguard Workerdep_threads = dependency('threads')
51*7688df22SAndroid Build Coastguard Worker
52*7688df22SAndroid Build Coastguard Workercc = meson.get_compiler('c')
53*7688df22SAndroid Build Coastguard Worker
54*7688df22SAndroid Build Coastguard Workerandroid = cc.compiles('''int func() { return __ANDROID__; }''')
55*7688df22SAndroid Build Coastguard Worker
56*7688df22SAndroid Build Coastguard Worker# Solaris / Illumos
57*7688df22SAndroid Build Coastguard Workerif host_machine.system() == 'sunos'
58*7688df22SAndroid Build Coastguard Worker  add_global_arguments('-D__EXTENSIONS__', language : 'c')
59*7688df22SAndroid Build Coastguard Worker  add_global_arguments('-D_POSIX_C_SOURCE=3', language : 'c')
60*7688df22SAndroid Build Coastguard Workerendif
61*7688df22SAndroid Build Coastguard Worker
62*7688df22SAndroid Build Coastguard Workersymbols_check = find_program('symbols-check.py')
63*7688df22SAndroid Build Coastguard Workerprog_nm = find_program('nm')
64*7688df22SAndroid Build Coastguard Worker
65*7688df22SAndroid Build Coastguard Worker# Check for atomics
66*7688df22SAndroid Build Coastguard Workerintel_atomics = false
67*7688df22SAndroid Build Coastguard Workerlib_atomics = false
68*7688df22SAndroid Build Coastguard Worker
69*7688df22SAndroid Build Coastguard Workerpython3 = import('python').find_installation()
70*7688df22SAndroid Build Coastguard Workerformat_mod_static_table = custom_target(
71*7688df22SAndroid Build Coastguard Worker  'format_mod_static_table',
72*7688df22SAndroid Build Coastguard Worker  output : 'generated_static_table_fourcc.h',
73*7688df22SAndroid Build Coastguard Worker  input : 'include/drm/drm_fourcc.h',
74*7688df22SAndroid Build Coastguard Worker  command : [python3, files('gen_table_fourcc.py'), '@INPUT@', '@OUTPUT@'])
75*7688df22SAndroid Build Coastguard Worker
76*7688df22SAndroid Build Coastguard Workerdep_atomic_ops = dependency('atomic_ops', required : false)
77*7688df22SAndroid Build Coastguard Workerif cc.links('''
78*7688df22SAndroid Build Coastguard Worker    int atomic_add(int *i) { return __sync_add_and_fetch (i, 1); }
79*7688df22SAndroid Build Coastguard Worker    int atomic_cmpxchg(int *i, int j, int k) { return __sync_val_compare_and_swap (i, j, k); }
80*7688df22SAndroid Build Coastguard Worker    int main() { }
81*7688df22SAndroid Build Coastguard Worker    ''',
82*7688df22SAndroid Build Coastguard Worker    name : 'Intel Atomics')
83*7688df22SAndroid Build Coastguard Worker  intel_atomics = true
84*7688df22SAndroid Build Coastguard Worker  with_atomics = true
85*7688df22SAndroid Build Coastguard Worker  dep_atomic_ops = []
86*7688df22SAndroid Build Coastguard Workerelif dep_atomic_ops.found()
87*7688df22SAndroid Build Coastguard Worker  lib_atomics = true
88*7688df22SAndroid Build Coastguard Worker  with_atomics = true
89*7688df22SAndroid Build Coastguard Workerelif cc.has_function('atomic_cas_uint')
90*7688df22SAndroid Build Coastguard Worker  with_atomics = true
91*7688df22SAndroid Build Coastguard Workerelse
92*7688df22SAndroid Build Coastguard Worker  with_atomics = false
93*7688df22SAndroid Build Coastguard Workerendif
94*7688df22SAndroid Build Coastguard Worker
95*7688df22SAndroid Build Coastguard Workerconfig.set10('HAVE_LIBDRM_ATOMIC_PRIMITIVES', intel_atomics)
96*7688df22SAndroid Build Coastguard Workerconfig.set10('HAVE_LIB_ATOMIC_OPS', lib_atomics)
97*7688df22SAndroid Build Coastguard Worker
98*7688df22SAndroid Build Coastguard Workerdep_pciaccess = dependency('pciaccess', version : '>= 0.10', required : get_option('intel'))
99*7688df22SAndroid Build Coastguard Worker
100*7688df22SAndroid Build Coastguard Workerwith_intel = get_option('intel') \
101*7688df22SAndroid Build Coastguard Worker  .require(with_atomics, error_message : 'libdrm_intel requires atomics') \
102*7688df22SAndroid Build Coastguard Worker  .require(dep_pciaccess.found(), error_message : 'libdrm_intel requires libpciaccess') \
103*7688df22SAndroid Build Coastguard Worker  .disable_auto_if(not host_machine.cpu_family().startswith('x86')) \
104*7688df22SAndroid Build Coastguard Worker  .allowed()
105*7688df22SAndroid Build Coastguard Workersummary('Intel', with_intel)
106*7688df22SAndroid Build Coastguard Worker
107*7688df22SAndroid Build Coastguard Workerwith_radeon = get_option('radeon') \
108*7688df22SAndroid Build Coastguard Worker  .require(with_atomics, error_message : 'libdrm_radeon requires atomics') \
109*7688df22SAndroid Build Coastguard Worker  .allowed()
110*7688df22SAndroid Build Coastguard Workersummary('Radeon', with_radeon)
111*7688df22SAndroid Build Coastguard Worker
112*7688df22SAndroid Build Coastguard Workerwith_amdgpu = get_option('amdgpu') \
113*7688df22SAndroid Build Coastguard Worker  .require(with_atomics, error_message : 'libdrm_amdgpu requires atomics') \
114*7688df22SAndroid Build Coastguard Worker  .allowed()
115*7688df22SAndroid Build Coastguard Workersummary('AMDGPU', with_amdgpu)
116*7688df22SAndroid Build Coastguard Worker
117*7688df22SAndroid Build Coastguard Workerwith_nouveau = get_option('nouveau') \
118*7688df22SAndroid Build Coastguard Worker  .require(with_atomics, error_message : 'libdrm_nouveau requires atomics') \
119*7688df22SAndroid Build Coastguard Worker  .allowed()
120*7688df22SAndroid Build Coastguard Workersummary('Nouveau', with_nouveau)
121*7688df22SAndroid Build Coastguard Worker
122*7688df22SAndroid Build Coastguard Workerwith_vmwgfx = get_option('vmwgfx').allowed()
123*7688df22SAndroid Build Coastguard Workersummary('vmwgfx', with_vmwgfx)
124*7688df22SAndroid Build Coastguard Worker
125*7688df22SAndroid Build Coastguard Workerwith_omap = get_option('omap') \
126*7688df22SAndroid Build Coastguard Worker  .require(with_atomics, error_message : 'libdrm_omap requires atomics') \
127*7688df22SAndroid Build Coastguard Worker  .enabled()
128*7688df22SAndroid Build Coastguard Workersummary('OMAP', with_omap)
129*7688df22SAndroid Build Coastguard Worker
130*7688df22SAndroid Build Coastguard Workerwith_freedreno = get_option('freedreno') \
131*7688df22SAndroid Build Coastguard Worker  .require(with_atomics, error_message : 'libdrm_freedreno requires atomics') \
132*7688df22SAndroid Build Coastguard Worker  .disable_auto_if(not ['arm', 'aarch64'].contains(host_machine.cpu_family())) \
133*7688df22SAndroid Build Coastguard Worker  .allowed()
134*7688df22SAndroid Build Coastguard Workersummary('Freedreno', with_freedreno)
135*7688df22SAndroid Build Coastguard Workersummary('Freedreon-kgsl', with_freedreno_kgsl)
136*7688df22SAndroid Build Coastguard Worker
137*7688df22SAndroid Build Coastguard Workerwith_tegra = get_option('tegra') \
138*7688df22SAndroid Build Coastguard Worker  .require(with_atomics, error_message : 'libdrm_tegra requires atomics') \
139*7688df22SAndroid Build Coastguard Worker  .disable_auto_if(not ['arm', 'aarch64'].contains(host_machine.cpu_family())) \
140*7688df22SAndroid Build Coastguard Worker  .enabled()
141*7688df22SAndroid Build Coastguard Workersummary('Tegra', with_tegra)
142*7688df22SAndroid Build Coastguard Worker
143*7688df22SAndroid Build Coastguard Workerwith_etnaviv = get_option('etnaviv') \
144*7688df22SAndroid Build Coastguard Worker  .require(with_atomics, error_message : 'libdrm_etnaviv requires atomics') \
145*7688df22SAndroid Build Coastguard Worker  .disable_auto_if(not ['arm', 'aarch64', 'arc', 'mips', 'mips64', 'loongarch64'].contains(host_machine.cpu_family())) \
146*7688df22SAndroid Build Coastguard Worker  .allowed()
147*7688df22SAndroid Build Coastguard Workersummary('Etnaviv', with_etnaviv)
148*7688df22SAndroid Build Coastguard Worker
149*7688df22SAndroid Build Coastguard Workerwith_exynos = get_option('exynos').enabled()
150*7688df22SAndroid Build Coastguard Workersummary('EXYNOS', with_exynos)
151*7688df22SAndroid Build Coastguard Worker
152*7688df22SAndroid Build Coastguard Workerwith_vc4 = get_option('vc4') \
153*7688df22SAndroid Build Coastguard Worker  .disable_auto_if(not ['arm', 'aarch64'].contains(host_machine.cpu_family())) \
154*7688df22SAndroid Build Coastguard Worker  .allowed()
155*7688df22SAndroid Build Coastguard Workersummary('VC4', with_vc4)
156*7688df22SAndroid Build Coastguard Worker
157*7688df22SAndroid Build Coastguard Worker# XXX: Apparently only freebsd and dragonfly bsd actually need this (and
158*7688df22SAndroid Build Coastguard Worker# gnu/kfreebsd), not openbsd and netbsd
159*7688df22SAndroid Build Coastguard Workerwith_libkms = false
160*7688df22SAndroid Build Coastguard Worker_libkms = get_option('libkms')
161*7688df22SAndroid Build Coastguard Workerif _libkms != 'false'
162*7688df22SAndroid Build Coastguard Worker  with_libkms = _libkms == 'true' or (['linux', 'freebsd', 'dragonfly'].contains(host_machine.system()) and not android)
163*7688df22SAndroid Build Coastguard Workerendif
164*7688df22SAndroid Build Coastguard Workersummary('libkms', with_libkms)
165*7688df22SAndroid Build Coastguard Worker
166*7688df22SAndroid Build Coastguard Worker# Among others FreeBSD does not have a separate dl library.
167*7688df22SAndroid Build Coastguard Workerif not cc.has_function('dlsym')
168*7688df22SAndroid Build Coastguard Worker  dep_dl = cc.find_library('dl', required : with_nouveau)
169*7688df22SAndroid Build Coastguard Workerelse
170*7688df22SAndroid Build Coastguard Worker  dep_dl = []
171*7688df22SAndroid Build Coastguard Workerendif
172*7688df22SAndroid Build Coastguard Worker# clock_gettime might require -rt, or it might not. find out
173*7688df22SAndroid Build Coastguard Workerif not cc.has_function('clock_gettime', prefix : '#define _GNU_SOURCE\n#include <time.h>')
174*7688df22SAndroid Build Coastguard Worker  # XXX: untested
175*7688df22SAndroid Build Coastguard Worker  dep_rt = cc.find_library('rt')
176*7688df22SAndroid Build Coastguard Workerelse
177*7688df22SAndroid Build Coastguard Worker  dep_rt = []
178*7688df22SAndroid Build Coastguard Workerendif
179*7688df22SAndroid Build Coastguard Worker
180*7688df22SAndroid Build Coastguard Worker# The header is not required on Linux, and is in fact deprecated in glibc 2.30+
181*7688df22SAndroid Build Coastguard Workerif host_machine.system() == 'linux'
182*7688df22SAndroid Build Coastguard Worker  config.set10('HAVE_SYS_SYSCTL_H', false)
183*7688df22SAndroid Build Coastguard Workerelse
184*7688df22SAndroid Build Coastguard Worker  # From Niclas Zeising:
185*7688df22SAndroid Build Coastguard Worker  # FreeBSD requires sys/types.h for sys/sysctl.h, so add it as part of
186*7688df22SAndroid Build Coastguard Worker  # the includes when checking for headers.
187*7688df22SAndroid Build Coastguard Worker  config.set10('HAVE_SYS_SYSCTL_H',
188*7688df22SAndroid Build Coastguard Worker    cc.compiles('#include <sys/types.h>\n#include <sys/sysctl.h>', name : 'sys/sysctl.h works'))
189*7688df22SAndroid Build Coastguard Workerendif
190*7688df22SAndroid Build Coastguard Worker
191*7688df22SAndroid Build Coastguard Workerforeach header : ['sys/select.h', 'alloca.h']
192*7688df22SAndroid Build Coastguard Worker  config.set10('HAVE_' + header.underscorify().to_upper(), cc.check_header(header))
193*7688df22SAndroid Build Coastguard Workerendforeach
194*7688df22SAndroid Build Coastguard Worker
195*7688df22SAndroid Build Coastguard Workerif (cc.has_header_symbol('sys/sysmacros.h', 'major') and
196*7688df22SAndroid Build Coastguard Worker  cc.has_header_symbol('sys/sysmacros.h', 'minor') and
197*7688df22SAndroid Build Coastguard Worker  cc.has_header_symbol('sys/sysmacros.h', 'makedev'))
198*7688df22SAndroid Build Coastguard Worker  config.set10('MAJOR_IN_SYSMACROS', true)
199*7688df22SAndroid Build Coastguard Workerendif
200*7688df22SAndroid Build Coastguard Workerif (cc.has_header_symbol('sys/mkdev.h', 'major') and
201*7688df22SAndroid Build Coastguard Worker  cc.has_header_symbol('sys/mkdev.h', 'minor') and
202*7688df22SAndroid Build Coastguard Worker  cc.has_header_symbol('sys/mkdev.h', 'makedev'))
203*7688df22SAndroid Build Coastguard Worker  config.set10('MAJOR_IN_MKDEV', true)
204*7688df22SAndroid Build Coastguard Workerendif
205*7688df22SAndroid Build Coastguard Workerconfig.set10('HAVE_OPEN_MEMSTREAM', cc.has_function('open_memstream'))
206*7688df22SAndroid Build Coastguard Worker
207*7688df22SAndroid Build Coastguard Workerlibdrm_c_args = cc.get_supported_arguments([
208*7688df22SAndroid Build Coastguard Worker  '-Wsign-compare', '-Werror=undef', '-Werror=implicit-function-declaration',
209*7688df22SAndroid Build Coastguard Worker  '-Wpointer-arith', '-Wwrite-strings', '-Wstrict-prototypes',
210*7688df22SAndroid Build Coastguard Worker  '-Wmissing-prototypes', '-Wmissing-declarations', '-Wnested-externs',
211*7688df22SAndroid Build Coastguard Worker  '-Wpacked', '-Wswitch-enum', '-Wmissing-format-attribute',
212*7688df22SAndroid Build Coastguard Worker  '-Wstrict-aliasing=2', '-Winit-self', '-Winline', '-Wshadow',
213*7688df22SAndroid Build Coastguard Worker  '-Wdeclaration-after-statement', '-Wold-style-definition',
214*7688df22SAndroid Build Coastguard Worker  '-Wno-unused-parameter', '-Wno-attributes', '-Wno-long-long',
215*7688df22SAndroid Build Coastguard Worker  '-Wno-missing-field-initializers'])
216*7688df22SAndroid Build Coastguard Worker
217*7688df22SAndroid Build Coastguard Workerdep_cunit = dependency('cunit', version : '>= 2.1', required : false)
218*7688df22SAndroid Build Coastguard Workerdep_cairo = dependency('cairo', required : get_option('cairo-tests'))
219*7688df22SAndroid Build Coastguard Workerwith_cairo_tests = dep_cairo.found()
220*7688df22SAndroid Build Coastguard Worker
221*7688df22SAndroid Build Coastguard Workervalgrind_version = []
222*7688df22SAndroid Build Coastguard Workerif with_freedreno
223*7688df22SAndroid Build Coastguard Worker  valgrind_version = '>=3.10.0'
224*7688df22SAndroid Build Coastguard Workerendif
225*7688df22SAndroid Build Coastguard Workerdep_valgrind = dependency('valgrind', required : get_option('valgrind'), version : valgrind_version)
226*7688df22SAndroid Build Coastguard Workerwith_valgrind = dep_valgrind.found()
227*7688df22SAndroid Build Coastguard Worker
228*7688df22SAndroid Build Coastguard Workerprog_rst2man = find_program('rst2man', 'rst2man.py', required: get_option('man-pages'))
229*7688df22SAndroid Build Coastguard Workerwith_man_pages = prog_rst2man.found()
230*7688df22SAndroid Build Coastguard Worker
231*7688df22SAndroid Build Coastguard Workerconfig.set10('HAVE_VISIBILITY', cc.has_function_attribute('visibility:hidden'))
232*7688df22SAndroid Build Coastguard Worker
233*7688df22SAndroid Build Coastguard Workerforeach t : [
234*7688df22SAndroid Build Coastguard Worker             [with_exynos, 'EXYNOS'],
235*7688df22SAndroid Build Coastguard Worker             [with_freedreno_kgsl, 'FREEDRENO_KGSL'],
236*7688df22SAndroid Build Coastguard Worker             [with_intel, 'INTEL'],
237*7688df22SAndroid Build Coastguard Worker             [with_nouveau, 'NOUVEAU'],
238*7688df22SAndroid Build Coastguard Worker             [with_radeon, 'RADEON'],
239*7688df22SAndroid Build Coastguard Worker             [with_vc4, 'VC4'],
240*7688df22SAndroid Build Coastguard Worker             [with_vmwgfx, 'VMWGFX'],
241*7688df22SAndroid Build Coastguard Worker             [with_cairo_tests, 'CAIRO'],
242*7688df22SAndroid Build Coastguard Worker             [with_valgrind, 'VALGRIND'],
243*7688df22SAndroid Build Coastguard Worker            ]
244*7688df22SAndroid Build Coastguard Worker  config.set10('HAVE_@0@'.format(t[1]), t[0])
245*7688df22SAndroid Build Coastguard Workerendforeach
246*7688df22SAndroid Build Coastguard Workerif with_freedreno_kgsl and not with_freedreno
247*7688df22SAndroid Build Coastguard Worker  error('cannot enable freedreno-kgsl without freedreno support')
248*7688df22SAndroid Build Coastguard Workerendif
249*7688df22SAndroid Build Coastguard Workerconfig.set10('_GNU_SOURCE', true)
250*7688df22SAndroid Build Coastguard Worker
251*7688df22SAndroid Build Coastguard Workerif target_machine.endian() == 'big'
252*7688df22SAndroid Build Coastguard Worker  config.set('HAVE_BIG_ENDIAN', 1)
253*7688df22SAndroid Build Coastguard Workerendif
254*7688df22SAndroid Build Coastguard Worker
255*7688df22SAndroid Build Coastguard Workerif android
256*7688df22SAndroid Build Coastguard Worker  config.set('BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD', 1)
257*7688df22SAndroid Build Coastguard Workerendif
258*7688df22SAndroid Build Coastguard Worker
259*7688df22SAndroid Build Coastguard Workerconfig_file = configure_file(
260*7688df22SAndroid Build Coastguard Worker  configuration : config,
261*7688df22SAndroid Build Coastguard Worker  output : 'config.h',
262*7688df22SAndroid Build Coastguard Worker)
263*7688df22SAndroid Build Coastguard Workeradd_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
264*7688df22SAndroid Build Coastguard Worker
265*7688df22SAndroid Build Coastguard Workerinc_root = include_directories('.')
266*7688df22SAndroid Build Coastguard Workerinc_drm = include_directories('include/drm')
267*7688df22SAndroid Build Coastguard Worker
268*7688df22SAndroid Build Coastguard Workerlibdrm_files = [files(
269*7688df22SAndroid Build Coastguard Worker   'xf86drm.c', 'xf86drmHash.c', 'xf86drmRandom.c', 'xf86drmSL.c',
270*7688df22SAndroid Build Coastguard Worker   'xf86drmMode.c'
271*7688df22SAndroid Build Coastguard Worker  ),
272*7688df22SAndroid Build Coastguard Worker  config_file, format_mod_static_table
273*7688df22SAndroid Build Coastguard Worker]
274*7688df22SAndroid Build Coastguard Worker
275*7688df22SAndroid Build Coastguard Worker# Build an unversioned so on android
276*7688df22SAndroid Build Coastguard Workerif android
277*7688df22SAndroid Build Coastguard Worker  libdrm_kw = {}
278*7688df22SAndroid Build Coastguard Workerelse
279*7688df22SAndroid Build Coastguard Worker  libdrm_kw = { 'version' : '2.@[email protected]'.format(patch_ver) }
280*7688df22SAndroid Build Coastguard Workerendif
281*7688df22SAndroid Build Coastguard Worker
282*7688df22SAndroid Build Coastguard Workerlibdrm = library(
283*7688df22SAndroid Build Coastguard Worker  'drm',
284*7688df22SAndroid Build Coastguard Worker  libdrm_files,
285*7688df22SAndroid Build Coastguard Worker  c_args : libdrm_c_args,
286*7688df22SAndroid Build Coastguard Worker  dependencies : [dep_valgrind, dep_rt],
287*7688df22SAndroid Build Coastguard Worker  include_directories : inc_drm,
288*7688df22SAndroid Build Coastguard Worker  install : true,
289*7688df22SAndroid Build Coastguard Worker  kwargs : libdrm_kw,
290*7688df22SAndroid Build Coastguard Worker  gnu_symbol_visibility : 'hidden',
291*7688df22SAndroid Build Coastguard Worker)
292*7688df22SAndroid Build Coastguard Worker
293*7688df22SAndroid Build Coastguard Workertest(
294*7688df22SAndroid Build Coastguard Worker  'core-symbols-check',
295*7688df22SAndroid Build Coastguard Worker  symbols_check,
296*7688df22SAndroid Build Coastguard Worker  args : [
297*7688df22SAndroid Build Coastguard Worker    '--lib', libdrm,
298*7688df22SAndroid Build Coastguard Worker    '--symbols-file', files('core-symbols.txt'),
299*7688df22SAndroid Build Coastguard Worker    '--nm', prog_nm.full_path(),
300*7688df22SAndroid Build Coastguard Worker  ],
301*7688df22SAndroid Build Coastguard Worker)
302*7688df22SAndroid Build Coastguard Worker
303*7688df22SAndroid Build Coastguard Workerext_libdrm = declare_dependency(
304*7688df22SAndroid Build Coastguard Worker  link_with : libdrm,
305*7688df22SAndroid Build Coastguard Worker  include_directories : [inc_root, inc_drm],
306*7688df22SAndroid Build Coastguard Worker)
307*7688df22SAndroid Build Coastguard Worker
308*7688df22SAndroid Build Coastguard Workerif meson.version().version_compare('>= 0.54.0')
309*7688df22SAndroid Build Coastguard Worker  meson.override_dependency('libdrm', ext_libdrm)
310*7688df22SAndroid Build Coastguard Workerendif
311*7688df22SAndroid Build Coastguard Worker
312*7688df22SAndroid Build Coastguard Workerinstall_headers('libsync.h', 'xf86drm.h', 'xf86drmMode.h')
313*7688df22SAndroid Build Coastguard Workerinstall_headers(
314*7688df22SAndroid Build Coastguard Worker  'include/drm/drm.h', 'include/drm/drm_fourcc.h', 'include/drm/drm_mode.h',
315*7688df22SAndroid Build Coastguard Worker  'include/drm/drm_sarea.h', 'include/drm/i915_drm.h',
316*7688df22SAndroid Build Coastguard Worker  'include/drm/mach64_drm.h', 'include/drm/mga_drm.h',
317*7688df22SAndroid Build Coastguard Worker  'include/drm/msm_drm.h', 'include/drm/nouveau_drm.h',
318*7688df22SAndroid Build Coastguard Worker  'include/drm/qxl_drm.h', 'include/drm/r128_drm.h',
319*7688df22SAndroid Build Coastguard Worker  'include/drm/radeon_drm.h', 'include/drm/amdgpu_drm.h',
320*7688df22SAndroid Build Coastguard Worker  'include/drm/savage_drm.h', 'include/drm/sis_drm.h',
321*7688df22SAndroid Build Coastguard Worker  'include/drm/tegra_drm.h', 'include/drm/vc4_drm.h',
322*7688df22SAndroid Build Coastguard Worker  'include/drm/via_drm.h', 'include/drm/virtgpu_drm.h',
323*7688df22SAndroid Build Coastguard Worker  subdir : 'libdrm',
324*7688df22SAndroid Build Coastguard Worker)
325*7688df22SAndroid Build Coastguard Workerif with_vmwgfx
326*7688df22SAndroid Build Coastguard Worker  install_headers('include/drm/vmwgfx_drm.h', subdir : 'libdrm')
327*7688df22SAndroid Build Coastguard Workerendif
328*7688df22SAndroid Build Coastguard Worker
329*7688df22SAndroid Build Coastguard Workerpkg.generate(
330*7688df22SAndroid Build Coastguard Worker  libdrm,
331*7688df22SAndroid Build Coastguard Worker  name : 'libdrm',
332*7688df22SAndroid Build Coastguard Worker  subdirs : ['.', 'libdrm'],
333*7688df22SAndroid Build Coastguard Worker  description : 'Userspace interface to kernel DRM services',
334*7688df22SAndroid Build Coastguard Worker)
335*7688df22SAndroid Build Coastguard Worker
336*7688df22SAndroid Build Coastguard Workerif with_libkms
337*7688df22SAndroid Build Coastguard Worker  subdir('libkms')
338*7688df22SAndroid Build Coastguard Workerendif
339*7688df22SAndroid Build Coastguard Workerif with_intel
340*7688df22SAndroid Build Coastguard Worker  subdir('intel')
341*7688df22SAndroid Build Coastguard Workerendif
342*7688df22SAndroid Build Coastguard Workerif with_nouveau
343*7688df22SAndroid Build Coastguard Worker  subdir('nouveau')
344*7688df22SAndroid Build Coastguard Workerendif
345*7688df22SAndroid Build Coastguard Workerif with_radeon
346*7688df22SAndroid Build Coastguard Worker  subdir('radeon')
347*7688df22SAndroid Build Coastguard Workerendif
348*7688df22SAndroid Build Coastguard Workerif with_amdgpu
349*7688df22SAndroid Build Coastguard Worker  subdir('amdgpu')
350*7688df22SAndroid Build Coastguard Workerendif
351*7688df22SAndroid Build Coastguard Workerif with_omap
352*7688df22SAndroid Build Coastguard Worker  subdir('omap')
353*7688df22SAndroid Build Coastguard Workerendif
354*7688df22SAndroid Build Coastguard Workerif with_exynos
355*7688df22SAndroid Build Coastguard Worker  subdir('exynos')
356*7688df22SAndroid Build Coastguard Workerendif
357*7688df22SAndroid Build Coastguard Workerif with_freedreno
358*7688df22SAndroid Build Coastguard Worker  subdir('freedreno')
359*7688df22SAndroid Build Coastguard Workerendif
360*7688df22SAndroid Build Coastguard Workerif with_tegra
361*7688df22SAndroid Build Coastguard Worker  subdir('tegra')
362*7688df22SAndroid Build Coastguard Workerendif
363*7688df22SAndroid Build Coastguard Workerif with_vc4
364*7688df22SAndroid Build Coastguard Worker  subdir('vc4')
365*7688df22SAndroid Build Coastguard Workerendif
366*7688df22SAndroid Build Coastguard Workerif with_etnaviv
367*7688df22SAndroid Build Coastguard Worker  subdir('etnaviv')
368*7688df22SAndroid Build Coastguard Workerendif
369*7688df22SAndroid Build Coastguard Workerif with_man_pages
370*7688df22SAndroid Build Coastguard Worker  subdir('man')
371*7688df22SAndroid Build Coastguard Workerendif
372*7688df22SAndroid Build Coastguard Workersubdir('data')
373*7688df22SAndroid Build Coastguard Workerif with_tests
374*7688df22SAndroid Build Coastguard Worker  subdir('tests')
375*7688df22SAndroid Build Coastguard Workerendif
376