nixpkgs/pkgs/development/compilers/jdk/builder.sh
Eelco Dolstra 5b63bb66f7 * Purification of JDK 5. At runtime it now uses the Nix-deployed
Glibc and X11 client libraries.  The latter are actually optional
  dependencies: if the function is called with `swingSupport' set to
  `false', they are not needed.  This is nice for, e.g., server
  environments.

  All hail Patchelf!

svn path=/nixpkgs/trunk/; revision=4030
2005-10-07 22:27:42 +00:00

49 lines
1,006 B
Bash

source $stdenv/setup
src=$filename.bin
if ! test -e "$pathname"; then
echo ""
echo "SORRY!"
echo "You should download \`$(basename $pathname)' from Sun and place it in $(dirname $pathname)."
echo "Blame Sun, not us."
echo ""
exit 1
fi
actual=$(md5sum -b $pathname | cut -c1-32)
if test "$actual" != "$md5"; then
echo "hash is $actual, expected $md5"
exit 1
fi
unzip $pathname || true
ensureDir $out
mv $dirname/* $out/
# Remove crap in the root directory.
for file in $out/*
do
if test -f $file ; then
rm $file
fi
done
# Set the dynamic linker.
rpath=
for i in $libraries; do
rpath=$rpath${rpath:+:}$i/lib
done
glibc=$(cat $NIX_GCC/nix-support/orig-glibc)
find $out -type f -perm +100 \
-exec patchelf --interpreter $glibc/lib/ld-linux.so.* \
--set-rpath "$rpath" {} \;
# Unpack .pack files.
for i in $(find $out -name "*.pack"); do
echo "unpacking $i..."
$out/bin/unpack200 "$i" "$(dirname $i)/$(basename $i .pack).jar"
rm "$i"
done