From 2d8304ddc50d7edf84afd15f9cd67034f419507d Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Thu, 9 Dec 2021 17:12:42 -0800 Subject: [PATCH] uclibc-ng: fix cross-compile to mips (for ben-nanonote) Must specify the the TARGET_ARCH (which confusingly is actually for the host platform, in Nix/autotools terminology) at build and `make install` time. Also, auto-disable UCLIBC_HAS_FPU when hostPlatform.gcc.float == "soft". Clarify platforms = linux and broken = arm to better reflect the current support situation. Fixes pkgsCross.ben-nanonote.stdenv --- pkgs/os-specific/linux/uclibc/default.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkgs/os-specific/linux/uclibc/default.nix b/pkgs/os-specific/linux/uclibc/default.nix index a724604c725e..a0b748be2149 100644 --- a/pkgs/os-specific/linux/uclibc/default.nix +++ b/pkgs/os-specific/linux/uclibc/default.nix @@ -39,6 +39,8 @@ let UCLIBC_SUSV4_LEGACY y UCLIBC_HAS_THREADS_NATIVE y KERNEL_HEADERS "${linuxHeaders}/include" + '' + lib.optionalString (stdenv.hostPlatform.gcc.float or "" == "soft") '' + UCLIBC_HAS_FPU n '' + lib.optionalString (stdenv.isAarch32 && stdenv.buildPlatform != stdenv.hostPlatform) '' CONFIG_ARM_EABI y ARCH_WANTS_BIG_ENDIAN n @@ -81,7 +83,8 @@ stdenv.mkDerivation { depsBuildBuild = [ buildPackages.stdenv.cc ]; makeFlags = [ - "ARCH=${stdenv.hostPlatform.parsed.cpu.name}" + "ARCH=${stdenv.hostPlatform.linuxArch}" + "TARGET_ARCH=${stdenv.hostPlatform.linuxArch}" "VERBOSE=1" ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ "CROSS=${stdenv.cc.targetPrefix}" @@ -93,7 +96,7 @@ stdenv.mkDerivation { installPhase = '' mkdir -p $out - make PREFIX=$out VERBOSE=1 install + make $makeFlags PREFIX=$out VERBOSE=1 install (cd $out/include && ln -s $(ls -d ${linuxHeaders}/include/* | grep -v "scsi$") .) # libpthread.so may not exist, so I do || true sed -i s@/lib/@$out/lib/@g $out/lib/libc.so $out/lib/libpthread.so || true @@ -109,6 +112,7 @@ stdenv.mkDerivation { description = "A small implementation of the C library"; maintainers = with maintainers; [ rasendubi ]; license = licenses.lgpl2; - platforms = intersectLists platforms.linux platforms.x86; # fails to build on ARM + platforms = platforms.linux; + broken = stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64; }; }