diff options
author | Tobias Mayer <tobim@fastmail.fm> | 2018-03-28 12:13:04 +0200 |
---|---|---|
committer | Tobias Mayer <tobim@fastmail.fm> | 2018-03-28 12:13:04 +0200 |
commit | 04f3b76dcec21f2fcba6b1b0afbb3ed224165050 (patch) | |
tree | 2617f1888616f118f7e94b67b669d3e0f6dc133e /pkgs/development | |
parent | 4930caae80618ff9f7e752d40efb4acc809eb463 (diff) | |
download | nixlib-04f3b76dcec21f2fcba6b1b0afbb3ed224165050.tar nixlib-04f3b76dcec21f2fcba6b1b0afbb3ed224165050.tar.gz nixlib-04f3b76dcec21f2fcba6b1b0afbb3ed224165050.tar.bz2 nixlib-04f3b76dcec21f2fcba6b1b0afbb3ed224165050.tar.lz nixlib-04f3b76dcec21f2fcba6b1b0afbb3ed224165050.tar.xz nixlib-04f3b76dcec21f2fcba6b1b0afbb3ed224165050.tar.zst nixlib-04f3b76dcec21f2fcba6b1b0afbb3ed224165050.zip |
cquery: extended wrapper
Use NIX_CFLAGS_COMPILE to find additional include paths.
Diffstat (limited to 'pkgs/development')
-rw-r--r-- | pkgs/development/tools/misc/cquery/default.nix | 15 | ||||
-rw-r--r-- | pkgs/development/tools/misc/cquery/wrapper | 12 |
2 files changed, 23 insertions, 4 deletions
diff --git a/pkgs/development/tools/misc/cquery/default.nix b/pkgs/development/tools/misc/cquery/default.nix index 31f6cbd8093b..09220b2dc651 100644 --- a/pkgs/development/tools/misc/cquery/default.nix +++ b/pkgs/development/tools/misc/cquery/default.nix @@ -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; }; } diff --git a/pkgs/development/tools/misc/cquery/wrapper b/pkgs/development/tools/misc/cquery/wrapper new file mode 100644 index 000000000000..f0bea41536d0 --- /dev/null +++ b/pkgs/development/tools/misc/cquery/wrapper @@ -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[@]}" "$@" |