Merge commit 'feb648ce59ffbed94c58133eb7aa2761992a35e1' into staging

This commit is contained in:
John Ericson 2018-05-10 01:55:26 -04:00
commit 006422d08d
13 changed files with 69 additions and 64 deletions

View File

@ -29,6 +29,7 @@ rec {
/**/ if final.isDarwin then "libSystem" /**/ if final.isDarwin then "libSystem"
else if final.isMinGW then "msvcrt" else if final.isMinGW then "msvcrt"
else if final.isMusl then "musl" else if final.isMusl then "musl"
else if final.isUClibc then "uclibc"
else if final.isAndroid then "bionic" else if final.isAndroid then "bionic"
else if final.isLinux /* default */ then "glibc" else if final.isLinux /* default */ then "glibc"
# TODO(@Ericson2314) think more about other operating systems # TODO(@Ericson2314) think more about other operating systems

View File

@ -11,22 +11,19 @@ rec {
sheevaplug = rec { sheevaplug = rec {
config = "armv5tel-unknown-linux-gnueabi"; config = "armv5tel-unknown-linux-gnueabi";
arch = "armv5tel";
float = "soft"; float = "soft";
platform = platforms.sheevaplug; platform = platforms.sheevaplug;
}; };
raspberryPi = rec { raspberryPi = rec {
config = "armv6l-unknown-linux-gnueabihf"; config = "armv6l-unknown-linux-gnueabihf";
arch = "armv6l";
float = "hard"; float = "hard";
fpu = "vfp"; fpu = "vfp";
platform = platforms.raspberrypi; platform = platforms.raspberrypi;
}; };
armv7l-hf-multiplatform = rec { armv7l-hf-multiplatform = rec {
config = "arm-unknown-linux-gnueabihf"; config = "armv7a-unknown-linux-gnueabihf";
arch = "armv7-a";
float = "hard"; float = "hard";
fpu = "vfpv3-d16"; fpu = "vfpv3-d16";
platform = platforms.armv7l-hf-multiplatform; platform = platforms.armv7l-hf-multiplatform;
@ -34,13 +31,11 @@ rec {
aarch64-multiplatform = rec { aarch64-multiplatform = rec {
config = "aarch64-unknown-linux-gnu"; config = "aarch64-unknown-linux-gnu";
arch = "aarch64";
platform = platforms.aarch64-multiplatform; platform = platforms.aarch64-multiplatform;
}; };
aarch64-android-prebuilt = rec { aarch64-android-prebuilt = rec {
config = "aarch64-unknown-linux-android"; config = "aarch64-unknown-linux-android";
arch = "aarch64";
platform = platforms.aarch64-multiplatform; platform = platforms.aarch64-multiplatform;
useAndroidPrebuilt = true; useAndroidPrebuilt = true;
}; };
@ -51,15 +46,26 @@ rec {
}; };
pogoplug4 = rec { pogoplug4 = rec {
arch = "armv5tel";
config = "armv5tel-unknown-linux-gnueabi"; config = "armv5tel-unknown-linux-gnueabi";
float = "soft"; float = "soft";
platform = platforms.pogoplug4; platform = platforms.pogoplug4;
}; };
ben-nanonote = rec {
config = "mipsel-unknown-linux-uclibc";
float = "soft";
platform = {
name = "ben_nanonote";
kernelMajor = "2.6";
kernelArch = "mips";
gcc = {
arch = "mips32";
};
};
};
fuloongminipc = rec { fuloongminipc = rec {
config = "mipsel-unknown-linux-gnu"; config = "mipsel-unknown-linux-gnu";
arch = "mips";
float = "hard"; float = "hard";
platform = platforms.fuloong2f_n32; platform = platforms.fuloong2f_n32;
}; };
@ -128,7 +134,6 @@ rec {
# 32 bit mingw-w64 # 32 bit mingw-w64
mingw32 = { mingw32 = {
config = "i686-pc-mingw32"; config = "i686-pc-mingw32";
arch = "x86"; # Irrelevant
libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
platform = {}; platform = {};
}; };
@ -137,7 +142,6 @@ rec {
mingwW64 = { mingwW64 = {
# That's the triplet they use in the mingw-w64 docs. # That's the triplet they use in the mingw-w64 docs.
config = "x86_64-pc-mingw32"; config = "x86_64-pc-mingw32";
arch = "x86_64"; # Irrelevant
libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
platform = {}; platform = {};
}; };

View File

@ -38,6 +38,7 @@ rec {
isAndroid = [ { abi = abis.android; } { abi = abis.androideabi; } ]; isAndroid = [ { abi = abis.android; } { abi = abis.androideabi; } ];
isMusl = with abis; map (a: { abi = a; }) [ musl musleabi musleabihf ]; isMusl = with abis; map (a: { abi = a; }) [ musl musleabi musleabihf ];
isUClibc = with abis; map (a: { abi = a; }) [ uclibc uclibceabi uclibceabihf ];
isEfi = map (family: { cpu.family = family; }) isEfi = map (family: { cpu.family = family; })
[ "x86" "arm" "aarch64" ]; [ "x86" "arm" "aarch64" ];

View File

@ -69,9 +69,15 @@ rec {
cpuTypes = with significantBytes; setTypes types.openCpuType { cpuTypes = with significantBytes; setTypes types.openCpuType {
arm = { bits = 32; significantByte = littleEndian; family = "arm"; }; arm = { bits = 32; significantByte = littleEndian; family = "arm"; };
armv5tel = { bits = 32; significantByte = littleEndian; family = "arm"; }; armv5tel = { bits = 32; significantByte = littleEndian; family = "arm"; };
armv6m = { bits = 32; significantByte = littleEndian; family = "arm"; };
armv6l = { bits = 32; significantByte = littleEndian; family = "arm"; }; armv6l = { bits = 32; significantByte = littleEndian; family = "arm"; };
armv7a = { bits = 32; significantByte = littleEndian; family = "arm"; }; armv7a = { bits = 32; significantByte = littleEndian; family = "arm"; };
armv7r = { bits = 32; significantByte = littleEndian; family = "arm"; };
armv7m = { bits = 32; significantByte = littleEndian; family = "arm"; };
armv7l = { bits = 32; significantByte = littleEndian; family = "arm"; }; armv7l = { bits = 32; significantByte = littleEndian; family = "arm"; };
armv8a = { bits = 32; significantByte = littleEndian; family = "arm"; };
armv8r = { bits = 32; significantByte = littleEndian; family = "arm"; };
armv8m = { bits = 32; significantByte = littleEndian; family = "arm"; };
aarch64 = { bits = 64; significantByte = littleEndian; family = "arm"; }; aarch64 = { bits = 64; significantByte = littleEndian; family = "arm"; };
i686 = { bits = 32; significantByte = littleEndian; family = "x86"; }; i686 = { bits = 32; significantByte = littleEndian; family = "x86"; };
x86_64 = { bits = 64; significantByte = littleEndian; family = "x86"; }; x86_64 = { bits = 64; significantByte = littleEndian; family = "x86"; };
@ -195,6 +201,9 @@ rec {
musleabi = {}; musleabi = {};
musleabihf = {}; musleabihf = {};
musl = {}; musl = {};
uclibceabihf = {};
uclibceabi = {};
uclibc = {};
unknown = {}; unknown = {};
}; };

View File

@ -52,7 +52,7 @@ let
"--cross-prefix=${stdenv.cc.targetPrefix}" "--cross-prefix=${stdenv.cc.targetPrefix}"
"--enable-cross-compile" "--enable-cross-compile"
"--target_os=linux" "--target_os=linux"
"--arch=${hostPlatform.arch}" "--arch=${hostPlatform.parsed.cpu.name}"
]; ];
}; };

View File

@ -443,7 +443,7 @@ stdenv.mkDerivation rec {
"--cross-prefix=${stdenv.cc.targetPrefix}" "--cross-prefix=${stdenv.cc.targetPrefix}"
"--enable-cross-compile" "--enable-cross-compile"
"--target_os=${hostPlatform.parsed.kernel.name}" "--target_os=${hostPlatform.parsed.kernel.name}"
"--arch=${hostPlatform.arch}" "--arch=${hostPlatform.parsed.cpu.name}"
]; ];
}; };

View File

@ -177,7 +177,7 @@ stdenv.mkDerivation rec {
"--cross-prefix=${stdenv.cc.targetPrefix}" "--cross-prefix=${stdenv.cc.targetPrefix}"
"--enable-cross-compile" "--enable-cross-compile"
"--target_os=${hostPlatform.parsed.kernel.name}" "--target_os=${hostPlatform.parsed.kernel.name}"
"--arch=${hostPlatform.arch}" "--arch=${hostPlatform.parsed.cpu.name}"
]; ];
}; };

