From 58dbc09c4103073e1f2e29b364d3c2a0a13b1585 Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Wed, 21 Jul 2021 15:52:41 +0200 Subject: [PATCH] gnatboot: explicitly check hostPlatform and prevent building a cross compiler * gnatboot can't be used as cross compiler, so we should prevent this at eval time. * Explicitly checking hostPlatform is also a lot nicer. Keeping system since gnatboot seems to be statically linked so gnu/musl which is also tracked in config isn't important. --- pkgs/development/compilers/gnatboot/default.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/gnatboot/default.nix b/pkgs/development/compilers/gnatboot/default.nix index d97298d0238..c68c4fd4ba0 100644 --- a/pkgs/development/compilers/gnatboot/default.nix +++ b/pkgs/development/compilers/gnatboot/default.nix @@ -1,15 +1,19 @@ { lib, stdenv, fetchurl }: +if stdenv.hostPlatform != stdenv.targetPlatform +then builtins.throw "gnatboot can't cross-compile" +else + stdenv.mkDerivation { pname = "gentoo-gnatboot"; version = "4.1"; - src = if stdenv.system == "i686-linux" then + src = if stdenv.hostPlatform.system == "i686-linux" then fetchurl { url = mirror://gentoo/distfiles/gnatboot-4.1-i386.tar.bz2; sha256 = "0665zk71598204bf521vw68i5y6ccqarq9fcxsqp7ccgycb4lysr"; } - else if stdenv.system == "x86_64-linux" then + else if stdenv.hostPlatform.system == "x86_64-linux" then fetchurl { url = mirror://gentoo/distfiles/gnatboot-4.1-amd64.tar.bz2; sha256 = "1li4d52lmbnfs6llcshlbqyik2q2q4bvpir0f7n38nagp0h6j0d4";