From fc56793b677f9a32797b2384c42fd6141f715218 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 19 Oct 2006 18:03:13 +0000 Subject: [PATCH] * Start of a Nix expression that builds and gathers all the statically linked tools necessary for bootstrapping stdenv-linux. svn path=/nixpkgs/trunk/; revision=6778 --- pkgs/stdenv/linux/make-bootstrap-tools.nix | 24 ++++++++++++++++++++++ pkgs/stdenv/linux/make-bootstrap-tools.sh | 21 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 pkgs/stdenv/linux/make-bootstrap-tools.nix create mode 100644 pkgs/stdenv/linux/make-bootstrap-tools.sh diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix new file mode 100644 index 000000000000..0586cd1021d8 --- /dev/null +++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix @@ -0,0 +1,24 @@ +let + + pkgs = import ../../top-level/all-packages.nix {}; + + pkgsDiet = import ../../top-level/all-packages.nix { + # Have to do removeAttrs to prevent all-packages from copying + # stdenv-linux's dependencies, rather than building new ones with + # dietlibc. + bootStdenv = removeAttrs (pkgs.useDietLibC pkgs.stdenv) + ["bash" "bzip2" "coreutils"]; + }; + + generator = pkgs.stdenv.mkDerivation { + name = "bootstrap-tools-generator"; + builder = ./make-bootstrap-tools.sh; + inherit (pkgsDiet) bash bzip2 coreutils; + + # 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 = []; + }; + +in generator diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.sh b/pkgs/stdenv/linux/make-bootstrap-tools.sh new file mode 100644 index 000000000000..775b99a502f2 --- /dev/null +++ b/pkgs/stdenv/linux/make-bootstrap-tools.sh @@ -0,0 +1,21 @@ +source $stdenv/setup + +ensureDir $out/in-nixpkgs +ensureDir $out/on-server + +nukeRefs() { + # Dirty, disgusting, but it works ;-) + fileName=$1 + cat $fileName | sed "s|/nix/store/[a-z0-9]*-|/nix/store/ffffffffffffffffffffffffffffffff-|g" > $fileName.tmp + if test -x $fileName; then chmod +x $fileName.tmp; fi + mv $fileName.tmp $fileName +} + +cp $bash/bin/bash $out/in-nixpkgs +cp $bzip2/bin/bunzip2 $out/in-nixpkgs +cp $coreutils/bin/cp $out/in-nixpkgs + +nukeRefs $out/in-nixpkgs/bash + +chmod +w $out/in-nixpkgs/* +strip -s $out/in-nixpkgs/*