1{ stdenv, fetchurl }:
2
3stdenv.mkDerivation rec {
4 name = "re2";
5 version = "20140304";
6
7 src = fetchurl {
8 url = "https://re2.googlecode.com/files/${name}-${version}.tgz";
9 sha256 = "19wn0472c9dsxp35d0m98hlwhngx1f2xhxqgr8cb5x72gnjx3zqb";
10 };
11
12 preConfigure = ''
13 substituteInPlace Makefile --replace "/usr/local" "$out"
14 '' + stdenv.lib.optionalString stdenv.isDarwin ''
15 # Fixed in https://github.com/google/re2/commit/b2c9765b4a7afbea8b6be1dae548b6f4d5f39e42
16 substituteInPlace Makefile \
17 --replace '-dynamiclib' '-dynamiclib -Wl,-install_name,$(libdir)/libre2.so.$(SONAME)'
18 '';
19
20 meta = {
21 homepage = https://code.google.com/p/re2/;
22 description = "An efficient, principled regular expression library";
23 license = stdenv.lib.licenses.bsd3;
24 platforms = with stdenv.lib.platforms; all;
25 };
26}