Files
video/libs/mesa/patches/100-use-llvm-subproject-vars.patch
Daniel Golle 2ebf064c05 mesa: update to 25.0.5
Improve build and make dependency on LLVM conditional.

Fixes: #60
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2025-05-12 19:01:45 +01:00

117 lines
3.8 KiB
Diff

--- a/meson.build
+++ b/meson.build
@@ -1782,21 +1782,26 @@ _llvm = get_option('llvm')
dep_llvm = null_dep
with_llvm = false
if _llvm.allowed()
- dep_llvm = dependency(
- 'llvm',
- method : host_machine.system() == 'windows' ? 'auto' : 'config-tool',
- version : _llvm_version,
- modules : llvm_modules,
- optional_modules : llvm_optional_modules,
- required : (
- with_amd_vk or with_gallium_radeonsi or with_gallium_clover or with_clc
- or _llvm.enabled()
- ),
- static : not _shared_llvm,
- fallback : ['llvm', 'dep_llvm'],
- include_type : 'system',
- )
- with_llvm = dep_llvm.found()
+ llvm_proj = subproject('llvm')
+ if llvm_proj.found()
+ dep_llvm = llvm_proj.get_variable('dep_llvm')
+ with_llvm = true
+ else
+ dep_llvm = dependency(
+ 'llvm',
+ method : host_machine.system() == 'windows' ? 'auto' : 'config-tool',
+ version : _llvm_version,
+ modules : llvm_modules,
+ optional_modules : llvm_optional_modules,
+ required : (
+ with_amd_vk or with_gallium_radeonsi or with_gallium_clover or with_clc
+ or _llvm.enabled()
+ ),
+ static : not _shared_llvm,
+ fallback : ['llvm', 'dep_llvm'],
+ include_type : 'system',
+ )
+ endif
endif
if with_llvm
pre_args += '-DMESA_LLVM_VERSION_STRING="@0@"'.format(dep_llvm.version())
@@ -1895,7 +1900,11 @@ endif
dep_clang = null_dep
if with_clc or with_gallium_clover
- llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir')
+ if dep_llvm.type_name() == 'internal'
+ llvm_libdir = subproject('llvm').get_variable('libdir')
+ else
+ llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir')
+ endif
dep_clang = cpp.find_library('clang-cpp', dirs : llvm_libdir, required : false)
--- a/src/compiler/clc/meson.build
+++ b/src/compiler/clc/meson.build
@@ -24,14 +24,14 @@ if not _shared_llvm
opencl_c_base_h = custom_target(
'opencl-c-base.h',
- input : [files_xxd, join_paths(clang_resource_dir, 'opencl-c-base.h')],
+ input : [files_xxd, 'opencl-c-base.h'],
output : 'opencl-c-base.h.h',
command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'opencl_c_base_source'],
)
opencl_c_h = custom_target(
'opencl-c.h',
- input : [files_xxd, join_paths(clang_resource_dir, 'opencl-c.h')],
+ input : [files_xxd, 'opencl-c.h'],
output : 'opencl-c.h.h',
command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'opencl_c_source'],
)
--- a/src/gallium/frontends/clover/meson.build
+++ b/src/gallium/frontends/clover/meson.build
@@ -26,6 +26,12 @@ if with_opencl_icd
clover_cpp_args += '-DHAVE_CLOVER_ICD'
endif
+if dep_llvm.type_name() == 'internal'
+ llvm_libdir = subproject('llvm').get_variable('libdir')
+else
+ llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir')
+endif
+
libclllvm = static_library(
'clllvm',
files(
@@ -44,7 +50,7 @@ libclllvm = static_library(
clover_cpp_args,
clover_opencl_cpp_args,
'-DCLANG_RESOURCE_DIR="@0@"'.format(join_paths(
- dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir'), 'clang',
+ llvm_libdir, 'clang',
dep_llvm.version(), 'include',
)),
],
--- a/src/gallium/targets/opencl/meson.build
+++ b/src/gallium/targets/opencl/meson.build
@@ -12,7 +12,12 @@ if with_ld_version_script
opencl_link_deps += files('opencl.sym')
endif
-llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir')
+if dep_llvm.type_name() == 'internal'
+ llvm_libdir = subproject('llvm').get_variable('libdir')
+else
+ llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir')
+endif
+
opencl_libname = with_opencl_icd ? 'MesaOpenCL' : 'OpenCL'
polly_dep = null_dep