From 364713fdd33de8ea0accfbf9f9cf342abaac2b62 Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Thu, 22 Jul 2021 18:57:58 +0200 Subject: [PATCH] gnat*: bootstrap cross with native compiler of the same version https://gcc.gnu.org/install/prerequisites.html#GNAT-prerequisite --- pkgs/top-level/all-packages.nix | 37 +++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7dc2993f453d..c5a3949c805a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11212,7 +11212,15 @@ in langCC = false; langAda = true; profiledCompiler = false; - inherit (buildPackages) gnatboot; + # As per upstream instructions building a cross compiler + # should be done with a (native) compiler of the same version. + # If we are cross-compiling GNAT, we may as well go the same + # route (especially as gnatboot can't cross-compile). + gnatboot = + if stdenv.hostPlatform == stdenv.targetPlatform + && stdenv.buildPlatform == stdenv.hostPlatform + then buildPackages.gnatboot + else buildPackages.gnat6; }); gnat9 = wrapCC (gcc9.cc.override { @@ -11221,7 +11229,14 @@ in langCC = false; langAda = true; profiledCompiler = false; - gnatboot = buildPackages.gnat6; + # As per upstream instructions building a cross compiler + # should be done with a (native) compiler of the same version. + # If we are cross-compiling GNAT, we may as well do the same. + gnatboot = + if stdenv.hostPlatform == stdenv.targetPlatform + && stdenv.buildPlatform == stdenv.hostPlatform + then buildPackages.gnat6 + else buildPackages.gnat9; }); gnat10 = wrapCC (gcc10.cc.override { @@ -11230,7 +11245,14 @@ in langCC = false; langAda = true; profiledCompiler = false; - gnatboot = buildPackages.gnat6; + # As per upstream instructions building a cross compiler + # should be done with a (native) compiler of the same version. + # If we are cross-compiling GNAT, we may as well do the same. + gnatboot = + if stdenv.hostPlatform == stdenv.targetPlatform + && stdenv.buildPlatform == stdenv.hostPlatform + then buildPackages.gnat6 + else buildPackages.gnat10; }); gnat11 = wrapCC (gcc11.cc.override { @@ -11239,7 +11261,14 @@ in langCC = false; langAda = true; profiledCompiler = false; - gnatboot = buildPackages.gnat6; + # As per upstream instructions building a cross compiler + # should be done with a (native) compiler of the same version. + # If we are cross-compiling GNAT, we may as well do the same. + gnatboot = + if stdenv.hostPlatform == stdenv.targetPlatform + && stdenv.buildPlatform == stdenv.hostPlatform + then buildPackages.gnat6 + else buildPackages.gnat11; }); gnatboot = wrapCC (callPackage ../development/compilers/gnatboot { });