Merge pull request #120229 from cmm/fix-clangd-wrapper
fix clangd wrapper
This commit is contained in:
commit
3926c6ffe8
|
@ -1,22 +1,22 @@
|
||||||
{ lib, stdenv, llvmPackages }:
|
{ lib, stdenv, llvmPackages }:
|
||||||
|
|
||||||
let
|
let
|
||||||
clang = llvmPackages.clang-unwrapped;
|
unwrapped = llvmPackages.clang-unwrapped;
|
||||||
|
|
||||||
in stdenv.mkDerivation {
|
in stdenv.mkDerivation {
|
||||||
pname = "clang-tools";
|
pname = "clang-tools";
|
||||||
version = lib.getVersion clang;
|
version = lib.getVersion unwrapped;
|
||||||
|
|
||||||
dontUnpack = true;
|
dontUnpack = true;
|
||||||
|
|
||||||
|
clang = llvmPackages.clang;
|
||||||
|
inherit unwrapped;
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
|
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
export libc_includes="${lib.getDev stdenv.cc.libc}/include"
|
|
||||||
export libcpp_includes="${llvmPackages.libcxx}/include/c++/v1"
|
|
||||||
|
|
||||||
export clang=${clang}
|
|
||||||
substituteAll ${./wrapper} $out/bin/clangd
|
substituteAll ${./wrapper} $out/bin/clangd
|
||||||
chmod +x $out/bin/clangd
|
chmod +x $out/bin/clangd
|
||||||
for tool in \
|
for tool in \
|
||||||
|
@ -32,7 +32,7 @@ in stdenv.mkDerivation {
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = clang.meta // {
|
meta = unwrapped.meta // {
|
||||||
description = "Standalone command line tools for C++ development";
|
description = "Standalone command line tools for C++ development";
|
||||||
maintainers = with lib.maintainers; [ aherrmann ];
|
maintainers = with lib.maintainers; [ aherrmann ];
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,20 +1,27 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
buildcpath() {
|
buildcpath() {
|
||||||
local path
|
local path after
|
||||||
while (( $# )); do
|
while (( $# )); do
|
||||||
case $1 in
|
case $1 in
|
||||||
-isystem)
|
-isystem)
|
||||||
shift
|
shift
|
||||||
path=$path${path:+':'}$1
|
path=$path${path:+':'}$1
|
||||||
|
;;
|
||||||
|
-idirafter)
|
||||||
|
shift
|
||||||
|
after=$after${after:+':'}$1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
echo $path
|
echo $path${after:+':'}$after
|
||||||
}
|
}
|
||||||
|
|
||||||
export CPATH=${CPATH}${CPATH:+':'}$(buildcpath ${NIX_CFLAGS_COMPILE})
|
export CPATH=${CPATH}${CPATH:+':'}$(buildcpath ${NIX_CFLAGS_COMPILE} \
|
||||||
export CPATH=${CPATH}${CPATH:+':'}@libc_includes@
|
$(<@clang@/nix-support/libc-cflags))
|
||||||
export CPLUS_INCLUDE_PATH=${CPATH}${CPATH:+':'}@libcpp_includes@
|
export CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}${CPLUS_INCLUDE_PATH:+':'}$(buildcpath ${NIX_CFLAGS_COMPILE} \
|
||||||
|
$(<@clang@/nix-support/libcxx-cxxflags) \
|
||||||
|
$(<@clang@/nix-support/libc-cflags))
|
||||||
|
|
||||||
exec -a "$0" @clang@/bin/$(basename $0) "$@"
|
exec -a "$0" @unwrapped@/bin/$(basename $0) "$@"
|
||||||
|
|
Loading…
Reference in New Issue