summaryrefslogtreecommitdiffstats
path: root/pkgs/stdenv/linux/make-bootstrap-tools.nix
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2017-06-26 16:56:03 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2018-01-02 13:52:41 -0500
commitab651d2c9bab620ebe5e515476fbd70d2c5b0c61 (patch)
treec214263d6b5dc420fa1fab98b42dcc79951e7df6 /pkgs/stdenv/linux/make-bootstrap-tools.nix
parent804285f589ded484b530750dd1ec03b9052bcdac (diff)
linux bootstrap tools: Use same derivation whether cross compiling or not
Diffstat (limited to 'pkgs/stdenv/linux/make-bootstrap-tools.nix')
-rw-r--r--pkgs/stdenv/linux/make-bootstrap-tools.nix34
1 files changed, 25 insertions, 9 deletions
diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix
index 15be64a22a92..f51a39d5820d 100644
--- a/pkgs/stdenv/linux/make-bootstrap-tools.nix
+++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix
@@ -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,10 +123,17 @@ 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.
@@ -135,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
@@ -176,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\"" ];