Merge pull request #287854 from jtbx/dlang-2.107.0
dmd, dtools: 2.106.1 -> 2.108.0, refactor
This commit is contained in:
commit
e3b3b675fe
|
@ -1,6 +1,6 @@
|
|||
{ version
|
||||
, dmdSha256
|
||||
, phobosSha256
|
||||
, dmdHash
|
||||
, phobosHash
|
||||
}:
|
||||
|
||||
{ stdenv
|
||||
|
@ -22,7 +22,7 @@
|
|||
, git
|
||||
, unzip
|
||||
, dmdBootstrap ? callPackage ./bootstrap.nix { }
|
||||
, dmd_bin ? "${dmdBootstrap}/bin"
|
||||
, dmdBin ? "${dmdBootstrap}/bin"
|
||||
}:
|
||||
|
||||
let
|
||||
|
@ -45,7 +45,7 @@ let
|
|||
pathToDmd = "\${NIX_BUILD_TOP}/dmd/generated/${osname}/release/${bits}/dmd";
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "dmd";
|
||||
inherit version;
|
||||
|
||||
|
@ -55,15 +55,15 @@ stdenv.mkDerivation rec {
|
|||
(fetchFromGitHub {
|
||||
owner = "dlang";
|
||||
repo = "dmd";
|
||||
rev = "v${version}";
|
||||
sha256 = dmdSha256;
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = dmdHash;
|
||||
name = "dmd";
|
||||
})
|
||||
(fetchFromGitHub {
|
||||
owner = "dlang";
|
||||
repo = "phobos";
|
||||
rev = "v${version}";
|
||||
sha256 = phobosSha256;
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = phobosHash;
|
||||
name = "phobos";
|
||||
})
|
||||
];
|
||||
|
@ -80,7 +80,7 @@ stdenv.mkDerivation rec {
|
|||
url = "https://github.com/dlang/dmd/commit/c4d33e5eb46c123761ac501e8c52f33850483a8a.patch";
|
||||
stripLen = 1;
|
||||
extraPrefix = "dmd/";
|
||||
sha256 = "sha256-N21mAPfaTo+zGCip4njejasraV5IsWVqlGR5eOdFZZE=";
|
||||
hash = "sha256-N21mAPfaTo+zGCip4njejasraV5IsWVqlGR5eOdFZZE=";
|
||||
})
|
||||
];
|
||||
|
||||
|
@ -102,18 +102,14 @@ stdenv.mkDerivation rec {
|
|||
# https://issues.dlang.org/show_bug.cgi?id=23317
|
||||
rm dmd/compiler/test/runnable/cdvecfill.sh
|
||||
rm dmd/compiler/test/compilable/cdcmp.d
|
||||
''
|
||||
|
||||
+ lib.optionalString (lib.versionAtLeast version "2.089.0" && lib.versionOlder version "2.092.2") ''
|
||||
'' + lib.optionalString (lib.versionAtLeast version "2.089.0" && lib.versionOlder version "2.092.2") ''
|
||||
rm dmd/compiler/test/dshell/test6952.d
|
||||
'' + lib.optionalString (lib.versionAtLeast version "2.092.2") ''
|
||||
substituteInPlace dmd/compiler/test/dshell/test6952.d --replace "/usr/bin/env bash" "${bash}/bin/bash"
|
||||
''
|
||||
|
||||
+ lib.optionalString stdenv.isLinux ''
|
||||
substituteInPlace phobos/std/socket.d --replace "assert(ih.addrList[0] == 0x7F_00_00_01);" ""
|
||||
substituteInPlace dmd/compiler/test/dshell/test6952.d --replace-fail "/usr/bin/env bash" "${bash}/bin/bash"
|
||||
'' + lib.optionalString stdenv.isLinux ''
|
||||
substituteInPlace phobos/std/socket.d --replace-fail "assert(ih.addrList[0] == 0x7F_00_00_01);" ""
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
substituteInPlace phobos/std/socket.d --replace "foreach (name; names)" "names = []; foreach (name; names)"
|
||||
substituteInPlace phobos/std/socket.d --replace-fail "foreach (name; names)" "names = []; foreach (name; names)"
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
|
@ -148,24 +144,23 @@ stdenv.mkDerivation rec {
|
|||
runHook preBuild
|
||||
|
||||
export buildJobs=$NIX_BUILD_CORES
|
||||
if [ -z $enableParallelBuilding ]; then
|
||||
buildJobs=1
|
||||
fi
|
||||
[ -z "$enableParallelBuilding" ] && buildJobs=1
|
||||
|
||||
${dmd_bin}/rdmd dmd/compiler/src/build.d -j$buildJobs HOST_DMD=${dmd_bin}/dmd $buildFlags
|
||||
make -C dmd/druntime -f posix.mak DMD=${pathToDmd} $buildFlags -j$buildJobs
|
||||
${dmdBin}/rdmd dmd/compiler/src/build.d -j$buildJobs $buildFlags \
|
||||
HOST_DMD=${dmdBin}/dmd
|
||||
make -C dmd/druntime -j$buildJobs DMD=${pathToDmd} $buildFlags
|
||||
echo ${tzdata}/share/zoneinfo/ > TZDatabaseDirFile
|
||||
echo ${lib.getLib curl}/lib/libcurl${stdenv.hostPlatform.extensions.sharedLibrary} > LibcurlPathFile
|
||||
make -C phobos -f posix.mak $buildFlags -j$buildJobs DMD=${pathToDmd} DFLAGS="-version=TZDatabaseDir -version=LibcurlPath -J$PWD"
|
||||
echo ${lib.getLib curl}/lib/libcurl${stdenv.hostPlatform.extensions.sharedLibrary} \
|
||||
> LibcurlPathFile
|
||||
make -C phobos -j$buildJobs $buildFlags \
|
||||
DMD=${pathToDmd} DFLAGS="-version=TZDatabaseDir -version=LibcurlPath -J$PWD"
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
doCheck = true;
|
||||
|
||||
checkFlags = buildFlags;
|
||||
|
||||
# many tests are disbled because they are failing
|
||||
# many tests are disabled because they are failing
|
||||
|
||||
# NOTE: Purity check is disabled for checkPhase because it doesn't fare well
|
||||
# with the DMD linker. See https://github.com/NixOS/nixpkgs/issues/97420
|
||||
|
@ -173,15 +168,14 @@ stdenv.mkDerivation rec {
|
|||
runHook preCheck
|
||||
|
||||
export checkJobs=$NIX_BUILD_CORES
|
||||
if [ -z $enableParallelChecking ]; then
|
||||
checkJobs=1
|
||||
fi
|
||||
[ -z "$enableParallelChecking" ] && checkJobs=1
|
||||
|
||||
CC=$CXX HOST_DMD=${pathToDmd} NIX_ENFORCE_PURITY= \
|
||||
${dmdBin}/rdmd dmd/compiler/test/run.d -j$checkJobs
|
||||
|
||||
NIX_ENFORCE_PURITY= \
|
||||
make -C dmd/compiler/test $checkFlags CC=$CXX SHELL=$SHELL -j$checkJobs N=$checkJobs
|
||||
|
||||
NIX_ENFORCE_PURITY= \
|
||||
make -C phobos -f posix.mak unittest $checkFlags -j$checkJobs DFLAGS="-version=TZDatabaseDir -version=LibcurlPath -J$PWD"
|
||||
make -C phobos unittest -j$checkJobs $checkFlags \
|
||||
DFLAGS="-version=TZDatabaseDir -version=LibcurlPath -J$PWD"
|
||||
|
||||
runHook postCheck
|
||||
'';
|
||||
|
@ -200,7 +194,7 @@ stdenv.mkDerivation rec {
|
|||
cp phobos/generated/${osname}/release/${bits}/libphobos2.* $out/lib/
|
||||
|
||||
wrapProgram $out/bin/dmd \
|
||||
--prefix PATH ":" "${targetPackages.stdenv.cc}/bin" \
|
||||
--prefix PATH : "${targetPackages.stdenv.cc}/bin" \
|
||||
--set-default CC "${targetPackages.stdenv.cc}/bin/cc"
|
||||
|
||||
substitute ${dmdConfFile} "$out/bin/dmd.conf" --subst-var out
|
||||
|
@ -209,19 +203,19 @@ stdenv.mkDerivation rec {
|
|||
'';
|
||||
|
||||
preFixup = ''
|
||||
find $out/bin -type f -exec ${removeReferencesTo}/bin/remove-references-to -t ${dmd_bin}/dmd '{}' +
|
||||
find $out/bin -type f -exec ${removeReferencesTo}/bin/remove-references-to -t ${dmdBin}/dmd '{}' +
|
||||
'';
|
||||
|
||||
disallowedReferences = [ dmdBootstrap ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Official reference compiler for the D language";
|
||||
mainProgram = "dmd";
|
||||
homepage = "https://dlang.org/";
|
||||
# Everything is now Boost licensed, even the backend.
|
||||
# https://github.com/dlang/dmd/pull/6680
|
||||
license = licenses.boost;
|
||||
mainProgram = "dmd";
|
||||
maintainers = with maintainers; [ lionello dukc jtbx ];
|
||||
platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ];
|
||||
};
|
||||
}
|
||||
})
|
5
pkgs/by-name/dm/dmd/package.nix
Normal file
5
pkgs/by-name/dm/dmd/package.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
import ./generic.nix {
|
||||
version = "2.108.0";
|
||||
dmdHash = "sha256-tlWcFgKtXzfqMMkOq4ezhZHdYCXFckjN5+m6jO4VH0U=";
|
||||
phobosHash = "sha256-uU8S4rABOfhpKh+MvSbclkbdf0hrsuKF8SIpWMnPpfU=";
|
||||
}
|
11
pkgs/by-name/dt/dtools/disabled-tests.diff
Normal file
11
pkgs/by-name/dt/dtools/disabled-tests.diff
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- a/rdmd_test.d
|
||||
+++ b/rdmd_test.d
|
||||
@@ -616,7 +616,7 @@ void runTests(string rdmdApp, string compiler, string model)
|
||||
enforce(res.status == 1, res.output);
|
||||
}
|
||||
|
||||
- version (Posix)
|
||||
+ version (none)
|
||||
{
|
||||
import std.conv : to;
|
||||
auto makeVersion = execute(["make", "--version"]).output.splitLines()[0];
|
102
pkgs/by-name/dt/dtools/fix-ldc-arm64.diff
Normal file
102
pkgs/by-name/dt/dtools/fix-ldc-arm64.diff
Normal file
|
@ -0,0 +1,102 @@
|
|||
Adapted from https://github.com/dlang/tools/commit/6c6a042d1b08e3ec1790bd07a7f69424625ee866.patch
|
||||
--- /dev/null
|
||||
+++ b/osmodel.mak
|
||||
@@ -0,0 +1,75 @@
|
||||
+# osmodel.mak
|
||||
+#
|
||||
+# Detects and sets the macros:
|
||||
+#
|
||||
+# OS = one of {osx,linux,freebsd,openbsd,netbsd,dragonflybsd,solaris}
|
||||
+# MODEL = one of { 32, 64 }
|
||||
+# MODEL_FLAG = one of { -m32, -m64 }
|
||||
+# ARCH = one of { x86, x86_64, aarch64 }
|
||||
+#
|
||||
+# Note:
|
||||
+# Keep this file in sync between druntime, phobos, and dmd repositories!
|
||||
+# Source: https://github.com/dlang/dmd/blob/master/src/osmodel.mak
|
||||
+
|
||||
+
|
||||
+ifeq (,$(OS))
|
||||
+ uname_S:=$(shell uname -s)
|
||||
+ ifeq (Darwin,$(uname_S))
|
||||
+ OS:=osx
|
||||
+ endif
|
||||
+ ifeq (Linux,$(uname_S))
|
||||
+ OS:=linux
|
||||
+ endif
|
||||
+ ifeq (FreeBSD,$(uname_S))
|
||||
+ OS:=freebsd
|
||||
+ endif
|
||||
+ ifeq (OpenBSD,$(uname_S))
|
||||
+ OS:=openbsd
|
||||
+ endif
|
||||
+ ifeq (NetBSD,$(uname_S))
|
||||
+ OS:=netbsd
|
||||
+ endif
|
||||
+ ifeq (DragonFly,$(uname_S))
|
||||
+ OS:=dragonflybsd
|
||||
+ endif
|
||||
+ ifeq (Solaris,$(uname_S))
|
||||
+ OS:=solaris
|
||||
+ endif
|
||||
+ ifeq (SunOS,$(uname_S))
|
||||
+ OS:=solaris
|
||||
+ endif
|
||||
+ ifeq (,$(OS))
|
||||
+ $(error Unrecognized or unsupported OS for uname: $(uname_S))
|
||||
+ endif
|
||||
+endif
|
||||
+
|
||||
+# When running make from XCode it may set environment var OS=MACOS.
|
||||
+# Adjust it here:
|
||||
+ifeq (MACOS,$(OS))
|
||||
+ OS:=osx
|
||||
+endif
|
||||
+
|
||||
+ifeq (,$(MODEL))
|
||||
+ ifeq ($(OS), solaris)
|
||||
+ uname_M:=$(shell isainfo -n)
|
||||
+ else
|
||||
+ uname_M:=$(shell uname -m)
|
||||
+ endif
|
||||
+ ifneq (,$(findstring $(uname_M),x86_64 amd64))
|
||||
+ MODEL:=64
|
||||
+ ARCH:=x86_64
|
||||
+ endif
|
||||
+ ifneq (,$(findstring $(uname_M),aarch64 arm64))
|
||||
+ MODEL:=64
|
||||
+ ARCH:=aarch64
|
||||
+ endif
|
||||
+ ifneq (,$(findstring $(uname_M),i386 i586 i686))
|
||||
+ MODEL:=32
|
||||
+ ARCH:=x86
|
||||
+ endif
|
||||
+ ifeq (,$(MODEL))
|
||||
+ $(error Cannot figure 32/64 model and arch from uname -m: $(uname_M))
|
||||
+ endif
|
||||
+endif
|
||||
+
|
||||
+MODEL_FLAG:=-m$(MODEL)
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -9,9 +9,8 @@ DUB=dub
|
||||
WITH_DOC = no
|
||||
DOC = ../dlang.org
|
||||
|
||||
-# Load operating system $(OS) (e.g. linux, osx, ...) and $(MODEL) (e.g. 32, 64) detection Makefile from dmd
|
||||
-$(shell [ ! -d $(DMD_DIR) ] && git clone --depth=1 https://github.com/dlang/dmd $(DMD_DIR))
|
||||
-include $(DMD_DIR)/compiler/src/osmodel.mak
|
||||
+# Load operating system $(OS) (e.g. linux, osx, ...) and $(MODEL) (e.g. 32, 64) detection Makefile
|
||||
+include osmodel.mak
|
||||
|
||||
ifeq (windows,$(OS))
|
||||
DOTEXE:=.exe
|
||||
@@ -30,7 +29,7 @@ DFLAGS = $(MODEL_FLAG) $(if $(findstring windows,$(OS)),,-fPIC) -preview=dip1000
|
||||
DFLAGS += $(WARNINGS)
|
||||
|
||||
# Default DUB flags (DUB uses a different architecture format)
|
||||
-DUBFLAGS = --arch=$(subst 32,x86,$(subst 64,x86_64,$(MODEL)))
|
||||
+DUBFLAGS = --arch=$(ARCH)
|
||||
|
||||
TOOLS = \
|
||||
$(ROOT)/catdoc$(DOTEXE) \
|
49
pkgs/by-name/dt/dtools/package.nix
Normal file
49
pkgs/by-name/dt/dtools/package.nix
Normal file
|
@ -0,0 +1,49 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, fetchpatch
|
||||
, ldc
|
||||
, curl
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "dtools";
|
||||
version = "2.108.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "dlang";
|
||||
repo = "tools";
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = "sha256-YEBUgJPG/+WN4MnQUNAVftZM0ULxZZzpHoOozXua46U=";
|
||||
name = "dtools";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# Disable failing tests
|
||||
./disabled-tests.diff
|
||||
# Fix LDC arm64 build
|
||||
./fix-ldc-arm64.diff
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ ldc ];
|
||||
buildInputs = [ curl ];
|
||||
|
||||
makeFlags = [
|
||||
"CC=${stdenv.cc}/bin/cc"
|
||||
"DMD=${ldc.out}/bin/ldmd2"
|
||||
"INSTALL_DIR=$(out)"
|
||||
];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
doCheck = true;
|
||||
checkTarget = "test_rdmd";
|
||||
|
||||
meta = with lib; {
|
||||
description = "Ancillary tools for the D programming language";
|
||||
homepage = "https://github.com/dlang/tools";
|
||||
license = licenses.boost;
|
||||
maintainers = with maintainers; [ jtbx ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
})
|
|
@ -1,5 +0,0 @@
|
|||
import ./generic.nix {
|
||||
version = "2.106.1";
|
||||
dmdSha256 = "sha256-vjYa/Pxrz7J2htXT+fa+xaeen/Vxne++lELbHTSXBK8=";
|
||||
phobosSha256 = "sha256-yRL9ub3u4mREG9PVxBvgQ/LDXD57RadPTZ2h08qyh/s=";
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
{ stdenv, lib, fetchFromGitHub, fetchpatch, ldc, curl, gnumake42 }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "dtools";
|
||||
version = "2.106.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "dlang";
|
||||
repo = "tools";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-Y8jSwd6tldCnq3yEuO/xUYrSV+lp7tBPMiheMA06f0M=";
|
||||
name = "dtools";
|
||||
};
|
||||
|
||||
patches = [
|
||||
(fetchpatch {
|
||||
# part of https://github.com/dlang/tools/pull/441
|
||||
url = "https://github.com/dlang/tools/commit/6c6a042d1b08e3ec1790bd07a7f69424625ee866.patch"; # Fix LDC arm64 build
|
||||
sha256 = "sha256-x6EclTYN1Y5FG57KLhbBK0BZicSYcZoWO7MTVcP4T18=";
|
||||
})
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ ldc gnumake42 ]; # fails with make 4.4
|
||||
buildInputs = [ curl ];
|
||||
|
||||
makeCmd = ''
|
||||
make -f posix.mak all DMD_DIR=dmd DMD=${ldc.out}/bin/ldmd2 CC=${stdenv.cc}/bin/cc
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
$makeCmd
|
||||
'';
|
||||
|
||||
doCheck = true;
|
||||
|
||||
checkPhase = ''
|
||||
$makeCmd test_rdmd
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
$makeCmd INSTALL_DIR=$out install
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Ancillary tools for the D programming language compiler";
|
||||
homepage = "https://github.com/dlang/tools";
|
||||
license = lib.licenses.boost;
|
||||
maintainers = with maintainers; [ jtbx ];
|
||||
platforms = lib.platforms.unix;
|
||||
};
|
||||
}
|
|
@ -5096,8 +5096,6 @@ with pkgs;
|
|||
|
||||
dsvpn = callPackage ../applications/networking/dsvpn { };
|
||||
|
||||
dtools = callPackage ../development/tools/dtools { };
|
||||
|
||||
dwt1-shell-color-scripts = callPackage ../tools/misc/dwt1-shell-color-scripts { };
|
||||
|
||||
dtrx = callPackage ../tools/compression/dtrx { };
|
||||
|
@ -7462,7 +7460,7 @@ with pkgs;
|
|||
|
||||
dleyna-server = callPackage ../development/libraries/dleyna-server { };
|
||||
|
||||
dmd = callPackage ../development/compilers/dmd ({
|
||||
dmd = callPackage ../by-name/dm/dmd/package.nix ({
|
||||
inherit (darwin.apple_sdk.frameworks) Foundation;
|
||||
} // lib.optionalAttrs stdenv.isLinux {
|
||||
# https://github.com/NixOS/nixpkgs/pull/206907#issuecomment-1527034123
|
||||
|
|
Loading…
Reference in New Issue
Block a user