about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/cc-wrapper/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-02-24 01:09:00 +0000
committerAlyssa Ross <hi@alyssa.is>2019-02-24 01:09:00 +0000
commit072c01a28f865e9487df09aed7ddff328252fb36 (patch)
tree6df6e652915940255f294ed8998cce1c4c7c2d40 /nixpkgs/pkgs/build-support/cc-wrapper/default.nix
parent024b46ff20027c15322e5d868ecec42632556d4b (diff)
parent969cff2691a02b3d7e5468beda26c482d8986644 (diff)
downloadnixlib-072c01a28f865e9487df09aed7ddff328252fb36.tar
nixlib-072c01a28f865e9487df09aed7ddff328252fb36.tar.gz
nixlib-072c01a28f865e9487df09aed7ddff328252fb36.tar.bz2
nixlib-072c01a28f865e9487df09aed7ddff328252fb36.tar.lz
nixlib-072c01a28f865e9487df09aed7ddff328252fb36.tar.xz
nixlib-072c01a28f865e9487df09aed7ddff328252fb36.tar.zst
nixlib-072c01a28f865e9487df09aed7ddff328252fb36.zip
Merge commit '969cff2691a02b3d7e5468beda26c482d8986644'
Diffstat (limited to 'nixpkgs/pkgs/build-support/cc-wrapper/default.nix')
-rw-r--r--nixpkgs/pkgs/build-support/cc-wrapper/default.nix14
1 files changed, 9 insertions, 5 deletions
diff --git a/nixpkgs/pkgs/build-support/cc-wrapper/default.nix b/nixpkgs/pkgs/build-support/cc-wrapper/default.nix
index c36181130478..176df51cbd9a 100644
--- a/nixpkgs/pkgs/build-support/cc-wrapper/default.nix
+++ b/nixpkgs/pkgs/build-support/cc-wrapper/default.nix
@@ -13,6 +13,7 @@
 , extraPackages ? [], extraBuildCommands ? ""
 , isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null
 , buildPackages ? {}
+, libcxx ? null
 }:
 
 with stdenvNoCC.lib;
@@ -44,8 +45,11 @@ let
   # The wrapper scripts use 'cat' and 'grep', so we may need coreutils.
   coreutils_bin = if nativeTools then "" else getBin coreutils;
 
-  default_cxx_stdlib_compile = optionalString (targetPlatform.isLinux && !(cc.isGNU or false) && !nativeTools && cc ? gcc)
-    "-isystem $(echo -n ${cc.gcc}/include/c++/*) -isystem $(echo -n ${cc.gcc}/include/c++/*)/$(${cc.gcc}/bin/gcc -dumpmachine)";
+  default_cxx_stdlib_compile = if (targetPlatform.isLinux && !(cc.isGNU or false) && !nativeTools && cc ? gcc) then
+    "-isystem $(echo -n ${cc.gcc}/include/c++/*) -isystem $(echo -n ${cc.gcc}/include/c++/*)/$(${cc.gcc}/bin/gcc -dumpmachine)"
+  else if targetPlatform.isDarwin && (libcxx != null) && (cc.isClang or false) then
+    "-isystem ${libcxx}/include/c++/v1"
+  else "";
 
   # The "infix salt" is a arbitrary string added in the middle of env vars
   # defined by cc-wrapper's hooks so that multiple cc-wrappers can be used
@@ -256,9 +260,9 @@ stdenv.mkDerivation {
 
       echo "$ccLDFlags" > $out/nix-support/cc-ldflags
       echo "$ccCFlags" > $out/nix-support/cc-cflags
-    ''
-
-    + optionalString propagateDoc ''
+    '' + optionalString (targetPlatform.isDarwin && (libcxx != null) && (cc.isClang or false)) ''
+      echo " -L${libcxx}/lib" >> $out/nix-support/cc-ldflags
+    '' + optionalString propagateDoc ''
       ##
       ## Man page and info support
       ##