View File

@ -24,7 +24,9 @@ stdenv.mkDerivation rec {
]; ];
# We should find a better way to access the arch reliably. # We should find a better way to access the arch reliably.
crossArch = hostPlatform.arch or null; crossArch = if stdenv.hostPlatform != stdenv.buildPlatform
then hostPlatform.parsed.cpu.name
else null;
preConfigure = '' preConfigure = ''
if test -n "$crossConfig"; then if test -n "$crossConfig"; then

View File

@ -47,7 +47,9 @@ stdenv.mkDerivation rec {
]; ];
# We should find a better way to access the arch reliably. # We should find a better way to access the arch reliably.
crossArch = hostPlatform.arch or null; crossArch = if stdenv.hostPlatform != stdenv.buildPlatform
then hostPlatform.parsed.cpu.name
else null;
preConfigure = '' preConfigure = ''
if test -n "$crossConfig"; then if test -n "$crossConfig"; then

View File

@ -118,7 +118,7 @@ let
"--cross-prefix=${stdenv.cc.targetPrefix}" "--cross-prefix=${stdenv.cc.targetPrefix}"
"--enable-cross-compile" "--enable-cross-compile"
"--target_os=linux" "--target_os=linux"
"--arch=${hostPlatform.arch}" "--arch=${hostPlatform.parsed.cpu.name}"
]; ];
}; };

