From 6dcc0e98a79c9636ef903848b16f5e265a2071b6 Mon Sep 17 00:00:00 2001 From: sempiternal-aurora <78790545+sempiternal-aurora@users.noreply.github.com> Date: Mon, 13 Apr 2026 09:51:23 +1000 Subject: [PATCH 1/5] ghdl: replace all-packages.nix callPackage with ghdl.override --- pkgs/top-level/all-packages.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2780fed25c60..0c7ae8abd103 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4097,11 +4097,11 @@ with pkgs; } ); - ghdl-mcode = callPackage ../by-name/gh/ghdl/package.nix { backend = "mcode"; }; + ghdl-mcode = ghdl.override { backend = "mcode"; }; - ghdl-gcc = callPackage ../by-name/gh/ghdl/package.nix { backend = "gcc"; }; + ghdl-gcc = ghdl.override { backend = "gcc"; }; - ghdl-llvm = callPackage ../by-name/gh/ghdl/package.nix { + ghdl-llvm = ghdl.override { backend = "llvm"; inherit (llvmPackages_20) llvm; }; From eb81d8c39c209a2c72181c7373a723da6a3f90ad Mon Sep 17 00:00:00 2001 From: sempiternal-aurora <78790545+sempiternal-aurora@users.noreply.github.com> Date: Mon, 13 Apr 2026 10:03:08 +1000 Subject: [PATCH 2/5] ghdl: add sempiternal-aurora as maintainer --- pkgs/by-name/gh/ghdl/package.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/by-name/gh/ghdl/package.nix b/pkgs/by-name/gh/ghdl/package.nix index 3d9943397e0b..3b879ebd2052 100644 --- a/pkgs/by-name/gh/ghdl/package.nix +++ b/pkgs/by-name/gh/ghdl/package.nix @@ -133,6 +133,7 @@ stdenv.mkDerivation (finalAttrs: { maintainers = with lib.maintainers; [ lucus16 thoughtpolice + sempiternal-aurora ]; platforms = lib.platforms.linux ++ lib.optionals (backend == "mcode" || backend == "llvm") [ "x86_64-darwin" ]; From 922ccc33640ba1ccc595d16e9bf465e6ded12c18 Mon Sep 17 00:00:00 2001 From: sempiternal-aurora <78790545+sempiternal-aurora@users.noreply.github.com> Date: Mon, 13 Apr 2026 09:54:57 +1000 Subject: [PATCH 3/5] ghdl: 5.1.1 -> 6.0.0, fix gcc build release notes: https://github.com/ghdl/ghdl/releases/tag/v6.0.0 upstream changes: https://github.com/ghdl/ghdl/compare/v5.1.1...v6.0.0 unpins the `ghdl-llvm` backend from llvm 20, as ghdl now supports building with llvm up to version 22 For `ghdl-gcc`, the build was failing because newer gcc versions had requirements for building that neither us or upstream can handle, so pinning the version to gcc13 and building against that, like upstream does, fixed the issues. Also changed the configure flags passed to gcc based on the configure options used in building `pkgs.gcc` Fixes: #447662 --- pkgs/by-name/gh/ghdl/package.nix | 30 ++++++++++++++++++------------ pkgs/top-level/all-packages.nix | 5 +---- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/pkgs/by-name/gh/ghdl/package.nix b/pkgs/by-name/gh/ghdl/package.nix index 3b879ebd2052..622e2a15338a 100644 --- a/pkgs/by-name/gh/ghdl/package.nix +++ b/pkgs/by-name/gh/ghdl/package.nix @@ -6,13 +6,12 @@ zlib, llvm, lib, - gcc-unwrapped, + gcc13, texinfo, gmp, mpfr, libmpc, gnutar, - glibc, makeWrapper, backend ? "mcode", }: @@ -21,13 +20,13 @@ assert backend == "mcode" || backend == "llvm" || backend == "gcc"; stdenv.mkDerivation (finalAttrs: { pname = "ghdl-${backend}"; - version = "5.1.1"; + version = "6.0.0"; src = fetchFromGitHub { owner = "ghdl"; repo = "ghdl"; - rev = "v${finalAttrs.version}"; - hash = "sha256-vPeODNTptxIjN6qLoIHaKOFf3P3iAK2GloVreHPaAz8="; + tag = "v${finalAttrs.version}"; + hash = "sha256-Q5lAWMa1SFjoIJTdWlHSbS4Cg5RYWiej8F05Xrz9ArY="; }; env.LIBRARY_PATH = "${stdenv.cc.libc}/lib"; @@ -39,6 +38,7 @@ stdenv.mkDerivation (finalAttrs: { texinfo makeWrapper ]; + buildInputs = [ zlib ] @@ -50,6 +50,7 @@ stdenv.mkDerivation (finalAttrs: { mpfr libmpc ]; + propagatedBuildInputs = [ ] ++ lib.optionals (backend == "llvm" || backend == "gcc") [ @@ -61,7 +62,7 @@ stdenv.mkDerivation (finalAttrs: { sed -i 's/check_version 7.0/check_version 7/g' configure '' + lib.optionalString (backend == "gcc") '' - ${gnutar}/bin/tar -xf ${gcc-unwrapped.src} + ${gnutar}/bin/tar -xf ${gcc13.cc.src} ''; configureFlags = [ @@ -73,16 +74,16 @@ stdenv.mkDerivation (finalAttrs: { "--with-llvm-config=${llvm.dev}/bin/llvm-config" ] ++ lib.optionals (backend == "gcc") [ - "--with-gcc=gcc-${gcc-unwrapped.version}" + "--with-gcc=gcc-${gcc13.cc.version}" ]; buildPhase = lib.optionalString (backend == "gcc") '' make copy-sources mkdir gcc-objs cd gcc-objs - ../gcc-${gcc-unwrapped.version}/configure \ - --with-native-system-header-dir=/include \ - --with-build-sysroot=${lib.getDev glibc} \ + ../gcc-${gcc13.cc.version}/configure \ + --with-native-system-header-dir=${lib.getDev stdenv.cc.libc}/include \ + --with-build-sysroot=/ \ --prefix=$out \ --enable-languages=c,vhdl \ --disable-bootstrap \ @@ -90,7 +91,12 @@ stdenv.mkDerivation (finalAttrs: { --disable-multilib \ --disable-libssp \ --disable-libgomp \ - --disable-libquadmath + --disable-libquadmath \ + --with-gmp-include=${gmp.dev}/include \ + --with-gmp-lib=${gmp.out}/lib \ + --with-mpfr-include=${mpfr.dev}/include \ + --with-mpfr-lib=${mpfr.out}/lib \ + --with-mpc=${libmpc} make -j $NIX_BUILD_CORES make install cd ../ @@ -101,7 +107,7 @@ stdenv.mkDerivation (finalAttrs: { wrapProgram $out/bin/ghdl \ --set LIBRARY_PATH ${ lib.makeLibraryPath [ - glibc + stdenv.cc.libc ] } ''; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0c7ae8abd103..4365f767f877 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4101,10 +4101,7 @@ with pkgs; ghdl-gcc = ghdl.override { backend = "gcc"; }; - ghdl-llvm = ghdl.override { - backend = "llvm"; - inherit (llvmPackages_20) llvm; - }; + ghdl-llvm = ghdl.override { backend = "llvm"; }; gcc-arm-embedded = gcc-arm-embedded-15; From 2159fa6704641885998438e9a5f56da55317644e Mon Sep 17 00:00:00 2001 From: sempiternal-aurora <78790545+sempiternal-aurora@users.noreply.github.com> Date: Mon, 13 Apr 2026 12:17:08 +1000 Subject: [PATCH 4/5] ghdl: enable __structuredAttrs and strictDeps --- pkgs/by-name/gh/ghdl/package.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/by-name/gh/ghdl/package.nix b/pkgs/by-name/gh/ghdl/package.nix index 622e2a15338a..290cd41a9416 100644 --- a/pkgs/by-name/gh/ghdl/package.nix +++ b/pkgs/by-name/gh/ghdl/package.nix @@ -29,6 +29,9 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-Q5lAWMa1SFjoIJTdWlHSbS4Cg5RYWiej8F05Xrz9ArY="; }; + strictDeps = true; + __structuredAttrs = true; + env.LIBRARY_PATH = "${stdenv.cc.libc}/lib"; nativeBuildInputs = [ From ee5f854be79aa4f0cc28f885ac1c3e7a74ffe574 Mon Sep 17 00:00:00 2001 From: sempiternal-aurora <78790545+sempiternal-aurora@users.noreply.github.com> Date: Mon, 13 Apr 2026 17:54:56 +1000 Subject: [PATCH 5/5] ghdl: fix environment for llvm and gcc backends gcc backend needs as on path, llvm requires the full gcc compiler suite, so just add stdenv.cc to both. Both also need to link against zlib, so add it to the library paths The problems arose in `nix shell nixpkgs#ghdl-llvm` and adding it to a system environment, not `nix-shell -p ghdl-llvm` because that added gcc and other things to the path. __structuredAttrs may also have affected this Fixes: #113401 --- pkgs/by-name/gh/ghdl/package.nix | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/pkgs/by-name/gh/ghdl/package.nix b/pkgs/by-name/gh/ghdl/package.nix index 290cd41a9416..b4f754b8e423 100644 --- a/pkgs/by-name/gh/ghdl/package.nix +++ b/pkgs/by-name/gh/ghdl/package.nix @@ -37,29 +37,22 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ gnat ] + ++ lib.optionals (backend == "llvm" || backend == "gcc") [ + makeWrapper + ] ++ lib.optionals (backend == "gcc") [ texinfo - makeWrapper ]; buildInputs = [ zlib ] - ++ lib.optionals (backend == "llvm") [ - llvm - ] ++ lib.optionals (backend == "gcc") [ gmp mpfr libmpc ]; - propagatedBuildInputs = [ - ] - ++ lib.optionals (backend == "llvm" || backend == "gcc") [ - zlib - ]; - preConfigure = '' # If llvm 7.0 works, 7.x releases should work too. sed -i 's/check_version 7.0/check_version 7/g' configure @@ -99,20 +92,18 @@ stdenv.mkDerivation (finalAttrs: { --with-gmp-lib=${gmp.out}/lib \ --with-mpfr-include=${mpfr.dev}/include \ --with-mpfr-lib=${mpfr.out}/lib \ - --with-mpc=${libmpc} + --with-mpc=${libmpc} \ + --enable-default-pie=${if stdenv.targetPlatform.hasSharedLibraries then "yes" else "no"} make -j $NIX_BUILD_CORES make install cd ../ make -j $NIX_BUILD_CORES ghdllib ''; - postFixup = lib.optionalString (backend == "gcc") '' + postFixup = lib.optionalString (backend == "llvm" || backend == "gcc") '' wrapProgram $out/bin/ghdl \ - --set LIBRARY_PATH ${ - lib.makeLibraryPath [ - stdenv.cc.libc - ] - } + --set LIBRARY_PATH ${lib.makeLibraryPath [ zlib ]} \ + --prefix PATH : ${lib.makeBinPath [ stdenv.cc ]} ''; hardeningDisable = [