about summary refs log tree commit diff
path: root/pkgs/development/compilers/ldc
diff options
context:
space:
mode:
authorThomas Mader <thomas.mader@gmail.com>2018-05-12 12:22:14 +0200
committerThomas Mader <thomas.mader@gmail.com>2018-05-19 23:16:55 +0200
commit893ba5d1b8442cca66f8109834261ac687c41938 (patch)
tree03532d17cb5a44621c3dd4e924b11def955cecda /pkgs/development/compilers/ldc
parentfe2deeb4584e7da1d7018d74ec659fa6a0357e45 (diff)
downloadnixlib-893ba5d1b8442cca66f8109834261ac687c41938.tar
nixlib-893ba5d1b8442cca66f8109834261ac687c41938.tar.gz
nixlib-893ba5d1b8442cca66f8109834261ac687c41938.tar.bz2
nixlib-893ba5d1b8442cca66f8109834261ac687c41938.tar.lz
nixlib-893ba5d1b8442cca66f8109834261ac687c41938.tar.xz
nixlib-893ba5d1b8442cca66f8109834261ac687c41938.tar.zst
nixlib-893ba5d1b8442cca66f8109834261ac687c41938.zip
ldc: wrap ldc2 binary with C compiler because it's needed for linking
Diffstat (limited to 'pkgs/development/compilers/ldc')
-rw-r--r--pkgs/development/compilers/ldc/default.nix24
1 files changed, 15 insertions, 9 deletions
diff --git a/pkgs/development/compilers/ldc/default.nix b/pkgs/development/compilers/ldc/default.nix
index 1fd839180c56..48301a8f2874 100644
--- a/pkgs/development/compilers/ldc/default.nix
+++ b/pkgs/development/compilers/ldc/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchgit, fetchurl, cmake, llvm, curl, tzdata
 , python, libconfig, lit, gdb, unzip, darwin, bash
-, callPackage
+, callPackage, makeWrapper, targetPackages
 , bootstrapVersion ? false
 , version ? "1.8.0"
 , ldcSha256 ? "0zswjlibj8zcdj06nn09jjhbd99chsa5f4kps8xifzgrpgsa28g4"
@@ -124,7 +124,7 @@ let
             --replace "tzName == \"+VERSION\"" "baseName(tzName) == \"leapseconds\" || tzName == \"+VERSION\""
     '';
 
-    nativeBuildInputs = [ cmake llvm bootstrapLdc python lit gdb unzip ]
+    nativeBuildInputs = [ cmake makeWrapper llvm bootstrapLdc python lit gdb unzip ]
 
     ++ stdenv.lib.optional (bootstrapVersion) [
       libconfig
@@ -135,7 +135,7 @@ let
     ]);
 
 
-    buildInputs = [ curl tzdata stdenv.cc ];
+    buildInputs = [ curl tzdata ];
 
     preConfigure = ''
       cmakeFlagsArray=("-DINCLUDE_INSTALL_DIR=$out/include/dlang/ldc"
@@ -158,14 +158,20 @@ let
     doCheck = true;
 
     checkPhase = ''
-	# Build and run LDC D unittests.
-	ctest --output-on-failure -R "ldc2-unittest"
-	# Run LIT testsuite.
-	ctest -V -R "lit-tests"
-	# Run DMD testsuite.
-	DMD_TESTSUITE_MAKE_ARGS=-j$NIX_BUILD_CORES ctest -V -R "dmd-testsuite"
+      # Build and run LDC D unittests.
+      ctest --output-on-failure -R "ldc2-unittest"
+      # Run LIT testsuite.
+      ctest -V -R "lit-tests"
+      # Run DMD testsuite.
+      DMD_TESTSUITE_MAKE_ARGS=-j$NIX_BUILD_CORES ctest -V -R "dmd-testsuite"
     '';
 
+    postInstall = ''
+      wrapProgram $out/bin/ldc2 \
+          --prefix PATH ":" "${targetPackages.stdenv.cc}/bin" \
+          --set-default CC "${targetPackages.stdenv.cc}/bin/cc"
+     '';
+
     meta = with stdenv.lib; {
       description = "The LLVM-based D compiler";
       homepage = https://github.com/ldc-developers/ldc;