about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorTristan Ross2024-09-22 11:29:19 -0700
committerGitHub2024-09-22 11:29:19 -0700
commit464d8f5eff3e350acb51b5a87681429313630e21 (patch)
treef8fa800ec8220204ca6207f872fa19a4e653075c /pkgs
parent84b1d4e0a917124a0966c2eeeaa37b80db86e54c (diff)
parent290ec4e775b7ebb6ff2a882ef0b836171a761bc3 (diff)
llvmPackages.*: Add devExtraCmakeFlags parameter (#342040)
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/compilers/llvm/common/bolt/default.nix9
-rw-r--r--pkgs/development/compilers/llvm/common/clang/default.nix5
-rw-r--r--pkgs/development/compilers/llvm/common/compiler-rt/default.nix5
-rw-r--r--pkgs/development/compilers/llvm/common/libcxx/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/common/libunwind/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/common/lld/default.nix3
-rw-r--r--pkgs/development/compilers/llvm/common/lldb.nix3
-rw-r--r--pkgs/development/compilers/llvm/common/llvm/default.nix3
-rw-r--r--pkgs/development/compilers/llvm/common/mlir/default.nix3
-rw-r--r--pkgs/development/compilers/llvm/common/openmp/default.nix3
10 files changed, 29 insertions, 13 deletions
diff --git a/pkgs/development/compilers/llvm/common/bolt/default.nix b/pkgs/development/compilers/llvm/common/bolt/default.nix
index ee89de4ac751..9d6385ae74b3 100644
--- a/pkgs/development/compilers/llvm/common/bolt/default.nix
+++ b/pkgs/development/compilers/llvm/common/bolt/default.nix
@@ -12,6 +12,7 @@
   python3,
   buildLlvmTools,
   patches ? [ ],
+  devExtraCmakeFlags ? [ ],
 }:
 
 stdenv.mkDerivation (finalAttrs: {
@@ -43,9 +44,11 @@ stdenv.mkDerivation (finalAttrs: {
     libxml2
   ];
 
-  cmakeFlags = lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
-    (lib.cmakeFeature "LLVM_TABLEGEN_EXE" "${buildLlvmTools.llvm}/bin/llvm-tblgen")
-  ];
+  cmakeFlags =
+    lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
+      (lib.cmakeFeature "LLVM_TABLEGEN_EXE" "${buildLlvmTools.llvm}/bin/llvm-tblgen")
+    ]
+    ++ devExtraCmakeFlags;
 
   postUnpack = ''
     chmod -R u+w -- $sourceRoot/..
diff --git a/pkgs/development/compilers/llvm/common/clang/default.nix b/pkgs/development/compilers/llvm/common/clang/default.nix
index 5a6d775804b6..9ef1a3a3c644 100644
--- a/pkgs/development/compilers/llvm/common/clang/default.nix
+++ b/pkgs/development/compilers/llvm/common/clang/default.nix
@@ -17,6 +17,7 @@
 , fixDarwinDylibNames
 , enableManpages ? false
 , clang-tools-extra_src ? null
+, devExtraCmakeFlags ? []
 }:
 
 let
@@ -69,7 +70,9 @@ let
       # `clang-pseudo-gen`: https://github.com/llvm/llvm-project/commit/cd2292ef824591cc34cc299910a3098545c840c7
       "-DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${buildLlvmTools.libclang.dev}/bin/clang-tidy-confusable-chars-gen"
       "-DCLANG_PSEUDO_GEN=${buildLlvmTools.libclang.dev}/bin/clang-pseudo-gen"
-    ]) ++ lib.optional (stdenv.targetPlatform.useLLVM or false) "-DCLANG_DEFAULT_CXX_STDLIB=ON";
+    ]) ++ lib.optionals (stdenv.targetPlatform.useLLVM or false) [
+      "-DCLANG_DEFAULT_CXX_STDLIB=ON"
+    ] ++ devExtraCmakeFlags;
 
     postPatch = ''
       # Make sure clang passes the correct location of libLTO to ld64
diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix
index 288ad81dcd21..e43ff09931b8 100644
--- a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix
+++ b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix
@@ -28,6 +28,7 @@
 # `libcompiler_rt` library, at least under certain configurations. Some
 # platforms stil expect this, however, so we symlink one into place.
 , forceLinkCompilerRt ? stdenv.hostPlatform.isOpenBSD
+, devExtraCmakeFlags ? []
 }:
 
 let
@@ -134,9 +135,9 @@ stdenv.mkDerivation ({
     "-DCOMPILER_RT_ENABLE_IOS=OFF"
   ]) ++ lib.optionals (lib.versionAtLeast version "19" && stdenv.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinMinVersion "10.13") [
     "-DSANITIZER_MIN_OSX_VERSION=10.10"
-  ]  ++ lib.optionals (noSanitizers && lib.versionAtLeast release_version "19") [
+  ] ++ lib.optionals (noSanitizers && lib.versionAtLeast release_version "19") [
     "-DCOMPILER_RT_BUILD_CTX_PROFILE=OFF"
-  ];
+  ] ++ devExtraCmakeFlags;
 
   outputs = [ "out" "dev" ];
 
diff --git a/pkgs/development/compilers/llvm/common/libcxx/default.nix b/pkgs/development/compilers/llvm/common/libcxx/default.nix
index f646edf03019..2893d012151d 100644
--- a/pkgs/development/compilers/llvm/common/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/common/libcxx/default.nix
@@ -16,6 +16,7 @@
 , cxxabi ? if stdenv.hostPlatform.isFreeBSD then freebsd.libcxxrt else null
 , libunwind
 , enableShared ? !stdenv.hostPlatform.isStatic
+, devExtraCmakeFlags ? []
 }:
 
 # external cxxabi is not supported on Darwin as the build will not link libcxx
@@ -103,7 +104,8 @@ let
     "-DCMAKE_CXX_COMPILER_WORKS=ON"
     "-DUNIX=ON" # Required otherwise libc++ fails to detect the correct linker
   ] ++ cxxCMakeFlags
-    ++ lib.optionals (cxxabi == null) cxxabiCMakeFlags;
+    ++ lib.optionals (cxxabi == null) cxxabiCMakeFlags
+    ++ devExtraCmakeFlags;
 
 in
 
diff --git a/pkgs/development/compilers/llvm/common/libunwind/default.nix b/pkgs/development/compilers/llvm/common/libunwind/default.nix
index 515914e6acb6..77854ddfcc5d 100644
--- a/pkgs/development/compilers/llvm/common/libunwind/default.nix
+++ b/pkgs/development/compilers/llvm/common/libunwind/default.nix
@@ -12,6 +12,7 @@
 , python3
 , libcxx
 , enableShared ? !stdenv.hostPlatform.isStatic
+, devExtraCmakeFlags ? []
 }:
 let
   pname = "libunwind";
@@ -68,7 +69,8 @@ stdenv.mkDerivation (rec {
   ];
 
   cmakeFlags = lib.optional (lib.versionAtLeast release_version "15") "-DLLVM_ENABLE_RUNTIMES=libunwind"
-    ++ lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF";
+    ++ lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"
+    ++ devExtraCmakeFlags;
 
   meta = llvm_meta // {
     # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst
diff --git a/pkgs/development/compilers/llvm/common/lld/default.nix b/pkgs/development/compilers/llvm/common/lld/default.nix
index 99bb150a817d..2c87d4cfa96f 100644
--- a/pkgs/development/compilers/llvm/common/lld/default.nix
+++ b/pkgs/development/compilers/llvm/common/lld/default.nix
@@ -13,6 +13,7 @@
 , libxml2
 , libllvm
 , version
+, devExtraCmakeFlags ? []
 }:
 let
   pname = "lld";
@@ -55,7 +56,7 @@ stdenv.mkDerivation (rec {
     "-DLLD_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/lld"
   ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
-  ];
+  ] ++ devExtraCmakeFlags;
 
   # Musl's default stack size is too small for lld to be able to link Firefox.
   LDFLAGS = lib.optionalString stdenv.hostPlatform.isMusl "-Wl,-z,stack-size=2097152";
