java: Refactor top level and build ordering

This commit is contained in:
William A. Kennington III
2015-06-07 21:02:02 -07:00
parent e0db2213fc
commit bdcb721546
4 changed files with 56 additions and 59 deletions
@@ -4,30 +4,33 @@ let
# !!! These should be on nixos.org
src = if glibc.system == "x86_64-linux" then
fetchurl {
url = http://tarballs.nixos.org/openjdk-bootstrap-x86_64-linux-2012-08-24.tar.xz;
sha256 = "0gla9dxrfq2w1hvgsnn8jg8a60k27im6z43a6iidi0qmwa0wah32";
url = http://pub.wak.io/nixos/tarballs/openjdk-bootstrap-x86_64-linux.tar.xz;
sha256 = "13m3df54mnr2nb67284s2zf5n8y502ck47gc39lcafrh40hzjil5";
}
else if glibc.system == "i686-linux" then
fetchurl {
url = http://tarballs.nixos.org/openjdk-bootstrap-i686-linux-2012-08-24.tar.xz;
sha256 = "184wq212bycwbbq4ix8cc6jwjxkrqw9b01zb86q95kqpa8zy5206";
url = http://pub.wak.io/nixos/tarballs/openjdk-bootstrap-i686-linux.tar.xz;
sha256 = "18kzv4h9skxg5g5c7ar2ji3qny880h5svcn207b4d6xv4sa0a6ks";
}
else throw "No bootstrap for system";
in
runCommand "openjdk-bootstrap" {} ''
tar xvf ${src}
mv openjdk-bootstrap $out
bootstrap = runCommand "openjdk-bootstrap" {
passthru.home = "${bootstrap}/lib/openjdk";
} ''
tar xvf ${src}
mv openjdk-bootstrap $out
for i in $out/bin/*; do
patchelf --set-interpreter ${glibc}/lib/ld-linux*.so.2 $i
done
for i in $out/bin/*; do
patchelf --set-interpreter ${glibc}/lib/ld-linux*.so.2 $i || true
patchelf --set-rpath ${glibc}/lib:$out/lib $i || true
done
# Temporarily, while NixOS's OpenJDK bootstrap tarball doesn't have PaX markings:
exes=$(${file}/bin/file $out/bin/* 2> /dev/null | grep -E 'ELF.*(executable|shared object)' | sed -e 's/: .*$//')
for file in $exes; do
paxmark m "$file"
# On x86 for heap sizes over 700MB disable SEGMEXEC and PAGEEXEC as well.
${stdenv.lib.optionalString stdenv.isi686 ''paxmark msp "$file"''}
done
''
# Temporarily, while NixOS's OpenJDK bootstrap tarball doesn't have PaX markings:
exes=$(${file}/bin/file $out/bin/* 2> /dev/null | grep -E 'ELF.*(executable|shared object)' | sed -e 's/: .*$//')
for file in $exes; do
paxmark m "$file"
# On x86 for heap sizes over 700MB disable SEGMEXEC and PAGEEXEC as well.
${stdenv.lib.optionalString stdenv.isi686 ''paxmark msp "$file"''}
done
'';
in bootstrap