Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-uml: init at 0.5.1 #304749

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions pkgs/by-name/cl/clang-uml/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,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.2";

src = fetchFromGitHub {
owner = "bkryza";
repo = "clang-uml";
rev = finalAttrs.version;
hash = "sha256-ZVaMLsI1FK05xFfMmlLBPop7DR3fDstnfgjdBmsjNBA=";
};

hatch01 marked this conversation as resolved.
Show resolved Hide resolved
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
'';

hatch01 marked this conversation as resolved.
Show resolved Hide resolved
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;
};
})
31 changes: 31 additions & 0 deletions pkgs/by-name/cl/clang-uml/wrapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh
# This file is copied from https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/clang-tools/wrapper
# The clang-tools wrapper is commonly used together with the clang package on
# nix, because without the wrapper, clang tools fail to find stdlib includes on
# nix.

buildcpath() {
local path after
while (( $# )); do
case $1 in
-isystem)
shift
path=$path${path:+':'}$1
;;
-idirafter)
shift
after=$after${after:+':'}$1
;;
esac
shift
done
echo $path${after:+':'}$after
}

export CPATH=${CPATH}${CPATH:+':'}$(buildcpath ${NIX_CFLAGS_COMPILE} \
$(<@clang@/nix-support/libc-cflags)):@clang@/resource-root/include
export CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}${CPLUS_INCLUDE_PATH:+':'}$(buildcpath ${NIX_CFLAGS_COMPILE} \
$(<@clang@/nix-support/libcxx-cxxflags) \
$(<@clang@/nix-support/libc-cflags)):@clang@/resource-root/include

exec @unwrapped_clang_uml@ "$@"