2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub
|
2020-04-24 23:36:52 +00:00
|
|
|
, cmake, llvmPackages, rapidjson, runtimeShell }:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "ccls";
|
2021-02-24 18:30:23 +00:00
|
|
|
version = "0.20201219";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "MaskRay";
|
|
|
|
repo = "ccls";
|
|
|
|
rev = version;
|
2021-02-24 18:30:23 +00:00
|
|
|
sha256 = "sha256-qCZYSzUh5WBQxMX6LtWRBz0VWnZVNR4v06aH9bJIb1o=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
buildInputs = with llvmPackages; [ clang-unwrapped llvm rapidjson ];
|
|
|
|
|
|
|
|
cmakeFlags = [ "-DCCLS_VERSION=${version}" ];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
cmakeFlagsArray+=(-DCMAKE_CXX_FLAGS="-fvisibility=hidden -fno-rtti")
|
|
|
|
'';
|
|
|
|
|
|
|
|
shell = runtimeShell;
|
|
|
|
postFixup = ''
|
|
|
|
# We need to tell ccls where to find the standard library headers.
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
standard_library_includes="\\\"-isystem\\\", \\\"${lib.getDev stdenv.cc.libc}/include\\\""
|
2020-04-24 23:36:52 +00:00
|
|
|
standard_library_includes+=", \\\"-isystem\\\", \\\"${llvmPackages.libcxx}/include/c++/v1\\\""
|
|
|
|
export standard_library_includes
|
|
|
|
|
|
|
|
wrapped=".ccls-wrapped"
|
|
|
|
export wrapped
|
|
|
|
|
|
|
|
mv $out/bin/ccls $out/bin/$wrapped
|
|
|
|
substituteAll ${./wrapper} $out/bin/ccls
|
|
|
|
chmod --reference=$out/bin/$wrapped $out/bin/ccls
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A c/c++ language server powered by clang";
|
|
|
|
homepage = "https://github.com/MaskRay/ccls";
|
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
|
|
maintainers = with maintainers; [ mic92 tobim ];
|
|
|
|
};
|
|
|
|
}
|