1# Copyright © 2017 Intel Corporation
2
3# Permission is hereby granted, free of charge, to any person obtaining a copy
4# of this software and associated documentation files (the "Software"), to deal
5# in the Software without restriction, including without limitation the rights
6# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7# copies of the Software, and to permit persons to whom the Software is
8# furnished to do so, subject to the following conditions:
9
10# The above copyright notice and this permission notice shall be included in
11# all copies or substantial portions of the Software.
12
13# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19# SOFTWARE.
20
21subdir('common')
22
23_dri_drivers = []
24_dri_link = []
25if with_dri_swrast
26  subdir('swrast')
27  _dri_drivers += libswrast_dri
28  _dri_link += 'swrast_dri.so'
29endif
30if with_dri_i915
31  subdir('i915')
32  _dri_drivers += libi915
33  _dri_link += 'i915_dri.so'
34endif
35if with_dri_i965
36  subdir('i965')
37  _dri_drivers += libi965
38  _dri_link += 'i965_dri.so'
39endif
40if with_dri_r100
41  subdir('radeon')
42  _dri_drivers += libr100
43  _dri_link += 'radeon_dri.so'
44endif
45if with_dri_r200
46  subdir('r200')
47  _dri_drivers += libr200
48  _dri_link += 'r200_dri.so'
49endif
50if with_dri_nouveau
51  subdir('nouveau')
52  _dri_drivers += libnouveau_vieux
53  _dri_link += 'nouveau_vieux_dri.so'
54endif
55
56if _dri_drivers != []
57  libmesa_dri_drivers = shared_library(
58    'mesa_dri_drivers',
59    [],
60    link_whole : _dri_drivers,
61    link_with : [
62      libmegadriver_stub, libdricommon, libxmlconfig, libglapi, libmesa_util,
63      libmesa_classic,
64    ],
65    dependencies : [
66      dep_selinux, dep_libdrm, dep_expat, dep_m, dep_thread, dep_dl, idep_nir,
67    ],
68    link_args : [ld_args_build_id, ld_args_bsymbolic, ld_args_gc_sections],
69    # Will be deleted during installation, see install_megadrivers.py
70    install : true,
71    install_dir : dri_drivers_path,
72    name_suffix : 'so',
73  )
74
75  meson.add_install_script(
76    prog_python.path(),
77    join_paths(meson.source_root(), 'bin/install_megadrivers.py'),
78    libmesa_dri_drivers.full_path(),
79    dri_drivers_path,
80    _dri_link,
81  )
82endif
83
84# This needs to be installed if any dri drivers (including gallium dri drivers)
85# are built.
86if with_dri
87  dri_req_private = []
88  if dep_libdrm.found()
89    dri_req_private = ['libdrm >= ' + dep_libdrm.version()]
90  endif
91
92  pkg.generate(
93    name : 'dri',
94    filebase : 'dri',
95    description : 'Direct Rendering Infrastructure',
96    version : meson.project_version(),
97    variables : ['dridriverdir=' + dri_drivers_path],
98    requires_private : dri_req_private,
99  )
100endif
101