nixpkgs/pkgs/development/libraries/re2/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

75 lines
1.6 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchFromGitHub
2022-10-15 10:51:41 +00:00
, cmake
, ninja
, chromium
, grpc
, haskellPackages
, mercurial
2022-10-15 10:51:41 +00:00
, python3Packages
, abseil-cpp
}:
stdenv.mkDerivation rec {
pname = "re2";
2023-11-01 10:19:51 +00:00
version = "2023-11-01";
2019-05-31 19:21:14 +00:00
src = fetchFromGitHub {
owner = "google";
repo = "re2";
rev = version;
2023-11-01 10:19:51 +00:00
hash = "sha256-cKXe8r5MUag/z+seem4Zg/gmqIQjaCY7DBxiKlrnXPs=";
};
2022-10-15 10:51:41 +00:00
outputs = [ "out" "dev" ];
2022-10-15 10:51:41 +00:00
nativeBuildInputs = [ cmake ninja ];
propagatedBuildInputs = [ abseil-cpp ];
2022-10-15 10:51:41 +00:00
postPatch = ''
substituteInPlace re2Config.cmake.in \
--replace "\''${PACKAGE_PREFIX_DIR}/" ""
'';
2021-11-30 09:33:42 +00:00
2022-10-15 10:51:41 +00:00
# Needed for case-insensitive filesystems (i.e. MacOS) because a file named
# BUILD already exists.
cmakeBuildDir = "build_dir";
cmakeFlags = lib.optional (!stdenv.hostPlatform.isStatic) "-DBUILD_SHARED_LIBS:BOOL=ON";
2019-05-31 21:28:45 +00:00
2022-10-15 10:51:41 +00:00
# This installs a pkg-config definition.
postInstall = ''
pushd "$src"
make common-install prefix="$dev" SED_INPLACE="sed -i"
popd
'';
2022-10-15 10:51:41 +00:00
doCheck = true;
2019-05-31 21:28:45 +00:00
2022-10-15 10:51:41 +00:00
passthru.tests = {
inherit
chromium
grpc
mercurial;
inherit (python3Packages)
fb-re2
google-re2;
haskell-re2 = haskellPackages.re2;
};
2022-10-15 10:51:41 +00:00
meta = with lib; {
description = "A 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 ];
2022-10-15 10:51:41 +00:00
platforms = platforms.all;
};
}