1{ lib
2, stdenv
3, fetchFromGitHub
4, cmake
5, libffi
6, libxml2
7, zlib
8, withManual ? true
9, withHTML ? true
10, llvmPackages
11, python3
12}:
13
14let
15 inherit (llvmPackages) libclang llvm;
16 inherit (python3.pkgs) sphinx;
17in
18stdenv.mkDerivation (finalAttrs: {
19 pname = "castxml";
20 version = "0.6.1";
21
22 src = fetchFromGitHub {
23 owner = "CastXML";
24 repo = "CastXML";
25 rev = "v${finalAttrs.version}";
26 hash = "sha256-dyB2h6Yix2lZbVFVCz8nWNNubFSEVBlRpjVrBRec4Xo=";
27 };
28
29 nativeBuildInputs = [
30 cmake
31 llvm.dev
32 ] ++ lib.optionals (withManual || withHTML) [
33 sphinx
34 ];
35
36 buildInputs = [
37 libclang
38 libffi
39 libxml2
40 zlib
41 ];
42
43 propagatedBuildInputs = [
44 libclang
45 ];
46
47 cmakeFlags = [
48 "-DCLANG_RESOURCE_DIR=${libclang.dev}/"
49 "-DSPHINX_HTML=${if withHTML then "ON" else "OFF"}"
50 "-DSPHINX_MAN=${if withManual then "ON" else "OFF"}"
51 ];
52
53 # 97% tests passed, 97 tests failed out of 2881
54 # mostly because it checks command line and nix append -isystem and all
55 doCheck = false;
56 # -E exclude 4 tests based on names
57 # see https://github.com/CastXML/CastXML/issues/90
58 checkPhase = ''
59 runHook preCheck
60 ctest -E 'cmd.cc-(gnu|msvc)-((c-src-c)|(src-cxx))-cmd'
61 runHook postCheck
62 '';
63
64 meta = with lib; {
65 homepage = "https://github.com/CastXML/CastXML";
66 description = "C-family Abstract Syntax Tree XML Output";
67 license = licenses.asl20;
68 maintainers = with maintainers; [ AndersonTorres ];
69 platforms = platforms.unix;
70 };
71})