From c7079d43ae99219ed5679df40f83b9266caab716 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 9 Mar 2024 15:11:27 -0500 Subject: dmd & ldc upkeep (dmd at 2.106.1) --- org/nixpkgs_overlays_d_related.org | 134 ++++++++++++++++++++++--------------- 1 file changed, 81 insertions(+), 53 deletions(-) (limited to 'org') diff --git a/org/nixpkgs_overlays_d_related.org b/org/nixpkgs_overlays_d_related.org index 4937517..c2e8008 100644 --- a/org/nixpkgs_overlays_d_related.org +++ b/org/nixpkgs_overlays_d_related.org @@ -43,11 +43,9 @@ nix overlays for (updates nixpkgs, more recent versions of): - dub ( 1.23.0 -> <> ) [for nix versions 1.31.0 ... 1.33.0 broken] - dtools ( 2.095.1 -> <> ) - - dmd ( 2.100.2 -> <> ) KO ✗ + - dmd ( 2.106.1 -> <> ) - gdc [not yet available] -(updates nixpkgs circa 2023-05-12) - dlang-nix-flakes.org --❯ . └── nix-overlays @@ -84,7 +82,7 @@ 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 -> <> ) +,*** dmd KO ✗ ( 2.100.2 -> 2.104.0); OK ✓ ( <> ) - https://dlang.org/ - https://wiki.dlang.org/LDC @@ -501,7 +499,7 @@ import ./generic.nix { #+HEADER: :tangle "../nix-overlays/ldc/generic.nix" #+BEGIN_SRC nix { 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 { } @@ -556,7 +554,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 @@ -570,7 +568,6 @@ stdenv.mkDerivation rec { cmakeFlags = [ "-DD_FLAGS=-d-version=TZDatabaseDir;-d-version=LibcurlPath;-J${pathConfig}" - "-DCMAKE_BUILD_TYPE=Release" ]; postConfigure = '' @@ -633,7 +630,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" ]; }; } @@ -735,7 +732,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" ]; }; } @@ -911,7 +908,7 @@ sha256-8cjs6eHjWAbDRBvyT75mbN3Y7vN1WSwZzY/uRwHNVFg= sha256-/bs3bwgkLZF5IqaiKnc5gCF/r6MQBG/F1kWUkK8j2s0= #+END_SRC -** dmd OK KO ✗ ISSUES +** dmd OK ✓ *** info **** links @@ -939,7 +936,6 @@ sha256-/bs3bwgkLZF5IqaiKnc5gCF/r6MQBG/F1kWUkK8j2s0= import ./generic.nix { version = "<>"; dmdSha256 = "<>"; - #druntimeSha256 = "<>"; phobosSha256 = "<>"; } #+END_SRC @@ -956,12 +952,14 @@ import ./generic.nix { { stdenv , lib , fetchFromGitHub +, removeReferencesTo , makeWrapper , which , writeTextFile , curl , tzdata , gdb +#, Foundation , callPackage , targetPackages , fetchpatch @@ -969,7 +967,8 @@ import ./generic.nix { , installShellFiles , git , unzip -, HOST_DMD ? "${callPackage ./bootstrap.nix { }}/bin/dmd" +, dmdBootstrap ? callPackage ./bootstrap.nix { } +, dmd_bin ? "${dmdBootstrap}/bin" }: let @@ -1020,46 +1019,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" @@ -1082,6 +1073,8 @@ stdenv.mkDerivation rec { buildInputs = [ curl tzdata + # ] ++ lib.optionals stdenv.isDarwin [ + # Foundation ]; nativeCheckInputs = [ @@ -1105,7 +1098,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" @@ -1145,6 +1139,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/ @@ -1157,13 +1154,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" ]; }; } @@ -1195,7 +1198,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; @@ -1263,21 +1271,41 @@ in stdenv.mkDerivation { #+END_SRC *** versions SET -**** selected version SET KO ✗ +**** selected version SET OK ✓ #+NAME: dmd_version #+BEGIN_SRC nix -<> +<> #+END_SRC #+NAME: dmd_hash #+BEGIN_SRC nix -<> +<> #+END_SRC #+NAME: phobos_hash #+BEGIN_SRC nix -<> +<> +#+END_SRC + +**** 2.106.1 OK ✓ + +- nix-prefetch-url --unpack https://github.com/dlang/dmd/archive/refs/tags/v2.106.1.tar.gz +- nix-prefetch-url --unpack https://github.com/dlang/phobos/archive/refs/tags/v2.106.1.tar.gz + +#+NAME: dmd_version_2_106_1 +#+BEGIN_SRC nix +2.106.1 +#+END_SRC + +#+NAME: dmd_hash_2_106_1 +#+BEGIN_SRC nix +sha256-vjYa/Pxrz7J2htXT+fa+xaeen/Vxne++lELbHTSXBK8= +#+END_SRC + +#+NAME: phobos_hash_2_106_1 +#+BEGIN_SRC nix +sha256-yRL9ub3u4mREG9PVxBvgQ/LDXD57RadPTZ2h08qyh/s= #+END_SRC **** 2.104.0 KO ✗ @@ -1457,7 +1485,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" ]; }; } -- cgit v1.2.3