about summary refs log tree commit diff
path: root/pkgs/by-name/cl/clang-uml/package.nix
blob: 9c037fb30be60f48d5c8888c6738e7b06929328e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{ lib
, fetchFromGitHub
, stdenv
, cmake
, pkg-config
, installShellFiles
, libclang
, clang
, llvmPackages
, libllvm
, yaml-cpp
, elfutils
, libunwind
, enableLibcxx ? false
, debug ? false
,
}:
stdenv.mkDerivation (finalAttrs: {
  pname = "clang-uml";
  version = "0.5.3";

  src = fetchFromGitHub {
    owner = "bkryza";
    repo = "clang-uml";
    rev = finalAttrs.version;
    hash = "sha256-ghnbOjVYw0zdFK/SDJ3sOObu6I7ROVNzYl1hovWju/Q=";
  };

  nativeBuildInputs = [
    cmake
    pkg-config
    installShellFiles
  ] ++ (if debug then [
    elfutils
    libunwind
  ] else [ ]);

  buildInputs = [
    clang
    libclang
    libllvm
    yaml-cpp
  ];

  cmakeFlags = if debug then [ "-DCMAKE_BUILD_TYPE=Debug" ] else [ ];

  clang = if enableLibcxx then llvmPackages.libcxxClang else llvmPackages.clang;

  postInstall = ''
    cp $out/bin/clang-uml $out/bin/clang-uml-unwrapped
    rm $out/bin/clang-uml
    export unwrapped_clang_uml="$out/bin/clang-uml-unwrapped"

    # inject clang and unwrapp_clang_uml variables into wrapper
    substituteAll ${./wrapper} $out/bin/clang-uml
    chmod +x $out/bin/clang-uml

    installShellCompletion --cmd clang-uml \
      --bash $src/packaging/autocomplete/clang-uml \
      --zsh $src/packaging/autocomplete/_clang-uml
  '';

  dontFixup = debug;
  dontStrip = debug;

  meta = with lib; {
    description = "Customizable automatic UML diagram generator for C++ based on Clang";
    longDescription = ''
      clang-uml is an automatic C++ to UML class, sequence, package and include diagram generator, driven by YAML configuration files.
      The main idea behind the project is to easily maintain up-to-date diagrams within a code-base or document legacy code.
      The configuration file or files for clang-uml define the types and contents of each generated diagram.
      The diagrams can be generated in PlantUML, MermaidJS and JSON formats.
    '';
    maintainers = with maintainers; [ eymeric ];
    homepage = "https://clang-uml.github.io/";
    license = licenses.asl20;
    platforms = platforms.all;
  };
})