2021-01-27 10:21:31 +00:00
|
|
|
{ lib, stdenv, fetchurl, curl, tzdata, autoPatchelfHook, fixDarwinDylibNames, glibc
|
2020-04-18 08:56:02 +00:00
|
|
|
, version, hashes }:
|
2021-01-27 10:21:31 +00:00
|
|
|
|
2020-04-18 08:56:02 +00:00
|
|
|
let
|
2021-01-27 10:21:31 +00:00
|
|
|
inherit (stdenv) hostPlatform;
|
2020-04-18 08:56:02 +00:00
|
|
|
OS = if hostPlatform.isDarwin then "osx" else hostPlatform.parsed.kernel.name;
|
|
|
|
MODEL = toString hostPlatform.parsed.cpu.bits;
|
2021-01-27 10:21:31 +00:00
|
|
|
in stdenv.mkDerivation {
|
2020-04-18 08:56:02 +00:00
|
|
|
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;
|
|
|
|
|
2022-03-22 17:59:05 +00:00
|
|
|
nativeBuildInputs = lib.optionals hostPlatform.isLinux [
|
|
|
|
autoPatchelfHook
|
2022-08-06 15:07:57 +00:00
|
|
|
] ++ lib.optionals hostPlatform.isDarwin [
|
|
|
|
fixDarwinDylibNames
|
|
|
|
];
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
curl
|
|
|
|
tzdata
|
|
|
|
] ++ lib.optionals hostPlatform.isLinux [
|
|
|
|
glibc
|
2023-04-25 22:51:22 +00:00
|
|
|
stdenv.cc.cc.libgcc
|
2022-08-06 15:07:57 +00:00
|
|
|
];
|
2020-04-18 08:56:02 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2022-08-06 15:07:57 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2020-04-18 08:56:02 +00:00
|
|
|
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 "/../../" "/../"
|
2022-08-06 15:07:57 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2020-04-18 08:56:02 +00:00
|
|
|
'';
|
|
|
|
|
2022-08-06 15:07:57 +00:00
|
|
|
# Stripping on Darwin started to break libphobos2.a
|
|
|
|
# Undefined symbols for architecture x86_64:
|
|
|
|
# "_rt_envvars_enabled", referenced from:
|
|
|
|
# __D2rt6config16rt_envvarsOptionFNbNiAyaMDFNbNiQkZQnZQq in libphobos2.a(config_99a_6c3.o)
|
|
|
|
dontStrip = hostPlatform.isDarwin;
|
|
|
|
|
2020-04-18 08:56:02 +00:00
|
|
|
meta = with lib; {
|
|
|
|
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" ];
|
|
|
|
};
|
|
|
|
}
|