2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchurl, cmake, makeWrapper
|
2021-05-20 23:08:51 +00:00
|
|
|
, llvm, libclang
|
2020-04-24 23:36:52 +00:00
|
|
|
, flex
|
|
|
|
, zlib
|
|
|
|
, perlPackages
|
2020-11-24 20:58:05 +00:00
|
|
|
, util-linux
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "creduce";
|
2021-12-06 16:07:01 +00:00
|
|
|
version = "2.10.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://embed.cs.utah.edu/${pname}/${pname}-${version}.tar.gz";
|
2021-12-06 16:07:01 +00:00
|
|
|
sha256 = "2xwPEjln8k1iCwQM69UwAb89zwPkAPeFVqL/LhH+oGM=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
nativeBuildInputs = [ cmake makeWrapper llvm.dev ];
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [
|
|
|
|
# Ensure stdenv's CC is on PATH before clang-unwrapped
|
|
|
|
stdenv.cc
|
|
|
|
# Actual deps:
|
2021-05-20 23:08:51 +00:00
|
|
|
llvm libclang
|
2020-04-24 23:36:52 +00:00
|
|
|
flex zlib
|
|
|
|
] ++ (with perlPackages; [ perl ExporterLite FileWhich GetoptTabular RegexpCommon TermReadKey ]);
|
|
|
|
|
|
|
|
# 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:
|
2021-02-05 17:12:51 +00:00
|
|
|
postPatch = lib.optionalString stdenv.isLinux ''
|
2020-04-24 23:36:52 +00:00
|
|
|
substituteInPlace creduce/creduce_utils.pm --replace \
|
2020-11-24 20:58:05 +00:00
|
|
|
lscpu ${util-linux}/bin/lscpu
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
wrapProgram $out/bin/creduce --prefix PERL5LIB : "$PERL5LIB"
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
}
|