1{ fetchurl, stdenv, perl }:
2
3stdenv.mkDerivation rec {
4 name = "sloccount-2.26";
5
6 src = fetchurl {
7 url = "http://www.dwheeler.com/sloccount/${name}.tar.gz";
8 sha256 = "0ayiwfjdh1946asah861ah9269s5xkc8p5fv1wnxs9znyaxs4zzs";
9 };
10
11 buildInputs = [ perl ];
12
13 # Make sure the Flex-generated files are newer than the `.l' files, so that
14 # Flex isn't needed to recompile them.
15 patchPhase = ''
16 for file in *
17 do
18 if grep -q /usr/bin/perl "$file"
19 then
20 echo "patching \`$file'..."
21 substituteInPlace "$file" --replace \
22 "/usr/bin/perl" "${perl}/bin/perl"
23 fi
24 done
25
26 for file in *.l
27 do
28 touch "$(echo $file | sed -es'/\.l$/.c/g')"
29 done
30 '';
31
32 makeFlags = "PREFIX=$(out) CC=cc";
33
34 doCheck = true;
35 checkPhase = ''HOME="$TMPDIR" PATH="$PWD:$PATH" make test'';
36
37 preInstall = ''
38 mkdir -p "$out/bin"
39 mkdir -p "$out/share/man/man1"
40 mkdir -p "$out/share/doc"
41 '';
42
43 meta = {
44 description = "Set of tools for counting physical Source Lines of Code (SLOC)";
45
46 longDescription = ''
47 This is the home page of "SLOCCount", a set of tools for
48 counting physical Source Lines of Code (SLOC) in a large number
49 of languages of a potentially large set of programs. This suite
50 of tools was used in my papers More than a Gigabuck: Estimating
51 GNU/Linux's Size and Estimating Linux's Size to measure the SLOC
52 of entire GNU/Linux distributions, and my essay Linux Kernel
53 2.6: It's Worth More! Others have measured Debian GNU/Linux and
54 the Perl CPAN library using this tool suite.
55 '';
56
57 license = stdenv.lib.licenses.gpl2Plus;
58
59 homepage = http://www.dwheeler.com/sloccount/;
60
61 maintainers = [ ];
62 platforms = stdenv.lib.platforms.all;
63 };
64}