From 6f7d967e289bbae8d9fbc3d9564f7235188b3186 Mon Sep 17 00:00:00 2001 From: Boey Maun Suang Date: Wed, 16 Nov 2022 01:15:24 +1100 Subject: [PATCH] gnat11: Fix by building with older gnatboot GCC's installation instructions strongly recommend using an older version of GNAT to build GNAT, as "[m]ore recent versions of GNAT than the version built are not guaranteed to work and will often fail during the build with compilation errors." [1] The recent upgrade of gnatboot to a 12.1 release in commit bc640dc unfortunately resulted in such a failure for gnat11 [2], resulting in the same errors as GCC bug 103357 [3], which was marked WONTFIX for the reason above. This patch therefore reverts gnat11 to being built with an earlier 11.x gnatboot version, while keeping the updated 12.1 gnatboot to build gnat12 (which is fine because the latter is currently version 12.2). Fixing gnat11 is also a step towards re-enabling the coreboot-toolchain-* packages to be built with Ada support. To facilitate such explicit version dependencies while retaining the meaning of the existing gnatboot package, and in the fashion of the existing gcc packages, this patch also creates the packages gnatboot11 and gnatboot12 with gnatboot made an alias of gnatboot12. [1]: https://gcc.gnu.org/install/prerequisites.html [2]: https://github.com/NixOS/nixpkgs/pull/182414#issuecomment-1204432909 [3]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103357 --- .../compilers/gnatboot/default.nix | 19 +++++++++++++++++-- pkgs/top-level/all-packages.nix | 8 +++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/pkgs/development/compilers/gnatboot/default.nix b/pkgs/development/compilers/gnatboot/default.nix index 4e1301e47a95..65f6269e2f00 100644 --- a/pkgs/development/compilers/gnatboot/default.nix +++ b/pkgs/development/compilers/gnatboot/default.nix @@ -1,14 +1,29 @@ { stdenv, lib, autoPatchelfHook, fetchzip, xz, ncurses5, readline, gmp, mpfr , expat, libipt, zlib, dejagnu, sourceHighlight, python3, elfutils, guile, glibc +, majorVersion }: +let + versionMap = { + "11" = { + version = "11.2.0-4"; + hash = "sha256-8fMBJp6igH+Md5jE4LMubDmC4GLt4A+bZG/Xcz2LAJQ="; + }; + "12" = { + version = "12.1.0-2"; + hash = "sha256-EPDPOOjWJnJsUM7GGxj20/PXumjfLoMIEFX1EDtvWVY="; + }; + }; + +in with versionMap.${majorVersion}; + stdenv.mkDerivation rec { pname = "gnatboot"; - version = "12.1.0-2"; + inherit version; src = fetchzip { url = "https://github.com/alire-project/GNAT-FSF-builds/releases/download/gnat-${version}/gnat-x86_64-linux-${version}.tar.gz"; - hash = "sha256-EPDPOOjWJnJsUM7GGxj20/PXumjfLoMIEFX1EDtvWVY="; + inherit hash; }; nativeBuildInputs = [ diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index aa0c6b4c803a..ab549f5f9e48 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14191,7 +14191,7 @@ with pkgs; gnatboot = if stdenv.hostPlatform == stdenv.targetPlatform && stdenv.buildPlatform == stdenv.hostPlatform - then buildPackages.gnatboot + then buildPackages.gnatboot11 else buildPackages.gnat11; }); @@ -14207,11 +14207,13 @@ with pkgs; gnatboot = if stdenv.hostPlatform == stdenv.targetPlatform && stdenv.buildPlatform == stdenv.hostPlatform - then buildPackages.gnatboot + then buildPackages.gnatboot12 else buildPackages.gnat12; }); - gnatboot = wrapCC (callPackage ../development/compilers/gnatboot { }); + gnatboot = gnatboot12; + gnatboot11 = wrapCC (callPackage ../development/compilers/gnatboot { majorVersion = "11"; }); + gnatboot12 = wrapCC (callPackage ../development/compilers/gnatboot { majorVersion = "12"; }); gnu-smalltalk = callPackage ../development/compilers/gnu-smalltalk { };