Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at fix-function-merge 51 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 CXXFLAGS = "-std=c++98"; 16 17 postInstall = '' 18 substituteInPlace $out/bin/compiler_test.pl \ 19 --replace '$CSMITH_HOME/runtime' $out/include/${pname}-${version} \ 20 --replace ' ''${CSMITH_HOME}/runtime' " $out/include/${pname}-${version}" \ 21 --replace '$CSMITH_HOME/src/csmith' $out/bin/csmith 22 23 substituteInPlace $out/bin/launchn.pl \ 24 --replace '../compiler_test.pl' $out/bin/compiler_test.pl \ 25 --replace '../$CONFIG_FILE' '$CONFIG_FILE' 26 27 wrapProgram $out/bin/launchn.pl \ 28 --prefix PERL5LIB : "$PERL5LIB" 29 30 mkdir -p $out/share/csmith 31 mv $out/bin/compiler_test.in $out/share/csmith/ 32 ''; 33 34 enableParallelBuilding = true; 35 36 meta = with lib; { 37 description = "Random generator of C programs"; 38 homepage = "https://embed.cs.utah.edu/csmith"; 39 # Officially, the license is this: https://github.com/csmith-project/csmith/blob/master/COPYING 40 license = licenses.bsd2; 41 longDescription = '' 42 Csmith is a tool that can generate random C programs that statically and 43 dynamically conform to the C99 standard. It is useful for stress-testing 44 compilers, static analyzers, and other tools that process C code. 45 Csmith has found bugs in every tool that it has tested, and has been used 46 to find and report more than 400 previously unknown compiler bugs. 47 ''; 48 maintainers = [ ]; 49 platforms = platforms.all; 50 }; 51}