summary refs log tree commit diff
path: root/pkgs/os-specific/linux/uclibc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2018-05-09 20:49:12 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2018-05-10 00:17:43 -0400
commitd65fe65616f28b60102fd9d05e593676e5a75555 (patch)
treed42edfd97e412508cd03277685494cbcfd23b1a3 /pkgs/os-specific/linux/uclibc
parentf063a860d69c5fbf3695a262da6a551ddd92a5f2 (diff)
downloadnixlib-d65fe65616f28b60102fd9d05e593676e5a75555.tar
nixlib-d65fe65616f28b60102fd9d05e593676e5a75555.tar.gz
nixlib-d65fe65616f28b60102fd9d05e593676e5a75555.tar.bz2
nixlib-d65fe65616f28b60102fd9d05e593676e5a75555.tar.lz
nixlib-d65fe65616f28b60102fd9d05e593676e5a75555.tar.xz
nixlib-d65fe65616f28b60102fd9d05e593676e5a75555.tar.zst
nixlib-d65fe65616f28b60102fd9d05e593676e5a75555.zip
uclibc: Fix eval
Diffstat (limited to 'pkgs/os-specific/linux/uclibc')
-rw-r--r--pkgs/os-specific/linux/uclibc/default.nix38
1 files changed, 20 insertions, 18 deletions
diff --git a/pkgs/os-specific/linux/uclibc/default.nix b/pkgs/os-specific/linux/uclibc/default.nix
index 180aabc94cc6..426834d42255 100644
--- a/pkgs/os-specific/linux/uclibc/default.nix
+++ b/pkgs/os-specific/linux/uclibc/default.nix
@@ -1,8 +1,8 @@
-{stdenv, fetchzip, linuxHeaders, libiconvReal, cross ? null, gccCross ? null,
-extraConfig ? ""}:
-
-assert stdenv.isLinux;
-assert cross != null -> gccCross != null;
+{ stdenv, buildPackages
+, fetchzip, linuxHeaders, libiconvReal
+, buildPlatform, hostPlatform
+, extraConfig ? ""
+}:
 
 let
   configParser = ''
@@ -28,9 +28,6 @@ let
     }
   '';
 
-  archMakeFlag = if cross != null then "ARCH=${cross.arch}" else "";
-  crossMakeFlag = if cross != null then "CROSS=${cross.config}-" else "";
-
   # UCLIBC_SUSV4_LEGACY defines 'tmpnam', needed for gcc libstdc++ builds.
   nixConfig = ''
     RUNTIME_PREFIX "/"
@@ -43,7 +40,7 @@ let
     UCLIBC_SUSV4_LEGACY y
     UCLIBC_HAS_THREADS_NATIVE y
     KERNEL_HEADERS "${linuxHeaders}/include"
-  '' + stdenv.lib.optionalString (stdenv.isAarch32 && cross == null) ''
+  '' + stdenv.lib.optionalString (stdenv.isAarch32 && buildPlatform != hostPlatform) ''
     CONFIG_ARM_EABI y
     ARCH_WANTS_BIG_ENDIAN n
     ARCH_BIG_ENDIAN n
@@ -58,7 +55,7 @@ let
 in
 
 stdenv.mkDerivation {
-  name = name + stdenv.lib.optionalString (cross != null) ("-" + cross.config);
+  inherit name;
 
   src = fetchzip {
     name = name + "-source";
@@ -68,13 +65,12 @@ stdenv.mkDerivation {
 
   # 'ftw' needed to build acl, a coreutils dependency
   configurePhase = ''
-    make defconfig ${archMakeFlag}
+    make defconfig
     ${configParser}
     cat << EOF | parseconfig
     ${nixConfig}
     ${extraConfig}
-    ${if cross != null then stdenv.lib.attrByPath [ "uclibc" "extraConfig" ] "" cross else ""}
-    $extraCrossConfig
+    ${hostPlatform.platform.uclibc.extraConfig or ""}
     EOF
     ( set +o pipefail; yes "" | make oldconfig )
   '';
@@ -82,11 +78,16 @@ stdenv.mkDerivation {
   hardeningDisable = [ "stackprotector" ];
 
   # Cross stripping hurts.
-  dontStrip = cross != null;
+  dontStrip = stdenv.hostPlatform != stdenv.buildPlatform;
 
-  makeFlags = [ crossMakeFlag "VERBOSE=1" ];
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
 
-  buildInputs = stdenv.lib.optional (gccCross != null) gccCross;
+  makeFlags = [
+    "ARCH=${hostPlatform.parsed.cpu.name}"
+    "VERBOSE=1"
+  ] ++ stdenv.lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
+    "CROSS=${stdenv.cc.targetPrefix}"
+  ];
 
   # `make libpthread/nptl/sysdeps/unix/sysv/linux/lowlevelrwlock.h`:
   # error: bits/sysnum.h: No such file or directory
@@ -94,7 +95,7 @@ stdenv.mkDerivation {
 
   installPhase = ''
     mkdir -p $out
-    make PREFIX=$out VERBOSE=1 install ${crossMakeFlag}
+    make 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
@@ -110,6 +111,7 @@ stdenv.mkDerivation {
     description = "A small implementation of the C library";
     maintainers = with maintainers; [ rasendubi ];
     license = licenses.lgpl2;
-    platforms = subtractLists ["aarch64-linux"] platforms.linux;
+    platforms = platforms.linux;
+    broken = hostPlatform.isAarch64;
   };
 }