2022-05-18 14:49:53 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2022-11-02 22:02:43 +00:00
|
|
|
, cmake
|
|
|
|
, ninja
|
2022-05-18 14:49:53 +00:00
|
|
|
, chromium
|
|
|
|
, grpc
|
|
|
|
, haskellPackages
|
|
|
|
, mercurial
|
2022-11-02 22:02:43 +00:00
|
|
|
, python3Packages
|
2022-05-18 14:49:53 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "re2";
|
2022-12-17 10:02:37 +00:00
|
|
|
version = "2022-12-01";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = "re2";
|
2021-05-20 23:08:51 +00:00
|
|
|
rev = version;
|
2022-12-17 10:02:37 +00:00
|
|
|
hash = "sha256-RmPXfavSKVnnl/RJ5aTjc/GbkPz+EXiFg1n5e4s6wjw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-11-02 22:02:43 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-11-02 22:02:43 +00:00
|
|
|
nativeBuildInputs = [ cmake ninja ];
|
2021-02-05 17:12:51 +00:00
|
|
|
|
2022-11-02 22:02:43 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace re2Config.cmake.in \
|
|
|
|
--replace "\''${PACKAGE_PREFIX_DIR}/" ""
|
|
|
|
'';
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2022-11-02 22:02:43 +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";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-11-02 22:02:43 +00:00
|
|
|
# This installs a pkg-config definition.
|
|
|
|
postInstall = ''
|
|
|
|
pushd "$src"
|
|
|
|
make common-install prefix="$dev" SED_INPLACE="sed -i"
|
|
|
|
popd
|
|
|
|
'';
|
2021-02-05 17:12:51 +00:00
|
|
|
|
2022-11-02 22:02:43 +00:00
|
|
|
doCheck = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-11-02 22:02:43 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit
|
|
|
|
chromium
|
|
|
|
grpc
|
|
|
|
mercurial;
|
|
|
|
inherit (python3Packages)
|
|
|
|
fb-re2
|
|
|
|
google-re2;
|
|
|
|
haskell-re2 = haskellPackages.re2;
|
2022-01-26 04:04:25 +00:00
|
|
|
};
|
|
|
|
|
2022-11-02 22:02:43 +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;
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/google/re2";
|
2022-11-02 22:02:43 +00:00
|
|
|
maintainers = with maintainers; [ azahi ];
|
|
|
|
platforms = platforms.all;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|