summary refs log tree commit diff
path: root/pkgs/development/tools
diff options
context:
space:
mode:
authorJoachim F <joachifm@users.noreply.github.com>2017-02-17 16:58:37 +0100
committerGitHub <noreply@github.com>2017-02-17 16:58:37 +0100
commitfe4552420eb0d7564867da302e1793cca49d5b49 (patch)
tree6e2c2e656b315e30cc28c9da30791fdf16fda9b6 /pkgs/development/tools
parent692f3c18cd83a2bd65692b1ea898339e8ddef2d8 (diff)
parenta82b3dd8e22e1d4555bd4f5487192e9d7cd58be6 (diff)
downloadnixlib-fe4552420eb0d7564867da302e1793cca49d5b49.tar
nixlib-fe4552420eb0d7564867da302e1793cca49d5b49.tar.gz
nixlib-fe4552420eb0d7564867da302e1793cca49d5b49.tar.bz2
nixlib-fe4552420eb0d7564867da302e1793cca49d5b49.tar.lz
nixlib-fe4552420eb0d7564867da302e1793cca49d5b49.tar.xz
nixlib-fe4552420eb0d7564867da302e1793cca49d5b49.tar.zst
nixlib-fe4552420eb0d7564867da302e1793cca49d5b49.zip
Merge pull request #22680 from dtzWill/feature/creduce
creduce: init at 2.6.0
Diffstat (limited to 'pkgs/development/tools')
-rw-r--r--pkgs/development/tools/misc/creduce/default.nix61
1 files changed, 61 insertions, 0 deletions
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;
+  };
+}