From 7672c68ed73a876e306cb04cd80f1c0e4b3c501f Mon Sep 17 00:00:00 2001 From: Johannes Bornhold <johannes@bornhold.name> Date: Fri, 25 Dec 2015 20:58:05 +0100 Subject: [PATCH] dmd: Avoid depending on gcc for the darwin build (close #11949) Adding stdenv.cc into the PATH, also setting CC, so that on Darwin clang will be used by default. Still allowing to use an existing value of CC if it is set already. Replacing __inline_isnanl with __inline_isnan on darwin since the former one was not defined. --- pkgs/development/compilers/dmd/default.nix | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pkgs/development/compilers/dmd/default.nix b/pkgs/development/compilers/dmd/default.nix index 1cd894372bb9..12e8745ece16 100644 --- a/pkgs/development/compilers/dmd/default.nix +++ b/pkgs/development/compilers/dmd/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, unzip, curl, makeWrapper, gcc }: +{ stdenv, fetchurl, unzip, curl, makeWrapper }: stdenv.mkDerivation { name = "dmd-2.067.1"; @@ -10,9 +10,15 @@ stdenv.mkDerivation { buildInputs = [ unzip curl makeWrapper ]; - # Allow to use "clang++", commented in Makefile postPatch = stdenv.lib.optionalString stdenv.isDarwin '' - substituteInPlace src/dmd/posix.mak --replace g++ clang++ + # Allow to use "clang++", commented in Makefile + substituteInPlace src/dmd/posix.mak \ + --replace g++ clang++ \ + --replace MACOSX_DEPLOYMENT_TARGET MACOSX_DEPLOYMENT_TARGET_ + + # Was not able to compile on darwin due to "__inline_isnanl" + # being undefined. + substituteInPlace src/dmd/root/port.c --replace __inline_isnanl __inline_isnan ''; # Buid and install are based on http://wiki.dlang.org/Building_DMD @@ -48,7 +54,9 @@ stdenv.mkDerivation { cp -r std $out/include/d2 cp -r etc $out/include/d2 - wrapProgram $out/bin/dmd --prefix PATH ":" "${gcc}/bin/" + wrapProgram $out/bin/dmd \ + --prefix PATH ":" "${stdenv.cc}/bin" \ + --set CC "$""{CC:-$CC""}" cd $out/bin tee dmd.conf << EOF