dtools: refactor

o  switch to using finalAttrs pattern over rec expression in
    mkDerivation call
 o  use hash over sha256 in calls to fetchers
 o  remove the build-time dependency on gnumake42; dtools now builds
    fine with the latest version of GNU make
 o  use stdenv's implicit phases that build+install with make
 o  specify make flags through makeFlags rather than through an
    arbitrary attribute
 o  remove unnecessary make flags
 o  build with parallelism
 o  use checkTarget instead of providing a full checkPhase
 o  clean up meta
This commit is contained in:
Jeremy Baxter 2024-04-02 17:20:43 +13:00
parent d1fec21f64
commit b01c88e620
2 changed files with 39 additions and 25 deletions

View File

@ -0,0 +1,11 @@
--- a/rdmd_test.d
+++ b/rdmd_test.d
@@ -616,7 +616,7 @@ void runTests(string rdmdApp, string compiler, string model)
enforce(res.status == 1, res.output);
}
- version (Posix)
+ version (none)
{
import std.conv : to;
auto makeVersion = execute(["make", "--version"]).output.splitLines()[0];

View File

@ -1,51 +1,54 @@
{ stdenv, lib, fetchFromGitHub, fetchpatch, ldc, curl, gnumake42 }:
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, ldc
, curl
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "dtools";
version = "2.106.1";
src = fetchFromGitHub {
owner = "dlang";
repo = "tools";
rev = "v${version}";
sha256 = "sha256-Y8jSwd6tldCnq3yEuO/xUYrSV+lp7tBPMiheMA06f0M=";
rev = "v${finalAttrs.version}";
hash = "sha256-Y8jSwd6tldCnq3yEuO/xUYrSV+lp7tBPMiheMA06f0M=";
name = "dtools";
};
patches = [
# Disable failing tests
./disabled-tests.diff
# Fix LDC arm64 build
(fetchpatch {
# part of https://github.com/dlang/tools/pull/441
url = "https://github.com/dlang/tools/commit/6c6a042d1b08e3ec1790bd07a7f69424625ee866.patch"; # Fix LDC arm64 build
sha256 = "sha256-x6EclTYN1Y5FG57KLhbBK0BZicSYcZoWO7MTVcP4T18=";
url = "https://github.com/dlang/tools/commit/6c6a042d1b08e3ec1790bd07a7f69424625ee866.patch";
hash = "sha256-x6EclTYN1Y5FG57KLhbBK0BZicSYcZoWO7MTVcP4T18=";
})
];
nativeBuildInputs = [ ldc gnumake42 ]; # fails with make 4.4
nativeBuildInputs = [ ldc ];
buildInputs = [ curl ];
makeCmd = ''
make -f posix.mak all DMD_DIR=dmd DMD=${ldc.out}/bin/ldmd2 CC=${stdenv.cc}/bin/cc
'';
makeFlags = [
"-fposix.mak"
"CC=${stdenv.cc}/bin/cc"
"DMD=${ldc.out}/bin/ldmd2"
"INSTALL_DIR=$(out)"
];
buildPhase = ''
$makeCmd
'';
enableParallelBuilding = true;
doCheck = true;
checkPhase = ''
$makeCmd test_rdmd
'';
installPhase = ''
$makeCmd INSTALL_DIR=$out install
'';
checkTarget = "test_rdmd";
meta = with lib; {
description = "Ancillary tools for the D programming language compiler";
description = "Ancillary tools for the D programming language";
homepage = "https://github.com/dlang/tools";
license = lib.licenses.boost;
license = licenses.boost;
maintainers = with maintainers; [ jtbx ];
platforms = lib.platforms.unix;
platforms = platforms.unix;
};
}
})