git.iko.soy/typeable/nixpkgs
on master help sign in
cquery: extended wrapper

Use NIX_CFLAGS_COMPILE to find additional include paths.

commit04f3b76dcec21f2fcba6b1b0afbb3ed224165050 authorTobias Mayer <tobim@fastmail.fm> dateWed 28 Mar 2018, 12:13 (9 years ago) parent4930caa
2 files changed+23−4
pkgs/development/tools/misc/cquery/default.nix+11−4 pkgs/development/tools/misc/cquery/wrapper+12
pkgs/development/tools/misc/cquery/default.nix+11−4
@@ -27,14 +27,20 @@ stdenv.mkDerivation rec {
2727 "-DCLANG_CXX=ON"
2828 ];
2929
30+ shell = stdenv.shell;
3031 postFixup = ''
3132 # We need to tell cquery where to find the standard library headers.
3233
33− args="\"-isystem\", \"${if (stdenv.hostPlatform.libc == "glibc") then stdenv.cc.libc.dev else stdenv.cc.libc}/include\""
34− args+=", \"-isystem\", \"${llvmPackages.libcxx}/include/c++/v1\""
34+ standard_library_includes="\\\"-isystem\\\", \\\"${if (stdenv.hostPlatform.libc == "glibc") then stdenv.cc.libc.dev else stdenv.cc.libc}/include\\\""
35+ standard_library_includes+=", \\\"-isystem\\\", \\\"${llvmPackages.libcxx}/include/c++/v1\\\""
36+ export standard_library_includes
3537
36− wrapProgram $out/bin/cquery \
37− --add-flags "'"'--init={"extraClangArguments": ['"''${args}"']}'"'"
38+ wrapped=".cquery-wrapped"
39+ export wrapped
40+
41+ mv $out/bin/cquery $out/bin/$wrapped
42+ substituteAll ${./wrapper} $out/bin/cquery
43+ chmod --reference=$out/bin/$wrapped $out/bin/cquery
3844 '';
3945
4046 doInstallCheck = true;
@@ -50,5 +56,6 @@ stdenv.mkDerivation rec {
5056 license = licenses.mit;
5157 platforms = platforms.linux ++ platforms.darwin;
5258 maintainers = [ maintainers.tobim ];
59+ priority = 3;
5360 };
5461}
pkgs/development/tools/misc/cquery/wrappernew file+12
@@ -0,0 +1,12 @@
1+#! @shell@ -e
2+
3+initString="--init={\"extraClangArguments\": [@standard_library_includes@"
4+
5+if [ "${NIX_CFLAGS_COMPILE}" != "" ]; then
6+ read -a cflags_array <<< ${NIX_CFLAGS_COMPILE}
7+ initString+=$(printf ', \"%s\"' "${cflags_array[@]}")
8+fi
9+
10+initString+="]}"
11+
12+exec -a "$0" "@out@/bin/@wrapped@" "${initString}" "${extraFlagsArray[@]}" "$@"