1{ lib
2, stdenv
3, fetchFromGitHub
4, cmake
5, catch2_3
6, python3Packages
7}:
8
9stdenv.mkDerivation (finalAttrs: {
10 pname = "rapidfuzz-cpp";
11 version = "3.0.4";
12
13 src = fetchFromGitHub {
14 owner = "rapidfuzz";
15 repo = "rapidfuzz-cpp";
16 rev = "v${finalAttrs.version}";
17 hash = "sha256-urMdK+6ORHRgisppb700jaQpxLXAvXVjd8WDN7Zky3A=";
18 };
19
20 nativeBuildInputs = [
21 cmake
22 ];
23
24 cmakeFlags = lib.optionals finalAttrs.finalPackage.doCheck [
25 "-DRAPIDFUZZ_BUILD_TESTING=ON"
26 ];
27
28 CXXFLAGS = lib.optionals stdenv.cc.isClang [
29 # error: no member named 'fill' in namespace 'std'
30 "-include algorithm"
31 ];
32
33 nativeCheckInputs = [
34 catch2_3
35 ];
36
37 passthru = {
38 tests = {
39 /** `python3Packages.levenshtein` crucially depends on `rapidfuzz-cpp` */
40 inherit (python3Packages) levenshtein;
41 };
42 };
43
44 meta = {
45 description = "Rapid fuzzy string matching in C++ using the Levenshtein Distance";
46 homepage = "https://github.com/rapidfuzz/rapidfuzz-cpp";
47 changelog = "https://github.com/rapidfuzz/rapidfuzz-cpp/blob/${finalAttrs.src.rev}/CHANGELOG.md";
48 license = lib.licenses.mit;
49 maintainers = with lib.maintainers; [ dotlambda ];
50 platforms = lib.platforms.unix;
51 };
52})