diff options
| author | Peter Hoeg <peter@hoeg.com> | 2020-06-09 15:42:31 +0800 |
|---|---|---|
| committer | Peter Hoeg <peter@hoeg.com> | 2020-06-15 14:54:42 +0800 |
| commit | 6b9ca515ce06cf70b3ec24a334a2756897e88837 (patch) | |
| tree | 0deb3b3c927b2e4f459fc19c19aaef517e9d931a | |
| parent | flashplayer: 32.0.0.371 -> 32.0.0.387 (diff) | |
| download | nixpkgs-origin/f/sloccount.tar.gz | |
sloccount: fix locale warnings when running with non-default localeorigin/f/sloccount
| -rw-r--r-- | pkgs/development/tools/misc/sloccount/default.nix | 58 |
1 files changed, 19 insertions, 39 deletions
diff --git a/pkgs/development/tools/misc/sloccount/default.nix b/pkgs/development/tools/misc/sloccount/default.nix index b2b83aa79b16..fe61f755fb85 100644 --- a/pkgs/development/tools/misc/sloccount/default.nix +++ b/pkgs/development/tools/misc/sloccount/default.nix @@ -1,54 +1,37 @@ -{ fetchurl, stdenv, perl, makeWrapper }: +{ stdenv, fetchurl, perlPackages, coreutils, flex, glibcLocales, makeWrapper }: -stdenv.mkDerivation rec { - name = "sloccount-2.26"; +perlPackages.buildPerlPackage rec { + pname = "sloccount"; + version = "2.26"; src = fetchurl { - url = "https://www.dwheeler.com/sloccount/${name}.tar.gz"; + url = "https://www.dwheeler.com/sloccount/${pname}-${version}.tar.gz"; sha256 = "0ayiwfjdh1946asah861ah9269s5xkc8p5fv1wnxs9znyaxs4zzs"; }; - nativeBuildInputs = [ makeWrapper ]; - buildInputs = [ perl ]; + # needed for the standard buildPerlPackage builder + postPatch = "touch Makefile.PL"; - # Make sure the Flex-generated files are newer than the `.l' files, so that - # Flex isn't needed to recompile them. - patchPhase = '' - for file in * - do - if grep -q /usr/bin/perl "$file" - then - echo "patching \`$file'..." - substituteInPlace "$file" --replace \ - "/usr/bin/perl" "${perl}/bin/perl" - fi - done + nativeBuildInputs = [ flex makeWrapper ]; - for file in *.l - do - touch "$(echo $file | sed -es'/\.l$/.c/g')" - done - ''; + outputs = [ "out" ]; makeFlags = [ "PREFIX=$(out)" "CC=cc" ]; - doCheck = true; checkPhase = ''HOME="$TMPDIR" PATH="$PWD:$PATH" make test''; - preInstall = '' - mkdir -p "$out/bin" - mkdir -p "$out/share/man/man1" - mkdir -p "$out/share/doc" - ''; + preInstall = "mkdir -p $out/bin"; + # coreutils is needed for wc and md5sum postInstall = '' - for w in "$out/bin"/*; do - isScript "$w" || continue - wrapProgram "$w" --prefix PATH : "$out/bin" - done - ''; + mv $out/bin $out/libexec - meta = { + makeWrapper $out/libexec/sloccount $out/bin/sloccount \ + --prefix PATH : $out/libexec:${stdenv.lib.makeBinPath [ coreutils ]} \ + --set LOCALE_ARCHIVE ${glibcLocales}/lib/locale/locale-archive + ''; + + meta = with stdenv.lib; { description = "Set of tools for counting physical Source Lines of Code (SLOC)"; longDescription = '' @@ -62,11 +45,8 @@ stdenv.mkDerivation rec { the Perl CPAN library using this tool suite. ''; - license = stdenv.lib.licenses.gpl2Plus; - homepage = "https://www.dwheeler.com/sloccount/"; - + license = licenses.gpl2Plus; maintainers = [ ]; - platforms = stdenv.lib.platforms.all; }; } |
