logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

gen.lua (2013B)


  1. local function havedriver(name)
  2. local enabled = config.video_drivers and config.video_drivers[name]
  3. return '-D HAVE_'..name:upper()..'='..(enabled and '1' or '0')
  4. end
  5. cflags{
  6. '-include $dir/config.h',
  7. havedriver('intel'),
  8. havedriver('nouveau'),
  9. havedriver('amdgpu'),
  10. '-I $dir',
  11. '-I $outdir',
  12. '-I $srcdir',
  13. '-I $srcdir/include/drm',
  14. '-isystem $builddir/pkg/linux-headers/include',
  15. }
  16. pkg.hdrs = {
  17. copy('$outdir/include', '$srcdir', {'xf86drm.h', 'xf86drmMode.h'}),
  18. copy('$outdir/include', '$srcdir/amdgpu', {'amdgpu.h'}),
  19. copy('$outdir/include', '$srcdir/include/drm', {
  20. 'drm.h',
  21. 'drm_fourcc.h',
  22. 'drm_mode.h',
  23. 'drm_sarea.h',
  24. 'i915_drm.h',
  25. 'amdgpu_drm.h',
  26. }),
  27. }
  28. pkg.deps = {
  29. '$outdir/generated_static_table_fourcc.h',
  30. 'pkg/linux-headers/headers',
  31. }
  32. rule('fourcc', 'lua $dir/fourcc.lua <$in >$out')
  33. build('fourcc', '$outdir/generated_static_table_fourcc.h', {'$srcdir/include/drm/drm_fourcc.h', '|', '$dir/fourcc.lua'})
  34. lib('libdrm.a', {
  35. 'xf86drm.c',
  36. 'xf86drmHash.c',
  37. 'xf86drmRandom.c',
  38. 'xf86drmSL.c',
  39. 'xf86drmMode.c',
  40. })
  41. if config.video_drivers and config.video_drivers['intel'] then
  42. cflags{'-isystem $builddir/pkg/libpciaccess/include'}
  43. table.insert(pkg.deps, 'pkg/libpciaccess/headers')
  44. lib('libdrm_intel.a', [[
  45. intel/(
  46. intel_bufmgr.c
  47. intel_bufmgr_fake.c
  48. intel_bufmgr_gem.c
  49. intel_decode.c
  50. mm.c
  51. )
  52. $builddir/pkg/libpciaccess/libpciaccess.a
  53. ]])
  54. end
  55. if config.video_drivers and config.video_drivers['nouveau'] then
  56. lib('libdrm_nouveau.a', [[
  57. nouveau/(
  58. nouveau.c
  59. pushbuf.c
  60. bufctx.c
  61. abi16.c
  62. )
  63. ]])
  64. end
  65. if config.video_drivers and config.video_drivers['amdgpu'] then
  66. cflags{string.format([[-D 'AMDGPU_ASIC_ID_TABLE="%s/share/libdrm/amdgpu.ids"']], config.prefix)}
  67. lib('libdrm_amdgpu.a', [[
  68. amdgpu/(
  69. amdgpu_asic_id.c
  70. amdgpu_bo.c
  71. amdgpu_cs.c
  72. amdgpu_device.c
  73. amdgpu_gpu_info.c
  74. amdgpu_vamgr.c
  75. amdgpu_vm.c
  76. handle_table.c
  77. )
  78. ]])
  79. file('share/libdrm/amdgpu.ids', '644', '$srcdir/data/amdgpu.ids')
  80. end
  81. fetch 'git'