about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/rapidfuzz-cpp
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/rapidfuzz-cpp')
-rw-r--r--nixpkgs/pkgs/development/libraries/rapidfuzz-cpp/default.nix52
1 files changed, 52 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/rapidfuzz-cpp/default.nix b/nixpkgs/pkgs/development/libraries/rapidfuzz-cpp/default.nix
new file mode 100644
index 000000000000..ab0a5edb7d42
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/rapidfuzz-cpp/default.nix
@@ -0,0 +1,52 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, cmake
+, catch2_3
+, python3Packages
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "rapidfuzz-cpp";
+  version = "3.0.2";
+
+  src = fetchFromGitHub {
+    owner = "rapidfuzz";
+    repo = "rapidfuzz-cpp";
+    rev = "v${finalAttrs.version}";
+    hash = "sha256-4J2j+/0ZVMNlrgLbEQk3me/EX07TZ/rLsT1/5ufxbic=";
+  };
+
+  nativeBuildInputs = [
+    cmake
+  ];
+
+  cmakeFlags = lib.optionals finalAttrs.finalPackage.doCheck [
+    "-DRAPIDFUZZ_BUILD_TESTING=ON"
+  ];
+
+  CXXFLAGS = lib.optionals stdenv.cc.isClang [
+    # error: no member named 'fill' in namespace 'std'
+    "-include algorithm"
+  ];
+
+  nativeCheckInputs = [
+    catch2_3
+  ];
+
+  passthru = {
+    tests = {
+      /** `python3Packages.levenshtein` crucially depends on `rapidfuzz-cpp` */
+      inherit (python3Packages) levenshtein;
+    };
+  };
+
+  meta = {
+    description = "Rapid fuzzy string matching in C++ using the Levenshtein Distance";
+    homepage = "https://github.com/rapidfuzz/rapidfuzz-cpp";
+    changelog = "https://github.com/rapidfuzz/rapidfuzz-cpp/blob/${finalAttrs.src.rev}/CHANGELOG.md";
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ dotlambda ];
+    platforms = lib.platforms.unix;
+  };
+})