@@ -1,4 +1,4 @@
1−{ stdenv, fetchurl, unzip, curl, makeWrapper, gcc }:
1+{ stdenv, fetchurl, unzip, curl, makeWrapper }:
22
33stdenv.mkDerivation {
44 name = "dmd-2.067.1";
@@ -10,9 +10,15 @@ stdenv.mkDerivation {
1010
1111 buildInputs = [ unzip curl makeWrapper ];
1212
13− # Allow to use "clang++", commented in Makefile
1413 postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
15− substituteInPlace src/dmd/posix.mak --replace g++ clang++
14+ # Allow to use "clang++", commented in Makefile
15+ substituteInPlace src/dmd/posix.mak \
16+ --replace g++ clang++ \
17+ --replace MACOSX_DEPLOYMENT_TARGET MACOSX_DEPLOYMENT_TARGET_
18+
19+ # Was not able to compile on darwin due to "__inline_isnanl"
20+ # being undefined.
21+ substituteInPlace src/dmd/root/port.c --replace __inline_isnanl __inline_isnan
1622 '';
1723
1824 # Buid and install are based on http://wiki.dlang.org/Building_DMD
@@ -48,7 +54,9 @@ stdenv.mkDerivation {
4854 cp -r std $out/include/d2
4955 cp -r etc $out/include/d2
5056
51− wrapProgram $out/bin/dmd --prefix PATH ":" "${gcc}/bin/"
57+ wrapProgram $out/bin/dmd \
58+ --prefix PATH ":" "${stdenv.cc}/bin" \
59+ --set CC "$""{CC:-$CC""}"
5260
5361 cd $out/bin
5462 tee dmd.conf << EOF