1 { callPackage, fetchurl, lib, stdenv, gtk3, pkg-config, libxml2, llvm, perl, sqlite }:
4 GCC_BASE = "${stdenv.cc.cc}/lib/gcc/${stdenv.hostPlatform.uname.processor}-unknown-linux-gnu/${stdenv.cc.cc.version}";
5 in stdenv.mkDerivation rec {
10 url = "mirror://kernel/software/devel/sparse/dist/${pname}-${version}.tar.xz";
11 sha256 = "sha256-arKLSZG8au29c1UCkTYKpqs99B9ZIGqb3paQIIpuOHw=";
15 sed -i 's|"/usr/include"|"${stdenv.cc.libc.dev}/include"|' pre-process.c
16 sed -i 's|qx(\$ccom -print-file-name=)|"${GCC_BASE}"|' cgcc
17 makeFlags+=" PREFIX=$out"
20 nativeBuildInputs = [ pkg-config ];
21 buildInputs = [ gtk3 libxml2 llvm perl sqlite ];
23 buildFlags = [ "GCC_BASE:=${GCC_BASE}" ];
25 # Test failures with "fortify3" on, such as:
26 # +*** buffer overflow detected ***: terminated
27 # +Aborted (core dumped)
28 # error: Actual exit value does not match the expected one.
29 # error: expected 0, got 134.
30 # error: FAIL: test 'bool-float.c' failed
31 hardeningDisable = [ "fortify3" ];
34 simple-execution = callPackage ./tests.nix { };
38 description = "Semantic parser for C";
39 homepage = "https://git.kernel.org/pub/scm/devel/sparse/sparse.git/";
40 license = licenses.mit;
41 platforms = platforms.linux;
42 maintainers = with maintainers; [ thoughtpolice jkarlson ];