diff --git a/pkgs/development/compilers/llvm/common/lldb.nix b/pkgs/development/compilers/llvm/common/lldb.nix
index 65974e757c4b..d174570c1f34 100644
--- a/pkgs/development/compilers/llvm/common/lldb.nix
+++ b/pkgs/development/compilers/llvm/common/lldb.nix
@@ -23,6 +23,7 @@
 , monorepoSrc ? null
 , patches ? [ ]
 , enableManpages ? false
+, devExtraCmakeFlags ? [ ]
 , ...
 }:
 
@@ -142,7 +143,7 @@ stdenv.mkDerivation (rec {
   ]) ++ lib.optionals doCheck [
     "-DLLDB_TEST_C_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
     "-DLLDB_TEST_CXX_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"
-  ];
+  ] ++ devExtraCmakeFlags;
 
   doCheck = false;
   doInstallCheck = lib.versionOlder release_version "15";
diff --git a/pkgs/development/compilers/llvm/common/llvm/default.nix b/pkgs/development/compilers/llvm/common/llvm/default.nix
index a995c83405e9..e39ba171373f 100644
--- a/pkgs/development/compilers/llvm/common/llvm/default.nix
+++ b/pkgs/development/compilers/llvm/common/llvm/default.nix
@@ -40,6 +40,7 @@
   && !stdenv.hostPlatform.isAarch
 , enablePolly ? lib.versionAtLeast release_version "14"
 , enableTerminfo ? true
+, devExtraCmakeFlags ? []
 }:
 
 let
@@ -399,7 +400,7 @@ stdenv.mkDerivation (rec {
         nativeInstallFlags
       ])
     )
-  ];
+  ] ++ devExtraCmakeFlags;
 
   postInstall = ''
     mkdir -p $python/share
diff --git a/pkgs/development/compilers/llvm/common/mlir/default.nix b/pkgs/development/compilers/llvm/common/mlir/default.nix
index 891e66b1d57c..3ef689b7fefe 100644
--- a/pkgs/development/compilers/llvm/common/mlir/default.nix
+++ b/pkgs/development/compilers/llvm/common/mlir/default.nix
@@ -10,6 +10,7 @@
 , libllvm
 , version
 , doCheck ? (!stdenv.isx86_32 /* TODO: why */) && (!stdenv.hostPlatform.isMusl)
+, devExtraCmakeFlags ? []
 }:
 
 stdenv.mkDerivation rec {
@@ -63,7 +64,7 @@ stdenv.mkDerivation rec {
   ] ++ lib.optionals ((stdenv.hostPlatform != stdenv.buildPlatform) && !(stdenv.buildPlatform.canExecute stdenv.hostPlatform)) [
     "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
     "-DMLIR_TABLEGEN_EXE=${buildLlvmTools.mlir}/bin/mlir-tblgen"
-  ];
+  ] ++ devExtraCmakeFlags;
 
   outputs = [ "out" "dev" ];
 
diff --git a/pkgs/development/compilers/llvm/common/openmp/default.nix b/pkgs/development/compilers/llvm/common/openmp/default.nix
index 0de91473dd8c..57c6de07c784 100644
--- a/pkgs/development/compilers/llvm/common/openmp/default.nix
+++ b/pkgs/development/compilers/llvm/common/openmp/default.nix
@@ -15,6 +15,7 @@
 , perl
 , pkg-config
 , version
+, devExtraCmakeFlags ? []
 }:
 let
   pname = "openmp";
@@ -60,7 +61,7 @@ stdenv.mkDerivation (rec {
     "-DCLANG_TOOL=${clang-unwrapped}/bin/clang"
     "-DOPT_TOOL=${llvm}/bin/opt"
     "-DLINK_TOOL=${llvm}/bin/llvm-link"
-  ];
+  ] ++ devExtraCmakeFlags;
 
   meta = llvm_meta // {
     homepage = "https://openmp.llvm.org/";