0001-demos-makes-opengl-an-optional-component.patch 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. From 5b45f98255b74589015d5cb0d8ca31d7169c9f34 Mon Sep 17 00:00:00 2001
  2. From: Julien Olivain <ju.o@free.fr>
  3. Date: Fri, 16 Sep 2022 22:30:59 +0200
  4. Subject: [PATCH] demos: makes opengl an optional component
  5. This patch is a port of [1] for the new meson build system.
  6. matrix-code from es2gears has been moved to util in version 9.0.0 [2]
  7. so now es2gears is linked with mesa3d-demo libutil (idep_util).
  8. But at the same time the dependency on glu (dep_glu) has been added
  9. to libutil [3]. dep_glu requires opengl (FULL_GL) to build.
  10. In order to keep the es2gears for egl only builds we have to
  11. split the libutil files list to build readtex.c and showbuffer.c
  12. only if opengl is available.
  13. Add back dep_glu since it's used in util's meson.
  14. Fixes:
  15. https://gitlab.com/buildroot.org/buildroot/-/jobs/4936948236
  16. https://gitlab.com/buildroot.org/buildroot/-/jobs/4936948042
  17. [1].
  18. https://git.busybox.net/buildroot/tree/package/mesa3d-demos/0001-demos-makes-opengl-an-optional-component.patch?h=2022.08
  19. [2] https://gitlab.freedesktop.org/mesa/demos/-/commit/c33e2f731c2eab86bbad7b6a028f8a90ea40a00c
  20. [3] https://gitlab.freedesktop.org/mesa/demos/-/commit/ef24aae22978d4d357340074ca9a1c04d9cf81e6
  21. Signed-off-by: Julien Olivain <ju.o@free.fr>
  22. [Bernd: rebased for version 9.0.0]
  23. Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
  24. [Romain: fix egl only builds in util]
  25. Signed-off-by: Romain Naour <romain.naour@gmail.com>
  26. ---
  27. meson.build | 5 ++++-
  28. meson_options.txt | 1 +
  29. src/egl/meson.build | 5 ++++-
  30. src/util/meson.build | 12 +++++++++---
  31. 4 files changed, 18 insertions(+), 5 deletions(-)
  32. diff --git a/meson.build b/meson.build
  33. index 3e39b5a2..f27e1a18 100644
  34. --- a/meson.build
  35. +++ b/meson.build
  36. @@ -39,7 +39,10 @@ add_project_arguments(
  37. dep_m = cc.find_library('m', required : false)
  38. dep_winmm = cc.find_library('winmm', required : false)
  39. -dep_gl = dependency('gl')
  40. +dep_gl = dependency('gl', required : get_option('gl'))
  41. +if not dep_gl.found()
  42. + add_project_arguments('-DEGL_NO_X11=1', language: 'c')
  43. +endif
  44. dep_epoll = dependency('epoll-shim', required : false)
  45. dep_gles1 = dependency('glesv1_cm', required : get_option('gles1'))
  46. diff --git a/meson_options.txt b/meson_options.txt
  47. index 832b916a..c954a710 100644
  48. --- a/meson_options.txt
  49. +++ b/meson_options.txt
  50. @@ -1,5 +1,6 @@
  51. option('with-glut', type : 'string')
  52. option('egl', type : 'feature')
  53. +option('gl', type : 'feature')
  54. option('gles1', type : 'feature')
  55. option('gles2', type : 'feature')
  56. option('glut', type : 'feature')
  57. diff --git a/src/egl/meson.build b/src/egl/meson.build
  58. index d1846921..42bf8ecd 100644
  59. --- a/src/egl/meson.build
  60. +++ b/src/egl/meson.build
  61. @@ -19,7 +19,10 @@
  62. # SOFTWARE.
  63. subdir('eglut')
  64. -subdir('opengl')
  65. +
  66. +if dep_gl.found()
  67. + subdir('opengl')
  68. +endif
  69. if dep_gles1.found()
  70. subdir('opengles1')
  71. diff --git a/src/util/meson.build b/src/util/meson.build
  72. index b4fe614f..4420f28a 100644
  73. --- a/src/util/meson.build
  74. +++ b/src/util/meson.build
  75. @@ -22,13 +22,19 @@ inc_util = include_directories('.')
  76. files_libutil = files(
  77. 'glinfo_common.c',
  78. - 'readtex.c',
  79. - 'showbuffer.c',
  80. 'trackball.c',
  81. 'matrix.c',
  82. )
  83. -_deps = [dep_glu, dep_m]
  84. +_deps = [dep_m]
  85. +if dep_gl.found()
  86. + files_libutil += files(
  87. + 'readtex.c',
  88. + 'showbuffer.c',
  89. + )
  90. + _deps += dep_glu
  91. +endif
  92. +
  93. if dep_glut.found()
  94. files_libutil += files('shaderutil.c')
  95. _deps += dep_glut
  96. --
  97. 2.41.0