Merge pull request #59897 from matthewbauer/mb-cross-fixes2
Miscellaneous cross compilation fixes
This commit is contained in:
+10
-4
@@ -72,16 +72,22 @@ rec {
|
|||||||
release = null;
|
release = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
kernelArch =
|
||||||
|
if final.isAarch32 then "arm"
|
||||||
|
else if final.isAarch64 then "arm64"
|
||||||
|
else if final.isx86_32 then "x86"
|
||||||
|
else if final.isx86_64 then "ia64"
|
||||||
|
else final.parsed.cpu.name;
|
||||||
|
|
||||||
qemuArch =
|
qemuArch =
|
||||||
if final.isArm then "arm"
|
if final.isArm then "arm"
|
||||||
else if final.isx86_64 then "x86_64"
|
else if final.isx86_64 then "x86_64"
|
||||||
else if final.isx86 then "i386"
|
else if final.isx86 then "i386"
|
||||||
else {
|
else {
|
||||||
"powerpc" = "ppc";
|
"powerpc" = "ppc";
|
||||||
|
"powerpcle" = "ppc";
|
||||||
"powerpc64" = "ppc64";
|
"powerpc64" = "ppc64";
|
||||||
"powerpc64le" = "ppc64";
|
"powerpc64le" = "ppc64le";
|
||||||
"mips64" = "mips";
|
|
||||||
"mipsel64" = "mipsel";
|
|
||||||
}.${final.parsed.cpu.name} or final.parsed.cpu.name;
|
}.${final.parsed.cpu.name} or final.parsed.cpu.name;
|
||||||
|
|
||||||
emulator = pkgs: let
|
emulator = pkgs: let
|
||||||
@@ -103,7 +109,7 @@ rec {
|
|||||||
in
|
in
|
||||||
if final.parsed.kernel.name == pkgs.stdenv.hostPlatform.parsed.kernel.name &&
|
if final.parsed.kernel.name == pkgs.stdenv.hostPlatform.parsed.kernel.name &&
|
||||||
pkgs.stdenv.hostPlatform.isCompatible final
|
pkgs.stdenv.hostPlatform.isCompatible final
|
||||||
then "${pkgs.runtimeShell} -c"
|
then "${pkgs.runtimeShell} -c '\"$@\"' --"
|
||||||
else if final.isWindows
|
else if final.isWindows
|
||||||
then "${wine}/bin/${wine-name}"
|
then "${wine}/bin/${wine-name}"
|
||||||
else if final.isLinux && pkgs.stdenv.hostPlatform.isLinux
|
else if final.isLinux && pkgs.stdenv.hostPlatform.isLinux
|
||||||
|
|||||||
+33
-13
@@ -127,22 +127,42 @@ rec {
|
|||||||
(b == i386 && isCompatible a i486)
|
(b == i386 && isCompatible a i486)
|
||||||
(b == i486 && isCompatible a i586)
|
(b == i486 && isCompatible a i586)
|
||||||
(b == i586 && isCompatible a i686)
|
(b == i586 && isCompatible a i686)
|
||||||
# NOTE: Not true in some cases. Like in WSL mode.
|
|
||||||
|
# XXX: Not true in some cases. Like in WSL mode.
|
||||||
(b == i686 && isCompatible a x86_64)
|
(b == i686 && isCompatible a x86_64)
|
||||||
|
|
||||||
# ARM
|
# ARMv4
|
||||||
(b == arm && isCompatible a armv5tel)
|
(b == arm && isCompatible a armv5tel)
|
||||||
(b == armv5tel && isCompatible a armv6m)
|
|
||||||
(b == armv6m && isCompatible a armv6l)
|
# ARMv5
|
||||||
(b == armv6l && isCompatible a armv7a)
|
(b == armv5tel && isCompatible a armv6l)
|
||||||
(b == armv7a && isCompatible a armv7r)
|
|
||||||
(b == armv7r && isCompatible a armv7m)
|
# ARMv6
|
||||||
(b == armv7m && isCompatible a armv7l)
|
(b == armv6l && isCompatible a armv6m)
|
||||||
(b == armv7l && isCompatible a armv8a)
|
(b == armv6m && isCompatible a armv7l)
|
||||||
(b == armv8a && isCompatible a armv8r)
|
|
||||||
(b == armv8r && isCompatible a armv8m)
|
# ARMv7
|
||||||
# NOTE: not always true! Some arm64 cpus don’t support arm32 mode.
|
(b == armv7l && isCompatible a armv7a)
|
||||||
(b == armv8m && isCompatible a aarch64)
|
(b == armv7l && isCompatible a armv7r)
|
||||||
|
(b == armv7l && isCompatible a armv7m)
|
||||||
|
(b == armv7a && isCompatible a armv8a)
|
||||||
|
(b == armv7r && isCompatible a armv8a)
|
||||||
|
(b == armv7m && isCompatible a armv8a)
|
||||||
|
(b == armv7a && isCompatible a armv8r)
|
||||||
|
(b == armv7r && isCompatible a armv8r)
|
||||||
|
(b == armv7m && isCompatible a armv8r)
|
||||||
|
(b == armv7a && isCompatible a armv8m)
|
||||||
|
(b == armv7r && isCompatible a armv8m)
|
||||||
|
(b == armv7m && isCompatible a armv8m)
|
||||||
|
|
||||||
|
# ARMv8
|
||||||
|
(b == armv8r && isCompatible a armv8a)
|
||||||
|
(b == armv8m && isCompatible a armv8a)
|
||||||
|
|
||||||
|
# XXX: not always true! Some arm64 cpus don’t support arm32 mode.
|
||||||
|
(b == aarch64 && a == armv8a)
|
||||||
|
(b == armv8a && isCompatible a aarch64)
|
||||||
|
|
||||||
(b == aarch64 && a == aarch64_be)
|
(b == aarch64 && a == aarch64_be)
|
||||||
(b == aarch64_be && isCompatible a aarch64)
|
(b == aarch64_be && isCompatible a aarch64)
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ in stdenv.mkDerivation rec {
|
|||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
configurePlatforms = [ "host" "target" ];
|
configurePlatforms = [ ];
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
export CXXFLAGS="-fpermissive"
|
export CXXFLAGS="-fpermissive"
|
||||||
@@ -51,7 +51,11 @@ in stdenv.mkDerivation rec {
|
|||||||
"--with-intl-api"
|
"--with-intl-api"
|
||||||
"--enable-readline"
|
"--enable-readline"
|
||||||
"--enable-shared-js"
|
"--enable-shared-js"
|
||||||
] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "--disable-jemalloc";
|
] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "--disable-jemalloc"
|
||||||
|
++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||||
|
"--host=${stdenv.buildPlatform.config}"
|
||||||
|
"--target=${stdenv.hostPlatform.config}"
|
||||||
|
];
|
||||||
|
|
||||||
makeFlags = [
|
makeFlags = [
|
||||||
"HOST_CC=${buildPackages.stdenv.cc}/bin/cc"
|
"HOST_CC=${buildPackages.stdenv.cc}/bin/cc"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ lib, stdenv, fetchFromGitHub, cmake }:
|
{ lib, stdenv, fetchFromGitHub, cmake, libexecinfo }:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "aws-c-common";
|
pname = "aws-c-common";
|
||||||
@@ -13,6 +13,8 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
nativeBuildInputs = [ cmake ];
|
nativeBuildInputs = [ cmake ];
|
||||||
|
|
||||||
|
buildInputs = lib.optional stdenv.hostPlatform.isMusl libexecinfo;
|
||||||
|
|
||||||
NIX_CFLAGS_COMPILE = lib.optionals stdenv.isDarwin [
|
NIX_CFLAGS_COMPILE = lib.optionals stdenv.isDarwin [
|
||||||
"-Wno-nullability-extension"
|
"-Wno-nullability-extension"
|
||||||
"-Wno-typedef-redefinition"
|
"-Wno-typedef-redefinition"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ let
|
|||||||
inherit sha256;
|
inherit sha256;
|
||||||
};
|
};
|
||||||
|
|
||||||
ARCH = stdenvNoCC.hostPlatform.platform.kernelArch or (throw "missing kernelArch");
|
ARCH = stdenvNoCC.hostPlatform.platform.kernelArch or stdenvNoCC.hostPlatform.kernelArch;
|
||||||
|
|
||||||
# It may look odd that we use `stdenvNoCC`, and yet explicit depend on a cc.
|
# It may look odd that we use `stdenvNoCC`, and yet explicit depend on a cc.
|
||||||
# We do this so we have a build->build, not build->host, C compiler.
|
# We do this so we have a build->build, not build->host, C compiler.
|
||||||
|
|||||||
@@ -129,12 +129,12 @@ in stdenv.mkDerivation rec {
|
|||||||
test -e $i
|
test -e $i
|
||||||
substituteInPlace $i \
|
substituteInPlace $i \
|
||||||
--replace /usr/bin/getent ${getent}/bin/getent \
|
--replace /usr/bin/getent ${getent}/bin/getent \
|
||||||
--replace /sbin/swapon ${utillinux.bin}/sbin/swapon \
|
--replace /sbin/swapon ${lib.getBin utillinux}/sbin/swapon \
|
||||||
--replace /sbin/swapoff ${utillinux.bin}/sbin/swapoff \
|
--replace /sbin/swapoff ${lib.getBin utillinux}/sbin/swapoff \
|
||||||
--replace /sbin/fsck ${utillinux.bin}/sbin/fsck \
|
--replace /sbin/fsck ${lib.getBin utillinux}/sbin/fsck \
|
||||||
--replace /bin/echo ${coreutils}/bin/echo \
|
--replace /bin/echo ${coreutils}/bin/echo \
|
||||||
--replace /bin/cat ${coreutils}/bin/cat \
|
--replace /bin/cat ${coreutils}/bin/cat \
|
||||||
--replace /sbin/sulogin ${utillinux.bin}/sbin/sulogin \
|
--replace /sbin/sulogin ${lib.getBin utillinux}/sbin/sulogin \
|
||||||
--replace /usr/lib/systemd/systemd-fsck $out/lib/systemd/systemd-fsck \
|
--replace /usr/lib/systemd/systemd-fsck $out/lib/systemd/systemd-fsck \
|
||||||
--replace /bin/plymouth /run/current-system/sw/bin/plymouth # To avoid dependency
|
--replace /bin/plymouth /run/current-system/sw/bin/plymouth # To avoid dependency
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -43,8 +43,14 @@ in
|
|||||||
"x86_64-linux" = stagesLinux;
|
"x86_64-linux" = stagesLinux;
|
||||||
"armv5tel-linux" = stagesLinux;
|
"armv5tel-linux" = stagesLinux;
|
||||||
"armv6l-linux" = stagesLinux;
|
"armv6l-linux" = stagesLinux;
|
||||||
|
"armv6m-linux" = stagesLinux;
|
||||||
"armv7a-linux" = stagesLinux;
|
"armv7a-linux" = stagesLinux;
|
||||||
"armv7l-linux" = stagesLinux;
|
"armv7l-linux" = stagesLinux;
|
||||||
|
"armv7r-linux" = stagesLinux;
|
||||||
|
"armv7m-linux" = stagesLinux;
|
||||||
|
"armv8a-linux" = stagesLinux;
|
||||||
|
"armv8r-linux" = stagesLinux;
|
||||||
|
"armv8m-linux" = stagesLinux;
|
||||||
"aarch64-linux" = stagesLinux;
|
"aarch64-linux" = stagesLinux;
|
||||||
"mipsel-linux" = stagesLinux;
|
"mipsel-linux" = stagesLinux;
|
||||||
"powerpc-linux" = /* stagesLinux */ stagesNative;
|
"powerpc-linux" = /* stagesLinux */ stagesNative;
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
"x86_64-linux" = import ./bootstrap-files/x86_64.nix;
|
"x86_64-linux" = import ./bootstrap-files/x86_64.nix;
|
||||||
"armv5tel-linux" = import ./bootstrap-files/armv5tel.nix;
|
"armv5tel-linux" = import ./bootstrap-files/armv5tel.nix;
|
||||||
"armv6l-linux" = import ./bootstrap-files/armv6l.nix;
|
"armv6l-linux" = import ./bootstrap-files/armv6l.nix;
|
||||||
"armv7a-linux" = import ./bootstrap-files/armv7l.nix;
|
|
||||||
"armv7l-linux" = import ./bootstrap-files/armv7l.nix;
|
"armv7l-linux" = import ./bootstrap-files/armv7l.nix;
|
||||||
"aarch64-linux" = import ./bootstrap-files/aarch64.nix;
|
"aarch64-linux" = import ./bootstrap-files/aarch64.nix;
|
||||||
"mipsel-linux" = import ./bootstrap-files/loongson2f.nix;
|
"mipsel-linux" = import ./bootstrap-files/loongson2f.nix;
|
||||||
@@ -26,10 +25,19 @@
|
|||||||
"powerpc64le-linux" = import ./bootstrap-files/ppc64le-musl.nix;
|
"powerpc64le-linux" = import ./bootstrap-files/ppc64le-musl.nix;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Try to find an architecture compatible with our current system. We
|
||||||
|
# just try every bootstrap we’ve got and test to see if it is
|
||||||
|
# compatible with or current architecture.
|
||||||
|
getCompatibleTools = lib.foldl (v: system:
|
||||||
|
if v != null then v
|
||||||
|
else if localSystem.isCompatible (lib.systems.elaborate { inherit system; }) then archLookupTable.${system}
|
||||||
|
else null) null (lib.attrNames archLookupTable);
|
||||||
|
|
||||||
archLookupTable = table.${localSystem.libc}
|
archLookupTable = table.${localSystem.libc}
|
||||||
or (abort "unsupported libc for the pure Linux stdenv");
|
or (abort "unsupported libc for the pure Linux stdenv");
|
||||||
files = archLookupTable.${localSystem.system}
|
files = archLookupTable.${localSystem.system} or (if getCompatibleTools != null then getCompatibleTools
|
||||||
or (abort "unsupported platform for the pure Linux stdenv");
|
else (abort "unsupported platform for the pure Linux stdenv"));
|
||||||
in files
|
in files
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ in
|
|||||||
else overlays homeOverlaysDir
|
else overlays homeOverlaysDir
|
||||||
else []
|
else []
|
||||||
|
|
||||||
|
, crossOverlays ? []
|
||||||
|
|
||||||
, ...
|
, ...
|
||||||
} @ args:
|
} @ args:
|
||||||
|
|
||||||
@@ -80,7 +82,7 @@ in
|
|||||||
assert args ? localSystem -> !(args ? system || args ? platform);
|
assert args ? localSystem -> !(args ? system || args ? platform);
|
||||||
|
|
||||||
import ./. (builtins.removeAttrs args [ "system" "platform" ] // {
|
import ./. (builtins.removeAttrs args [ "system" "platform" ] // {
|
||||||
inherit config overlays crossSystem;
|
inherit config overlays crossSystem crossOverlays;
|
||||||
# Fallback: Assume we are building packages on the current (build, in GNU
|
# Fallback: Assume we are building packages on the current (build, in GNU
|
||||||
# Autotools parlance) system.
|
# Autotools parlance) system.
|
||||||
localSystem = (if args ? localSystem then {}
|
localSystem = (if args ? localSystem then {}
|
||||||
|
|||||||
Reference in New Issue
Block a user