about summary refs log tree commit diff
path: root/pkgs/development/libraries/catboost/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/catboost/default.nix')
-rw-r--r--pkgs/development/libraries/catboost/default.nix30
1 files changed, 19 insertions, 11 deletions
diff --git a/pkgs/development/libraries/catboost/default.nix b/pkgs/development/libraries/catboost/default.nix
index fc18eef2ca893..b4fa78a125265 100644
--- a/pkgs/development/libraries/catboost/default.nix
+++ b/pkgs/development/libraries/catboost/default.nix
@@ -1,8 +1,8 @@
 { lib
 , config
-, stdenv
 , fetchFromGitHub
 , cmake
+, darwin
 , libiconv
 , llvmPackages
 , ninja
@@ -13,18 +13,22 @@
 , zlib
 , cudaSupport ? config.cudaSupport
 , cudaPackages ? {}
+, llvmPackages_12
 , pythonSupport ? false
 }:
+let
+  inherit (llvmPackages) stdenv;
+in
 
 stdenv.mkDerivation (finalAttrs: {
   pname = "catboost";
-  version = "1.2.2";
+  version = "1.2.5";
 
   src = fetchFromGitHub {
     owner = "catboost";
     repo = "catboost";
     rev = "refs/tags/v${finalAttrs.version}";
-    hash = "sha256-A1zCIqPOW21dHKBQHRtS+/sstZ2o6F8k71lmJFGn0+g=";
+    hash = "sha256-2dfCCCa0LheytkLRbYuBd25M320f1kbhBWKIVjslor0=";
   };
 
   patches = [
@@ -33,8 +37,8 @@ stdenv.mkDerivation (finalAttrs: {
 
   postPatch = ''
     substituteInPlace cmake/common.cmake \
-      --replace  "\''${RAGEL_BIN}" "${ragel}/bin/ragel" \
-      --replace "\''${YASM_BIN}" "${yasm}/bin/yasm"
+      --replace-fail  "\''${RAGEL_BIN}" "${ragel}/bin/ragel" \
+      --replace-fail "\''${YASM_BIN}" "${yasm}/bin/yasm"
 
     shopt -s globstar
     for cmakelists in **/CMakeLists.*; do
@@ -55,6 +59,8 @@ stdenv.mkDerivation (finalAttrs: {
     (python3Packages.python.withPackages (ps: with ps; [ six ]))
     ragel
     yasm
+  ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
+    darwin.cctools
   ] ++ lib.optionals cudaSupport (with cudaPackages; [
     cuda_nvcc
   ]);
@@ -71,17 +77,19 @@ stdenv.mkDerivation (finalAttrs: {
   ]);
 
   env = {
-    CUDAHOSTCXX = lib.optionalString cudaSupport "${stdenv.cc}/bin/cc";
+    # catboost requires clang 14+ for build, but does clang 12 for cuda build.
+    # after bumping the default version of llvm, check for compatibility with the cuda backend and pin it.
+    # see https://catboost.ai/en/docs/installation/build-environment-setup-for-cmake#compilers,-linkers-and-related-tools
+    CUDAHOSTCXX = lib.optionalString cudaSupport "${llvmPackages_12.stdenv.cc}/bin/cc";
     NIX_CFLAGS_LINK = lib.optionalString stdenv.isLinux "-fuse-ld=lld";
     NIX_LDFLAGS = "-lc -lm";
   };
 
   cmakeFlags = [
-    "-DCMAKE_BINARY_DIR=$out"
-    "-DCMAKE_POSITION_INDEPENDENT_CODE=on"
-    "-DCATBOOST_COMPONENTS=app;libs${lib.optionalString pythonSupport ";python-package"}"
-  ] ++ lib.optionals cudaSupport [
-    "-DHAVE_CUDA=on"
+    (lib.cmakeFeature "CMAKE_BINARY_DIR" "$out")
+    (lib.cmakeBool "CMAKE_POSITION_INDEPENDENT_CODE" true)
+    (lib.cmakeFeature "CATBOOST_COMPONENTS" "app;libs${lib.optionalString pythonSupport ";python-package"}")
+    (lib.cmakeBool "HAVE_CUDA" cudaSupport)
   ];
 
   installPhase = ''