2018-07-21 01:44:44 +01:00
|
|
|
{ fetchFromGitHub, makeWrapper
|
2018-03-25 23:02:06 +01:00
|
|
|
, cmake, llvmPackages, ncurses }:
|
|
|
|
|
|
|
|
let
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "cquery-project";
|
|
|
|
repo = "cquery";
|
2018-10-16 16:39:08 +01:00
|
|
|
rev = "a95a6503d68a85baa25465ce147b7fc20f4a552e";
|
|
|
|
sha256 = "0rxbdln7dqkdw4q8rhclssgwypq16g9flkwmaabsr8knckbszxrx";
|
2018-03-25 23:02:06 +01:00
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
stdenv = llvmPackages.stdenv;
|
|
|
|
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "cquery-${version}";
|
2018-10-16 16:39:08 +01:00
|
|
|
version = "2018-10-14";
|
2018-03-25 23:02:06 +01:00
|
|
|
|
|
|
|
inherit src;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake makeWrapper ];
|
|
|
|
buildInputs = with llvmPackages; [ clang clang-unwrapped llvm ncurses ];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DSYSTEM_CLANG=ON"
|
|
|
|
"-DCLANG_CXX=ON"
|
2018-08-09 00:31:15 +01:00
|
|
|
"-DCMAKE_OSX_DEPLOYMENT_TARGET=10.12"
|
2018-03-25 23:02:06 +01:00
|
|
|
];
|
|
|
|
|
2018-03-28 11:13:04 +01:00
|
|
|
shell = stdenv.shell;
|
2018-03-25 23:02:06 +01:00
|
|
|
postFixup = ''
|
|
|
|
# We need to tell cquery where to find the standard library headers.
|
|
|
|
|
2018-10-16 16:39:08 +01:00
|
|
|
standard_library_includes="\\\"-isystem\\\", \\\"${stdenv.lib.getDev stdenv.cc.libc}/include\\\""
|
2018-03-28 11:13:04 +01:00
|
|
|
standard_library_includes+=", \\\"-isystem\\\", \\\"${llvmPackages.libcxx}/include/c++/v1\\\""
|
|
|
|
export standard_library_includes
|
2018-03-25 23:02:06 +01:00
|
|
|
|
2018-03-28 11:13:04 +01:00
|
|
|
wrapped=".cquery-wrapped"
|
|
|
|
export wrapped
|
|
|
|
|
|
|
|
mv $out/bin/cquery $out/bin/$wrapped
|
|
|
|
substituteAll ${./wrapper} $out/bin/cquery
|
|
|
|
chmod --reference=$out/bin/$wrapped $out/bin/cquery
|
2018-03-25 23:02:06 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
pushd ${src}
|
|
|
|
$out/bin/cquery --ci --test-unit
|
2018-08-09 00:31:15 +01:00
|
|
|
|
|
|
|
# The integration tests have to be disabled because cquery ignores `--init`
|
|
|
|
# if they are invoked, which means it won't find the system includes.
|
|
|
|
#$out/bin/cquery --ci --test-index
|
2018-03-25 23:02:06 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "A c/c++ language server powered by libclang";
|
|
|
|
homepage = https://github.com/cquery-project/cquery;
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
|
|
maintainers = [ maintainers.tobim ];
|
|
|
|
};
|
|
|
|
}
|