acr-cli: init at 0.14 (#359508)
[NixPkgs.git] / pkgs / by-name / cl / clang-uml / package.nix
blob736f4eb787c87965ae347281d8d5382f56b40351
2   lib,
3   fetchFromGitHub,
4   stdenv,
5   cmake,
6   pkg-config,
7   installShellFiles,
8   libclang,
9   llvmPackages,
10   libllvm,
11   yaml-cpp,
12   elfutils,
13   libunwind,
14   versionCheckHook,
15   enableLibcxx ? false,
16   debug ? false,
18 stdenv.mkDerivation (finalAttrs: {
19   pname = "clang-uml";
20   version = "0.5.6";
22   src = fetchFromGitHub {
23     owner = "bkryza";
24     repo = "clang-uml";
25     rev = finalAttrs.version;
26     hash = "sha256-fsN9l5sgQ9NIjS0Tn/tAUK/p2mdP7/R7a9BFb+9I0UU=";
27   };
29   nativeBuildInputs =
30     [
31       cmake
32       pkg-config
33       installShellFiles
34     ]
35     ++ (
36       if debug then
37         [
38           elfutils
39           libunwind
40         ]
41       else
42         [ ]
43     );
45   cmakeFlags = [
46     "-DCUSTOM_COMPILE_OPTIONS=-Wno-error=sign-compare"
47     "-DGIT_VERSION=${finalAttrs.version}"
48   ];
50   buildInputs = [
51     libclang
52     libllvm
53     yaml-cpp
54   ];
56   cmakeBuildType = if debug then "Debug" else "Release";
58   clang = if enableLibcxx then llvmPackages.libcxxClang else llvmPackages.clang;
60   postInstall = ''
61     cp $out/bin/clang-uml $out/bin/clang-uml-unwrapped
62     rm $out/bin/clang-uml
63     export unwrapped_clang_uml="$out/bin/clang-uml-unwrapped"
65     # inject clang and unwrapp_clang_uml variables into wrapper
66     substituteAll ${./wrapper} $out/bin/clang-uml
67     chmod +x $out/bin/clang-uml
69     installShellCompletion --cmd clang-uml \
70       --bash $src/packaging/autocomplete/clang-uml \
71       --zsh $src/packaging/autocomplete/_clang-uml
72   '';
74   dontFixup = debug;
75   dontStrip = debug;
77   nativeInstallCheckInputs = [ versionCheckHook ];
78   doInstallCheck = true;
79   versionCheckProgramArg = "--version";
81   meta = {
82     description = "Customizable automatic UML diagram generator for C++ based on Clang";
83     longDescription = ''
84       clang-uml is an automatic C++ to UML class, sequence, package and include diagram generator, driven by YAML configuration files.
85       The main idea behind the project is to easily maintain up-to-date diagrams within a code-base or document legacy code.
86       The configuration file or files for clang-uml define the types and contents of each generated diagram.
87       The diagrams can be generated in PlantUML, MermaidJS and JSON formats.
88     '';
89     maintainers = with lib.maintainers; [ eymeric ];
90     homepage = "https://clang-uml.github.io/";
91     license = lib.licenses.asl20;
92     platforms = lib.platforms.all;
93     mainProgram = "clang-uml";
94   };