about summary refs log tree commit diff
path: root/pkgs/development/libraries/re2/default.nix
blob: 09d2f7539f15a478567bb241c4d5d6d4129221c3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{
  abseil-cpp,
  chromium,
  cmake,
  fetchFromGitHub,
  gbenchmark,
  grpc,
  gtest,
  haskellPackages,
  icu,
  lib,
  mercurial,
  ninja,
  python3Packages,
  stdenv,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "re2";
  version = "2024-06-01";

  src = fetchFromGitHub {
    owner = "google";
    repo = "re2";
    rev = finalAttrs.version;
    hash = "sha256-iQETsjdIFcYM5I/W8ytvV3z/4va6TaZ/+KkSjb8CtF0=";
  };

  outputs = [
    "out"
    "dev"
  ];

  nativeBuildInputs = [
    cmake
    ninja
  ];

  buildInputs = lib.optionals finalAttrs.doCheck [
    gbenchmark
    gtest
  ];

  propagatedBuildInputs = [
    abseil-cpp
    icu
  ];

  cmakeFlags = [
    (lib.cmakeBool "RE2_BUILD_TESTING" finalAttrs.doCheck)
    (lib.cmakeBool "RE2_USE_ICU" true)
  ] ++ lib.optional (!stdenv.hostPlatform.isStatic) (lib.cmakeBool "BUILD_SHARED_LIBS" true);

  doCheck = true;

  passthru.tests = {
    inherit chromium grpc mercurial;
    inherit (python3Packages) fb-re2 google-re2;
    haskell-re2 = haskellPackages.re2;
  };

  meta = with lib; {
    description = "Regular expression library";
    longDescription = ''
      RE2 is a fast, safe, thread-friendly alternative to backtracking regular
      expression engines like those used in PCRE, Perl, and Python. It is a C++
      library.
    '';
    license = licenses.bsd3;
    homepage = "https://github.com/google/re2";
    maintainers = with maintainers; [
      azahi
      networkexception
    ];
    platforms = platforms.all;
  };
})