View File

@ -1,7 +1,8 @@
{stdenv, fetchzip, linuxHeaders, libiconvReal, cross ? null, gccCross ? null, { stdenv, buildPackages
extraConfig ? ""}: , fetchurl, linuxHeaders, libiconvReal
, buildPlatform, hostPlatform
assert cross != null -> gccCross != null; , extraConfig ? ""
}:
let let
configParser = '' configParser = ''
@ -27,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 "/"
@ -42,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
@ -51,29 +49,27 @@ let
UCLIBC_HAS_FPU n UCLIBC_HAS_FPU n
''; '';
name = "uclibc-0.9.34-pre-20150131"; version = "1.0.30";
rev = "343f6b8f1f754e397632b0552e4afe586c8b392b";
in in
stdenv.mkDerivation { stdenv.mkDerivation {
name = name + stdenv.lib.optionalString (cross != null) ("-" + cross.config); name = "uclibc-ng-${version}";
inherit version;
src = fetchzip { src = fetchurl {
name = name + "-source"; url = "https://downloads.uclibc-ng.org/releases/${version}/uClibc-ng-${version}.tar.bz2";
url = "http://git.uclibc.org/uClibc/snapshot/uClibc-${rev}.tar.bz2"; # from "${url}.sha256";
sha256 = "1kgylzpid7da5i7wz7slh5q9rnq1m8bv5h9ilm76g0xwc2iwlhbw"; sha256 = "3e0f057f24882823d697126015aa4d7d48fa2542be3939985cb3c26dcbcab5a8";
}; };
# '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 )
''; '';
@ -81,11 +77,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
@ -93,7 +94,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
@ -105,10 +106,10 @@ stdenv.mkDerivation {
}; };
meta = with stdenv.lib; { meta = with stdenv.lib; {
homepage = http://www.uclibc.org/; homepage = "https://uclibc-ng.org";
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;
}; };
} }

View File

@ -1,5 +1,5 @@
{ stdenv, fetchgit, libusb, libusb1, autoconf, automake, confuse, pkgconfig { stdenv, fetchgit, libusb, libusb1, autoconf, automake, confuse, pkgconfig
, gccCross ? null, crossPrefix , gccCross ? null
}: }:
let let
@ -19,7 +19,7 @@ stdenv.mkDerivation {
''; '';
configureFlags = if gccCross != null then configureFlags = if gccCross != null then
"--enable-firmware CROSS_COMPILE=${crossPrefix}-" "--enable-firmware CROSS_COMPILE=${gccCross.targetPrefix}"
else ""; else "";
hardeningDisable = [ "pic" "stackprotector" ]; hardeningDisable = [ "pic" "stackprotector" ];

View File

@ -5708,28 +5708,14 @@ with pkgs;
x11_ssh_askpass = callPackage ../tools/networking/x11-ssh-askpass { }; x11_ssh_askpass = callPackage ../tools/networking/x11-ssh-askpass { };
xbursttools = assert stdenv ? glibc; callPackage ../tools/misc/xburst-tools rec { xbursttools = callPackage ../tools/misc/xburst-tools {
# It needs a cross compiler for mipsel to build the firmware it will # It needs a cross compiler for mipsel to build the firmware it will
# load into the Ben Nanonote # load into the Ben Nanonote
crossPrefix = "mipsel-unknown-linux-gnu";
gccCross = gccCross =
let let
pkgsCross = nixpkgsFun { pkgsCross = nixpkgsFun {
# Ben Nanonote system # Ben Nanonote system
crossSystem = { crossSystem = lib.systems.examples.ben-nanonote;
config = crossPrefix;
arch = "mips";
float = "soft";
libc = "uclibc";
platform = {
name = "ben_nanonote";
kernelMajor = "2.6";
kernelArch = "mips";
};
gcc = {
arch = "mips32";
};
};
}; };
in in
pkgsCross.buildPackages.gccCrossStageStatic; pkgsCross.buildPackages.gccCrossStageStatic;
@ -9078,7 +9064,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 targetPlatform.useiOSPrebuilt then targetPackages.iosSdkPkgs.libraries else if targetPlatform.useiOSPrebuilt then targetPackages.iosSdkPkgs.libraries
@ -14070,10 +14056,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; };
});
eudev = callPackage ../os-specific/linux/eudev {}; eudev = callPackage ../os-specific/linux/eudev {};