mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-23 05:14:45 +00:00
gcc: tighten platform flags special-case for aarch64-darwin
The 4aa95e3312
commit added support for
aarch64-darwin but also ignored platform flags if the build platform
is aarch64-darwin. This leads to confusing errors such as
`pkgsCross.raspberryPi` packages compiled with soft-float even though
the platform supports hard-float (and is built as such on other
platforms).
The correct way to ignore platform flags is to check `targetPlatform`,
not the build platform. This change fixes that.
While we're here, tigthen the special-case to cover only the problematic
flags: `-with-cpu` and `-with-arch`.
This commit is contained in:
parent
f7cb50b3cf
commit
c10a195ab1
@ -217,8 +217,7 @@ let
|
||||
++ lib.optional javaAwtGtk "--enable-java-awt=gtk"
|
||||
++ lib.optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr}"
|
||||
|
||||
# TODO: aarch64-darwin has clang stdenv and its arch and cpu flag values are incompatible with gcc
|
||||
++ lib.optionals (!(stdenv.isDarwin && stdenv.isAarch64)) (import ../common/platform-flags.nix { inherit (stdenv) targetPlatform; inherit lib; })
|
||||
++ import ../common/platform-flags.nix { inherit (stdenv) targetPlatform; inherit lib; }
|
||||
++ lib.optionals (targetPlatform != hostPlatform) crossConfigureFlags
|
||||
++ lib.optional disableBootstrap' "--disable-bootstrap"
|
||||
|
||||
|
@ -1,12 +1,15 @@
|
||||
{ lib, targetPlatform }:
|
||||
|
||||
let
|
||||
isAarch64Darwin = targetPlatform.isDarwin && targetPlatform.isAarch64;
|
||||
gcc = targetPlatform.gcc or {};
|
||||
p = gcc
|
||||
// targetPlatform.parsed.abi;
|
||||
in lib.concatLists [
|
||||
(lib.optional (!targetPlatform.isx86_64 && p ? arch) "--with-arch=${p.arch}") # --with-arch= is unknown flag on x86_64
|
||||
(lib.optional (p ? cpu) "--with-cpu=${p.cpu}")
|
||||
# --with-arch= is unknown flag on x86_64 and aarch64-darwin.
|
||||
(lib.optional (!targetPlatform.isx86_64 && !isAarch64Darwin && p ? arch) "--with-arch=${p.arch}")
|
||||
# --with-cpu on aarch64-darwin fails with "Unknown cpu used in --with-cpu=apple-a13".
|
||||
(lib.optional (!isAarch64Darwin && p ? cpu) "--with-cpu=${p.cpu}")
|
||||
(lib.optional (p ? abi) "--with-abi=${p.abi}")
|
||||
(lib.optional (p ? fpu) "--with-fpu=${p.fpu}")
|
||||
(lib.optional (p ? float) "--with-float=${p.float}")
|
||||
|
Loading…
Reference in New Issue
Block a user