mesa3d.mk 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. ################################################################################
  2. #
  3. # mesa3d
  4. #
  5. ################################################################################
  6. # When updating the version, please also update mesa3d-headers
  7. MESA3D_VERSION = 25.1.6
  8. MESA3D_SOURCE = mesa-$(MESA3D_VERSION).tar.xz
  9. MESA3D_SITE = https://archive.mesa3d.org
  10. MESA3D_LICENSE = MIT, SGI, Khronos
  11. MESA3D_LICENSE_FILES = \
  12. docs/license.rst \
  13. licenses/MIT \
  14. licenses/SGI-B-2.0
  15. MESA3D_CPE_ID_VENDOR = mesa3d
  16. MESA3D_CPE_ID_PRODUCT = mesa
  17. MESA3D_INSTALL_STAGING = YES
  18. MESA3D_PROVIDES =
  19. MESA3D_DEPENDENCIES = \
  20. host-bison \
  21. host-flex \
  22. host-python-mako \
  23. host-python-pyyaml \
  24. expat \
  25. libdrm \
  26. zlib
  27. MESA3D_CONF_OPTS = \
  28. -Dmicrosoft-clc=disabled
  29. ifeq ($(BR2_PACKAGE_MESA3D_DRIVER)$(BR2_PACKAGE_XORG7),yy)
  30. MESA3D_DEPENDENCIES += xlib_libxshmfence
  31. endif
  32. ifeq ($(BR2_PACKAGE_MESA3D_LLVM),y)
  33. MESA3D_DEPENDENCIES += host-llvm llvm
  34. MESA3D_MESON_EXTRA_BINARIES += llvm-config='$(STAGING_DIR)/usr/bin/llvm-config'
  35. MESA3D_CONF_OPTS += -Dllvm=enabled
  36. ifeq ($(BR2_PACKAGE_LLVM_RTTI),y)
  37. MESA3D_CONF_OPTS += -Dcpp_rtti=true
  38. else
  39. MESA3D_CONF_OPTS += -Dcpp_rtti=false
  40. endif
  41. else
  42. # Avoid automatic search of llvm-config
  43. MESA3D_CONF_OPTS += -Dllvm=disabled
  44. endif
  45. ifeq ($(BR2_PACKAGE_MESA3D_OPENCL),y)
  46. MESA3D_PROVIDES += libopencl
  47. MESA3D_DEPENDENCIES += clang libclc
  48. endif
  49. ifeq ($(BR2_PACKAGE_MESA3D_RUSTICL),y)
  50. MESA3D_DEPENDENCIES += \
  51. host-rustc \
  52. host-rust-bindgen \
  53. spirv-tools \
  54. spirv-llvm-translator \
  55. opencl-icd-loader
  56. # rust_std is defined here to workaround a known meson bug. See:
  57. # https://docs.mesa3d.org/rusticl.html#known-issues
  58. # https://github.com/mesonbuild/meson/issues/10664
  59. MESA3D_CONF_OPTS += \
  60. -Dgallium-rusticl=true \
  61. -Drust_std=2021 \
  62. -Dmesa-clc-bundle-headers=enabled
  63. MESA3D_MESON_EXTRA_BINARIES += \
  64. rust=['$(HOST_DIR)/bin/rustc','--target=$(RUSTC_TARGET_NAME)'] \
  65. rust_ld='$(TARGET_CROSS)gcc'
  66. else
  67. MESA3D_CONF_OPTS += -Dgallium-rusticl=false
  68. endif
  69. ifeq ($(BR2_PACKAGE_MESA3D_NEEDS_ELFUTILS),y)
  70. MESA3D_DEPENDENCIES += elfutils
  71. endif
  72. ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_GLX),y)
  73. # Disable-mangling not yet supported by meson build system.
  74. # glx:
  75. # dri : dri based GLX requires at least one DRI driver
  76. # xlib : xlib conflicts with any dri driver
  77. # Always enable glx-direct; without it, many GLX applications don't work.
  78. MESA3D_CONF_OPTS += \
  79. -Dglx=dri \
  80. -Dglx-direct=true
  81. ifeq ($(BR2_PACKAGE_MESA3D_NEEDS_XA),y)
  82. MESA3D_CONF_OPTS += -Dgallium-xa=enabled
  83. else
  84. MESA3D_CONF_OPTS += -Dgallium-xa=disabled
  85. endif
  86. else
  87. MESA3D_CONF_OPTS += \
  88. -Dglx=disabled \
  89. -Dgallium-xa=disabled
  90. endif
  91. ifeq ($(BR2_ARM_CPU_HAS_NEON),y)
  92. MESA3D_CONF_OPTS += -Dgallium-vc4-neon=auto
  93. else
  94. MESA3D_CONF_OPTS += -Dgallium-vc4-neon=disabled
  95. endif
  96. # Drivers
  97. #Gallium Drivers
  98. MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_CROCUS) += crocus
  99. MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_ETNAVIV) += etnaviv
  100. MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_FREEDRENO) += freedreno
  101. MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_I915) += i915
  102. MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_IRIS) += iris
  103. HOST_MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_IRIS) += iris
  104. MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_LIMA) += lima
  105. MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_LLVMPIPE) += llvmpipe
  106. MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_NOUVEAU) += nouveau
  107. MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_PANFROST) += panfrost
  108. HOST_MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_PANFROST) += panfrost
  109. MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_R300) += r300
  110. MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_R600) += r600
  111. MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_RADEONSI) += radeonsi
  112. MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SVGA) += svga
  113. MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SOFTPIPE) += softpipe
  114. MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_TEGRA) += tegra
  115. MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_V3D) += v3d
  116. MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VC4) += vc4
  117. MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VIRGL) += virgl
  118. MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_ZINK) += zink
  119. # Vulkan Drivers
  120. MESA3D_VULKAN_DRIVERS-$(BR2_PACKAGE_MESA3D_VULKAN_DRIVER_BROADCOM) += broadcom
  121. MESA3D_VULKAN_DRIVERS-$(BR2_PACKAGE_MESA3D_VULKAN_DRIVER_IMAGINATION) += imagination-experimental
  122. MESA3D_VULKAN_DRIVERS-$(BR2_PACKAGE_MESA3D_VULKAN_DRIVER_INTEL) += intel
  123. MESA3D_VULKAN_DRIVERS-$(BR2_PACKAGE_MESA3D_VULKAN_DRIVER_SWRAST) += swrast
  124. MESA3D_VULKAN_DRIVERS-$(BR2_PACKAGE_MESA3D_VULKAN_DRIVER_VIRTIO) += virtio
  125. ifeq ($(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER),)
  126. MESA3D_CONF_OPTS += \
  127. -Dgallium-drivers= \
  128. -Dgallium-extra-hud=false
  129. else
  130. MESA3D_CONF_OPTS += \
  131. -Dgallium-drivers=$(subst $(space),$(comma),$(MESA3D_GALLIUM_DRIVERS-y)) \
  132. -Dgallium-extra-hud=true
  133. endif
  134. ifeq ($(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_ETNAVIV),y)
  135. MESA3D_DEPENDENCIES += host-python-pycparser
  136. endif
  137. ifeq ($(BR2_PACKAGE_MESA3D_VULKAN_DRIVER_INTEL),y)
  138. MESA3D_DEPENDENCIES += host-python-ply
  139. endif
  140. ifeq ($(BR2_PACKAGE_MESA3D_NEEDS_PRECOMP_COMPILER),y)
  141. MESA3D_CONF_OPTS += -Dmesa-clc=system -Dprecomp-compiler=system
  142. MESA3D_DEPENDENCIES += host-mesa3d spirv-llvm-translator spirv-tools
  143. endif
  144. ifeq ($(BR2_PACKAGE_MESA3D_VULKAN_DRIVER),)
  145. MESA3D_CONF_OPTS += \
  146. -Dvulkan-drivers=
  147. else
  148. MESA3D_DEPENDENCIES += host-python-glslang
  149. MESA3D_CONF_OPTS += \
  150. -Dvulkan-drivers=$(subst $(space),$(comma),$(MESA3D_VULKAN_DRIVERS-y))
  151. endif
  152. # APIs
  153. # Always enable OpenGL:
  154. # - Building OpenGL ES without OpenGL is not supported, so always keep opengl enabled.
  155. MESA3D_CONF_OPTS += -Dopengl=true
  156. # libva and mesa3d have a circular dependency
  157. # we do not need libva support in mesa3d, therefore disable this option
  158. MESA3D_CONF_OPTS += -Dgallium-va=disabled
  159. # libGL is only provided for a full xorg stack, without libglvnd
  160. ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_GLX),y)
  161. MESA3D_PROVIDES += $(if $(BR2_PACKAGE_LIBGLVND),,libgl)
  162. else
  163. define MESA3D_REMOVE_OPENGL_HEADERS
  164. rm -rf $(STAGING_DIR)/usr/include/GL/
  165. endef
  166. MESA3D_POST_INSTALL_STAGING_HOOKS += MESA3D_REMOVE_OPENGL_HEADERS
  167. endif
  168. ifeq ($(BR2_PACKAGE_MESA3D_NEEDS_X11),y)
  169. MESA3D_DEPENDENCIES += \
  170. xlib_libX11 \
  171. xlib_libXext \
  172. xlib_libXdamage \
  173. xlib_libXfixes \
  174. xlib_libXrandr \
  175. xlib_libXxf86vm \
  176. xorgproto \
  177. libxcb
  178. MESA3D_PLATFORMS += x11
  179. endif
  180. ifeq ($(BR2_PACKAGE_WAYLAND),y)
  181. MESA3D_DEPENDENCIES += wayland wayland-protocols
  182. MESA3D_PLATFORMS += wayland
  183. endif
  184. MESA3D_CONF_OPTS += \
  185. -Dplatforms=$(subst $(space),$(comma),$(MESA3D_PLATFORMS))
  186. ifeq ($(BR2_PACKAGE_MESA3D_GBM),y)
  187. MESA3D_CONF_OPTS += \
  188. -Dgbm=enabled
  189. else
  190. MESA3D_CONF_OPTS += \
  191. -Dgbm=disabled
  192. endif
  193. ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_EGL),y)
  194. MESA3D_PROVIDES += $(if $(BR2_PACKAGE_LIBGLVND),,libegl)
  195. MESA3D_CONF_OPTS += \
  196. -Degl=enabled
  197. else
  198. MESA3D_CONF_OPTS += \
  199. -Degl=disabled
  200. endif
  201. ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_ES),y)
  202. MESA3D_PROVIDES += $(if $(BR2_PACKAGE_LIBGLVND),,libgles)
  203. MESA3D_CONF_OPTS += -Dgles1=enabled -Dgles2=enabled
  204. else
  205. MESA3D_CONF_OPTS += -Dgles1=disabled -Dgles2=disabled
  206. endif
  207. ifeq ($(BR2_PACKAGE_VALGRIND),y)
  208. MESA3D_CONF_OPTS += -Dvalgrind=enabled
  209. MESA3D_DEPENDENCIES += valgrind
  210. else
  211. MESA3D_CONF_OPTS += -Dvalgrind=disabled
  212. endif
  213. ifeq ($(BR2_PACKAGE_LIBUNWIND),y)
  214. MESA3D_CONF_OPTS += -Dlibunwind=enabled
  215. MESA3D_DEPENDENCIES += libunwind
  216. else
  217. MESA3D_CONF_OPTS += -Dlibunwind=disabled
  218. endif
  219. ifeq ($(BR2_PACKAGE_MESA3D_VDPAU),y)
  220. MESA3D_DEPENDENCIES += libvdpau
  221. MESA3D_CONF_OPTS += -Dgallium-vdpau=enabled
  222. else
  223. MESA3D_CONF_OPTS += -Dgallium-vdpau=disabled
  224. endif
  225. ifeq ($(BR2_PACKAGE_LM_SENSORS),y)
  226. MESA3D_CONF_OPTS += -Dlmsensors=enabled
  227. MESA3D_DEPENDENCIES += lm-sensors
  228. else
  229. MESA3D_CONF_OPTS += -Dlmsensors=disabled
  230. endif
  231. ifeq ($(BR2_PACKAGE_ZSTD),y)
  232. MESA3D_CONF_OPTS += -Dzstd=enabled
  233. MESA3D_DEPENDENCIES += zstd
  234. else
  235. MESA3D_CONF_OPTS += -Dzstd=disabled
  236. endif
  237. MESA3D_CFLAGS = $(TARGET_CFLAGS)
  238. # m68k needs 32-bit offsets in switch tables to build
  239. ifeq ($(BR2_m68k),y)
  240. MESA3D_CFLAGS += -mlong-jump-table-offsets
  241. endif
  242. ifeq ($(BR2_PACKAGE_LIBGLVND),y)
  243. ifneq ($(BR2_PACKAGE_MESA3D_OPENGL_GLX)$(BR2_PACKAGE_MESA3D_OPENGL_EGL),)
  244. MESA3D_DEPENDENCIES += libglvnd
  245. MESA3D_CONF_OPTS += -Dglvnd=enabled
  246. else
  247. MESA3D_CONF_OPTS += -Dglvnd=disabled
  248. endif
  249. else
  250. MESA3D_CONF_OPTS += -Dglvnd=disabled
  251. endif
  252. HOST_MESA3D_CONF_OPTS = \
  253. -Dglvnd=disabled \
  254. -Dgallium-drivers=$(subst $(space),$(comma),$(HOST_MESA3D_GALLIUM_DRIVERS-y)) \
  255. -Dgallium-vdpau=disabled \
  256. -Dinstall-mesa-clc=true \
  257. -Dmesa-clc=enabled \
  258. -Dplatforms= \
  259. -Dprecomp-compiler=enabled \
  260. -Dglx=disabled \
  261. -Dvulkan-drivers=""
  262. ifeq ($(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_PANFROST),y)
  263. HOST_MESA3D_CONF_OPTS += -Dtools=panfrost
  264. endif
  265. HOST_MESA3D_DEPENDENCIES = \
  266. host-libclc \
  267. host-libdrm \
  268. host-python-mako \
  269. host-python-pyyaml \
  270. host-spirv-tools
  271. ifeq ($(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_PANFROST),y)
  272. HOST_MESA3D_INSTALL_PANFROST_COMPILE = \
  273. $(INSTALL) -D -m 0755 $(@D)/buildroot-build/src/panfrost/clc/panfrost_compile $(HOST_DIR)/bin/panfrost_compile
  274. endif
  275. define HOST_MESA3D_INSTALL_CMDS
  276. $(INSTALL) -D -m 0755 $(@D)/buildroot-build/src/compiler/clc/mesa_clc $(HOST_DIR)/bin/mesa_clc
  277. $(INSTALL) -D -m 0755 $(@D)/buildroot-build/src/compiler/spirv/vtn_bindgen2 $(HOST_DIR)/bin/vtn_bindgen2
  278. $(HOST_MESA3D_INSTALL_PANFROST_COMPILE)
  279. endef
  280. $(eval $(meson-package))
  281. $(eval $(host-meson-package))