@@ -1,12 +1,12 @@
11{ stdenv, fetchFromGitHub, overrideCC, gcc5
22, makeWrapper, unzip, which
33, curl, tzdata, gdb, darwin
4−, callPackage
4+, callPackage, targetPackages
55, bootstrapVersion ? false
6−, version ? "2.079.0"
7−, dmdSha256 ? "1k6cky71pqnss6h6391p1ich2mjs598f5fda018aygnxg87qgh4y"
8−, druntimeSha256 ? "183pqygj5w4105czs5kswyjn9mrcybx3wmkynz3in0m3ylzzjmvl"
9−, phobosSha256 ? "0y9i86ggmf41ww2xk2bsrlsv9b1blj5dbyan6q6r6xp8dmgrd79w"
6+, version ? "2.079.1"
7+, dmdSha256 ? "0mlk095aw94d940qkymfp85daggiz3f0xv598nlc7acgp6408kyj"
8+, druntimeSha256 ? "18r8gwvb54ar80j5155wx0qbqq4w56hqmbf6wap20xwijg2rw90g"
9+, phobosSha256 ? "1x5v1ln51nr8x2vyki864160bakdyq0acmvbfv7jcipaj2w3m9bb"
1010}:
1111
1212let
@@ -143,6 +143,9 @@ let
143143 + stdenv.lib.optionalString (stdenv.hostPlatform.isLinux && bootstrapVersion) ''
144144 substituteInPlace ${dmdPath}/root/port.c \
145145 --replace "#include <bits/mathdef.h>" "#include <complex.h>"
146+
147+ substituteInPlace ${dmdPath}/root/port.c \
148+ --replace "#include <bits/nan.h>" "#include <math.h>"
146149 ''
147150
148151 + stdenv.lib.optionalString stdenv.hostPlatform.isDarwin ''
@@ -198,6 +201,8 @@ let
198201
199202 extension = if stdenv.hostPlatform.isDarwin then "a" else "{a,so}";
200203
204+ dontStrip = true;
205+
201206 installPhase = ''
202207 cd dmd
203208 mkdir $out
@@ -222,13 +227,13 @@ let
222227 cp -r etc $out/include/d2
223228
224229 wrapProgram $out/bin/dmd \
225− --prefix PATH ":" "${stdenv.cc}/bin" \
226− --set-default CC "$CC"
230+ --prefix PATH ":" "${targetPackages.stdenv.cc}/bin" \
231+ --set-default CC "${targetPackages.stdenv.cc}/bin/cc"
227232
228233 cd $out/bin
229234 tee dmd.conf << EOF
230235 [Environment]
231− DFLAGS=-I$out/include/d2 -L-L$out/lib ${stdenv.lib.optionalString (!stdenv.cc.isClang) "-L--export-dynamic"} -fPIC
236+ DFLAGS=-I$out/include/d2 -L-L$out/lib ${stdenv.lib.optionalString (!targetPackages.stdenv.cc.isClang) "-L--export-dynamic"} -fPIC
232237 EOF
233238 '';
234239