1 { fetchurl, lib, stdenv, perl, makeWrapper }:
3 stdenv.mkDerivation rec {
8 url = "https://www.dwheeler.com/${pname}/${pname}-${version}.tar.gz";
9 sha256 = "0ayiwfjdh1946asah861ah9269s5xkc8p5fv1wnxs9znyaxs4zzs";
12 nativeBuildInputs = [ makeWrapper ];
13 buildInputs = [ perl ];
15 # Make sure the Flex-generated files are newer than the `.l' files, so that
16 # Flex isn't needed to recompile them.
20 if grep -q /usr/bin/perl "$file"
22 echo "patching \`$file'..."
23 substituteInPlace "$file" --replace \
24 "/usr/bin/perl" "${perl}/bin/perl"
30 touch "$(echo $file | sed -es'/\.l$/.c/g')"
34 makeFlags = [ "PREFIX=$(out)" "CC=${stdenv.cc.targetPrefix}cc" ];
37 checkPhase = ''HOME="$TMPDIR" PATH="$PWD:$PATH" make test'';
41 mkdir -p "$out/share/man/man1"
42 mkdir -p "$out/share/doc"
46 for w in "$out/bin"/*; do
47 isScript "$w" || continue
48 wrapProgram "$w" --prefix PATH : "$out/bin"
53 description = "Set of tools for counting physical Source Lines of Code (SLOC)";
56 This is the home page of "SLOCCount", a set of tools for
57 counting physical Source Lines of Code (SLOC) in a large number
58 of languages of a potentially large set of programs. This suite
59 of tools was used in my papers More than a Gigabuck: Estimating
60 GNU/Linux's Size and Estimating Linux's Size to measure the SLOC
61 of entire GNU/Linux distributions, and my essay Linux Kernel
62 2.6: It's Worth More! Others have measured Debian GNU/Linux and
63 the Perl CPAN library using this tool suite.
66 license = lib.licenses.gpl2Plus;
68 homepage = "https://www.dwheeler.com/sloccount/";
71 platforms = lib.platforms.all;