2021-01-23 13:26:19 +01:00
|
|
|
{ lib, stdenv, fetchurl, m4, makeWrapper, libbsd, perlPackages }:
|
2017-07-03 21:27:08 +02:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "csmith";
|
2017-07-03 21:27:08 +02:00
|
|
|
version = "2.3.0";
|
|
|
|
|
|
|
|
src = fetchurl {
|
2019-08-15 14:41:18 +02:00
|
|
|
url = "https://embed.cs.utah.edu/csmith/${pname}-${version}.tar.gz";
|
2017-07-03 21:27:08 +02:00
|
|
|
sha256 = "1mb5zgixsyf86slggs756k8a5ddmj980md3ic9sa1y75xl5cqizj";
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ m4 makeWrapper ];
|
2018-12-15 04:50:31 +01:00
|
|
|
buildInputs = [ libbsd ] ++ (with perlPackages; [ perl SysCPU ]);
|
2017-07-03 21:27:08 +02:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
substituteInPlace $out/bin/compiler_test.pl \
|
2019-08-15 14:41:18 +02:00
|
|
|
--replace '$CSMITH_HOME/runtime' $out/include/${pname}-${version} \
|
|
|
|
--replace ' ''${CSMITH_HOME}/runtime' " $out/include/${pname}-${version}" \
|
2017-07-03 21:27:08 +02:00
|
|
|
--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'
|
|
|
|
|
2017-08-10 00:43:26 +02:00
|
|
|
wrapProgram $out/bin/launchn.pl \
|
|
|
|
--prefix PERL5LIB : "$PERL5LIB"
|
2017-07-03 21:27:08 +02:00
|
|
|
|
|
|
|
mkdir -p $out/share/csmith
|
|
|
|
mv $out/bin/compiler_test.in $out/share/csmith/
|
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-01-23 13:26:19 +01:00
|
|
|
meta = with lib; {
|
2017-07-03 21:27:08 +02:00
|
|
|
description = "A random generator of C programs";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://embed.cs.utah.edu/csmith";
|
2017-07-03 21:27:08 +02:00
|
|
|
# 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;
|
|
|
|
};
|
|
|
|
}
|