1{ lib, stdenv, fetchurl, curl, tzdata, autoPatchelfHook, fixDarwinDylibNames, libxml2
2, version, hashes }:
3
4let
5 inherit (stdenv) hostPlatform;
6 OS = if hostPlatform.isDarwin then "osx" else hostPlatform.parsed.kernel.name;
7 ARCH = if hostPlatform.isDarwin && hostPlatform.isAarch64 then "arm64" else hostPlatform.parsed.cpu.name;
8in stdenv.mkDerivation {
9 pname = "ldc-bootstrap";
10 inherit version;
11
12 src = fetchurl rec {
13 name = "ldc2-${version}-${OS}-${ARCH}.tar.xz";
14 url = "https://github.com/ldc-developers/ldc/releases/download/v${version}/${name}";
15 sha256 = hashes."${OS}-${ARCH}" or (throw "missing bootstrap sha256 for ${OS}-${ARCH}");
16 };
17
18 dontConfigure = true;
19 dontBuild = true;
20
21 nativeBuildInputs = [ autoPatchelfHook ]
22 ++ lib.optional hostPlatform.isDarwin fixDarwinDylibNames;
23
24 buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ libxml2 stdenv.cc.cc ];
25
26 propagatedBuildInputs = [ curl tzdata ];
27
28 installPhase = ''
29 mkdir -p $out
30
31 mv bin etc import lib LICENSE README $out/
32 '';
33
34 meta = with lib; {
35 description = "The LLVM-based D Compiler";
36 homepage = "https://github.com/ldc-developers/ldc";
37 # from https://github.com/ldc-developers/ldc/blob/master/LICENSE
38 license = with licenses; [ bsd3 boost mit ncsa gpl2Plus ];
39 maintainers = with maintainers; [ ThomasMader lionello ];
40 platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
41 };
42}