summaryrefslogtreecommitdiff
path: root/pkg/libdrm/gen.lua
blob: 36de2fedaf8d98c31393d36ed7058e5009d91f2f (plain)
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
local function havedriver(name)
	local enabled = config.video_drivers and config.video_drivers[name]
	return '-D HAVE_'..name:upper()..'='..(enabled and '1' or '0')
end

cflags{
	'-D HAVE_CONFIG_H',
	havedriver('intel'),
	havedriver('nouveau'),
	havedriver('amdgpu'),
	'-I $dir',
	'-I $srcdir',
	'-I $srcdir/include/drm',
}

lib('libdrm.a', {
	'xf86drm.c',
	'xf86drmHash.c',
	'xf86drmRandom.c',
	'xf86drmSL.c',
	'xf86drmMode.c',
})

if config.video_drivers and config.video_drivers['intel'] then
	cflags{'-I pkg/libpciaccess/src/include'}
	pkg.deps = {'pkg/libpciaccess/fetch'}
	lib('libdrm_intel.a', [[
		intel/(
			intel_bufmgr.c
			intel_bufmgr_fake.c
			intel_bufmgr_gem.c
			intel_decode.c
			mm.c
		)
		$builddir/pkg/libpciaccess/libpciaccess.a
	]])
end

if config.video_drivers and config.video_drivers['nouveau'] then
	lib('libdrm_nouveau.a', [[
		nouveau/(
			nouveau.c
			pushbuf.c
			bufctx.c
			abi16.c
		)
	]])
end

if config.video_drivers and config.video_drivers['amdgpu'] then
	cflags{[[-D 'AMDGPU_ASIC_ID_TABLE="/share/libdrm/amdgpu.ids"']]}
	lib('libdrm_amdgpu.a', [[
		amdgpu/(
			amdgpu_asic_id.c
			amdgpu_bo.c
			amdgpu_cs.c
			amdgpu_device.c
			amdgpu_gpu_info.c
			amdgpu_vamgr.c
			amdgpu_vm.c
			util_hash.c
			util_hash_table.c
		)
	]])
	file('share/libdrm/amdgpu.ids', '644', '$srcdir/data/amdgpu.ids')
end

fetch 'git'