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-28 15:32:49 +02:00
|
|
|
export PATH=$coreutils/bin:$PATH # !!! temporary hack
|
|
|
|
|
|
|
|
|
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
|
2006-10-20 22:18:21 +02:00
|
|
|
nukeRefs $out/in-nixpkgs/bash
|
2007-12-03 13:15:35 +01:00
|
|
|
cp $bzip2/bin/bzip2 $out/in-nixpkgs
|
2006-10-20 22:18:21 +02:00
|
|
|
cp $coreutils/bin/cp $out/in-nixpkgs
|
2006-10-24 19:24:04 +02:00
|
|
|
cp $gnutar/bin/tar $out/in-nixpkgs
|
2006-10-19 23:36:51 +02:00
|
|
|
nukeRefs $out/in-nixpkgs/tar
|
|
|
|
|
2006-10-26 17:02:16 +02:00
|
|
|
if test "$system" = "powerpc-linux"; then
|
|
|
|
nukeRefs $out/in-nixpkgs/cp
|
|
|
|
fi
|
|
|
|
|
2006-10-19 23:36:51 +02:00
|
|
|
|
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 18:01:38 +02:00
|
|
|
cp $findutils/bin/find tools/bin
|
|
|
|
cp $findutils/bin/xargs tools/bin
|
2006-10-21 00:23:36 +02:00
|
|
|
cp $diffutils/bin/* tools/bin
|
2006-10-20 00:31:08 +02:00
|
|
|
cp $gnused/bin/* tools/bin
|
2007-11-26 16:59:07 +01:00
|
|
|
cp $gnugrep/bin/* tools/bin
|
2006-10-20 22:57:31 +02:00
|
|
|
cp $gawk/bin/gawk tools/bin
|
|
|
|
ln -s gawk tools/bin/awk
|
2006-10-20 00:31:08 +02:00
|
|
|
cp $gnutar/bin/* tools/bin
|
2006-10-28 00:50:58 +02:00
|
|
|
cp $gzip/bin/gzip tools/bin
|
2007-12-03 13:15:35 +01:00
|
|
|
cp $bzip2/bin/bzip2 tools/bin
|
2006-10-20 22:18:21 +02:00
|
|
|
cp $gnumake/bin/* tools/bin
|
2006-10-20 00:31:08 +02:00
|
|
|
cp $patch/bin/* tools/bin
|
2006-10-20 13:50:08 +02:00
|
|
|
cp $patchelf/bin/* tools/bin
|
2006-10-20 00:31:08 +02:00
|
|
|
|
2006-10-21 00:23:36 +02:00
|
|
|
nukeRefs tools/bin/diff
|
2006-10-20 00:31:08 +02:00
|
|
|
nukeRefs tools/bin/sed
|
2006-10-20 22:57:31 +02:00
|
|
|
nukeRefs tools/bin/gawk
|
2006-10-20 00:31:08 +02:00
|
|
|
nukeRefs tools/bin/tar
|
2006-10-20 00:47:51 +02:00
|
|
|
nukeRefs tools/bin/grep
|
2007-11-26 16:59:07 +01:00
|
|
|
nukeRefs tools/bin/fgrep
|
|
|
|
nukeRefs tools/bin/egrep
|
2006-10-20 13:50:08 +02:00
|
|
|
nukeRefs tools/bin/patchelf
|
2006-10-20 22:18:21 +02:00
|
|
|
nukeRefs tools/bin/make
|
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
|
2006-10-27 22:08:53 +02:00
|
|
|
for i in as ld ar ranlib nm strip readelf objdump; do
|
2006-10-20 12:13:07 +02:00
|
|
|
cp $binutils/bin/$i binutils/bin
|
|
|
|
nukeRefs binutils/bin/$i
|
|
|
|
done
|
|
|
|
|
|
|
|
|
2006-10-20 14:50:45 +02:00
|
|
|
# Create the gcc tarball.
|
2006-10-20 13:16:15 +02: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-25 11:51:32 +02:00
|
|
|
if test -e gcc/lib/libgcc_s.so.1; then
|
|
|
|
nukeRefs gcc/lib/libgcc_s.so.1
|
|
|
|
fi
|
2006-10-24 14:45:55 +02: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
|
2007-12-03 16:40:29 +01:00
|
|
|
rm -f gcc/lib*/libmud* gcc/lib*/libiberty* gcc/lib*/libssp* gcc/lib*/libgomp*
|
2006-10-20 13:16:15 +02:00
|
|
|
rm -rf gcc/lib/gcc/*/*/install-tools
|
2006-10-23 23:52:36 +02:00
|
|
|
rm -rf gcc/lib/gcc/*/*/include/root
|
|
|
|
rm -rf gcc/lib/gcc/*/*/include/linux
|
2008-01-25 00:49:02 +01:00
|
|
|
if test "$system" = "powerpc-linux"; then
|
|
|
|
nukeRefs gcc/lib/gcc/powerpc-unknown-linux-gnu/*/include/bits/mathdef.h
|
2006-10-30 13:57:30 +01:00
|
|
|
fi
|
2008-05-09 18:02:14 +02:00
|
|
|
# Dangling symlink "sound", probably produced by fixinclude.
|
|
|
|
# Should investigate why it's there in the first place.
|
|
|
|
rm -f gcc/lib/gcc/*/*/include/sound
|
2006-10-20 13:16:15 +02:00
|
|
|
|
|
|
|
|
2006-10-20 14:50:45 +02:00
|
|
|
# Create the glibc tarball.
|
|
|
|
mkdir glibc
|
|
|
|
mkdir glibc/lib
|
|
|
|
cp $glibc/lib/*.a glibc/lib
|
2006-10-25 11:51:32 +02:00
|
|
|
rm -f glibc/lib/*_p.a
|
2006-10-20 14:50:45 +02: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
|
2008-01-25 02:28:11 +01:00
|
|
|
if test -L "$(readlink $glibc/include/asm)"; then
|
|
|
|
ln -s $(readlink $(readlink $glibc/include/asm)) glibc/include/asm
|
|
|
|
else
|
|
|
|
cp -prd "$(readlink $glibc/include/asm)" glibc/include
|
|
|
|
fi
|
2006-10-20 14:50:45 +02:00
|
|
|
for i in glibc/include/asm-*; do
|
|
|
|
target=$(readlink $i)
|
|
|
|
rm $i
|
|
|
|
cp -prd $target glibc/include
|
|
|
|
done
|
2008-05-09 18:02:14 +02:00
|
|
|
# Hopefully we won't need these.
|
|
|
|
rm -f glibc/include/mtd glibc/include/rdma glibc/include/sound glibc/include/video
|
2006-10-20 14:50:45 +02:00
|
|
|
|
|
|
|
|
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.
|
2006-10-24 21:29:12 +02:00
|
|
|
bzip2 < $curl/bin/curl > $out/in-nixpkgs/curl.bz2
|
|
|
|
bzip2 $out/in-nixpkgs/tar
|
|
|
|
chmod +x $out/in-nixpkgs/*.bz2
|
|
|
|
|
2006-10-20 12:13:07 +02:00
|
|
|
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-20 14:50:45 +02:00
|
|
|
tar cfj $out/on-server/glibc.tar.bz2 glibc
|
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
|
2006-10-20 22:18:21 +02:00
|
|
|
|
|
|
|
for i in $out/in-nixpkgs/*.bz2; do
|
|
|
|
(cd $out/check-only && bunzip2 < $i > $(basename $i .bz2))
|
|
|
|
done
|
2006-10-27 22:08:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
# Check that everything is statically linked
|
2006-10-28 00:50:58 +02: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 22:08:53 +02:00
|
|
|
done
|