Skip to content

Commit

Permalink
Merge pull request #226179 from amjoseph-nixpkgs/pr/gnat-bootstrap/cl…
Browse files Browse the repository at this point in the history
…eanup

gnat-bootstrap: parameterize better
  • Loading branch information
Adam Joseph authored Aug 23, 2023
2 parents d334606 + 605ccc8 commit 451b68f
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions pkgs/development/compilers/gnat-bootstrap/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
};
Expand All @@ -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 = [
Expand Down Expand Up @@ -142,4 +146,4 @@ stdenv.mkDerivation rec {
platforms = [ "x86_64-linux" "x86_64-darwin" ];
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
};
}
})

0 comments on commit 451b68f

Please sign in to comment.