Merge remote-tracking branch 'upstream/master' into gcc-7
Conflicts: pkgs/development/compilers/gcc/7/default.nix pkgs/development/libraries/SDL2/default.nix pkgs/top-level/all-packages.nix
This commit is contained in:
@@ -80,9 +80,10 @@ let
|
||||
inherit (prevStage) stdenv;
|
||||
};
|
||||
cc = prevStage.gcc-unwrapped;
|
||||
bintools = prevStage.binutils;
|
||||
isGNU = true;
|
||||
libc = prevStage.glibc;
|
||||
inherit (prevStage) binutils coreutils gnugrep;
|
||||
inherit (prevStage) coreutils gnugrep;
|
||||
name = name;
|
||||
stdenvNoCC = prevStage.ccWrapperStdenv;
|
||||
};
|
||||
@@ -143,7 +144,15 @@ in
|
||||
'';
|
||||
};
|
||||
gcc-unwrapped = bootstrapTools;
|
||||
binutils = bootstrapTools;
|
||||
binutils = import ../../build-support/bintools-wrapper {
|
||||
nativeTools = false;
|
||||
nativeLibc = false;
|
||||
buildPackages = { };
|
||||
libc = self.glibc;
|
||||
inherit (self) stdenvNoCC coreutils gnugrep;
|
||||
bintools = bootstrapTools;
|
||||
name = "bootstrap-binutils-wrapper";
|
||||
};
|
||||
coreutils = bootstrapTools;
|
||||
gnugrep = bootstrapTools;
|
||||
};
|
||||
@@ -165,7 +174,7 @@ in
|
||||
|
||||
# Rebuild binutils to use from stage2 onwards.
|
||||
overrides = self: super: {
|
||||
binutils = super.binutils.override { gold = false; };
|
||||
binutils = super.binutils_nogold;
|
||||
inherit (prevStage)
|
||||
ccWrapperStdenv
|
||||
glibc gcc-unwrapped coreutils gnugrep;
|
||||
@@ -188,9 +197,14 @@ in
|
||||
overrides = self: super: {
|
||||
inherit (prevStage)
|
||||
ccWrapperStdenv
|
||||
binutils gcc-unwrapped coreutils gnugrep
|
||||
gcc-unwrapped coreutils gnugrep
|
||||
perl paxctl gnum4 bison;
|
||||
# This also contains the full, dynamically linked, final Glibc.
|
||||
binutils = prevStage.binutils.override {
|
||||
# Rewrap the binutils with the new glibc, so both the next
|
||||
# stage's wrappers use it.
|
||||
libc = self.glibc;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
@@ -235,6 +249,15 @@ in
|
||||
# other purposes (binutils and top-level pkgs) too.
|
||||
inherit (prevStage) gettext gnum4 bison gmp perl glibc zlib linuxHeaders;
|
||||
|
||||
binutils = super.binutils.override {
|
||||
# Don't use stdenv's shell but our own
|
||||
shell = self.bash + "/bin/bash";
|
||||
# Build expand-response-params with last stage like below
|
||||
buildPackages = {
|
||||
inherit (prevStage) stdenv;
|
||||
};
|
||||
};
|
||||
|
||||
gcc = lib.makeOverridable (import ../../build-support/cc-wrapper) {
|
||||
nativeTools = false;
|
||||
nativeLibc = false;
|
||||
@@ -243,8 +266,9 @@ in
|
||||
inherit (prevStage) stdenv;
|
||||
};
|
||||
cc = prevStage.gcc-unwrapped;
|
||||
bintools = self.binutils;
|
||||
libc = self.glibc;
|
||||
inherit (self) stdenvNoCC binutils coreutils gnugrep;
|
||||
inherit (self) stdenvNoCC coreutils gnugrep;
|
||||
name = "";
|
||||
shell = self.bash + "/bin/bash";
|
||||
};
|
||||
@@ -299,8 +323,8 @@ in
|
||||
allowedRequisites = with prevStage; with lib;
|
||||
# Simple executable tools
|
||||
concatMap (p: [ (getBin p) (getLib p) ])
|
||||
[ gzip bzip2 xz bash binutils coreutils diffutils findutils gawk
|
||||
gnumake gnused gnutar gnugrep gnupatch patchelf ed paxctl
|
||||
[ gzip bzip2 xz bash binutils.bintools coreutils diffutils findutils
|
||||
gawk gnumake gnused gnutar gnugrep gnupatch patchelf ed paxctl
|
||||
]
|
||||
# Library dependencies
|
||||
++ map getLib (
|
||||
@@ -310,7 +334,7 @@ in
|
||||
# More complicated cases
|
||||
++ [
|
||||
glibc.out glibc.dev glibc.bin/*propagated from .dev*/ linuxHeaders
|
||||
gcc gcc.cc gcc.cc.lib gcc.expand-response-params
|
||||
binutils gcc gcc.cc gcc.cc.lib gcc.expand-response-params
|
||||
]
|
||||
++ lib.optionals localSystem.isAarch64
|
||||
[ prevStage.updateAutotoolsGnuConfigScriptsHook prevStage.gnu-config ];
|
||||
@@ -322,7 +346,7 @@ in
|
||||
attr acl paxctl zlib pcre;
|
||||
} // lib.optionalAttrs (super.targetPlatform == localSystem) {
|
||||
# Need to get rid of these when cross-compiling.
|
||||
inherit (prevStage) binutils;
|
||||
inherit (prevStage) binutils binutils-raw;
|
||||
gcc = cc;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,233 +1,16 @@
|
||||
{system ? builtins.currentSystem}:
|
||||
|
||||
let buildFor = toolsArch: (
|
||||
|
||||
let
|
||||
lib = import ../../../lib;
|
||||
pkgsFun = import ../../..;
|
||||
|
||||
inherit (lib.systems.examples)
|
||||
sheevaplug raspberryPi armv7l-hf-multiplatform
|
||||
aarch64-multiplatform scaleway-c1 pogoplug4;
|
||||
|
||||
selectedCrossSystem =
|
||||
if toolsArch == "armv5tel" then sheevaplug else
|
||||
if toolsArch == "scaleway" then scaleway-c1 else
|
||||
if toolsArch == "pogoplug4" then pogoplug4 else
|
||||
if toolsArch == "armv6l" then raspberryPi else
|
||||
if toolsArch == "armv7l" then armv7l-hf-multiplatform else
|
||||
if toolsArch == "aarch64" then aarch64-multiplatform else null;
|
||||
|
||||
pkgs = pkgsFun ({ inherit system; crossSystem = selectedCrossSystem; });
|
||||
|
||||
glibc = pkgs.libcCross;
|
||||
bash = pkgs.bash;
|
||||
findutils = pkgs.findutils;
|
||||
diffutils = pkgs.diffutils;
|
||||
gnused = pkgs.gnused;
|
||||
gnugrep = pkgs.gnugrep;
|
||||
gawk = pkgs.gawk;
|
||||
gzip = pkgs.gzip;
|
||||
bzip2 = pkgs.bzip2;
|
||||
gnumake = pkgs.gnumake;
|
||||
patch = pkgs.patch;
|
||||
patchelf = pkgs.patchelf;
|
||||
gcc = pkgs.gcc.cc;
|
||||
gmpxx = pkgs.gmpxx;
|
||||
mpfr = pkgs.mpfr;
|
||||
zlib = pkgs.zlib;
|
||||
libmpc = pkgs.libmpc;
|
||||
binutils = pkgs.binutils;
|
||||
libelf = pkgs.libelf;
|
||||
|
||||
# Keep these versions in sync with the versions used in the current GCC!
|
||||
isl = pkgs.isl_0_14;
|
||||
in
|
||||
|
||||
rec {
|
||||
|
||||
|
||||
coreutilsMinimal = pkgs.coreutils.override (args: {
|
||||
# We want coreutils without ACL/attr support.
|
||||
aclSupport = false;
|
||||
attrSupport = false;
|
||||
# Our tooling currently can't handle scripts in bin/, only ELFs and symlinks.
|
||||
singleBinary = "symlinks";
|
||||
});
|
||||
|
||||
tarMinimal = pkgs.gnutar.override { acl = null; };
|
||||
|
||||
busyboxMinimal = pkgs.busybox.override {
|
||||
useMusl = true;
|
||||
enableStatic = true;
|
||||
enableMinimal = true;
|
||||
extraConfig = ''
|
||||
CONFIG_ASH y
|
||||
CONFIG_ASH_BUILTIN_ECHO y
|
||||
CONFIG_ASH_BUILTIN_TEST y
|
||||
CONFIG_ASH_OPTIMIZE_FOR_SIZE y
|
||||
CONFIG_MKDIR y
|
||||
CONFIG_TAR y
|
||||
CONFIG_UNXZ y
|
||||
'';
|
||||
make = crossSystem: import ./make-bootstrap-tools.nix {
|
||||
localSystem = { inherit system; };
|
||||
inherit crossSystem;
|
||||
};
|
||||
|
||||
build =
|
||||
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "stdenv-bootstrap-tools-cross";
|
||||
crossConfig = pkgs.hostPlatform.config;
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkgs.buildPackages.nukeReferences
|
||||
pkgs.buildPackages.cpio
|
||||
];
|
||||
|
||||
buildCommand = ''
|
||||
set -x
|
||||
mkdir -p $out/bin $out/lib $out/libexec
|
||||
|
||||
# Copy what we need of Glibc.
|
||||
cp -d ${glibc.out}/lib/ld-*.so* $out/lib
|
||||
cp -d ${glibc.out}/lib/libc*.so* $out/lib
|
||||
cp -d ${glibc.out}/lib/libc_nonshared.a $out/lib
|
||||
cp -d ${glibc.out}/lib/libm*.so* $out/lib
|
||||
cp -d ${glibc.out}/lib/libdl*.so* $out/lib
|
||||
cp -d ${glibc.out}/lib/librt*.so* $out/lib
|
||||
cp -d ${glibc.out}/lib/libpthread*.so* $out/lib
|
||||
cp -d ${glibc.out}/lib/libnsl*.so* $out/lib
|
||||
cp -d ${glibc.out}/lib/libutil*.so* $out/lib
|
||||
cp -d ${glibc.out}/lib/libnss*.so* $out/lib
|
||||
cp -d ${glibc.out}/lib/libresolv*.so* $out/lib
|
||||
cp -d ${glibc.out}/lib/crt?.o $out/lib
|
||||
|
||||
cp -rL ${glibc.dev}/include $out
|
||||
chmod -R u+w "$out"
|
||||
|
||||
# glibc can contain linker scripts: find them, copy their deps,
|
||||
# and get rid of absolute paths (nuke-refs would make them useless)
|
||||
local lScripts=$(grep --files-with-matches --max-count=1 'GNU ld script' -R "$out/lib")
|
||||
cp -d -t "$out/lib/" $(cat $lScripts | tr " " "\n" | grep -F '${glibc.out}' | sort -u)
|
||||
for f in $lScripts; do
|
||||
substituteInPlace "$f" --replace '${glibc.out}/lib/' ""
|
||||
done
|
||||
|
||||
# Hopefully we won't need these.
|
||||
rm -rf $out/include/mtd $out/include/rdma $out/include/sound $out/include/video
|
||||
find $out/include -name .install -exec rm {} \;
|
||||
find $out/include -name ..install.cmd -exec rm {} \;
|
||||
mv $out/include $out/include-glibc
|
||||
|
||||
# Copy coreutils, bash, etc.
|
||||
cp ${coreutilsMinimal}/bin/* $out/bin
|
||||
(cd $out/bin && rm vdir dir sha*sum pinky factor pathchk runcon shuf who whoami shred users)
|
||||
|
||||
cp ${bash}/bin/bash $out/bin
|
||||
cp ${findutils}/bin/find $out/bin
|
||||
cp ${findutils}/bin/xargs $out/bin
|
||||
cp -d ${diffutils}/bin/* $out/bin
|
||||
cp -d ${gnused}/bin/* $out/bin
|
||||
cp -d ${gnugrep}/bin/grep $out/bin
|
||||
cp ${gawk}/bin/gawk $out/bin
|
||||
cp -d ${gawk}/bin/awk $out/bin
|
||||
cp ${tarMinimal}/bin/tar $out/bin
|
||||
cp ${gzip}/bin/gzip $out/bin
|
||||
cp ${bzip2.bin}/bin/bzip2 $out/bin
|
||||
cp -d ${gnumake}/bin/* $out/bin
|
||||
cp -d ${patch}/bin/* $out/bin
|
||||
cp ${patchelf}/bin/* $out/bin
|
||||
|
||||
cp -d ${gnugrep.pcre.out}/lib/libpcre*.so* $out/lib # needed by grep
|
||||
|
||||
# Copy what we need of GCC.
|
||||
cp -d ${gcc.out}/bin/gcc $out/bin
|
||||
cp -d ${gcc.out}/bin/cpp $out/bin
|
||||
cp -d ${gcc.out}/bin/g++ $out/bin
|
||||
cp -d ${gcc.lib}/lib*/libgcc_s.so* $out/lib
|
||||
cp -d ${gcc.lib}/lib*/libstdc++.so* $out/lib
|
||||
cp -rd ${gcc.out}/lib/gcc $out/lib
|
||||
chmod -R u+w $out/lib
|
||||
rm -f $out/lib/gcc/*/*/include*/linux
|
||||
rm -f $out/lib/gcc/*/*/include*/sound
|
||||
rm -rf $out/lib/gcc/*/*/include*/root
|
||||
rm -f $out/lib/gcc/*/*/include-fixed/asm
|
||||
rm -rf $out/lib/gcc/*/*/plugin
|
||||
#rm -f $out/lib/gcc/*/*/*.a
|
||||
cp -rd ${gcc.out}/libexec/* $out/libexec
|
||||
chmod -R u+w $out/libexec
|
||||
rm -rf $out/libexec/gcc/*/*/plugin
|
||||
mkdir $out/include
|
||||
cp -rd ${gcc.out}/include/c++ $out/include
|
||||
chmod -R u+w $out/include
|
||||
rm -rf $out/include/c++/*/ext/pb_ds
|
||||
rm -rf $out/include/c++/*/ext/parallel
|
||||
|
||||
cp -d ${gmpxx.out}/lib/libgmp*.so* $out/lib
|
||||
cp -d ${mpfr.out}/lib/libmpfr*.so* $out/lib
|
||||
cp -d ${libmpc.out}/lib/libmpc*.so* $out/lib
|
||||
cp -d ${zlib.out}/lib/libz.so* $out/lib
|
||||
cp -d ${libelf}/lib/libelf.so* $out/lib
|
||||
|
||||
# These needed for cross but not native tools because the stdenv
|
||||
# GCC has certain things built in statically. See
|
||||
# pkgs/stdenv/linux/default.nix for the details.
|
||||
cp -d ${isl}/lib/libisl*.so* $out/lib
|
||||
|
||||
cp -d ${bzip2.out}/lib/libbz2.so* $out/lib
|
||||
|
||||
# Copy binutils.
|
||||
for i in as ld ar ranlib nm strip readelf objdump; do
|
||||
cp ${binutils.out}/bin/$i $out/bin
|
||||
done
|
||||
cp -d ${binutils.lib}/lib/lib*.so* $out/lib
|
||||
|
||||
chmod -R u+w $out
|
||||
|
||||
# Strip executables even further.
|
||||
for i in $out/bin/* $out/libexec/gcc/*/*/*; do
|
||||
if test -x $i -a ! -L $i; then
|
||||
chmod +w $i
|
||||
$crossConfig-strip -s $i || true
|
||||
fi
|
||||
done
|
||||
|
||||
nuke-refs $out/bin/*
|
||||
nuke-refs $out/lib/*
|
||||
nuke-refs $out/libexec/gcc/*/*/*
|
||||
|
||||
mkdir $out/.pack
|
||||
mv $out/* $out/.pack
|
||||
mv $out/.pack $out/pack
|
||||
|
||||
mkdir $out/on-server
|
||||
tar cvfJ $out/on-server/bootstrap-tools.tar.xz --hard-dereference --sort=name --numeric-owner --owner=0 --group=0 --mtime=@1 -C $out/pack .
|
||||
cp ${busyboxMinimal}/bin/busybox $out/on-server
|
||||
chmod u+w $out/on-server/busybox
|
||||
nuke-refs $out/on-server/busybox
|
||||
''; # */
|
||||
|
||||
# The result should not contain any references (store paths) so
|
||||
# that we can safely copy them out of the store and to other
|
||||
# locations in the store.
|
||||
allowedReferences = [];
|
||||
};
|
||||
|
||||
dist = pkgs.stdenv.mkDerivation {
|
||||
name = "stdenv-bootstrap-tools-cross";
|
||||
|
||||
buildCommand = ''
|
||||
mkdir -p $out/nix-support
|
||||
echo "file tarball ${build}/on-server/bootstrap-tools.tar.xz" >> $out/nix-support/hydra-build-products
|
||||
echo "file busybox ${build}/on-server/busybox" >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
); in {
|
||||
armv5tel = buildFor "armv5tel";
|
||||
armv6l = buildFor "armv6l";
|
||||
armv7l = buildFor "armv7l";
|
||||
aarch64 = buildFor "aarch64";
|
||||
scaleway = buildFor "scaleway";
|
||||
pogoplug4 = buildFor "pogoplug4";
|
||||
in with (import ../../../lib).systems.examples; {
|
||||
armv5tel = make sheevaplug;
|
||||
scaleway = make scaleway-c1;
|
||||
pogoplug4 = make pogoplug4;
|
||||
armv6l = make raspberryPi;
|
||||
armv7l = make armv7l-hf-multiplatform;
|
||||
aarch64 = make aarch64-multiplatform;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
{ system ? builtins.currentSystem }:
|
||||
{ localSystem ? { system = builtins.currentSystem; }
|
||||
, crossSystem ? null
|
||||
}:
|
||||
|
||||
with import ../../.. {inherit system;};
|
||||
|
||||
rec {
|
||||
let
|
||||
pkgs = import ../../.. { inherit localSystem crossSystem; };
|
||||
glibc = if pkgs.hostPlatform != pkgs.buildPlatform
|
||||
then pkgs.glibcCross
|
||||
else pkgs.glibc;
|
||||
in with pkgs; rec {
|
||||
|
||||
|
||||
coreutilsMinimal = coreutils.override (args: {
|
||||
@@ -35,7 +40,7 @@ rec {
|
||||
stdenv.mkDerivation {
|
||||
name = "stdenv-bootstrap-tools";
|
||||
|
||||
buildInputs = [nukeReferences cpio];
|
||||
nativeBuildInputs = [ buildPackages.nukeReferences buildPackages.cpio ];
|
||||
|
||||
buildCommand = ''
|
||||
set -x
|
||||
@@ -118,17 +123,23 @@ rec {
|
||||
|
||||
cp -d ${gmpxx.out}/lib/libgmp*.so* $out/lib
|
||||
cp -d ${mpfr.out}/lib/libmpfr*.so* $out/lib
|
||||
cp -d ${libmpc}/lib/libmpc*.so* $out/lib
|
||||
cp -d ${libmpc.out}/lib/libmpc*.so* $out/lib
|
||||
cp -d ${zlib.out}/lib/libz.so* $out/lib
|
||||
cp -d ${libelf}/lib/libelf.so* $out/lib
|
||||
|
||||
'' + lib.optionalString (hostPlatform != buildPlatform) ''
|
||||
# These needed for cross but not native tools because the stdenv
|
||||
# GCC has certain things built in statically. See
|
||||
# pkgs/stdenv/linux/default.nix for the details.
|
||||
cp -d ${isl_0_14.out}/lib/libisl*.so* $out/lib
|
||||
|
||||
'' + ''
|
||||
cp -d ${bzip2.out}/lib/libbz2.so* $out/lib
|
||||
|
||||
# Copy binutils.
|
||||
for i in as ld ar ranlib nm strip readelf objdump; do
|
||||
cp ${binutils.out}/bin/$i $out/bin
|
||||
cp ${binutils.bintools.out}/bin/$i $out/bin
|
||||
done
|
||||
cp -d ${binutils.lib}/lib/lib*.so* $out/lib
|
||||
|
||||
chmod -R u+w $out
|
||||
|
||||
@@ -136,13 +147,14 @@ rec {
|
||||
for i in $out/bin/* $out/libexec/gcc/*/*/*; do
|
||||
if test -x $i -a ! -L $i; then
|
||||
chmod +w $i
|
||||
strip -s $i || true
|
||||
$STRIP -s $i || true
|
||||
fi
|
||||
done
|
||||
|
||||
nuke-refs $out/bin/*
|
||||
nuke-refs $out/lib/*
|
||||
nuke-refs $out/libexec/gcc/*/*/*
|
||||
nuke-refs $out/lib/gcc/*/*/*
|
||||
|
||||
mkdir $out/.pack
|
||||
mv $out/* $out/.pack
|
||||
@@ -177,11 +189,14 @@ rec {
|
||||
bootstrapTools = runCommand "bootstrap-tools.tar.xz" {} "cp ${build}/on-server/bootstrap-tools.tar.xz $out";
|
||||
};
|
||||
|
||||
bootstrapTools = import ./bootstrap-tools { inherit system bootstrapFiles; };
|
||||
bootstrapTools = import ./bootstrap-tools {
|
||||
inherit (hostPlatform) system;
|
||||
inherit bootstrapFiles;
|
||||
};
|
||||
|
||||
test = derivation {
|
||||
name = "test-bootstrap-tools";
|
||||
inherit system;
|
||||
inherit (hostPlatform) system;
|
||||
builder = bootstrapFiles.busybox;
|
||||
args = [ "ash" "-e" "-c" "eval \"$buildCommand\"" ];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user