1{ stdenv, lib, fetchFromGitHub, fetchpatch, ldc, curl, gnumake42 }:
2
3stdenv.mkDerivation rec {
4 pname = "dtools";
5 version = "2.105.2";
6
7 src = fetchFromGitHub {
8 owner = "dlang";
9 repo = "tools";
10 rev = "v${version}";
11 sha256 = "sha256-Y8jSwd6tldCnq3yEuO/xUYrSV+lp7tBPMiheMA06f0M=";
12 name = "dtools";
13 };
14
15 patches = [
16 (fetchpatch {
17 # part of https://github.com/dlang/tools/pull/441
18 url = "https://github.com/dlang/tools/commit/6c6a042d1b08e3ec1790bd07a7f69424625ee866.patch"; # Fix LDC arm64 build
19 sha256 = "sha256-x6EclTYN1Y5FG57KLhbBK0BZicSYcZoWO7MTVcP4T18=";
20 })
21 ];
22
23 nativeBuildInputs = [ ldc gnumake42 ]; # fails with make 4.4
24 buildInputs = [ curl ];
25
26 makeCmd = ''
27 make -f posix.mak all DMD_DIR=dmd DMD=${ldc.out}/bin/ldmd2 CC=${stdenv.cc}/bin/cc
28 '';
29
30 buildPhase = ''
31 $makeCmd
32 '';
33
34 doCheck = true;
35
36 checkPhase = ''
37 $makeCmd test_rdmd
38 '';
39
40 installPhase = ''
41 $makeCmd INSTALL_DIR=$out install
42 '';
43
44 meta = with lib; {
45 description = "Ancillary tools for the D programming language compiler";
46 homepage = "https://github.com/dlang/tools";
47 license = lib.licenses.boost;
48 maintainers = with maintainers; [ ThomasMader jtbx ];
49 platforms = lib.platforms.unix;
50 };
51}