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