lol
1{ stdenv, fetchurl, pcre, libiconv, perl }:
2
3let version = "2.22"; in
4
5stdenv.mkDerivation {
6 name = "gnugrep-${version}";
7
8 src = fetchurl {
9 url = "mirror://gnu/grep/grep-${version}.tar.xz";
10 sha256 = "1srn321x7whlhs5ks36zlcrrmj4iahll8fxwsh1vbz3v04px54fa";
11 };
12
13 # Perl is needed for testing
14 nativeBuildInputs = [ perl ];
15 buildInputs = [ pcre libiconv ];
16
17 # cygwin: FAIL: multibyte-white-space
18 # freebsd: FAIL mb-non-UTF8-performance
19 # all platforms: timing sensitivity in long-pattern-perf
20 #doCheck = !stdenv.isDarwin && !stdenv.isSunOS && !stdenv.isCygwin && !stdenv.isFreeBSD;
21 doCheck = false;
22
23 # On Mac OS X, force use of mkdir -p, since Grep's fallback
24 # (./install-sh) is broken.
25 preConfigure = ''
26 export MKDIR_P="mkdir -p"
27 '';
28
29 # Fix reference to sh in bootstrap-tools, and invoke grep via
30 # absolute path rather than looking at argv[0].
31 postInstall =
32 ''
33 rm $out/bin/egrep $out/bin/fgrep
34 echo "#! /bin/sh" > $out/bin/egrep
35 echo "exec $out/bin/grep -E \"\$@\"" >> $out/bin/egrep
36 echo "#! /bin/sh" > $out/bin/fgrep
37 echo "exec $out/bin/grep -F \"\$@\"" >> $out/bin/fgrep
38 chmod +x $out/bin/egrep $out/bin/fgrep
39 '';
40
41 meta = {
42 homepage = http://www.gnu.org/software/grep/;
43 description = "GNU implementation of the Unix grep command";
44
45 longDescription = ''
46 The grep command searches one or more input files for lines
47 containing a match to a specified pattern. By default, grep
48 prints the matching lines.
49 '';
50
51 license = stdenv.lib.licenses.gpl3Plus;
52
53 maintainers = [ stdenv.lib.maintainers.eelco ];
54 platforms = stdenv.lib.platforms.all;
55 };
56
57 passthru = {inherit pcre;};
58}