From eef236e8efdf99e4e4d61815aa9889e5b64e6bc3 Mon Sep 17 00:00:00 2001 From: Gabriel Ebner Date: Mon, 24 May 2021 12:39:15 +0200 Subject: [PATCH] ccls: fix libc++ header path --- pkgs/development/tools/misc/ccls/default.nix | 12 +++--------- pkgs/development/tools/misc/ccls/wrapper | 13 +++++-------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/pkgs/development/tools/misc/ccls/default.nix b/pkgs/development/tools/misc/ccls/default.nix index 986363b83ef3..bd753016fc8b 100644 --- a/pkgs/development/tools/misc/ccls/default.nix +++ b/pkgs/development/tools/misc/ccls/default.nix @@ -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 diff --git a/pkgs/development/tools/misc/ccls/wrapper b/pkgs/development/tools/misc/ccls/wrapper index 155e6d4f6474..c92bc6b40d1a 100644 --- a/pkgs/development/tools/misc/ccls/wrapper +++ b/pkgs/development/tools/misc/ccls/wrapper @@ -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}" "$@"