Merge pull request #273 from pogobanane/master
Nix package: add wrapper to fix stdlib includes
This commit is contained in:
@@ -4,8 +4,11 @@
|
||||
pkg-config,
|
||||
installShellFiles,
|
||||
libclang,
|
||||
clang,
|
||||
llvmPackages,
|
||||
libllvm,
|
||||
yaml-cpp,
|
||||
enableLibcxx ? false,
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
name = "clang-uml";
|
||||
@@ -18,12 +21,21 @@ stdenv.mkDerivation {
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
clang
|
||||
libclang
|
||||
libllvm
|
||||
yaml-cpp
|
||||
];
|
||||
|
||||
clang = if enableLibcxx then llvmPackages.libcxxClang else llvmPackages.clang;
|
||||
|
||||
postInstall = ''
|
||||
export unwrapped_clang_uml="$out/bin/clang-uml"
|
||||
|
||||
# inject clang and unwrapp_clang_uml variables into wrapper
|
||||
substituteAll ${./wrapper} $out/bin/clang-uml-wrapped
|
||||
chmod +x $out/bin/clang-uml-wrapped
|
||||
|
||||
installShellCompletion --bash $src/packaging/autocomplete/clang-uml
|
||||
installShellCompletion --zsh $src/packaging/autocomplete/_clang-uml
|
||||
'';
|
||||
|
||||
31
packaging/nix/wrapper
Normal file
31
packaging/nix/wrapper
Normal file
@@ -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@ "$@"
|
||||
Reference in New Issue
Block a user