llvmPackages_23.openmp: fix build for LLVM 23+

This commit is contained in:
aaravrav
2026-10-16 23:20:55 +05:30
parent 7f9e8bbfaa
commit ab348e2dc2

View File

@@ -36,15 +36,28 @@ stdenv.mkDerivation (finalAttrs: {
strictDeps = true;
__structuredAttrs = true;
}
''
mkdir -p "$out"
cp -r ${monorepoSrc}/cmake "$out"
cp -r ${monorepoSrc}/openmp "$out"
''
(
''
mkdir -p "$out"
cp -r ${monorepoSrc}/cmake "$out"
cp -r ${monorepoSrc}/openmp "$out"
''
+ lib.optionalString (lib.versionAtLeast release_version "23") ''
mkdir -p "$out/llvm"
cp -r ${monorepoSrc}/llvm/cmake "$out/llvm"
cp -r ${monorepoSrc}/llvm/utils "$out/llvm"
cp -r ${monorepoSrc}/third-party "$out"
cp -r ${monorepoSrc}/runtimes "$out"
''
)
else
src;
sourceRoot = "${finalAttrs.src.name}/openmp";
# LLVM 23 removed OpenMP's standalone build
# https://openmp.llvm.org/Building.html
sourceRoot =
"${finalAttrs.src.name}/"
+ (if lib.versionAtLeast release_version "23" then "runtimes" else "openmp");
outputs = [
"out"
@@ -89,6 +102,9 @@ stdenv.mkDerivation (finalAttrs: {
(lib.cmakeFeature "OPT_TOOL" "${llvm}/bin/opt")
(lib.cmakeFeature "LINK_TOOL" "${llvm}/bin/llvm-link")
]
++ lib.optionals (lib.versionAtLeast release_version "23") [
(lib.cmakeFeature "LLVM_ENABLE_RUNTIMES" "openmp")
]
++ devExtraCmakeFlags;
doCheck = false;
@@ -96,7 +112,9 @@ stdenv.mkDerivation (finalAttrs: {
checkTarget = "check-openmp";
preCheck = ''
patchShebangs ../tools/archer/tests/deflake.bash
patchShebangs ${
if lib.versionAtLeast release_version "23" then "../../openmp" else ".."
}/tools/archer/tests/deflake.bash
'';
__structuredAttrs = true;