diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-10-20 22:09:03 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-10-20 22:09:03 +0000 |
commit | 50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e (patch) | |
tree | f2556b911180125ccbb7ed0e78a54e92da89adce /nixpkgs/pkgs/development/libraries/catboost | |
parent | 4c16d4548a98563c9d9ad76f4e5b2202864ccd54 (diff) | |
parent | cfc75eec4603c06503ae750f88cf397e00796ea8 (diff) | |
download | nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar.gz nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar.bz2 nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar.lz nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar.xz nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar.zst nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.zip |
Merge commit 'cfc75eec4603c06503ae750f88cf397e00796ea8'
Conflicts: nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/catboost')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/catboost/default.nix | 113 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/libraries/catboost/remove-conan.patch | 34 |
2 files changed, 147 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/catboost/default.nix b/nixpkgs/pkgs/development/libraries/catboost/default.nix new file mode 100644 index 000000000000..fc18eef2ca89 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/catboost/default.nix @@ -0,0 +1,113 @@ +{ lib +, config +, stdenv +, fetchFromGitHub +, cmake +, libiconv +, llvmPackages +, ninja +, openssl +, python3Packages +, ragel +, yasm +, zlib +, cudaSupport ? config.cudaSupport +, cudaPackages ? {} +, pythonSupport ? false +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "catboost"; + version = "1.2.2"; + + src = fetchFromGitHub { + owner = "catboost"; + repo = "catboost"; + rev = "refs/tags/v${finalAttrs.version}"; + hash = "sha256-A1zCIqPOW21dHKBQHRtS+/sstZ2o6F8k71lmJFGn0+g="; + }; + + patches = [ + ./remove-conan.patch + ]; + + postPatch = '' + substituteInPlace cmake/common.cmake \ + --replace "\''${RAGEL_BIN}" "${ragel}/bin/ragel" \ + --replace "\''${YASM_BIN}" "${yasm}/bin/yasm" + + shopt -s globstar + for cmakelists in **/CMakeLists.*; do + sed -i "s/OpenSSL::OpenSSL/OpenSSL::SSL/g" $cmakelists + ${lib.optionalString (lib.versionOlder cudaPackages.cudaVersion "11.8") '' + sed -i 's/-gencode=arch=compute_89,code=sm_89//g' $cmakelists + sed -i 's/-gencode=arch=compute_90,code=sm_90//g' $cmakelists + ''} + done + ''; + + outputs = [ "out" "dev" ]; + + nativeBuildInputs = [ + cmake + llvmPackages.bintools + ninja + (python3Packages.python.withPackages (ps: with ps; [ six ])) + ragel + yasm + ] ++ lib.optionals cudaSupport (with cudaPackages; [ + cuda_nvcc + ]); + + buildInputs = [ + openssl + zlib + ] ++ lib.optionals stdenv.isDarwin [ + libiconv + ] ++ lib.optionals cudaSupport (with cudaPackages; [ + cuda_cudart + cuda_cccl + libcublas + ]); + + env = { + CUDAHOSTCXX = lib.optionalString cudaSupport "${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" + ]; + + installPhase = '' + runHook preInstall + + mkdir $dev + cp -r catboost $dev + install -Dm555 catboost/app/catboost -t $out/bin + install -Dm444 catboost/libs/model_interface/static/lib/libmodel_interface-static-lib.a -t $out/lib + install -Dm444 catboost/libs/model_interface/libcatboostmodel${stdenv.hostPlatform.extensions.sharedLibrary} -t $out/lib + install -Dm444 catboost/libs/train_interface/libcatboost${stdenv.hostPlatform.extensions.sharedLibrary} -t $out/lib + + runHook postInstall + ''; + + meta = with lib; { + description = "High-performance library for gradient boosting on decision trees"; + longDescription = '' + A fast, scalable, high performance Gradient Boosting on Decision Trees + library, used for ranking, classification, regression and other machine + learning tasks for Python, R, Java, C++. Supports computation on CPU and GPU. + ''; + license = licenses.asl20; + platforms = platforms.unix; + homepage = "https://catboost.ai"; + maintainers = with maintainers; [ PlushBeaver natsukium ]; + mainProgram = "catboost"; + }; +}) diff --git a/nixpkgs/pkgs/development/libraries/catboost/remove-conan.patch b/nixpkgs/pkgs/development/libraries/catboost/remove-conan.patch new file mode 100644 index 000000000000..6f96b7989a58 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/catboost/remove-conan.patch @@ -0,0 +1,34 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index becd2ad03c..7e3c8c99b1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -27,7 +27,6 @@ cmake_policy(SET CMP0104 OLD) + + include(cmake/archive.cmake) + include(cmake/common.cmake) +-include(cmake/conan.cmake) + include(cmake/cuda.cmake) + include(cmake/cython.cmake) + include(cmake/fbs.cmake) +@@ -37,21 +36,6 @@ include(cmake/recursive_library.cmake) + include(cmake/swig.cmake) + include(cmake/global_vars.cmake) + +-if (CMAKE_CROSSCOMPILING) +- include(${CMAKE_BINARY_DIR}/conan_paths.cmake) +-else() +- conan_cmake_autodetect(settings) +- conan_cmake_install( +- PATH_OR_REFERENCE ${CMAKE_SOURCE_DIR} +- INSTALL_FOLDER ${CMAKE_BINARY_DIR} +- BUILD missing +- REMOTE conancenter +- SETTINGS ${settings} +- ENV "CONAN_CMAKE_GENERATOR=${CMAKE_GENERATOR}" +- CONF "tools.cmake.cmaketoolchain:generator=${CMAKE_GENERATOR}" +- ) +-endif() +- + if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND NOT HAVE_CUDA) + include(CMakeLists.linux-x86_64.txt) + elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND HAVE_CUDA) |