From 605ccc82967d8fbd52f7b3e04e15b9fb10a88129 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Fri, 14 Apr 2023 10:57:30 -0700 Subject: [PATCH] gnat-bootstrap: parameterize better This commit makes `url` dependent on the gnat version, and allows for `alireRevision` to be empty (in which case no hyphen is added after ${gccVersion} in `version`). This should cause no changes to eval on `gnat11` or `gnat12`. This is submitted in order to reduce the size of #225191 --- .../compilers/gnat-bootstrap/default.nix | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/pkgs/development/compilers/gnat-bootstrap/default.nix b/pkgs/development/compilers/gnat-bootstrap/default.nix index bd7bdfd102395..5de926a02853d 100644 --- a/pkgs/development/compilers/gnat-bootstrap/default.nix +++ b/pkgs/development/compilers/gnat-bootstrap/default.nix @@ -5,17 +5,22 @@ let throwUnsupportedSystem = throw "Unsupported system: ${stdenv.hostPlatform.system}"; - - versionMap = rec { +in +stdenv.mkDerivation(finalAttrs: + let versionMap = + let url = "https://github.com/alire-project/GNAT-FSF-builds/releases/download/gnat-${finalAttrs.version}/gnat-${stdenv.hostPlatform.system}-${finalAttrs.version}.tar.gz"; + in { "11" = { gccVersion = "11.2.0"; alireRevision = "4"; } // { x86_64-darwin = { + inherit url; hash = "sha256-FmBgD20PPQlX/ddhJliCTb/PRmKxe9z7TFPa2/SK4GY="; upstreamTriplet = "x86_64-apple-darwin19.6.0"; }; x86_64-linux = { + inherit url; hash = "sha256-8fMBJp6igH+Md5jE4LMubDmC4GLt4A+bZG/Xcz2LAJQ="; upstreamTriplet = "x86_64-pc-linux-gnu"; }; @@ -25,27 +30,26 @@ let alireRevision = "2"; } // { x86_64-darwin = { + inherit url; hash = "sha256-zrcVFvFZMlGUtkG0p1wST6kGInRI64Icdsvkcf25yVs="; upstreamTriplet = "x86_64-apple-darwin19.6.0"; }; x86_64-linux = { + inherit url; hash = "sha256-EPDPOOjWJnJsUM7GGxj20/PXumjfLoMIEFX1EDtvWVY="; upstreamTriplet = "x86_64-pc-linux-gnu"; }; }.${stdenv.hostPlatform.system} or throwUnsupportedSystem; }; - -in with versionMap.${majorVersion}; - -stdenv.mkDerivation rec { + inherit (versionMap.${majorVersion}) gccVersion alireRevision upstreamTriplet; +in { pname = "gnat-bootstrap"; - inherit gccVersion alireRevision; + inherit (versionMap.${majorVersion}) gccVersion alireRevision; - version = "${gccVersion}-${alireRevision}"; + version = "${gccVersion}${lib.optionalString (alireRevision!="") "-"}${alireRevision}"; src = fetchzip { - url = "https://github.com/alire-project/GNAT-FSF-builds/releases/download/gnat-${version}/gnat-${stdenv.hostPlatform.system}-${version}.tar.gz"; - inherit hash; + inherit (versionMap.${majorVersion}) url hash; }; nativeBuildInputs = [ @@ -141,4 +145,4 @@ stdenv.mkDerivation rec { maintainers = with maintainers; [ ethindp ]; platforms = [ "x86_64-linux" "x86_64-darwin" ]; }; -} +})