Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchurl, cmake, makeWrapper
2, llvm, libclang
3, flex
4, zlib
5, perlPackages
6, util-linux
7}:
8
9stdenv.mkDerivation rec {
10 pname = "creduce";
11 version = "2.10.0";
12
13 src = fetchurl {
14 url = "https://embed.cs.utah.edu/${pname}/${pname}-${version}.tar.gz";
15 sha256 = "2xwPEjln8k1iCwQM69UwAb89zwPkAPeFVqL/LhH+oGM=";
16 };
17
18 nativeBuildInputs = [ cmake makeWrapper llvm.dev ];
19 buildInputs = [
20 # Ensure stdenv's CC is on PATH before clang-unwrapped
21 stdenv.cc
22 # Actual deps:
23 llvm libclang
24 flex zlib
25 ] ++ (with perlPackages; [ perl ExporterLite FileWhich GetoptTabular RegexpCommon TermReadKey ]);
26
27 # On Linux, c-reduce's preferred way to reason about
28 # the cpu architecture/topology is to use 'lscpu',
29 # so let's make sure it knows where to find it:
30 postPatch = lib.optionalString stdenv.isLinux ''
31 substituteInPlace creduce/creduce_utils.pm --replace \
32 lscpu ${util-linux}/bin/lscpu
33 '';
34
35 postInstall = ''
36 wrapProgram $out/bin/creduce --prefix PERL5LIB : "$PERL5LIB"
37 '';
38
39 meta = with lib; {
40 description = "A C program reducer";
41 homepage = "https://embed.cs.utah.edu/creduce";
42 # Officially, the license is: https://github.com/csmith-project/creduce/blob/master/COPYING
43 license = licenses.ncsa;
44 longDescription = ''
45 C-Reduce is a tool that takes a large C or C++ program that has a
46 property of interest (such as triggering a compiler bug) and
47 automatically produces a much smaller C/C++ program that has the same
48 property. It is intended for use by people who discover and report
49 bugs in compilers and other tools that process C/C++ code.
50 '';
51 maintainers = [ maintainers.dtzWill ];
52 platforms = platforms.all;
53 };
54}