about summary refs log tree commit diff
path: root/pkgs/development/compilers/dmd/binary.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/dmd/binary.nix')
-rw-r--r--pkgs/development/compilers/dmd/binary.nix52
1 files changed, 52 insertions, 0 deletions
diff --git a/pkgs/development/compilers/dmd/binary.nix b/pkgs/development/compilers/dmd/binary.nix
new file mode 100644
index 000000000000..cd3a15889b21
--- /dev/null
+++ b/pkgs/development/compilers/dmd/binary.nix
@@ -0,0 +1,52 @@
+{ stdenv, fetchurl, curl, tzdata, autoPatchelfHook, fixDarwinDylibNames, glibc
+, version, hashes }:
+with stdenv;
+let
+  OS = if hostPlatform.isDarwin then "osx" else hostPlatform.parsed.kernel.name;
+  MODEL = toString hostPlatform.parsed.cpu.bits;
+in mkDerivation {
+  pname = "dmd-bootstrap";
+  inherit version;
+
+  src = fetchurl rec {
+    name = "dmd.${version}.${OS}.tar.xz";
+    url = "http://downloads.dlang.org/releases/2.x/${version}/${name}";
+    sha256 = hashes.${OS} or (throw "missing bootstrap sha256 for OS ${OS}");
+  };
+
+  dontConfigure = true;
+  dontBuild = true;
+
+  nativeBuildInputs = [ fixDarwinDylibNames autoPatchelfHook ];
+  propagatedBuildInputs = [ curl tzdata ] ++ lib.optional hostPlatform.isLinux glibc;
+
+  installPhase = ''
+    mkdir -p $out
+
+    # try to copy model-specific binaries into bin first
+    mv ${OS}/bin${MODEL} $out/bin || true
+
+    mv src license.txt ${OS}/* $out/
+
+    # move man into place
+    mkdir -p $out/share
+    mv man $out/share/
+
+    # move docs into place
+    mkdir -p $out/share/doc
+    mv html/d $out/share/doc/
+
+    # fix paths in dmd.conf (one level less)
+    substituteInPlace $out/bin/dmd.conf --replace "/../../" "/../"
+  '';
+
+  meta = with lib; {
+    inherit version;
+    description = "Digital Mars D Compiler Package";
+    # As of 2.075 all sources and binaries use the boost license
+    license = licenses.boost;
+    maintainers = [ maintainers.lionello ];
+    homepage = "https://dlang.org/";
+    platforms = [ "x86_64-darwin" "i686-linux" "x86_64-linux" ];
+  };
+}