nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 pkg-config,
6 sqlite,
7 openssl,
8 buildllvmsparse ? false,
9 buildc2xml ? false,
10 libllvm,
11 libxml2,
12}:
13let
14 version = "1.73";
15in
16stdenv.mkDerivation {
17 pname = "smatch";
18 inherit version;
19
20 src = fetchFromGitHub {
21 owner = "error27";
22 repo = "smatch";
23 rev = version;
24 sha256 = "sha256-Pv3bd2cjnQKnhH7TrkYWfDEeaq6u/q/iK1ZErzn6bME=";
25 };
26
27 NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isClang [
28 "-Wno-incompatible-function-pointer-types"
29 ];
30
31 nativeBuildInputs = [ pkg-config ];
32 patches = [ ./remove_const.patch ];
33
34 buildInputs = [
35 sqlite
36 openssl
37 ]
38 ++ lib.optionals buildllvmsparse [ libllvm ]
39 ++ lib.optionals buildc2xml [ libxml2.dev ];
40
41 makeFlags = [
42 "PREFIX=${placeholder "out"}"
43 "CXX=${stdenv.cc.targetPrefix}c++"
44 ];
45
46 meta = {
47 description = "Semantic analysis tool for C";
48 homepage = "https://sparse.docs.kernel.org/";
49 maintainers = with lib.maintainers; [ momeemt ];
50 license = lib.licenses.gpl2Plus;
51 platforms = lib.platforms.all;
52 };
53}