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.
This commit is contained in:
sternenseemann 2021-07-21 15:52:41 +02:00 committed by Profpatsch
parent 590fac37c8
commit 58dbc09c41

View file

@ -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";