2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv, fetchFromGitHub, CoreServices, CoreFoundation, fetchpatch }:
|
2019-04-28 09:36:32 +02:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
version = "1.1";
|
|
|
|
pname = "qgrep";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "zeux";
|
|
|
|
repo = "qgrep";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "046ccw34vz2k5jn6gyxign5gs2qi7i50jy9b74wqv7sjf5zayrh0";
|
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
|
2021-01-15 10:19:50 +01:00
|
|
|
patches = lib.optionals stdenv.isDarwin [
|
2019-12-28 17:20:06 +01:00
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/zeux/qgrep/commit/21c4d1a5ab0f0bdaa0b5ca993c1315c041418cc6.patch";
|
|
|
|
sha256 = "0wpxzrd9pmhgbgby17vb8279xwvkxfdd99gvv7r74indgdxqg7v8";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-01-15 10:19:50 +01:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ CoreServices CoreFoundation ];
|
2019-12-28 17:20:06 +01:00
|
|
|
|
2023-02-20 16:36:06 +01:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [
|
2023-02-05 14:56:47 +01:00
|
|
|
# Needed with GCC 12 but breaks on darwin (with clang) or older gcc
|
2022-12-23 17:57:29 +01:00
|
|
|
"-Wno-error=mismatched-new-delete"
|
2023-02-20 16:36:06 +01:00
|
|
|
]);
|
2022-12-23 17:57:29 +01:00
|
|
|
|
2021-01-15 10:19:50 +01:00
|
|
|
postPatch = lib.optionalString stdenv.isAarch64 ''
|
2019-12-28 17:20:06 +01:00
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace "-msse2" "" --replace "-DUSE_SSE2" ""
|
|
|
|
'';
|
|
|
|
|
2021-01-15 10:19:50 +01:00
|
|
|
installPhase = ''
|
2019-04-28 09:36:32 +02:00
|
|
|
install -Dm755 qgrep $out/bin/qgrep
|
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2019-04-28 09:36:32 +02:00
|
|
|
description = "Fast regular expression grep for source code with incremental index updates";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/zeux/qgrep";
|
2019-04-28 09:36:32 +02:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = [ maintainers.yrashk ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|