3
0
Fork 0
forked from mirrors/nixpkgs

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
This commit is contained in:
Boey Maun Suang 2022-11-16 01:15:24 +11:00 committed by Rick van Schijndel
parent 8d7badd689
commit 6f7d967e28
2 changed files with 22 additions and 5 deletions

View file

@ -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 = [

View file

@ -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 { };