100a23bdaSmrg# Copyright © 2017-2018 Intel Corporation
200a23bdaSmrg
300a23bdaSmrg# Permission is hereby granted, free of charge, to any person obtaining a copy
400a23bdaSmrg# of this software and associated documentation files (the "Software"), to deal
500a23bdaSmrg# in the Software without restriction, including without limitation the rights
600a23bdaSmrg# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
700a23bdaSmrg# copies of the Software, and to permit persons to whom the Software is
800a23bdaSmrg# furnished to do so, subject to the following conditions:
900a23bdaSmrg
1000a23bdaSmrg# The above copyright notice and this permission notice shall be included in
1100a23bdaSmrg# all copies or substantial portions of the Software.
1200a23bdaSmrg
1300a23bdaSmrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1400a23bdaSmrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1500a23bdaSmrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1600a23bdaSmrg# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1700a23bdaSmrg# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1800a23bdaSmrg# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1900a23bdaSmrg# SOFTWARE.
2000a23bdaSmrg
2100a23bdaSmrg
2241687f09Smrglibdrm_nouveau = library(
2300a23bdaSmrg  'drm_nouveau',
2400a23bdaSmrg  [files( 'nouveau.c', 'pushbuf.c', 'bufctx.c', 'abi16.c'), config_file],
257cdc0497Smrg  c_args : libdrm_c_args,
260ed5401bSmrg  gnu_symbol_visibility : 'hidden',
2700a23bdaSmrg  include_directories : [inc_root, inc_drm],
2800a23bdaSmrg  link_with : libdrm,
297cdc0497Smrg  dependencies : [dep_threads, dep_atomic_ops],
306acbc0e0Smrg  version : '2.@0@.0'.format(patch_ver),
3100a23bdaSmrg  install : true,
3200a23bdaSmrg)
3300a23bdaSmrg
3400a23bdaSmrgext_libdrm_nouveau = declare_dependency(
3500a23bdaSmrg  link_with : [libdrm, libdrm_nouveau],
3600a23bdaSmrg  include_directories : [inc_drm, include_directories('.')],
3700a23bdaSmrg)
3800a23bdaSmrg
390ed5401bSmrgif meson.version().version_compare('>= 0.54.0')
400ed5401bSmrg  meson.override_dependency('libdrm_nouveau', ext_libdrm_nouveau)
410ed5401bSmrgendif
420ed5401bSmrg
4300a23bdaSmrginstall_headers('nouveau.h', subdir : 'libdrm/nouveau')
4400a23bdaSmrginstall_headers(
4500a23bdaSmrg  'nvif/class.h', 'nvif/cl0080.h', 'nvif/cl9097.h', 'nvif/if0002.h',
4600a23bdaSmrg  'nvif/if0003.h', 'nvif/ioctl.h', 'nvif/unpack.h',
4700a23bdaSmrg  subdir : 'libdrm/nouveau/nvif'
4800a23bdaSmrg)
4900a23bdaSmrg
5000a23bdaSmrgpkg.generate(
510ed5401bSmrg  libdrm_nouveau,
5200a23bdaSmrg  name : 'libdrm_nouveau',
5300a23bdaSmrg  subdirs : ['.', 'libdrm', 'libdrm/nouveau'],
5400a23bdaSmrg  description : 'Userspace interface to nouveau kernel DRM services',
5500a23bdaSmrg)
5600a23bdaSmrg
5700a23bdaSmrgtest(
589bd392adSmrg  'nouveau-symbols-check',
599bd392adSmrg  symbols_check,
609bd392adSmrg  args : [
619bd392adSmrg    '--lib', libdrm_nouveau,
629bd392adSmrg    '--symbols-file', files('nouveau-symbols.txt'),
63bbff01ceSmrg    '--nm', prog_nm.full_path(),
649bd392adSmrg  ],
6500a23bdaSmrg)
66