From 893ba5d1b8442cca66f8109834261ac687c41938 Mon Sep 17 00:00:00 2001 From: Thomas Mader Date: Sat, 12 May 2018 12:22:14 +0200 Subject: [PATCH] ldc: wrap ldc2 binary with C compiler because it's needed for linking --- pkgs/development/compilers/ldc/default.nix | 24 ++++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/pkgs/development/compilers/ldc/default.nix b/pkgs/development/compilers/ldc/default.nix index 1fd839180c5..48301a8f287 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;