about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/re2/default.nix
blob: 2e163a79d596b6a14bab41702790e39cd55345f4 (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
{ lib
, stdenv
, fetchFromGitHub
, nix-update-script

# for passthru.tests
, bazel
, chromium
, grpc
, haskellPackages
, mercurial
, ninja
, python3
}:

stdenv.mkDerivation rec {
  pname = "re2";
  version = "2022-06-01";

  src = fetchFromGitHub {
    owner = "google";
    repo = "re2";
    rev = version;
    sha256 = "sha256-UontAjOXpnPcOgoFHjf+1WSbCR7h58/U7nn4meT200Y=";
  };

  preConfigure = ''
    substituteInPlace Makefile --replace "/usr/local" "$out"
    # we're using gnu sed, even on darwin
    substituteInPlace Makefile  --replace "SED_INPLACE=sed -i '''" "SED_INPLACE=sed -i"
  '';

  buildFlags = lib.optionals stdenv.hostPlatform.isStatic [ "static" ];

  enableParallelBuilding = true;

  preCheck = "patchShebangs runtests";
  doCheck = true;
  checkTarget = if stdenv.hostPlatform.isStatic then "static-test" else "test";

  installTargets = lib.optionals stdenv.hostPlatform.isStatic [ "static-install" ];

  doInstallCheck = true;
  installCheckTarget = if stdenv.hostPlatform.isStatic then "static-testinstall" else "testinstall";

  passthru = {
    updateScript = nix-update-script {
      attrPath = pname;
    };
    tests = {
      inherit
        chromium
        grpc
        mercurial;
      inherit (python3.pkgs)
        fb-re2
        google-re2;
      haskellPackages-re2 = haskellPackages.re2;
    };
  };

  meta = {
    homepage = "https://github.com/google/re2";
    description = "An efficient, principled regular expression library";
    license = lib.licenses.bsd3;
    platforms = with lib.platforms; all;
  };
}