ccls: fix libc++ header path
This commit is contained in:
parent
6e72346fc3
commit
eef236e8ef
2 changed files with 8 additions and 17 deletions
|
@ -21,17 +21,11 @@ stdenv.mkDerivation rec {
|
|||
cmakeFlagsArray+=(-DCMAKE_CXX_FLAGS="-fvisibility=hidden -fno-rtti")
|
||||
'';
|
||||
|
||||
clang = llvmPackages.clang;
|
||||
shell = runtimeShell;
|
||||
|
||||
postFixup = ''
|
||||
# We need to tell ccls where to find the standard library headers.
|
||||
|
||||
standard_library_includes="\\\"-isystem\\\", \\\"${lib.getDev stdenv.cc.libc}/include\\\""
|
||||
standard_library_includes+=", \\\"-isystem\\\", \\\"${llvmPackages.libcxx}/include/c++/v1\\\""
|
||||
export standard_library_includes
|
||||
|
||||
wrapped=".ccls-wrapped"
|
||||
export wrapped
|
||||
|
||||
export wrapped=".ccls-wrapped"
|
||||
mv $out/bin/ccls $out/bin/$wrapped
|
||||
substituteAll ${./wrapper} $out/bin/ccls
|
||||
chmod --reference=$out/bin/$wrapped $out/bin/ccls
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
#! @shell@ -e
|
||||
|
||||
initString="--init={\"clang\":{\"extraArgs\": [@standard_library_includes@"
|
||||
|
||||
if [ "${NIX_CFLAGS_COMPILE}" != "" ]; then
|
||||
read -a cflags_array <<< ${NIX_CFLAGS_COMPILE}
|
||||
initString+=$(printf ', \"%s\"' "${cflags_array[@]}")
|
||||
fi
|
||||
|
||||
initString+="]}}"
|
||||
printf -v extraArgs ',\"%s\"' \
|
||||
$(cat @clang@/nix-support/libc-cflags \
|
||||
@clang@/nix-support/libcxx-cxxflags) \
|
||||
${NIX_CFLAGS_COMPILE}
|
||||
initString="--init={\"clang\":{\"extraArgs\":[${extraArgs:1}]}}"
|
||||
|
||||
exec -a "$0" "@out@/bin/@wrapped@" "${initString}" "$@"
|
||||
|
|
Loading…
Reference in a new issue