2014-02-19 18:45:58 +01:00
|
|
|
{ stdenv, runCommand, glibc, fetchurl, file }:
|
2012-08-25 04:29:23 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
# !!! These should be on nixos.org
|
|
|
|
src = if glibc.system == "x86_64-linux" then
|
|
|
|
fetchurl {
|
2013-06-25 14:05:48 +02:00
|
|
|
url = http://tarballs.nixos.org/openjdk-bootstrap-x86_64-linux-2012-08-24.tar.xz;
|
2012-08-25 04:29:23 +02:00
|
|
|
sha256 = "0gla9dxrfq2w1hvgsnn8jg8a60k27im6z43a6iidi0qmwa0wah32";
|
|
|
|
}
|
|
|
|
else if glibc.system == "i686-linux" then
|
|
|
|
fetchurl {
|
2013-06-25 14:05:48 +02:00
|
|
|
url = http://tarballs.nixos.org/openjdk-bootstrap-i686-linux-2012-08-24.tar.xz;
|
2012-08-25 04:29:23 +02:00
|
|
|
sha256 = "184wq212bycwbbq4ix8cc6jwjxkrqw9b01zb86q95kqpa8zy5206";
|
|
|
|
}
|
|
|
|
else throw "No bootstrap for system";
|
|
|
|
in
|
|
|
|
|
|
|
|
runCommand "openjdk-bootstrap" {} ''
|
2015-01-19 23:24:47 +01:00
|
|
|
tar xvf ${src}
|
2012-08-25 04:29:23 +02:00
|
|
|
mv openjdk-bootstrap $out
|
2014-02-19 18:45:58 +01:00
|
|
|
|
2015-01-19 23:24:47 +01:00
|
|
|
for i in $out/bin/*; do
|
2015-04-26 19:54:51 +02:00
|
|
|
patchelf --set-interpreter ${glibc.out}/lib/ld-linux*.so.2 $i
|
2015-01-19 23:24:47 +01:00
|
|
|
done
|
|
|
|
|
2014-02-19 18:45:58 +01:00
|
|
|
# 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
|
2012-08-25 04:29:23 +02:00
|
|
|
''
|