From a82b3dd8e22e1d4555bd4f5487192e9d7cd58be6 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Fri, 10 Feb 2017 15:22:49 -0600 Subject: [PATCH] creduce: init at 2.6.0 Also includes perl dependency 'GetOpt::Tabular'. --- .../tools/misc/creduce/default.nix | 61 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 7 +++ pkgs/top-level/perl-packages.nix | 8 +++ 3 files changed, 76 insertions(+) create mode 100644 pkgs/development/tools/misc/creduce/default.nix diff --git a/pkgs/development/tools/misc/creduce/default.nix b/pkgs/development/tools/misc/creduce/default.nix new file mode 100644 index 000000000000..a9296adf3343 --- /dev/null +++ b/pkgs/development/tools/misc/creduce/default.nix @@ -0,0 +1,61 @@ +{ stdenv, fetchurl, cmake +, llvm, clang-unwrapped +, flex +, zlib +, perl, ExporterLite, FileWhich, GetoptTabular, RegexpCommon, TermReadKey +, utillinux +}: + +assert stdenv.isLinux -> (utillinux != null); + +stdenv.mkDerivation rec { + name = "creduce-${version}"; + version = "2.6.0"; + + src = fetchurl { + url = "http://embed.cs.utah.edu/creduce/${name}.tar.gz"; + sha256 = "0pf5q0n8vkdcr1wrkxn2jzxv0xkrir13bwmqfw3jpbm3dh2c3b6d"; + }; + + buildInputs = [ + # Ensure stdenv's CC is on PATH before clang-unwrapped + stdenv.cc + # Actual deps: + cmake + llvm clang-unwrapped + flex zlib + ]; + + # On Linux, c-reduce's preferred way to reason about + # the cpu architecture/topology is to use 'lscpu', + # so let's make sure it knows where to find it: + patchPhase = stdenv.lib.optionalString stdenv.isLinux '' + substituteInPlace creduce/creduce_utils.pm --replace \ + lscpu ${utillinux}/bin/lscpu + ''; + + perlDeps = [ + perl ExporterLite FileWhich GetoptTabular RegexpCommon TermReadKey + ]; + + propagatedNativeBuildInputs = perlDeps; + propagatedUserEnvPkgs = perlDeps; + + enableParallelBuilding = true; + + meta = with stdenv.lib; { + description = "A C program reducer"; + homepage = "https://embed.cs.utah.edu/creduce"; + # Officially, the license is: https://github.com/csmith-project/creduce/blob/master/COPYING + license = licenses.ncsa; + longDescription = '' + C-Reduce is a tool that takes a large C or C++ program that has a + property of interest (such as triggering a compiler bug) and + automatically produces a much smaller C/C++ program that has the same + property. It is intended for use by people who discover and report + bugs in compilers and other tools that process C/C++ code. + ''; + maintainers = [ maintainers.dtzWill ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a5ddc9d34284..8d5fc9dd783a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6263,6 +6263,13 @@ with pkgs; cppcheck = callPackage ../development/tools/analysis/cppcheck { }; + creduce = callPackage ../development/tools/misc/creduce { + inherit (perlPackages) perl + ExporterLite FileWhich GetoptTabular RegexpCommon TermReadKey; + inherit (llvmPackages_39) llvm clang-unwrapped; + utillinux = if stdenv.isLinux then utillinuxMinimal else null; + }; + cscope = callPackage ../development/tools/misc/cscope { }; csslint = callPackage ../development/web/csslint { }; diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix index f50d5dfe38d8..744ca5f53e5e 100644 --- a/pkgs/top-level/perl-packages.nix +++ b/pkgs/top-level/perl-packages.nix @@ -5611,6 +5611,14 @@ let self = _self // overrides; _self = with self; { }; }; + GetoptTabular = buildPerlPackage rec { + name = "Getopt-Tabular-0.3"; + src = fetchurl { + url = "mirror://cpan/authors/id/G/GW/GWARD/${name}.tar.gz"; + sha256 = "0xskl9lcj07sdfx5dkma5wvhhgf5xlsq0khgh8kk34dm6dv0dpwv"; + }; + }; + GitPurePerl = buildPerlPackage { name = "Git-PurePerl-0.51"; src = fetchurl {