summary refs log tree commit diff
path: root/pkgs/os-specific/linux/uclibc/default.nix
diff options
context:
space:
mode:
authorRyan Burns <rtburns@protonmail.com>2021-12-09 17:12:42 -0800
committerRyan Burns <rtburns@protonmail.com>2021-12-09 17:12:42 -0800
commit2d8304ddc50d7edf84afd15f9cd67034f419507d (patch)
treeb0ab834f63e95347a41c5e86dae88eb7b1f75549 /pkgs/os-specific/linux/uclibc/default.nix
parent581d2d6c9cd5c289002203581d8aa0861963a933 (diff)
downloadnixpkgs-2d8304ddc50d7edf84afd15f9cd67034f419507d.tar
nixpkgs-2d8304ddc50d7edf84afd15f9cd67034f419507d.tar.gz
nixpkgs-2d8304ddc50d7edf84afd15f9cd67034f419507d.tar.bz2
nixpkgs-2d8304ddc50d7edf84afd15f9cd67034f419507d.tar.lz
nixpkgs-2d8304ddc50d7edf84afd15f9cd67034f419507d.tar.xz
nixpkgs-2d8304ddc50d7edf84afd15f9cd67034f419507d.tar.zst
nixpkgs-2d8304ddc50d7edf84afd15f9cd67034f419507d.zip
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
Diffstat (limited to 'pkgs/os-specific/linux/uclibc/default.nix')
-rw-r--r--pkgs/os-specific/linux/uclibc/default.nix10
1 files changed, 7 insertions, 3 deletions
diff --git a/pkgs/os-specific/linux/uclibc/default.nix b/pkgs/os-specific/linux/uclibc/default.nix
index a724604c725..a0b748be214 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;
   };
 }