summary refs log tree commit diff
path: root/pkgs/development/tools/misc/csmith
diff options
context:
space:
mode:
authorWill Dietz <w@wdtz.org>2017-07-03 14:27:08 -0500
committerWill Dietz <w@wdtz.org>2017-07-03 14:39:56 -0500
commit050ee80ddb717a0b875c882949105549f9f66437 (patch)
tree0908413580f83b05b2e6e623107d167893f84b4c /pkgs/development/tools/misc/csmith
parent24ec6634f4df0683bcf7b32dcf5499d4409a4030 (diff)
downloadnixpkgs-050ee80ddb717a0b875c882949105549f9f66437.tar
nixpkgs-050ee80ddb717a0b875c882949105549f9f66437.tar.gz
nixpkgs-050ee80ddb717a0b875c882949105549f9f66437.tar.bz2
nixpkgs-050ee80ddb717a0b875c882949105549f9f66437.tar.lz
nixpkgs-050ee80ddb717a0b875c882949105549f9f66437.tar.xz
nixpkgs-050ee80ddb717a0b875c882949105549f9f66437.tar.zst
nixpkgs-050ee80ddb717a0b875c882949105549f9f66437.zip
csmith: init at 2.3.0, pull in Sys::CPU as dependency.
Diffstat (limited to 'pkgs/development/tools/misc/csmith')
-rw-r--r--pkgs/development/tools/misc/csmith/default.nix48
1 files changed, 48 insertions, 0 deletions
diff --git a/pkgs/development/tools/misc/csmith/default.nix b/pkgs/development/tools/misc/csmith/default.nix
new file mode 100644
index 00000000000..20d149f3efe
--- /dev/null
+++ b/pkgs/development/tools/misc/csmith/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchurl, m4, makeWrapper, libbsd, perl, SysCPU }:
+
+stdenv.mkDerivation rec {
+  name = "csmith-${version}";
+  version = "2.3.0";
+
+  src = fetchurl {
+    url = "http://embed.cs.utah.edu/csmith/${name}.tar.gz";
+    sha256 = "1mb5zgixsyf86slggs756k8a5ddmj980md3ic9sa1y75xl5cqizj";
+  };
+
+  nativeBuildInputs = [ m4 makeWrapper ];
+  buildInputs = [ libbsd perl SysCPU ];
+
+  postInstall = ''
+    substituteInPlace $out/bin/compiler_test.pl \
+      --replace '$CSMITH_HOME/runtime' $out/include/${name} \
+      --replace ' ''${CSMITH_HOME}/runtime' " $out/include/${name}" \
+      --replace '$CSMITH_HOME/src/csmith' $out/bin/csmith
+
+    substituteInPlace $out/bin/launchn.pl \
+      --replace '../compiler_test.pl' $out/bin/compiler_test.pl \
+      --replace '../$CONFIG_FILE' '$CONFIG_FILE'
+
+    wrapProgram $out/bin/launchn.pl --prefix PERL5LIB : "$PERL5LIB" $out/bin/launchn.pl
+
+    mkdir -p $out/share/csmith
+    mv $out/bin/compiler_test.in $out/share/csmith/
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "A random generator of C programs";
+    homepage = "https://embed.cs.utah.edu/csmith";
+    # Officially, the license is this: https://github.com/csmith-project/csmith/blob/master/COPYING
+    license = licenses.bsd2;
+    longDescription = ''
+      Csmith is a tool that can generate random C programs that statically and
+      dynamically conform to the C99 standard. It is useful for stress-testing
+      compilers, static analyzers, and other tools that process C code.
+      Csmith has found bugs in every tool that it has tested, and has been used
+      to find and report more than 400 previously unknown compiler bugs.
+    '';
+    maintainers = [ maintainers.dtzWill ];
+    platforms = platforms.all;
+  };
+}