mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-12 03:56:17 +03:00
cquery: extended wrapper
Use NIX_CFLAGS_COMPILE to find additional include paths.
This commit is contained in:
parent
4930caae80
commit
04f3b76dce
@ -27,14 +27,20 @@ stdenv.mkDerivation rec {
|
||||
"-DCLANG_CXX=ON"
|
||||
];
|
||||
|
||||
shell = stdenv.shell;
|
||||
postFixup = ''
|
||||
# We need to tell cquery where to find the standard library headers.
|
||||
|
||||
args="\"-isystem\", \"${if (stdenv.hostPlatform.libc == "glibc") then stdenv.cc.libc.dev else stdenv.cc.libc}/include\""
|
||||
args+=", \"-isystem\", \"${llvmPackages.libcxx}/include/c++/v1\""
|
||||
standard_library_includes="\\\"-isystem\\\", \\\"${if (stdenv.hostPlatform.libc == "glibc") then stdenv.cc.libc.dev else stdenv.cc.libc}/include\\\""
|
||||
standard_library_includes+=", \\\"-isystem\\\", \\\"${llvmPackages.libcxx}/include/c++/v1\\\""
|
||||
export standard_library_includes
|
||||
|
||||
wrapProgram $out/bin/cquery \
|
||||
--add-flags "'"'--init={"extraClangArguments": ['"''${args}"']}'"'"
|
||||
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
|
||||
'';
|
||||
|
||||
doInstallCheck = true;
|
||||
@ -50,5 +56,6 @@ stdenv.mkDerivation rec {
|
||||
license = licenses.mit;
|
||||
platforms = platforms.linux ++ platforms.darwin;
|
||||
maintainers = [ maintainers.tobim ];
|
||||
priority = 3;
|
||||
};
|
||||
}
|
||||
|
12
pkgs/development/tools/misc/cquery/wrapper
Normal file
12
pkgs/development/tools/misc/cquery/wrapper
Normal file
@ -0,0 +1,12 @@
|
||||
#! @shell@ -e
|
||||
|
||||
initString="--init={\"extraClangArguments\": [@standard_library_includes@"
|
||||
|
||||
if [ "${NIX_CFLAGS_COMPILE}" != "" ]; then
|
||||
read -a cflags_array <<< ${NIX_CFLAGS_COMPILE}
|
||||
initString+=$(printf ', \"%s\"' "${cflags_array[@]}")
|
||||
fi
|
||||
|
||||
initString+="]}"
|
||||
|
||||
exec -a "$0" "@out@/bin/@wrapped@" "${initString}" "${extraFlagsArray[@]}" "$@"
|
Loading…
Reference in New Issue
Block a user