at 23.11-beta 49 lines 1.8 kB view raw
1{ lib, stdenv, fetchurl, m4, makeWrapper, libbsd, perlPackages }: 2 3stdenv.mkDerivation rec { 4 pname = "csmith"; 5 version = "2.3.0"; 6 7 src = fetchurl { 8 url = "https://embed.cs.utah.edu/csmith/${pname}-${version}.tar.gz"; 9 sha256 = "1mb5zgixsyf86slggs756k8a5ddmj980md3ic9sa1y75xl5cqizj"; 10 }; 11 12 nativeBuildInputs = [ m4 makeWrapper ]; 13 buildInputs = [ libbsd ] ++ (with perlPackages; [ perl SysCPU ]); 14 15 postInstall = '' 16 substituteInPlace $out/bin/compiler_test.pl \ 17 --replace '$CSMITH_HOME/runtime' $out/include/${pname}-${version} \ 18 --replace ' ''${CSMITH_HOME}/runtime' " $out/include/${pname}-${version}" \ 19 --replace '$CSMITH_HOME/src/csmith' $out/bin/csmith 20 21 substituteInPlace $out/bin/launchn.pl \ 22 --replace '../compiler_test.pl' $out/bin/compiler_test.pl \ 23 --replace '../$CONFIG_FILE' '$CONFIG_FILE' 24 25 wrapProgram $out/bin/launchn.pl \ 26 --prefix PERL5LIB : "$PERL5LIB" 27 28 mkdir -p $out/share/csmith 29 mv $out/bin/compiler_test.in $out/share/csmith/ 30 ''; 31 32 enableParallelBuilding = true; 33 34 meta = with lib; { 35 description = "A random generator of C programs"; 36 homepage = "https://embed.cs.utah.edu/csmith"; 37 # Officially, the license is this: https://github.com/csmith-project/csmith/blob/master/COPYING 38 license = licenses.bsd2; 39 longDescription = '' 40 Csmith is a tool that can generate random C programs that statically and 41 dynamically conform to the C99 standard. It is useful for stress-testing 42 compilers, static analyzers, and other tools that process C code. 43 Csmith has found bugs in every tool that it has tested, and has been used 44 to find and report more than 400 previously unknown compiler bugs. 45 ''; 46 maintainers = [ maintainers.dtzWill ]; 47 platforms = platforms.all; 48 }; 49}