2012-12-22 12:17:06 +01:00
|
|
|
{system ? builtins.currentSystem}:
|
|
|
|
|
2015-01-29 02:36:16 +01:00
|
|
|
let buildFor = toolsArch: (
|
|
|
|
|
2012-12-22 12:17:06 +01:00
|
|
|
let
|
2017-04-26 01:54:25 +02:00
|
|
|
lib = import ../../../lib;
|
2016-03-13 19:24:55 +01:00
|
|
|
pkgsFun = import ../../..;
|
2016-06-01 12:18:58 +02:00
|
|
|
|
2017-05-24 00:04:15 +02:00
|
|
|
inherit (lib.systems.examples)
|
|
|
|
sheevaplug raspberryPi armv7l-hf-multiplatform
|
|
|
|
aarch64-multiplatform scaleway-c1 pogoplug4;
|
2016-05-09 20:55:43 +02:00
|
|
|
|
2015-01-29 02:36:16 +01:00
|
|
|
selectedCrossSystem =
|
2017-05-24 00:04:15 +02:00
|
|
|
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; });
|
2016-12-26 23:42:48 +01:00
|
|
|
|
2017-04-26 05:55:03 +02:00
|
|
|
glibc = pkgs.libcCross;
|
2016-12-26 23:42:48 +01:00
|
|
|
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;
|
2012-12-22 12:17:06 +01:00
|
|
|
|
2016-01-05 10:25:53 +01:00
|
|
|
# Keep these versions in sync with the versions used in the current GCC!
|
2016-12-26 23:42:48 +01:00
|
|
|
isl = pkgs.isl_0_14;
|
2012-12-22 12:17:06 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
rec {
|
|
|
|
|
2016-07-17 02:40:45 +02:00
|
|
|
|
top-level: Introduce `buildPackages` for resolving build-time deps
[N.B., this package also applies to the commits that follow it in the same
PR.]
In most cases, buildPackages = pkgs so things work just as before. For
cross compiling, however, buildPackages is resolved as the previous
bootstrapping stage. This allows us to avoid the mkDerivation hacks cross
compiling currently uses today.
To avoid a massive refactor, callPackage will splice together both package
sets. Again to avoid churn, it uses the old `nativeDrv` vs `crossDrv` to do
so. So now, whether cross compiling or not, packages with get a `nativeDrv`
and `crossDrv`---in the non-cross-compiling case they are simply the same
derivation. This is good because it reduces the divergence between the
cross and non-cross dataflow. See `pkgs/top-level/splice.nix` for a comment
along the lines of the preceding paragraph, and the code that does this
splicing.
Also, `forceNativeDrv` is replaced with `forceNativePackages`. The latter
resolves `pkgs` unless the host platform is different from the build
platform, in which case it resolves to `buildPackages`. Note that the
target platform is not important here---it will not prevent
`forcedNativePackages` from resolving to `pkgs`.
--------
Temporarily, we make preserve some dubious decisions in the name of preserving
hashes:
Most importantly, we don't distinguish between "host" and "target" in the
autoconf sense. This leads to the proliferation of *Cross derivations
currently used. What we ought to is resolve native deps of the cross "build
packages" (build = host != target) package set against the "vanilla
packages" (build = host = target) package set. Instead, "build packages"
uses itself, with (informally) target != build in all cases.
This is wrong because it violates the "sliding window" principle of
bootstrapping stages that shifting the platform triple of one stage to the
left coincides with the next stage's platform triple. Only because we don't
explicitly distinguish between "host" and "target" does it appear that the
"sliding window" principle is preserved--indeed it is over the reductionary
"platform double" of just "build" and "host/target".
Additionally, we build libc, libgcc, etc in the same stage as the compilers
themselves, which is wrong because they are used at runtime, not build
time. Fixing this is somewhat subtle, and the solution and problem will be
better explained in the commit that does fix it.
Commits after this will solve both these issues, at the expense of breaking
cross hashes. Native hashes won't be broken, thankfully.
--------
Did the temporary ugliness pan out? Of the packages that currently build in
`release-cross.nix`, the only ones that have their hash changed are
`*.gcc.crossDrv` and `bootstrapTools.*.coreutilsMinimal`. In both cases I
think it doesn't matter.
1. GCC when doing a `build = host = target = foreign` build (maximally
cross), still defines environment variables like `CPATH`[1] with
packages. This seems assuredly wrong because whether gcc dynamically
links those, or the programs built by gcc dynamically link those---I
have no idea which case is reality---they should be foreign. Therefore,
in all likelihood, I just made the gcc less broken.
2. Coreutils (ab)used the old cross-compiling infrastructure to depend on
a native version of itself. When coreutils was overwritten to be built
with fewer features, the native version it used would also be
overwritten because the binding was tight. Now it uses the much looser
`BuildPackages.coreutils` which is just fine as a richer build dep
doesn't cause any problems and avoids a rebuild.
So, in conclusion I'd say the conservatism payed off. Onward to actually
raking the muck in the next PR!
[1]: https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
2016-12-18 08:51:18 +01:00
|
|
|
coreutilsMinimal = pkgs.coreutils.override (args: {
|
2017-01-04 23:46:34 +01:00
|
|
|
# We want coreutils without ACL/attr support.
|
2015-01-29 02:36:16 +01:00
|
|
|
aclSupport = false;
|
2017-01-04 23:46:34 +01:00
|
|
|
attrSupport = false;
|
2016-06-28 09:48:56 +02:00
|
|
|
# Our tooling currently can't handle scripts in bin/, only ELFs and symlinks.
|
|
|
|
singleBinary = "symlinks";
|
top-level: Introduce `buildPackages` for resolving build-time deps
[N.B., this package also applies to the commits that follow it in the same
PR.]
In most cases, buildPackages = pkgs so things work just as before. For
cross compiling, however, buildPackages is resolved as the previous
bootstrapping stage. This allows us to avoid the mkDerivation hacks cross
compiling currently uses today.
To avoid a massive refactor, callPackage will splice together both package
sets. Again to avoid churn, it uses the old `nativeDrv` vs `crossDrv` to do
so. So now, whether cross compiling or not, packages with get a `nativeDrv`
and `crossDrv`---in the non-cross-compiling case they are simply the same
derivation. This is good because it reduces the divergence between the
cross and non-cross dataflow. See `pkgs/top-level/splice.nix` for a comment
along the lines of the preceding paragraph, and the code that does this
splicing.
Also, `forceNativeDrv` is replaced with `forceNativePackages`. The latter
resolves `pkgs` unless the host platform is different from the build
platform, in which case it resolves to `buildPackages`. Note that the
target platform is not important here---it will not prevent
`forcedNativePackages` from resolving to `pkgs`.
--------
Temporarily, we make preserve some dubious decisions in the name of preserving
hashes:
Most importantly, we don't distinguish between "host" and "target" in the
autoconf sense. This leads to the proliferation of *Cross derivations
currently used. What we ought to is resolve native deps of the cross "build
packages" (build = host != target) package set against the "vanilla
packages" (build = host = target) package set. Instead, "build packages"
uses itself, with (informally) target != build in all cases.
This is wrong because it violates the "sliding window" principle of
bootstrapping stages that shifting the platform triple of one stage to the
left coincides with the next stage's platform triple. Only because we don't
explicitly distinguish between "host" and "target" does it appear that the
"sliding window" principle is preserved--indeed it is over the reductionary
"platform double" of just "build" and "host/target".
Additionally, we build libc, libgcc, etc in the same stage as the compilers
themselves, which is wrong because they are used at runtime, not build
time. Fixing this is somewhat subtle, and the solution and problem will be
better explained in the commit that does fix it.
Commits after this will solve both these issues, at the expense of breaking
cross hashes. Native hashes won't be broken, thankfully.
--------
Did the temporary ugliness pan out? Of the packages that currently build in
`release-cross.nix`, the only ones that have their hash changed are
`*.gcc.crossDrv` and `bootstrapTools.*.coreutilsMinimal`. In both cases I
think it doesn't matter.
1. GCC when doing a `build = host = target = foreign` build (maximally
cross), still defines environment variables like `CPATH`[1] with
packages. This seems assuredly wrong because whether gcc dynamically
links those, or the programs built by gcc dynamically link those---I
have no idea which case is reality---they should be foreign. Therefore,
in all likelihood, I just made the gcc less broken.
2. Coreutils (ab)used the old cross-compiling infrastructure to depend on
a native version of itself. When coreutils was overwritten to be built
with fewer features, the native version it used would also be
overwritten because the binding was tight. Now it uses the much looser
`BuildPackages.coreutils` which is just fine as a richer build dep
doesn't cause any problems and avoids a rebuild.
So, in conclusion I'd say the conservatism payed off. Onward to actually
raking the muck in the next PR!
[1]: https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
2016-12-18 08:51:18 +01:00
|
|
|
});
|
2016-06-01 12:18:58 +02:00
|
|
|
|
top-level: Introduce `buildPackages` for resolving build-time deps
[N.B., this package also applies to the commits that follow it in the same
PR.]
In most cases, buildPackages = pkgs so things work just as before. For
cross compiling, however, buildPackages is resolved as the previous
bootstrapping stage. This allows us to avoid the mkDerivation hacks cross
compiling currently uses today.
To avoid a massive refactor, callPackage will splice together both package
sets. Again to avoid churn, it uses the old `nativeDrv` vs `crossDrv` to do
so. So now, whether cross compiling or not, packages with get a `nativeDrv`
and `crossDrv`---in the non-cross-compiling case they are simply the same
derivation. This is good because it reduces the divergence between the
cross and non-cross dataflow. See `pkgs/top-level/splice.nix` for a comment
along the lines of the preceding paragraph, and the code that does this
splicing.
Also, `forceNativeDrv` is replaced with `forceNativePackages`. The latter
resolves `pkgs` unless the host platform is different from the build
platform, in which case it resolves to `buildPackages`. Note that the
target platform is not important here---it will not prevent
`forcedNativePackages` from resolving to `pkgs`.
--------
Temporarily, we make preserve some dubious decisions in the name of preserving
hashes:
Most importantly, we don't distinguish between "host" and "target" in the
autoconf sense. This leads to the proliferation of *Cross derivations
currently used. What we ought to is resolve native deps of the cross "build
packages" (build = host != target) package set against the "vanilla
packages" (build = host = target) package set. Instead, "build packages"
uses itself, with (informally) target != build in all cases.
This is wrong because it violates the "sliding window" principle of
bootstrapping stages that shifting the platform triple of one stage to the
left coincides with the next stage's platform triple. Only because we don't
explicitly distinguish between "host" and "target" does it appear that the
"sliding window" principle is preserved--indeed it is over the reductionary
"platform double" of just "build" and "host/target".
Additionally, we build libc, libgcc, etc in the same stage as the compilers
themselves, which is wrong because they are used at runtime, not build
time. Fixing this is somewhat subtle, and the solution and problem will be
better explained in the commit that does fix it.
Commits after this will solve both these issues, at the expense of breaking
cross hashes. Native hashes won't be broken, thankfully.
--------
Did the temporary ugliness pan out? Of the packages that currently build in
`release-cross.nix`, the only ones that have their hash changed are
`*.gcc.crossDrv` and `bootstrapTools.*.coreutilsMinimal`. In both cases I
think it doesn't matter.
1. GCC when doing a `build = host = target = foreign` build (maximally
cross), still defines environment variables like `CPATH`[1] with
packages. This seems assuredly wrong because whether gcc dynamically
links those, or the programs built by gcc dynamically link those---I
have no idea which case is reality---they should be foreign. Therefore,
in all likelihood, I just made the gcc less broken.
2. Coreutils (ab)used the old cross-compiling infrastructure to depend on
a native version of itself. When coreutils was overwritten to be built
with fewer features, the native version it used would also be
overwritten because the binding was tight. Now it uses the much looser
`BuildPackages.coreutils` which is just fine as a richer build dep
doesn't cause any problems and avoids a rebuild.
So, in conclusion I'd say the conservatism payed off. Onward to actually
raking the muck in the next PR!
[1]: https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
2016-12-18 08:51:18 +01:00
|
|
|
tarMinimal = pkgs.gnutar.override { acl = null; };
|
2016-07-17 02:40:45 +02:00
|
|
|
|
top-level: Introduce `buildPackages` for resolving build-time deps
[N.B., this package also applies to the commits that follow it in the same
PR.]
In most cases, buildPackages = pkgs so things work just as before. For
cross compiling, however, buildPackages is resolved as the previous
bootstrapping stage. This allows us to avoid the mkDerivation hacks cross
compiling currently uses today.
To avoid a massive refactor, callPackage will splice together both package
sets. Again to avoid churn, it uses the old `nativeDrv` vs `crossDrv` to do
so. So now, whether cross compiling or not, packages with get a `nativeDrv`
and `crossDrv`---in the non-cross-compiling case they are simply the same
derivation. This is good because it reduces the divergence between the
cross and non-cross dataflow. See `pkgs/top-level/splice.nix` for a comment
along the lines of the preceding paragraph, and the code that does this
splicing.
Also, `forceNativeDrv` is replaced with `forceNativePackages`. The latter
resolves `pkgs` unless the host platform is different from the build
platform, in which case it resolves to `buildPackages`. Note that the
target platform is not important here---it will not prevent
`forcedNativePackages` from resolving to `pkgs`.
--------
Temporarily, we make preserve some dubious decisions in the name of preserving
hashes:
Most importantly, we don't distinguish between "host" and "target" in the
autoconf sense. This leads to the proliferation of *Cross derivations
currently used. What we ought to is resolve native deps of the cross "build
packages" (build = host != target) package set against the "vanilla
packages" (build = host = target) package set. Instead, "build packages"
uses itself, with (informally) target != build in all cases.
This is wrong because it violates the "sliding window" principle of
bootstrapping stages that shifting the platform triple of one stage to the
left coincides with the next stage's platform triple. Only because we don't
explicitly distinguish between "host" and "target" does it appear that the
"sliding window" principle is preserved--indeed it is over the reductionary
"platform double" of just "build" and "host/target".
Additionally, we build libc, libgcc, etc in the same stage as the compilers
themselves, which is wrong because they are used at runtime, not build
time. Fixing this is somewhat subtle, and the solution and problem will be
better explained in the commit that does fix it.
Commits after this will solve both these issues, at the expense of breaking
cross hashes. Native hashes won't be broken, thankfully.
--------
Did the temporary ugliness pan out? Of the packages that currently build in
`release-cross.nix`, the only ones that have their hash changed are
`*.gcc.crossDrv` and `bootstrapTools.*.coreutilsMinimal`. In both cases I
think it doesn't matter.
1. GCC when doing a `build = host = target = foreign` build (maximally
cross), still defines environment variables like `CPATH`[1] with
packages. This seems assuredly wrong because whether gcc dynamically
links those, or the programs built by gcc dynamically link those---I
have no idea which case is reality---they should be foreign. Therefore,
in all likelihood, I just made the gcc less broken.
2. Coreutils (ab)used the old cross-compiling infrastructure to depend on
a native version of itself. When coreutils was overwritten to be built
with fewer features, the native version it used would also be
overwritten because the binding was tight. Now it uses the much looser
`BuildPackages.coreutils` which is just fine as a richer build dep
doesn't cause any problems and avoids a rebuild.
So, in conclusion I'd say the conservatism payed off. Onward to actually
raking the muck in the next PR!
[1]: https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
2016-12-18 08:51:18 +01:00
|
|
|
busyboxMinimal = pkgs.busybox.override {
|
2016-06-01 21:52:34 +02:00
|
|
|
useMusl = true;
|
2015-01-29 02:36:16 +01:00
|
|
|
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
|
|
|
|
'';
|
top-level: Introduce `buildPackages` for resolving build-time deps
[N.B., this package also applies to the commits that follow it in the same
PR.]
In most cases, buildPackages = pkgs so things work just as before. For
cross compiling, however, buildPackages is resolved as the previous
bootstrapping stage. This allows us to avoid the mkDerivation hacks cross
compiling currently uses today.
To avoid a massive refactor, callPackage will splice together both package
sets. Again to avoid churn, it uses the old `nativeDrv` vs `crossDrv` to do
so. So now, whether cross compiling or not, packages with get a `nativeDrv`
and `crossDrv`---in the non-cross-compiling case they are simply the same
derivation. This is good because it reduces the divergence between the
cross and non-cross dataflow. See `pkgs/top-level/splice.nix` for a comment
along the lines of the preceding paragraph, and the code that does this
splicing.
Also, `forceNativeDrv` is replaced with `forceNativePackages`. The latter
resolves `pkgs` unless the host platform is different from the build
platform, in which case it resolves to `buildPackages`. Note that the
target platform is not important here---it will not prevent
`forcedNativePackages` from resolving to `pkgs`.
--------
Temporarily, we make preserve some dubious decisions in the name of preserving
hashes:
Most importantly, we don't distinguish between "host" and "target" in the
autoconf sense. This leads to the proliferation of *Cross derivations
currently used. What we ought to is resolve native deps of the cross "build
packages" (build = host != target) package set against the "vanilla
packages" (build = host = target) package set. Instead, "build packages"
uses itself, with (informally) target != build in all cases.
This is wrong because it violates the "sliding window" principle of
bootstrapping stages that shifting the platform triple of one stage to the
left coincides with the next stage's platform triple. Only because we don't
explicitly distinguish between "host" and "target" does it appear that the
"sliding window" principle is preserved--indeed it is over the reductionary
"platform double" of just "build" and "host/target".
Additionally, we build libc, libgcc, etc in the same stage as the compilers
themselves, which is wrong because they are used at runtime, not build
time. Fixing this is somewhat subtle, and the solution and problem will be
better explained in the commit that does fix it.
Commits after this will solve both these issues, at the expense of breaking
cross hashes. Native hashes won't be broken, thankfully.
--------
Did the temporary ugliness pan out? Of the packages that currently build in
`release-cross.nix`, the only ones that have their hash changed are
`*.gcc.crossDrv` and `bootstrapTools.*.coreutilsMinimal`. In both cases I
think it doesn't matter.
1. GCC when doing a `build = host = target = foreign` build (maximally
cross), still defines environment variables like `CPATH`[1] with
packages. This seems assuredly wrong because whether gcc dynamically
links those, or the programs built by gcc dynamically link those---I
have no idea which case is reality---they should be foreign. Therefore,
in all likelihood, I just made the gcc less broken.
2. Coreutils (ab)used the old cross-compiling infrastructure to depend on
a native version of itself. When coreutils was overwritten to be built
with fewer features, the native version it used would also be
overwritten because the binding was tight. Now it uses the much looser
`BuildPackages.coreutils` which is just fine as a richer build dep
doesn't cause any problems and avoids a rebuild.
So, in conclusion I'd say the conservatism payed off. Onward to actually
raking the muck in the next PR!
[1]: https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
2016-12-18 08:51:18 +01:00
|
|
|
};
|
2016-06-01 12:18:58 +02:00
|
|
|
|
|
|
|
build =
|
2012-12-22 12:17:06 +01:00
|
|
|
|
2017-04-26 03:51:24 +02:00
|
|
|
pkgs.stdenv.mkDerivation {
|
2016-07-17 02:40:45 +02:00
|
|
|
name = "stdenv-bootstrap-tools-cross";
|
2016-12-26 23:42:48 +01:00
|
|
|
crossConfig = pkgs.hostPlatform.config;
|
2012-12-22 12:17:06 +01:00
|
|
|
|
2017-04-26 03:51:24 +02:00
|
|
|
nativeBuildInputs = [
|
2017-02-12 01:28:13 +01:00
|
|
|
pkgs.buildPackages.nukeReferences
|
|
|
|
pkgs.buildPackages.cpio
|
|
|
|
];
|
2012-12-22 12:17:06 +01:00
|
|
|
|
|
|
|
buildCommand = ''
|
2016-07-17 02:40:45 +02:00
|
|
|
set -x
|
2014-06-30 14:56:10 +02:00
|
|
|
mkdir -p $out/bin $out/lib $out/libexec
|
2012-12-22 12:17:06 +01:00
|
|
|
|
|
|
|
# Copy what we need of Glibc.
|
2015-04-26 19:54:51 +02:00
|
|
|
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
|
2016-06-01 12:18:58 +02:00
|
|
|
|
2015-04-26 19:54:51 +02:00
|
|
|
cp -rL ${glibc.dev}/include $out
|
2016-07-17 02:40:45 +02:00
|
|
|
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
|
2016-06-01 12:18:58 +02:00
|
|
|
|
2012-12-22 12:17:06 +01:00
|
|
|
# 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
|
2016-06-01 12:18:58 +02:00
|
|
|
|
2012-12-22 12:17:06 +01:00
|
|
|
# Copy coreutils, bash, etc.
|
2015-01-29 02:36:16 +01:00
|
|
|
cp ${coreutilsMinimal}/bin/* $out/bin
|
2012-12-22 12:17:06 +01:00
|
|
|
(cd $out/bin && rm vdir dir sha*sum pinky factor pathchk runcon shuf who whoami shred users)
|
2016-06-01 12:18:58 +02:00
|
|
|
|
2012-12-22 12:17:06 +01:00
|
|
|
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
|
2015-01-29 02:36:16 +01:00
|
|
|
cp -d ${gnugrep}/bin/grep $out/bin
|
2012-12-22 12:17:06 +01:00
|
|
|
cp ${gawk}/bin/gawk $out/bin
|
|
|
|
cp -d ${gawk}/bin/awk $out/bin
|
2016-07-17 02:40:45 +02:00
|
|
|
cp ${tarMinimal}/bin/tar $out/bin
|
2012-12-22 12:17:06 +01:00
|
|
|
cp ${gzip}/bin/gzip $out/bin
|
2016-02-01 19:45:57 +01:00
|
|
|
cp ${bzip2.bin}/bin/bzip2 $out/bin
|
2012-12-22 12:17:06 +01:00
|
|
|
cp -d ${gnumake}/bin/* $out/bin
|
|
|
|
cp -d ${patch}/bin/* $out/bin
|
|
|
|
cp ${patchelf}/bin/* $out/bin
|
|
|
|
|
2016-12-26 23:42:48 +01:00
|
|
|
cp -d ${gnugrep.pcre.out}/lib/libpcre*.so* $out/lib # needed by grep
|
2016-06-01 12:18:58 +02:00
|
|
|
|
2012-12-22 12:17:06 +01:00
|
|
|
# Copy what we need of GCC.
|
2016-06-01 22:01:57 +02:00
|
|
|
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
|
2012-12-22 12:17:06 +01:00
|
|
|
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
|
2016-06-01 22:01:57 +02:00
|
|
|
cp -rd ${gcc.out}/libexec/* $out/libexec
|
2015-01-29 02:36:16 +01:00
|
|
|
chmod -R u+w $out/libexec
|
|
|
|
rm -rf $out/libexec/gcc/*/*/plugin
|
2012-12-22 12:17:06 +01:00
|
|
|
mkdir $out/include
|
2016-06-01 22:01:57 +02:00
|
|
|
cp -rd ${gcc.out}/include/c++ $out/include
|
2012-12-22 12:17:06 +01:00
|
|
|
chmod -R u+w $out/include
|
|
|
|
rm -rf $out/include/c++/*/ext/pb_ds
|
|
|
|
rm -rf $out/include/c++/*/ext/parallel
|
|
|
|
|
2016-06-01 22:01:57 +02:00
|
|
|
cp -d ${gmpxx.out}/lib/libgmp*.so* $out/lib
|
2016-01-24 08:30:00 +01:00
|
|
|
cp -d ${mpfr.out}/lib/libmpfr*.so* $out/lib
|
2016-06-01 22:01:57 +02:00
|
|
|
cp -d ${libmpc.out}/lib/libmpc*.so* $out/lib
|
2016-01-24 08:30:24 +01:00
|
|
|
cp -d ${zlib.out}/lib/libz.so* $out/lib
|
2015-01-29 02:36:16 +01:00
|
|
|
cp -d ${libelf}/lib/libelf.so* $out/lib
|
2016-06-01 12:18:58 +02:00
|
|
|
|
2016-01-05 10:25:53 +01:00
|
|
|
# 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.
|
2012-12-23 13:18:26 +01:00
|
|
|
cp -d ${isl}/lib/libisl*.so* $out/lib
|
2017-04-13 15:28:09 +02:00
|
|
|
|
2016-06-01 22:01:57 +02:00
|
|
|
cp -d ${bzip2.out}/lib/libbz2.so* $out/lib
|
2016-06-01 12:18:58 +02:00
|
|
|
|
2012-12-22 12:17:06 +01:00
|
|
|
# Copy binutils.
|
|
|
|
for i in as ld ar ranlib nm strip readelf objdump; do
|
2017-09-15 00:12:54 +02:00
|
|
|
cp ${binutils.out}/bin/$i $out/bin
|
2012-12-22 12:17:06 +01:00
|
|
|
done
|
|
|
|
|
|
|
|
chmod -R u+w $out
|
2016-06-01 12:18:58 +02:00
|
|
|
|
2012-12-22 12:17:06 +01:00
|
|
|
# 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
|
2016-07-19 00:04:53 +02:00
|
|
|
tar cvfJ $out/on-server/bootstrap-tools.tar.xz --hard-dereference --sort=name --numeric-owner --owner=0 --group=0 --mtime=@1 -C $out/pack .
|
2015-01-29 02:36:16 +01:00
|
|
|
cp ${busyboxMinimal}/bin/busybox $out/on-server
|
|
|
|
chmod u+w $out/on-server/busybox
|
|
|
|
nuke-refs $out/on-server/busybox
|
2012-12-22 12:17:06 +01:00
|
|
|
''; # */
|
|
|
|
|
|
|
|
# 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 = [];
|
|
|
|
};
|
|
|
|
|
2017-04-26 03:51:24 +02:00
|
|
|
dist = pkgs.stdenv.mkDerivation {
|
2016-07-17 05:34:31 +02:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
};
|
2015-01-29 02:36:16 +01:00
|
|
|
}
|
2012-12-22 12:17:06 +01:00
|
|
|
|
2015-01-29 02:36:16 +01:00
|
|
|
); in {
|
2015-02-05 21:37:29 +01:00
|
|
|
armv5tel = buildFor "armv5tel";
|
2015-01-29 02:36:16 +01:00
|
|
|
armv6l = buildFor "armv6l";
|
|
|
|
armv7l = buildFor "armv7l";
|
2016-02-04 23:47:23 +01:00
|
|
|
aarch64 = buildFor "aarch64";
|
2016-04-17 14:06:10 +02:00
|
|
|
scaleway = buildFor "scaleway";
|
2016-05-09 20:55:43 +02:00
|
|
|
pogoplug4 = buildFor "pogoplug4";
|
2012-12-22 12:17:06 +01:00
|
|
|
}
|