aboutsummaryrefslogtreecommitdiffhomepage
path: root/nix-overlays/dmd
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2024-03-08 20:53:55 -0500
committerRalph Amissah <ralph.amissah@gmail.com>2024-03-09 23:30:12 -0500
commit3abf80402ad1e7e8d312f2bdf5435ed4f079c0d1 (patch)
tree72f8a01e53290a56c85405736e290ac7259129bf /nix-overlays/dmd
parentldc-1.37.0 & dub-1.36.0 (diff)
dmd & ldc upkeep (dmd at 2.106.1)
- dmd current nixpkgs and overlay identical
Diffstat (limited to 'nix-overlays/dmd')
-rw-r--r--nix-overlays/dmd/binary.nix7
-rw-r--r--nix-overlays/dmd/default.nix7
-rw-r--r--nix-overlays/dmd/generic.nix79
3 files changed, 52 insertions, 41 deletions
diff --git a/nix-overlays/dmd/binary.nix b/nix-overlays/dmd/binary.nix
index 6a99d42..3a5d6b7 100644
--- a/nix-overlays/dmd/binary.nix
+++ b/nix-overlays/dmd/binary.nix
@@ -5,7 +5,12 @@ let
inherit (stdenv) hostPlatform;
OS = if hostPlatform.isDarwin then "osx" else hostPlatform.parsed.kernel.name;
MODEL = toString hostPlatform.parsed.cpu.bits;
-in stdenv.mkDerivation {
+in
+
+# On linux pargets like `pkgsLLVM.dmd` `cc` does not expose `libgcc`
+# and can't build `dmd`.
+assert hostPlatform.isLinux -> (stdenv.cc.cc ? libgcc);
+stdenv.mkDerivation {
pname = "dmd-bootstrap";
inherit version;
diff --git a/nix-overlays/dmd/default.nix b/nix-overlays/dmd/default.nix
index 7beb9e5..bdc9faf 100644
--- a/nix-overlays/dmd/default.nix
+++ b/nix-overlays/dmd/default.nix
@@ -1,6 +1,5 @@
import ./generic.nix {
- version = "2.104.0";
- dmdSha256 = "sha256-yv+uW6cYAId2HK/YSPxsR9Xt0o3LWa97z8KyzjFik6s=";
- #druntimeSha256 = "";
- phobosSha256 = "sha256-cWp36Gd/lh3gy21bf9z0/RqzlJmf6ypmx72aMeakcec=";
+ version = "2.106.1";
+ dmdSha256 = "sha256-vjYa/Pxrz7J2htXT+fa+xaeen/Vxne++lELbHTSXBK8=";
+ phobosSha256 = "sha256-yRL9ub3u4mREG9PVxBvgQ/LDXD57RadPTZ2h08qyh/s=";
}
diff --git a/nix-overlays/dmd/generic.nix b/nix-overlays/dmd/generic.nix
index e500385..a2a1b8a 100644
--- a/nix-overlays/dmd/generic.nix
+++ b/nix-overlays/dmd/generic.nix
@@ -6,12 +6,14 @@
{ stdenv
, lib
, fetchFromGitHub
+, removeReferencesTo
, makeWrapper
, which
, writeTextFile
, curl
, tzdata
, gdb
+#, Foundation
, callPackage
, targetPackages
, fetchpatch
@@ -19,7 +21,8 @@
, installShellFiles
, git
, unzip
-, HOST_DMD ? "${callPackage ./bootstrap.nix { }}/bin/dmd"
+, dmdBootstrap ? callPackage ./bootstrap.nix { }
+, dmd_bin ? "${dmdBootstrap}/bin"
}:
let
@@ -70,46 +73,38 @@ stdenv.mkDerivation rec {
# https://issues.dlang.org/show_bug.cgi?id=19553
hardeningDisable = [ "fortify" ];
- #patches = lib.optionals (lib.versionOlder version "2.088.0") [
- # # Migrates D1-style operator overloads in DMD source, to allow building with
- # # a newer DMD
- # (fetchpatch {
- # url = "https://github.com/dlang/dmd/commit/c4d33e5eb46c123761ac501e8c52f33850483a8a.patch";
- # stripLen = 1;
- # extraPrefix = "dmd/";
- # sha256 = "sha256-N21mAPfaTo+zGCip4njejasraV5IsWVqlGR5eOdFZZE=";
- # })
- #] ++ lib.optionals (lib.versionOlder version "2.092.2") [
- # # Fixes C++ tests that compiled on older C++ but not on the current one
- # (fetchpatch {
- # url = "https://github.com/dlang/druntime/commit/438990def7e377ca1f87b6d28246673bb38022ab.patch";
- # stripLen = 1;
- # extraPrefix = "druntime/";
- # sha256 = "sha256-/pPKK7ZK9E/mBrxm2MZyBNhYExE8p9jz8JqBdZSE6uY=";
- # })
- #];
+ patches = lib.optionals (lib.versionOlder version "2.088.0") [
+ # Migrates D1-style operator overloads in DMD source, to allow building with
+ # a newer DMD
+ (fetchpatch {
+ url = "https://github.com/dlang/dmd/commit/c4d33e5eb46c123761ac501e8c52f33850483a8a.patch";
+ stripLen = 1;
+ extraPrefix = "dmd/";
+ sha256 = "sha256-N21mAPfaTo+zGCip4njejasraV5IsWVqlGR5eOdFZZE=";
+ })
+ ];
postPatch = ''
patchShebangs dmd/compiler/test/{runnable,fail_compilation,compilable,tools}{,/extra-files}/*.sh
- rm dmd/compiler/test/runnable_cxx/cppa.d
-
- # Grep'd string changed with gdb 12
- # https://issues.dlang.org/show_bug.cgi?id=23198
- substituteInPlace dmd/druntime/test/exceptions/Makefile \
- --replace 'in D main (' 'in _Dmain ('
+ rm dmd/compiler/test/runnable/gdb1.d
+ rm dmd/compiler/test/runnable/gdb10311.d
+ rm dmd/compiler/test/runnable/gdb14225.d
+ rm dmd/compiler/test/runnable/gdb14276.d
+ rm dmd/compiler/test/runnable/gdb14313.d
+ rm dmd/compiler/test/runnable/gdb14330.d
+ rm dmd/compiler/test/runnable/gdb15729.sh
+ rm dmd/compiler/test/runnable/gdb4149.d
+ rm dmd/compiler/test/runnable/gdb4181.d
+ rm dmd/compiler/test/compilable/ddocYear.d
- # We're using gnused on all platforms
- substituteInPlace dmd/druntime/test/coverage/Makefile \
- --replace 'freebsd osx' 'none'
+ # Disable tests that rely on objdump whitespace until fixed upstream:
+ # 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.versionOlder version "2.091.0") ''
- # This one has tested against a hardcoded year, then against a current year on
- # and off again. It just isn't worth it to patch all the historical versions
- # of it, so just remove it until the most recent change.
- rm dmd/compiler/test/compilable/ddocYear.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"
@@ -132,6 +127,8 @@ stdenv.mkDerivation rec {
buildInputs = [
curl
tzdata
+ # ] ++ lib.optionals stdenv.isDarwin [
+ # Foundation
];
nativeCheckInputs = [
@@ -155,7 +152,8 @@ stdenv.mkDerivation rec {
buildJobs=1
fi
- make -C dmd -f posix.mak $buildFlags -j$buildJobs HOST_DMD=${HOST_DMD}
+ ${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
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"
@@ -195,6 +193,9 @@ stdenv.mkDerivation rec {
installManPage dmd/docs/man/man*/*
+ mkdir -p $out/include/dmd
+ cp -r {dmd/druntime/import/*,phobos/{std,etc}} $out/include/dmd/
+
mkdir $out/lib
cp phobos/generated/${osname}/release/${bits}/libphobos2.* $out/lib/
@@ -207,13 +208,19 @@ stdenv.mkDerivation rec {
runHook postInstall
'';
+ preFixup = ''
+ find $out/bin -type f -exec ${removeReferencesTo}/bin/remove-references-to -t ${dmd_bin}/dmd '{}' +
+ '';
+
+ disallowedReferences = [ dmdBootstrap ];
+
meta = with lib; {
description = "Official reference compiler for the D language";
homepage = "https://dlang.org/";
# Everything is now Boost licensed, even the backend.
# https://github.com/dlang/dmd/pull/6680
license = licenses.boost;
- maintainers = with maintainers; [ ThomasMader lionello dukc ];
+ maintainers = with maintainers; [ lionello dukc jtbx ];
platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ];
};
}