2006-10-19 20:03:13 +02:00
|
|
|
source $stdenv/setup
|
|
|
|
|
|
|
|
ensureDir $out/in-nixpkgs
|
|
|
|
ensureDir $out/on-server
|
|
|
|
|
2006-10-19 23:36:51 +02:00
|
|
|
# Everything we put in check-only is merely to allow Nix to check that
|
|
|
|
# we aren't putting binaries with store path references in tarballs.
|
|
|
|
ensureDir $out/check-only
|
|
|
|
|
|
|
|
|
2006-10-19 20:03:13 +02:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2006-10-19 23:36:51 +02:00
|
|
|
|
2006-10-20 12:13:07 +02:00
|
|
|
# Create the tools that need to be in-tree, i.e., the ones that are
|
|
|
|
# necessary for the absolute first stage of the bootstrap.
|
2006-10-19 20:03:13 +02:00
|
|
|
cp $bash/bin/bash $out/in-nixpkgs
|
|
|
|
cp $bzip2/bin/bunzip2 $out/in-nixpkgs
|
2006-10-19 23:36:51 +02:00
|
|
|
cp $gnutar/bin/tar $out/in-nixpkgs
|
|
|
|
cp $curl/bin/curl $out/check-only
|
|
|
|
bzip2 < $curl/bin/curl > $out/in-nixpkgs/curl.bz2
|
2006-10-19 20:03:13 +02:00
|
|
|
|
|
|
|
nukeRefs $out/in-nixpkgs/bash
|
2006-10-19 23:36:51 +02:00
|
|
|
nukeRefs $out/in-nixpkgs/tar
|
|
|
|
|
|
|
|
|
2006-10-20 12:13:07 +02:00
|
|
|
# Create the tools tarball.
|
2006-10-19 23:36:51 +02:00
|
|
|
mkdir tools
|
|
|
|
mkdir tools/bin
|
|
|
|
|
|
|
|
cp $coreutils/bin/* tools/bin
|
|
|
|
rm tools/bin/groups # has references
|
|
|
|
rm tools/bin/printf # idem
|
|
|
|
|
2006-10-20 00:31:08 +02:00
|
|
|
cp $gnused/bin/* tools/bin
|
2006-10-20 00:47:51 +02:00
|
|
|
cp $gnugrep/bin/* tools/bin
|
2006-10-20 00:31:08 +02:00
|
|
|
cp $gnutar/bin/* tools/bin
|
2006-10-20 12:13:07 +02:00
|
|
|
cp $gunzip/bin/gunzip tools/bin
|
2006-10-20 00:31:08 +02:00
|
|
|
cp $bzip2/bin/bunzip2 tools/bin
|
|
|
|
cp $patch/bin/* tools/bin
|
|
|
|
|
|
|
|
nukeRefs tools/bin/sed
|
|
|
|
nukeRefs tools/bin/tar
|
2006-10-20 00:47:51 +02:00
|
|
|
nukeRefs tools/bin/grep
|
2006-10-20 00:31:08 +02:00
|
|
|
|
2006-10-19 23:36:51 +02:00
|
|
|
#cp $patchelf/bin/* tools/bin
|
2006-10-20 00:31:08 +02:00
|
|
|
|
|
|
|
|
2006-10-20 12:13:07 +02:00
|
|
|
# Create the binutils tarball.
|
|
|
|
mkdir binutils
|
|
|
|
mkdir binutils/bin
|
|
|
|
for i in as ld ar ranlib nm strip; do
|
|
|
|
cp $binutils/bin/$i binutils/bin
|
|
|
|
nukeRefs binutils/bin/$i
|
|
|
|
done
|
|
|
|
|
|
|
|
|
2006-10-20 13:16:15 +02:00
|
|
|
# Create the gcc tarball
|
|
|
|
mkdir gcc
|
|
|
|
mkdir gcc/bin
|
|
|
|
cp $gcc/bin/gcc gcc/bin
|
|
|
|
cp $gcc/bin/cpp gcc/bin
|
|
|
|
nukeRefs gcc/bin/gcc
|
|
|
|
nukeRefs gcc/bin/cpp
|
|
|
|
cp -prd $gcc/lib gcc
|
|
|
|
cp -prd $gcc/libexec gcc
|
|
|
|
chmod -R +w gcc
|
|
|
|
nukeRefs gcc/libexec/gcc/*/*/cc1
|
|
|
|
nukeRefs gcc/libexec/gcc/*/*/collect2
|
|
|
|
rm gcc/lib/libmud* gcc/lib/libiberty* gcc/lib/libssp*
|
|
|
|
rm gcc/lib/*.so*
|
|
|
|
rm -rf gcc/lib/gcc/*/*/install-tools
|
|
|
|
|
|
|
|
|
2006-10-20 12:13:07 +02:00
|
|
|
# Strip executables even further.
|
2006-10-20 13:16:15 +02:00
|
|
|
for i in $out/in-nixpkgs/* */bin/* gcc/libexec/gcc/*/*/*; do
|
2006-10-20 00:31:08 +02:00
|
|
|
if test -x $i; then
|
|
|
|
chmod +w $i
|
2006-10-20 00:47:51 +02:00
|
|
|
strip -s $i || true
|
2006-10-20 00:31:08 +02:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
|
2006-10-20 12:13:07 +02:00
|
|
|
# Pack, unpack everything.
|
|
|
|
tar cfj $out/on-server/static-tools.tar.bz2 tools
|
|
|
|
tar cfj $out/on-server/binutils.tar.bz2 binutils
|
2006-10-20 13:16:15 +02:00
|
|
|
tar cfj $out/on-server/gcc.tar.bz2 gcc
|
2006-10-19 20:03:13 +02:00
|
|
|
|
2006-10-19 23:36:51 +02:00
|
|
|
for i in $out/on-server/*.tar.bz2; do
|
2006-10-20 12:13:07 +02:00
|
|
|
(cd $out/check-only && tar xfj $i)
|
2006-10-19 23:36:51 +02:00
|
|
|
done
|