2006-10-19 19:03:13 +01:00
|
|
|
source $stdenv/setup
|
|
|
|
|
|
|
|
ensureDir $out/in-nixpkgs
|
|
|
|
ensureDir $out/on-server
|
|
|
|
|
2006-10-19 22:36:51 +01: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-28 14:32:49 +01:00
|
|
|
export PATH=$coreutils/bin:$PATH # !!! temporary hack
|
|
|
|
|
|
|
|
|
2006-10-19 19:03:13 +01: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 22:36:51 +01:00
|
|
|
|
2006-10-20 11:13:07 +01: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 19:03:13 +01:00
|
|
|
cp $bash/bin/bash $out/in-nixpkgs
|
2006-10-20 21:18:21 +01:00
|
|
|
nukeRefs $out/in-nixpkgs/bash
|
2006-10-19 19:03:13 +01:00
|
|
|
cp $bzip2/bin/bunzip2 $out/in-nixpkgs
|
2006-10-20 21:18:21 +01:00
|
|
|
cp $coreutils/bin/cp $out/in-nixpkgs
|
2006-10-24 18:24:04 +01:00
|
|
|
cp $gnutar/bin/tar $out/in-nixpkgs
|
2006-10-19 22:36:51 +01:00
|
|
|
nukeRefs $out/in-nixpkgs/tar
|
|
|
|
|
2006-10-26 16:02:16 +01:00
|
|
|
if test "$system" = "powerpc-linux"; then
|
|
|
|
nukeRefs $out/in-nixpkgs/cp
|
|
|
|
fi
|
|
|
|
|
2006-10-19 22:36:51 +01:00
|
|
|
|
2006-10-20 11:13:07 +01:00
|
|
|
# Create the tools tarball.
|
2006-10-19 22:36:51 +01: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 17:01:38 +01:00
|
|
|
cp $findutils/bin/find tools/bin
|
|
|
|
cp $findutils/bin/xargs tools/bin
|
2006-10-20 23:23:36 +01:00
|
|
|
cp $diffutils/bin/* tools/bin
|
2006-10-19 23:31:08 +01:00
|
|
|
cp $gnused/bin/* tools/bin
|
2007-11-26 15:59:07 +00:00
|
|
|
cp $gnugrep/bin/* tools/bin
|
2006-10-20 21:57:31 +01:00
|
|
|
cp $gawk/bin/gawk tools/bin
|
|
|
|
ln -s gawk tools/bin/awk
|
2006-10-19 23:31:08 +01:00
|
|
|
cp $gnutar/bin/* tools/bin
|
2006-10-27 23:50:58 +01:00
|
|
|
cp $gzip/bin/gzip tools/bin
|
|
|
|
ln -s gzip tools/bin/gunzip
|
2006-10-19 23:31:08 +01:00
|
|
|
cp $bzip2/bin/bunzip2 tools/bin
|
2006-10-20 21:18:21 +01:00
|
|
|
cp $gnumake/bin/* tools/bin
|
2006-10-19 23:31:08 +01:00
|
|
|
cp $patch/bin/* tools/bin
|
2006-10-20 12:50:08 +01:00
|
|
|
cp $patchelf/bin/* tools/bin
|
2006-10-19 23:31:08 +01:00
|
|
|
|
2006-10-20 23:23:36 +01:00
|
|
|
nukeRefs tools/bin/diff
|
2006-10-19 23:31:08 +01:00
|
|
|
nukeRefs tools/bin/sed
|
2006-10-20 21:57:31 +01:00
|
|
|
nukeRefs tools/bin/gawk
|
2006-10-19 23:31:08 +01:00
|
|
|
nukeRefs tools/bin/tar
|
2006-10-19 23:47:51 +01:00
|
|
|
nukeRefs tools/bin/grep
|
2007-11-26 15:59:07 +00:00
|
|
|
nukeRefs tools/bin/fgrep
|
|
|
|
nukeRefs tools/bin/egrep
|
2006-10-20 12:50:08 +01:00
|
|
|
nukeRefs tools/bin/patchelf
|
2006-10-20 21:18:21 +01:00
|
|
|
nukeRefs tools/bin/make
|
2006-10-19 23:31:08 +01:00
|
|
|
|
|
|
|
|
2006-10-20 11:13:07 +01:00
|
|
|
# Create the binutils tarball.
|
|
|
|
mkdir binutils
|
|
|
|
mkdir binutils/bin
|
2006-10-27 21:08:53 +01:00
|
|
|
for i in as ld ar ranlib nm strip readelf objdump; do
|
2006-10-20 11:13:07 +01:00
|
|
|
cp $binutils/bin/$i binutils/bin
|
|
|
|
nukeRefs binutils/bin/$i
|
|
|
|
done
|
|
|
|
|
|
|
|
|
2006-10-20 13:50:45 +01:00
|
|
|
# Create the gcc tarball.
|
2006-10-20 12:16:15 +01:00
|
|
|
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
|
2006-10-23 22:52:36 +01:00
|
|
|
rm -f gcc/lib/libmud* gcc/lib/libiberty* gcc/lib/libssp*
|
2006-10-25 10:51:32 +01:00
|
|
|
if test -e gcc/lib/libgcc_s.so.1; then
|
|
|
|
nukeRefs gcc/lib/libgcc_s.so.1
|
|
|
|
fi
|
2006-10-24 13:45:55 +01:00
|
|
|
if test -e $gcc/lib64; then
|
|
|
|
cp -prd $gcc/lib64 gcc
|
|
|
|
chmod -R +w gcc/lib64
|
|
|
|
nukeRefs gcc/lib64/libgcc_s.so.1
|
|
|
|
fi
|
2006-10-20 12:16:15 +01:00
|
|
|
rm -rf gcc/lib/gcc/*/*/install-tools
|
2006-10-23 22:52:36 +01:00
|
|
|
rm -rf gcc/lib/gcc/*/*/include/root
|
|
|
|
rm -rf gcc/lib/gcc/*/*/include/linux
|
2007-11-22 12:39:51 +00:00
|
|
|
rm -f gcc/lib/libgomp*
|
2006-10-30 12:57:30 +00:00
|
|
|
if test -e gcc/lib/gcc/powerpc-unknown-linux-gnu/4.1.1/include/bits/mathdef.h; then
|
|
|
|
nukeRefs gcc/lib/gcc/powerpc-unknown-linux-gnu/4.1.1/include/bits/mathdef.h
|
|
|
|
fi
|
2006-10-20 12:16:15 +01:00
|
|
|
|
|
|
|
|
2006-10-20 13:50:45 +01:00
|
|
|
# Create the glibc tarball.
|
|
|
|
mkdir glibc
|
|
|
|
mkdir glibc/lib
|
|
|
|
cp $glibc/lib/*.a glibc/lib
|
2006-10-25 10:51:32 +01:00
|
|
|
rm -f glibc/lib/*_p.a
|
2006-10-20 13:50:45 +01:00
|
|
|
nukeRefs glibc/lib/libc.a
|
|
|
|
cp $glibc/lib/*.o glibc/lib
|
|
|
|
cp -prd $glibc/include glibc
|
|
|
|
chmod -R +w glibc
|
|
|
|
rm glibc/include/linux
|
|
|
|
cp -prd $(readlink $glibc/include/linux) glibc/include
|
|
|
|
rm glibc/include/asm
|
|
|
|
ln -s $(readlink $(readlink $glibc/include/asm)) glibc/include/asm
|
|
|
|
for i in glibc/include/asm-*; do
|
|
|
|
target=$(readlink $i)
|
|
|
|
rm $i
|
|
|
|
cp -prd $target glibc/include
|
|
|
|
done
|
|
|
|
|
|
|
|
|
2006-10-20 11:13:07 +01:00
|
|
|
# Strip executables even further.
|
2006-10-20 12:16:15 +01:00
|
|
|
for i in $out/in-nixpkgs/* */bin/* gcc/libexec/gcc/*/*/*; do
|
2006-10-19 23:31:08 +01:00
|
|
|
if test -x $i; then
|
|
|
|
chmod +w $i
|
2006-10-19 23:47:51 +01:00
|
|
|
strip -s $i || true
|
2006-10-19 23:31:08 +01:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
|
2006-10-20 11:13:07 +01:00
|
|
|
# Pack, unpack everything.
|
2006-10-24 20:29:12 +01:00
|
|
|
bzip2 < $curl/bin/curl > $out/in-nixpkgs/curl.bz2
|
|
|
|
bzip2 $out/in-nixpkgs/tar
|
|
|
|
chmod +x $out/in-nixpkgs/*.bz2
|
|
|
|
|
2006-10-20 11:13:07 +01:00
|
|
|
tar cfj $out/on-server/static-tools.tar.bz2 tools
|
|
|
|
tar cfj $out/on-server/binutils.tar.bz2 binutils
|
2006-10-20 12:16:15 +01:00
|
|
|
tar cfj $out/on-server/gcc.tar.bz2 gcc
|
2006-10-20 13:50:45 +01:00
|
|
|
tar cfj $out/on-server/glibc.tar.bz2 glibc
|
2006-10-19 19:03:13 +01:00
|
|
|
|
2006-10-19 22:36:51 +01:00
|
|
|
for i in $out/on-server/*.tar.bz2; do
|
2006-10-20 11:13:07 +01:00
|
|
|
(cd $out/check-only && tar xfj $i)
|
2006-10-19 22:36:51 +01:00
|
|
|
done
|
2006-10-20 21:18:21 +01:00
|
|
|
|
|
|
|
for i in $out/in-nixpkgs/*.bz2; do
|
|
|
|
(cd $out/check-only && bunzip2 < $i > $(basename $i .bz2))
|
|
|
|
done
|
2006-10-27 21:08:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
# Check that everything is statically linked
|
2006-10-27 23:50:58 +01:00
|
|
|
for i in $(find $out -type f -perm +111); do
|
|
|
|
if ldd $i | grep -q "=>"; then echo "not statically linked: $i"; exit 1; fi
|
2006-10-27 21:08:53 +01:00
|
|
|
done
|