uclibc: Fix eval

This commit is contained in:
John Ericson 2018-05-09 20:49:12 -04:00
parent f063a860d6
commit d65fe65616
2 changed files with 24 additions and 23 deletions

View File

@ -1,8 +1,8 @@
{stdenv, fetchzip, linuxHeaders, libiconvReal, cross ? null, gccCross ? null, { stdenv, buildPackages
extraConfig ? ""}: , fetchzip, linuxHeaders, libiconvReal
, buildPlatform, hostPlatform
assert stdenv.isLinux; , extraConfig ? ""
assert cross != null -> gccCross != null; }:
let let
configParser = '' 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. # UCLIBC_SUSV4_LEGACY defines 'tmpnam', needed for gcc libstdc++ builds.
nixConfig = '' nixConfig = ''
RUNTIME_PREFIX "/" RUNTIME_PREFIX "/"
@ -43,7 +40,7 @@ let
UCLIBC_SUSV4_LEGACY y UCLIBC_SUSV4_LEGACY y
UCLIBC_HAS_THREADS_NATIVE y UCLIBC_HAS_THREADS_NATIVE y
KERNEL_HEADERS "${linuxHeaders}/include" KERNEL_HEADERS "${linuxHeaders}/include"
'' + stdenv.lib.optionalString (stdenv.isAarch32 && cross == null) '' '' + stdenv.lib.optionalString (stdenv.isAarch32 && buildPlatform != hostPlatform) ''
CONFIG_ARM_EABI y CONFIG_ARM_EABI y
ARCH_WANTS_BIG_ENDIAN n ARCH_WANTS_BIG_ENDIAN n
ARCH_BIG_ENDIAN n ARCH_BIG_ENDIAN n
@ -58,7 +55,7 @@ let
in in
stdenv.mkDerivation { stdenv.mkDerivation {
name = name + stdenv.lib.optionalString (cross != null) ("-" + cross.config); inherit name;
src = fetchzip { src = fetchzip {
name = name + "-source"; name = name + "-source";
@ -68,13 +65,12 @@ stdenv.mkDerivation {
# 'ftw' needed to build acl, a coreutils dependency # 'ftw' needed to build acl, a coreutils dependency
configurePhase = '' configurePhase = ''
make defconfig ${archMakeFlag} make defconfig
${configParser} ${configParser}
cat << EOF | parseconfig cat << EOF | parseconfig
${nixConfig} ${nixConfig}
${extraConfig} ${extraConfig}
${if cross != null then stdenv.lib.attrByPath [ "uclibc" "extraConfig" ] "" cross else ""} ${hostPlatform.platform.uclibc.extraConfig or ""}
$extraCrossConfig
EOF EOF
( set +o pipefail; yes "" | make oldconfig ) ( set +o pipefail; yes "" | make oldconfig )
''; '';
@ -82,11 +78,16 @@ stdenv.mkDerivation {
hardeningDisable = [ "stackprotector" ]; hardeningDisable = [ "stackprotector" ];
# Cross stripping hurts. # 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`: # `make libpthread/nptl/sysdeps/unix/sysv/linux/lowlevelrwlock.h`:
# error: bits/sysnum.h: No such file or directory # error: bits/sysnum.h: No such file or directory
@ -94,7 +95,7 @@ stdenv.mkDerivation {
installPhase = '' installPhase = ''
mkdir -p $out 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$") .) (cd $out/include && ln -s $(ls -d ${linuxHeaders}/include/* | grep -v "scsi$") .)
# libpthread.so may not exist, so I do || true # 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 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"; description = "A small implementation of the C library";
maintainers = with maintainers; [ rasendubi ]; maintainers = with maintainers; [ rasendubi ];
license = licenses.lgpl2; license = licenses.lgpl2;
platforms = subtractLists ["aarch64-linux"] platforms.linux; platforms = platforms.linux;
broken = hostPlatform.isAarch64;
}; };
} }

View File

@ -8903,7 +8903,7 @@ with pkgs;
# hack fixes the hack, *sigh*. # hack fixes the hack, *sigh*.
/**/ if name == "glibc" then targetPackages.glibcCross or glibcCross /**/ if name == "glibc" then targetPackages.glibcCross or glibcCross
else if name == "bionic" then targetPackages.bionic else if name == "bionic" then targetPackages.bionic
else if name == "uclibc" then uclibcCross else if name == "uclibc" then targetPackages.uclibcCross
else if name == "musl" then targetPackages.muslCross or muslCross else if name == "musl" then targetPackages.muslCross or muslCross
else if name == "msvcrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64 else if name == "msvcrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64
else if name == "libSystem" then darwin.xcode else if name == "libSystem" then darwin.xcode
@ -13819,10 +13819,9 @@ with pkgs;
uclibc = callPackage ../os-specific/linux/uclibc { }; uclibc = callPackage ../os-specific/linux/uclibc { };
uclibcCross = lowPrio (callPackage ../os-specific/linux/uclibc { uclibcCross = callPackage ../os-specific/linux/uclibc {
gccCross = gccCrossStageStatic; stdenv = crossLibcStdenv;
cross = assert targetPlatform != buildPlatform; targetPlatform; };
});
udev = systemd; udev = systemd;
libudev = udev; libudev = udev;