From 3abf80402ad1e7e8d312f2bdf5435ed4f079c0d1 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 8 Mar 2024 20:53:55 -0500 Subject: dmd & ldc upkeep (dmd at 2.106.1) - dmd current nixpkgs and overlay identical --- nix-overlays/README | 8 ++--- nix-overlays/dmd/binary.nix | 7 +++- nix-overlays/dmd/default.nix | 7 ++-- nix-overlays/dmd/generic.nix | 79 ++++++++++++++++++++++++-------------------- nix-overlays/dub/default.nix | 2 +- nix-overlays/ldc/binary.nix | 2 +- nix-overlays/ldc/generic.nix | 7 ++-- 7 files changed, 60 insertions(+), 52 deletions(-) (limited to 'nix-overlays') diff --git a/nix-overlays/README b/nix-overlays/README index 0c55f1b..421074f 100644 --- a/nix-overlays/README +++ b/nix-overlays/README @@ -20,11 +20,9 @@ nix overlays for (updates nixpkgs, more recent versions of): - dub ( 1.23.0 -> 1.36.0 ) [for nix versions 1.31.0 ... 1.33.0 broken] - dtools ( 2.095.1 -> 2.103.1 ) - - dmd ( 2.100.2 -> 2.104.0 ) KO ✗ + - dmd ( 2.106.1 -> 2.106.1 ) - gdc [not yet available] -(updates nixpkgs circa 2023-05-12) - dlang-nix-flakes.org --❯ . └── nix-overlays @@ -61,14 +59,14 @@ search nixpkgs here: - version in nixpkgs: - https://search.nixos.org/packages?channel=unstable&show=ldc&from=0&size=100&sort=relevance&type=packages&query=ldc -*** dmd KO ✗ ( 2.100.2 -> 2.104.0 ) +*** dmd KO ✗ ( 2.100.2 -> 2.104.0); OK ✓ ( 2.106.1 ) - https://dlang.org/ - https://wiki.dlang.org/LDC - https://github.com/dlang/dmd - https://github.com/dlang/dmd/tags - nix-prefetch-url --unpack https://github.com/dlang/dmd/archive/refs/tags/v2.104.0.tar.gz + nix-prefetch-url --unpack https://github.com/dlang/dmd/archive/refs/tags/v2.106.1.tar.gz - https://github.com/dlang/dmd/pulls - version in nixpkgs: 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" ]; }; } diff --git a/nix-overlays/dub/default.nix b/nix-overlays/dub/default.nix index 47e6bf6..819a5e5 100644 --- a/nix-overlays/dub/default.nix +++ b/nix-overlays/dub/default.nix @@ -80,7 +80,7 @@ stdenv.mkDerivation rec { description = "Package and build manager for D applications and libraries"; homepage = "https://code.dlang.org/"; license = licenses.mit; - maintainers = with maintainers; [ ThomasMader ]; + maintainers = with maintainers; [ jtbx ]; platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; }; } diff --git a/nix-overlays/ldc/binary.nix b/nix-overlays/ldc/binary.nix index dd4d51c..ca7fb4f 100644 --- a/nix-overlays/ldc/binary.nix +++ b/nix-overlays/ldc/binary.nix @@ -37,7 +37,7 @@ in stdenv.mkDerivation { homepage = "https://github.com/ldc-developers/ldc"; # from https://github.com/ldc-developers/ldc/blob/master/LICENSE license = with licenses; [ bsd3 boost mit ncsa gpl2Plus ]; - maintainers = with maintainers; [ ThomasMader lionello ]; + maintainers = with maintainers; [ lionello ]; platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; }; } diff --git a/nix-overlays/ldc/generic.nix b/nix-overlays/ldc/generic.nix index 78a9a0c..2fd779a 100644 --- a/nix-overlays/ldc/generic.nix +++ b/nix-overlays/ldc/generic.nix @@ -1,5 +1,5 @@ { version, sha256 }: -{ lib, stdenv, fetchurl, cmake, ninja, llvm_14, curl, tzdata +{ lib, stdenv, fetchurl, cmake, ninja, llvm_17, curl, tzdata , libconfig, lit, gdb, unzip, darwin, bash , callPackage, makeWrapper, runCommand, targetPackages , ldcBootstrap ? callPackage ./bootstrap.nix { } @@ -54,7 +54,7 @@ stdenv.mkDerivation rec { ''; nativeBuildInputs = [ - cmake ldcBootstrap lit lit.python llvm_14.dev makeWrapper ninja unzip + cmake ldcBootstrap lit lit.python llvm_17.dev makeWrapper ninja unzip ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.Foundation @@ -68,7 +68,6 @@ stdenv.mkDerivation rec { cmakeFlags = [ "-DD_FLAGS=-d-version=TZDatabaseDir;-d-version=LibcurlPath;-J${pathConfig}" - "-DCMAKE_BUILD_TYPE=Release" ]; postConfigure = '' @@ -131,7 +130,7 @@ stdenv.mkDerivation rec { homepage = "https://github.com/ldc-developers/ldc"; # from https://github.com/ldc-developers/ldc/blob/master/LICENSE license = with licenses; [ bsd3 boost mit ncsa gpl2Plus ]; - maintainers = with maintainers; [ ThomasMader lionello ]; + maintainers = with maintainers; [ lionello jtbx ]; platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; }; } -- cgit v1.2.3