git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commit7672c68ed73a876e306cb04cd80f1c0e4b3c501f authorJohannes Bornhold <johannes@bornhold.name> dateFri 25 Dec 2015, 20:58 (11 years ago) parent250133c
1 file changed+12−4
pkgs/development/compilers/dmd/default.nix+12−4
pkgs/development/compilers/dmd/default.nix+12−4
@@ -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