ldc: wrap ldc2 binary with C compiler because it's needed for linking

This commit is contained in:
Thomas Mader 2018-05-12 12:22:14 +02:00
parent fe2deeb458
commit 893ba5d1b8
1 changed files with 15 additions and 9 deletions

View File

@ -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;