dmd: 2.085.1 -> 2.091.1

Apply patch dlang/dmd#11053
This commit is contained in:
Lionello Lunesu 2020-04-18 16:56:02 +08:00
parent c01ac3ed12
commit 6c9beaa744
3 changed files with 83 additions and 12 deletions

View file

@ -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" ];
};
}

View file

@ -0,0 +1,9 @@
{ callPackage }:
callPackage ./binary.nix {
version = "2.090.1";
hashes = {
# Get these from `nix-prefetch-url http://downloads.dlang.org/releases/2.x/2.090.1/dmd.2.090.1.linux.tar.xz` etc..
osx = "0rbn7j4dr3q0y09fblpj999bi063pi4230rqd5xgd3gwxxa0cz7l";
linux = "1vk6lsvd6y7ccvffd23yial4ig90azaxf2rxc6yvidqd1qhan807";
};
}

View file

@ -1,11 +1,13 @@
{ stdenv, lib, fetchFromGitHub
, makeWrapper, unzip, which, writeTextFile
, curl, tzdata, gdb, darwin, git
, targetPackages, ldc
, version ? "2.085.1"
, dmdSha256 ? "0ccidfcawrcwdpfjwjiln5xwr4ffp8i2hwx52p8zn3xmc5yxm660"
, druntimeSha256 ? "109f2glsqrlshk06761xlw4r5v22mivp873cq9g5gcax3g00k617"
, phobosSha256 ? "0giispqqx8j8xg6c0hm7nx77bcahiwic8rvf12sws3sv5pizv8pr"
, curl, tzdata, gdb, darwin, git, callPackage
, targetPackages, fetchpatch
, dmdBootstrap ? callPackage ./bootstrap.nix { }
, HOST_DMD ? "${dmdBootstrap}/bin/dmd"
, version ? "2.091.1"
, dmdSha256 ? "0brz0n84jdkhr4sq4k91w48p739psbhbb1jk2pi9q60psmx353yr"
, druntimeSha256 ? "0smgpmfriffh110ksski1s5j921kmxbc2zjy0dyj9ksyrxbzklbl"
, phobosSha256 ? "1n00anajgibrfs1xzvrmag28hvbvkc0w1fwlimqbznvhf28rhrxs"
}:
let
@ -51,7 +53,17 @@ stdenv.mkDerivation rec {
})
];
patchFlags = [ "--directory=dmd" "-p1" ];
patchFlags = [ "--directory=dmd" "-p1" "-F3" ];
patches = [
(fetchpatch {
url = "https://github.com/dlang/dmd/commit/4157298cf04f7aae9f701432afd1de7b7e05c30f.patch";
sha256 = "0v4xgqmrx5r8vbx5a4v88s0xnm23mam9nm99yfga7s2sxr0hi5p2";
})
(fetchpatch {
url = "https://github.com/dlang/dmd/commit/14547ae37a97678a80a32fea4c76626bbd8595ca.patch";
sha256 = "17f7glbmq61r9zy9y40p1zwgqc9daf2sbly3p6d6z9wsd1p57xnl";
})
];
sourceRoot = ".";
@ -65,12 +77,11 @@ stdenv.mkDerivation rec {
postPatch = stdenv.lib.optionalString stdenv.hostPlatform.isLinux ''
substituteInPlace phobos/std/socket.d --replace "assert(ih.addrList[0] == 0x7F_00_00_01);" ""
''
+ stdenv.lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace phobos/std/socket.d --replace "foreach (name; names)" "names = []; foreach (name; names)"
'';
nativeBuildInputs = [ ldc makeWrapper unzip which gdb git ]
nativeBuildInputs = [ makeWrapper unzip which gdb git ]
++ stdenv.lib.optional stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [
Foundation
@ -89,7 +100,7 @@ stdenv.mkDerivation rec {
# Buid and install are based on http://wiki.dlang.org/Building_DMD
buildPhase = ''
cd dmd
make -j$NIX_BUILD_CORES -f posix.mak INSTALL_DIR=$out BUILD=release ENABLE_RELEASE=1 PIC=1 HOST_DMD=ldmd2
make -j$NIX_BUILD_CORES -f posix.mak INSTALL_DIR=$out BUILD=release ENABLE_RELEASE=1 PIC=1 HOST_DMD=${HOST_DMD}
cd ../druntime
make -j$NIX_BUILD_CORES -f posix.mak BUILD=release ENABLE_RELEASE=1 PIC=1 INSTALL_DIR=$out DMD=${pathToDmd}
cd ../phobos
@ -147,8 +158,7 @@ stdenv.mkDerivation rec {
# Everything is now Boost licensed, even the backend.
# https://github.com/dlang/dmd/pull/6680
license = licenses.boost;
maintainers = with maintainers; [ ThomasMader ];
maintainers = with maintainers; [ ThomasMader lionello ];
platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ];
};
}