Merge pull request #183997 from alyssais/isAarch

This commit is contained in:
Sandro 2022-07-30 19:43:34 +02:00 committed by GitHub
commit 6e5cce711d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 35 additions and 37 deletions

View file

@ -18,7 +18,7 @@ rec {
]; ];
qemuSerialDevice = if pkgs.stdenv.hostPlatform.isx86 || pkgs.stdenv.hostPlatform.isRiscV then "ttyS0" qemuSerialDevice = if pkgs.stdenv.hostPlatform.isx86 || pkgs.stdenv.hostPlatform.isRiscV then "ttyS0"
else if (with pkgs.stdenv.hostPlatform; isAarch32 || isAarch64 || isPower) then "ttyAMA0" else if (with pkgs.stdenv.hostPlatform; isAarch || isPower) then "ttyAMA0"
else throw "Unknown QEMU serial device for system '${pkgs.stdenv.hostPlatform.system}'"; else throw "Unknown QEMU serial device for system '${pkgs.stdenv.hostPlatform.system}'";
qemuBinary = qemuPkg: { qemuBinary = qemuPkg: {

View file

@ -62,7 +62,7 @@ in {
alsa-firmware alsa-firmware
sof-firmware sof-firmware
libreelec-dvb-firmware libreelec-dvb-firmware
] ++ optional (pkgs.stdenv.hostPlatform.isAarch32 || pkgs.stdenv.hostPlatform.isAarch64) raspberrypiWirelessFirmware ] ++ optional pkgs.stdenv.hostPlatform.isAarch raspberrypiWirelessFirmware
++ optionals (versionOlder config.boot.kernelPackages.kernel.version "4.13") [ ++ optionals (versionOlder config.boot.kernelPackages.kernel.version "4.13") [
rtl8723bs-firmware rtl8723bs-firmware
] ++ optionals (versionOlder config.boot.kernelPackages.kernel.version "5.16") [ ] ++ optionals (versionOlder config.boot.kernelPackages.kernel.version "5.16") [

View file

@ -476,9 +476,9 @@ in
isoImage.squashfsCompression = mkOption { isoImage.squashfsCompression = mkOption {
default = with pkgs.stdenv.targetPlatform; "xz -Xdict-size 100% " default = with pkgs.stdenv.targetPlatform; "xz -Xdict-size 100% "
+ lib.optionalString (isx86_32 || isx86_64) "-Xbcj x86" + lib.optionalString isx86 "-Xbcj x86"
# Untested but should also reduce size for these platforms # Untested but should also reduce size for these platforms
+ lib.optionalString (isAarch32 || isAarch64) "-Xbcj arm" + lib.optionalString isAarch "-Xbcj arm"
+ lib.optionalString (isPower && is32bit && isBigEndian) "-Xbcj powerpc" + lib.optionalString (isPower && is32bit && isBigEndian) "-Xbcj powerpc"
+ lib.optionalString (isSparc) "-Xbcj sparc"; + lib.optionalString (isSparc) "-Xbcj sparc";
description = '' description = ''

View file

@ -57,7 +57,7 @@ in
# Hyper-V support. # Hyper-V support.
"hv_storvsc" "hv_storvsc"
] ++ lib.optionals (pkgs.stdenv.isAarch32 || pkgs.stdenv.isAarch64) [ ] ++ lib.optionals pkgs.stdenv.hostPlatform.isAarch [
# Most of the following falls into two categories: # Most of the following falls into two categories:
# - early KMS / early display # - early KMS / early display
# - early storage (e.g. USB) support # - early storage (e.g. USB) support

View file

@ -92,7 +92,7 @@ in {
"default_config" "default_config"
"met" "met"
"esphome" "esphome"
] ++ optionals (pkgs.stdenv.hostPlatform.isAarch32 || pkgs.stdenv.hostPlatform.isAarch64) [ ] ++ optionals pkgs.stdenv.hostPlatform.isAarch [
# Use the platform as an indicator that we might be running on a RaspberryPi and include # Use the platform as an indicator that we might be running on a RaspberryPi and include
# relevant components # relevant components
"rpi_power" "rpi_power"

View file

@ -870,7 +870,7 @@ in
(mkIf pkgs.stdenv.hostPlatform.isx86 [ (mkIf pkgs.stdenv.hostPlatform.isx86 [
"-usb" "-device usb-tablet,bus=usb-bus.0" "-usb" "-device usb-tablet,bus=usb-bus.0"
]) ])
(mkIf (pkgs.stdenv.isAarch32 || pkgs.stdenv.isAarch64) [ (mkIf pkgs.stdenv.hostPlatform.isAarch [
"-device virtio-gpu-pci" "-device usb-ehci,id=usb0" "-device usb-kbd" "-device usb-tablet" "-device virtio-gpu-pci" "-device usb-ehci,id=usb0" "-device usb-kbd" "-device usb-tablet"
]) ])
(let (let

View file

@ -48,7 +48,7 @@ let
configureFlags = old.configureFlags configureFlags = old.configureFlags
++ (readLinesToList ./config/ffmpeg_args_common) ++ (readLinesToList ./config/ffmpeg_args_common)
++ lib.optionals stdenv.isLinux (readLinesToList ./config/ffmpeg_args_linux) ++ lib.optionals stdenv.isLinux (readLinesToList ./config/ffmpeg_args_linux)
++ lib.optionals (stdenv.isx86_32 || stdenv.isx86_64) (readLinesToList ./config/ffmpeg_args_x86); ++ lib.optionals stdenv.hostPlatform.isx86 (readLinesToList ./config/ffmpeg_args_x86);
outputs = [ "out" "doc" ]; outputs = [ "out" "doc" ];
meta = old.meta // { meta = old.meta // {
# undefined reference to `ff_nlmeans_init_aarch64' # undefined reference to `ff_nlmeans_init_aarch64'

View file

@ -206,7 +206,7 @@ let self = stdenv.mkDerivation rec {
++ optional (!useGtk) "--disable-gtk" ++ optional (!useGtk) "--disable-gtk"
++ optional useFdk "--enable-fdk-aac" ++ optional useFdk "--enable-fdk-aac"
++ optional stdenv.isDarwin "--disable-xcode" ++ optional stdenv.isDarwin "--disable-xcode"
++ optional (stdenv.isx86_32 || stdenv.isx86_64) "--harden"; ++ optional stdenv.hostPlatform.isx86 "--harden";
# NOTE: 2018-12-27: Check NixOS HandBrake test if changing # NOTE: 2018-12-27: Check NixOS HandBrake test if changing
NIX_LDFLAGS = [ "-lx265" ]; NIX_LDFLAGS = [ "-lx265" ];

View file

@ -80,7 +80,6 @@
let let
inherit (lib) optionalString optional optionals; inherit (lib) optionalString optional optionals;
hostIsAarch = stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64;
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "${optionalString onlyLibVLC "lib"}vlc"; pname = "${optionalString onlyLibVLC "lib"}vlc";
@ -159,7 +158,7 @@ stdenv.mkDerivation rec {
xcbutilkeysyms xcbutilkeysyms
xlibsWrapper xlibsWrapper
]) ])
++ optional (!hostIsAarch && !onlyLibVLC) live555 ++ optional (!stdenv.hostPlatform.isAarch && !onlyLibVLC) live555
++ optional jackSupport libjack2 ++ optional jackSupport libjack2
++ optionals chromecastSupport [ libmicrodns protobuf ] ++ optionals chromecastSupport [ libmicrodns protobuf ]
++ optionals skins2Support (with xorg; [ ++ optionals skins2Support (with xorg; [
@ -184,7 +183,7 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true; enableParallelBuilding = true;
LIVE555_PREFIX = if hostIsAarch then null else live555; LIVE555_PREFIX = if stdenv.hostPlatform.isAarch then null else live555;
# vlc depends on a c11-gcc wrapper script which we don't have so we need to # vlc depends on a c11-gcc wrapper script which we don't have so we need to
# set the path to the compiler # set the path to the compiler

View file

@ -1,8 +1,8 @@
# ARM-SPECIFIC OVERRIDES FOR THE HASKELL PACKAGE SET IN NIXPKGS # ARM-SPECIFIC OVERRIDES FOR THE HASKELL PACKAGE SET IN NIXPKGS
# #
# This extension is applied to all haskell package sets in nixpkgs # This extension is applied to all haskell package sets in nixpkgs if
# if `stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64` # `stdenv.hostPlatform.isAarch` to apply arm specific workarounds or
# to apply arm specific workarounds or fixes. # fixes.
# #
# The file is split into three parts: # The file is split into three parts:
# #

View file

@ -21,8 +21,7 @@ let
inherit stdenv haskellLib ghc buildHaskellPackages extensible-self all-cabal-hashes; inherit stdenv haskellLib ghc buildHaskellPackages extensible-self all-cabal-hashes;
}; };
isArm = with stdenv.hostPlatform; isAarch64 || isAarch32; platformConfigurations = lib.optionals stdenv.hostPlatform.isAarch [
platformConfigurations = lib.optionals isArm [
(configurationArm { inherit pkgs haskellLib; }) (configurationArm { inherit pkgs haskellLib; })
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
(configurationDarwin { inherit pkgs haskellLib; }) (configurationDarwin { inherit pkgs haskellLib; })

View file

@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
# emulating build_all.sh configuration variables # emulating build_all.sh configuration variables
jplatform = jplatform =
if stdenv.isDarwin then "darwin" if stdenv.isDarwin then "darwin"
else if (stdenv.isAarch32 || stdenv.isAarch64) then "raspberry" else if stdenv.hostPlatform.isAarch then "raspberry"
else if stdenv.isLinux then "linux" else if stdenv.isLinux then "linux"
else "unsupported"; else "unsupported";

View file

@ -69,7 +69,7 @@ stdenv.mkDerivation rec {
patchShebangs ../test/ patchShebangs ../test/
mkdir ../test/tmp mkdir ../test/tmp
${lib.optionalString (stdenv.isAarch64 || stdenv.isAarch32) '' ${lib.optionalString stdenv.hostPlatform.isAarch ''
# Fix tests on arm # Fix tests on arm
# https://github.com/Exiv2/exiv2/issues/933 # https://github.com/Exiv2/exiv2/issues/933
rm -f ../tests/bugfixes/github/test_CVE_2018_12265.py rm -f ../tests/bugfixes/github/test_CVE_2018_12265.py

View file

@ -29,11 +29,11 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ autoreconfHook ]; nativeBuildInputs = [ autoreconfHook ];
# tcmalloc uses libunwind in a way that works correctly only on non-ARM linux # tcmalloc uses libunwind in a way that works correctly only on non-ARM linux
buildInputs = lib.optional (stdenv.isLinux && !(stdenv.isAarch64 || stdenv.isAarch32)) libunwind; buildInputs = lib.optional (stdenv.isLinux && !stdenv.hostPlatform.isAarch) libunwind;
# Disable general dynamic TLS on AArch to support dlopen()'ing the library: # Disable general dynamic TLS on AArch to support dlopen()'ing the library:
# https://bugzilla.redhat.com/show_bug.cgi?id=1483558 # https://bugzilla.redhat.com/show_bug.cgi?id=1483558
configureFlags = lib.optional (stdenv.isAarch32 || stdenv.isAarch64) configureFlags = lib.optional stdenv.hostPlatform.isAarch
"--disable-general-dynamic-tls"; "--disable-general-dynamic-tls";
prePatch = lib.optionalString stdenv.isDarwin '' prePatch = lib.optionalString stdenv.isDarwin ''

View file

@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
"-Dnm-path=${stdenv.cc.targetPrefix}nm" "-Dnm-path=${stdenv.cc.targetPrefix}nm"
"-Dinstall-test-programs=true" "-Dinstall-test-programs=true"
"-Domap=true" "-Domap=true"
] ++ lib.optionals (stdenv.isAarch32 || stdenv.isAarch64) [ ] ++ lib.optionals stdenv.hostPlatform.isAarch [
"-Dtegra=true" "-Dtegra=true"
"-Detnaviv=true" "-Detnaviv=true"
]; ];

View file

@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
preConfigure = lib.optionalString (stdenv.buildPlatform.isx86_64 || stdenv.hostPlatform.isi686) '' preConfigure = lib.optionalString (stdenv.buildPlatform.isx86_64 || stdenv.hostPlatform.isi686) ''
# `AS' is set to the binutils assembler, but we need nasm # `AS' is set to the binutils assembler, but we need nasm
unset AS unset AS
'' + lib.optionalString (stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isAarch32) '' '' + lib.optionalString stdenv.hostPlatform.isAarch ''
export AS=$CC export AS=$CC
''; '';

View file

@ -85,7 +85,7 @@ buildPythonPackage rec {
"test_filename_without_dir" "test_filename_without_dir"
"test_overwrite" "test_overwrite"
"test_options" "test_options"
] ++ lib.optionals (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isRiscV) [ ] ++ lib.optionals (stdenv.hostPlatform.isAarch || stdenv.hostPlatform.isRiscV) [
# unknown reason so far # unknown reason so far
# https://github.com/adobe-type-tools/afdko/issues/1425 # https://github.com/adobe-type-tools/afdko/issues/1425
"test_spec" "test_spec"

View file

@ -29,7 +29,7 @@ buildPythonPackage rec {
# Tests fail due to numeric precision differences on ARM # Tests fail due to numeric precision differences on ARM
# See https://github.com/SethMMorton/fastnumbers/issues/28 # See https://github.com/SethMMorton/fastnumbers/issues/28
doCheck = !(stdenv.isAarch64 || stdenv.isAarch32); doCheck = !stdenv.hostPlatform.isAarch;
checkInputs = [ checkInputs = [
hypothesis hypothesis

View file

@ -48,7 +48,7 @@ buildPythonPackage rec {
# Depend on pyopenssl # Depend on pyopenssl
"--deselect tests/test_tcp.py::Test_UV_TCPSSL::test_flush_before_shutdown" "--deselect tests/test_tcp.py::Test_UV_TCPSSL::test_flush_before_shutdown"
"--deselect tests/test_tcp.py::Test_UV_TCPSSL::test_renegotiation" "--deselect tests/test_tcp.py::Test_UV_TCPSSL::test_renegotiation"
] ++ lib.optionals (stdenv.isAarch32 || stdenv.isAarch64) [ ] ++ lib.optionals stdenv.hostPlatform.isAarch [
# test gets stuck in epoll_pwait on hydras aarch64 builders # test gets stuck in epoll_pwait on hydras aarch64 builders
# https://github.com/MagicStack/uvloop/issues/412 # https://github.com/MagicStack/uvloop/issues/412
"--deselect tests/test_tcp.py::Test_AIO_TCPSSL::test_remote_shutdown_receives_trailing_data" "--deselect tests/test_tcp.py::Test_AIO_TCPSSL::test_remote_shutdown_receives_trailing_data"

View file

@ -18,7 +18,7 @@
let let
# the GLES backend on rpi is untested as I don't have the hardware # the GLES backend on rpi is untested as I don't have the hardware
backend = backend =
if (stdenv.isx86_32 || stdenv.isx86_64) then "OpenGL" else "GLES"; if stdenv.hostPlatform.isx86 then "OpenGL" else "GLES";
withVLC = stdenv.isDarwin; withVLC = stdenv.isDarwin;

View file

@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
]; ];
# "marbling" has NEON code that mixes signed and unsigned vector types # "marbling" has NEON code that mixes signed and unsigned vector types
NIX_CFLAGS_COMPILE = lib.optional (with stdenv.hostPlatform; isAarch64 || isAarch32) "-flax-vector-conversions"; NIX_CFLAGS_COMPILE = lib.optional stdenv.hostPlatform.isAarch "-flax-vector-conversions";
postInstall = '' postInstall = ''
for bin in $out/bin/*; do for bin in $out/bin/*; do

View file

@ -13,8 +13,8 @@ stdenv.mkDerivation rec {
dontUnpack = true; dontUnpack = true;
buildPhase = "${stdenv.cc.targetPrefix}cc -o nmon ${src} -g -O2 -D JFS -D GETUSER -Wall -D LARGEMEM -lncurses -lm -g -D ${ buildPhase = "${stdenv.cc.targetPrefix}cc -o nmon ${src} -g -O2 -D JFS -D GETUSER -Wall -D LARGEMEM -lncurses -lm -g -D ${
with stdenv.targetPlatform; with stdenv.targetPlatform;
if isx86_32 || isx86_64 then "X86" if isx86 then "X86"
else if isAarch32 || isAarch64 then "ARM" else if isAarch then "ARM"
else if isPower then "POWER" else if isPower then "POWER"
else "UNKNOWN" else "UNKNOWN"
}"; }";

View file

@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
makeFlags = kernel.makeFlags ++ [ makeFlags = kernel.makeFlags ++ [
"KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" "KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
("CONFIG_PLATFORM_I386_PC=" + (if (stdenv.hostPlatform.isi686 || stdenv.hostPlatform.isx86_64) then "y" else "n")) ("CONFIG_PLATFORM_I386_PC=" + (if (stdenv.hostPlatform.isi686 || stdenv.hostPlatform.isx86_64) then "y" else "n"))
("CONFIG_PLATFORM_ARM_RPI=" + (if (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) then "y" else "n")) ("CONFIG_PLATFORM_ARM_RPI=" + (if stdenv.hostPlatform.isAarch then "y" else "n"))
]; ];
preInstall = '' preInstall = ''

View file

@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
"ARCH=${stdenv.hostPlatform.linuxArch}" "ARCH=${stdenv.hostPlatform.linuxArch}"
"KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" "KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
("CONFIG_PLATFORM_I386_PC=" + (if stdenv.hostPlatform.isx86 then "y" else "n")) ("CONFIG_PLATFORM_I386_PC=" + (if stdenv.hostPlatform.isx86 then "y" else "n"))
("CONFIG_PLATFORM_ARM_RPI=" + (if (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) then "y" else "n")) ("CONFIG_PLATFORM_ARM_RPI=" + (if stdenv.hostPlatform.isAarch then "y" else "n"))
] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [ ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
"CROSS_COMPILE=${stdenv.cc.targetPrefix}" "CROSS_COMPILE=${stdenv.cc.targetPrefix}"
]; ];

View file

@ -46,7 +46,7 @@ stdenv.mkDerivation rec {
# - ignore test_screen because it assumes vt terminals exist # - ignore test_screen because it assumes vt terminals exist
checkPhase = '' checkPhase = ''
pytest . \ pytest . \
${lib.optionalString (stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isAarch32) "--ignore=test/t/test_gcc.py"} \ ${lib.optionalString stdenv.hostPlatform.isAarch "--ignore=test/t/test_gcc.py"} \
--ignore=test/t/test_chsh.py \ --ignore=test/t/test_chsh.py \
--ignore=test/t/test_ether_wake.py \ --ignore=test/t/test_ether_wake.py \
--ignore=test/t/test_ifdown.py \ --ignore=test/t/test_ifdown.py \

View file

@ -178,7 +178,7 @@ let
# Except when: # Except when:
# - static aarch64, where compilation works, but produces segfaulting dynamically linked binaries. # - static aarch64, where compilation works, but produces segfaulting dynamically linked binaries.
# - static armv7l, where compilation fails. # - static armv7l, where compilation fails.
!((stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isAarch32) && stdenv.hostPlatform.isStatic) !(stdenv.hostPlatform.isAarch && stdenv.hostPlatform.isStatic)
then supportedHardeningFlags then supportedHardeningFlags
else lib.remove "pie" supportedHardeningFlags; else lib.remove "pie" supportedHardeningFlags;
enabledHardeningOptions = enabledHardeningOptions =

View file

@ -108,7 +108,7 @@ in {
# aarch64 ghc865Binary gets SEGVs due to haskell#15449 or similar # aarch64 ghc865Binary gets SEGVs due to haskell#15449 or similar
# the oldest ghc with aarch64-darwin support is 8.10.5 # the oldest ghc with aarch64-darwin support is 8.10.5
# Musl bindists do not exist for ghc 8.6.5, so we use 8.10.* for them # Musl bindists do not exist for ghc 8.6.5, so we use 8.10.* for them
if stdenv.isAarch64 || stdenv.isAarch32 then if stdenv.hostPlatform.isAarch then
packages.ghc8107BinaryMinimal packages.ghc8107BinaryMinimal
else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
# to my (@a-m-joseph) knowledge there are no newer official binaries for this platform # to my (@a-m-joseph) knowledge there are no newer official binaries for this platform
@ -127,7 +127,7 @@ in {
bootPkgs = bootPkgs =
# aarch64 ghc8107Binary exceeds max output size on hydra # aarch64 ghc8107Binary exceeds max output size on hydra
# the oldest ghc with aarch64-darwin support is 8.10.5 # the oldest ghc with aarch64-darwin support is 8.10.5
if stdenv.isAarch64 || stdenv.isAarch32 then if stdenv.hostPlatform.isAarch then
packages.ghc8107BinaryMinimal packages.ghc8107BinaryMinimal
else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
packages.ghc8107 packages.ghc8107
@ -141,7 +141,7 @@ in {
ghc923 = callPackage ../development/compilers/ghc/9.2.3.nix { ghc923 = callPackage ../development/compilers/ghc/9.2.3.nix {
bootPkgs = bootPkgs =
# aarch64 ghc8107Binary exceeds max output size on hydra # aarch64 ghc8107Binary exceeds max output size on hydra
if stdenv.isAarch64 || stdenv.isAarch32 then if stdenv.hostPlatform.isAarch then
packages.ghc8107BinaryMinimal packages.ghc8107BinaryMinimal
else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
packages.ghc8107 packages.ghc8107