Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 callPackage,
3 fetchurl,
4 lib,
5 stdenv,
6 gtk3,
7 pkg-config,
8 libxml2,
9 llvm,
10 perl,
11 sqlite,
12}:
13
14let
15 GCC_BASE = "${stdenv.cc.cc}/lib/gcc/${stdenv.hostPlatform.uname.processor}-unknown-linux-gnu/${stdenv.cc.cc.version}";
16in
17stdenv.mkDerivation rec {
18 pname = "sparse";
19 version = "0.6.4";
20
21 src = fetchurl {
22 url = "mirror://kernel/software/devel/sparse/dist/${pname}-${version}.tar.xz";
23 sha256 = "sha256-arKLSZG8au29c1UCkTYKpqs99B9ZIGqb3paQIIpuOHw=";
24 };
25
26 preConfigure = ''
27 sed -i 's|"/usr/include"|"${stdenv.cc.libc.dev}/include"|' pre-process.c
28 sed -i 's|qx(\$ccom -print-file-name=)|"${GCC_BASE}"|' cgcc
29 '';
30
31 makeFlags = [
32 "PREFIX=${placeholder "out"}"
33 ];
34
35 nativeBuildInputs = [ pkg-config ];
36 buildInputs = [
37 gtk3
38 libxml2
39 llvm
40 perl
41 sqlite
42 ];
43 doCheck = true;
44 buildFlags = [ "GCC_BASE:=${GCC_BASE}" ];
45
46 # Test failures with "fortify3" on, such as:
47 # +*** buffer overflow detected ***: terminated
48 # +Aborted (core dumped)
49 # error: Actual exit value does not match the expected one.
50 # error: expected 0, got 134.
51 # error: FAIL: test 'bool-float.c' failed
52 hardeningDisable = [ "fortify3" ];
53
54 passthru.tests = {
55 simple-execution = callPackage ./tests.nix { };
56 };
57
58 meta = with lib; {
59 description = "Semantic parser for C";
60 homepage = "https://git.kernel.org/pub/scm/devel/sparse/sparse.git/";
61 license = licenses.mit;
62 platforms = platforms.linux;
63 maintainers = with maintainers; [
64 thoughtpolice
65 jkarlson
66 ];
67 };
68}