2015-06-08 04:01:17 +00:00
|
|
|
{ stdenv, runCommand, glibc, fetchurl, file
|
|
|
|
|
|
|
|
, version
|
|
|
|
}:
|
2012-08-25 02:29:23 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
# !!! These should be on nixos.org
|
|
|
|
src = if glibc.system == "x86_64-linux" then
|
2015-06-08 04:01:17 +00:00
|
|
|
(if version == "8" then
|
|
|
|
fetchurl {
|
|
|
|
url = "https://www.dropbox.com/s/a0lsq2ig4uguky5/openjdk8-bootstrap-x86_64-linux.tar.xz?dl=1";
|
|
|
|
sha256 = "18zqx6jhm3lizn9hh6ryyqc9dz3i96pwaz8f6nxfllk70qi5gvks";
|
|
|
|
}
|
|
|
|
else if version == "7" then
|
|
|
|
fetchurl {
|
|
|
|
url = "https://www.dropbox.com/s/rssfbeommrfbsjf/openjdk7-bootstrap-x86_64-linux.tar.xz?dl=1";
|
|
|
|
sha256 = "024gg2sgg4labxbc1nhn8lxls2p7d9h3b82hnsahwaja2pm1hbra";
|
|
|
|
}
|
|
|
|
else throw "No bootstrap for version")
|
2012-08-25 02:29:23 +00:00
|
|
|
else if glibc.system == "i686-linux" then
|
2015-06-08 04:01:17 +00:00
|
|
|
(if version == "8" then
|
|
|
|
fetchurl {
|
|
|
|
url = "https://www.dropbox.com/s/rneqjhlerijsw74/openjdk8-bootstrap-i686-linux.tar.xz?dl=1";
|
|
|
|
sha256 = "1yx04xh8bqz7amg12d13rw5vwa008rav59mxjw1b9s6ynkvfgqq9";
|
|
|
|
}
|
|
|
|
else if version == "7" then
|
|
|
|
fetchurl {
|
|
|
|
url = "https://www.dropbox.com/s/6xe64td7eg2wurs/openjdk7-bootstrap-i686-linux.tar.xz?dl=1";
|
|
|
|
sha256 = "0xwqjk1zx8akziw8q9sbjc1rs8s7c0w6mw67jdmmi26cwwp8ijnx";
|
|
|
|
}
|
|
|
|
else throw "No bootstrap for version")
|
2012-08-25 02:29:23 +00:00
|
|
|
else throw "No bootstrap for system";
|
|
|
|
|
2015-06-06 23:14:43 +00:00
|
|
|
bootstrap = runCommand "openjdk-bootstrap" {
|
|
|
|
passthru.home = "${bootstrap}/lib/openjdk";
|
|
|
|
} ''
|
|
|
|
tar xvf ${src}
|
|
|
|
mv openjdk-bootstrap $out
|
2014-02-19 17:45:58 +00:00
|
|
|
|
2015-06-08 04:01:17 +00:00
|
|
|
LIBDIRS="$(find $out -name \*.so\* -exec dirname {} \; | sort | uniq | tr '\n' ':')"
|
|
|
|
|
2015-06-06 23:14:43 +00:00
|
|
|
for i in $out/bin/*; do
|
2015-10-03 11:33:13 +00:00
|
|
|
patchelf --set-interpreter ${glibc.out}/lib/ld-linux*.so.2 $i || true
|
|
|
|
patchelf --set-rpath "${glibc.out}/lib:$LIBDIRS" $i || true
|
2015-06-08 04:01:17 +00:00
|
|
|
done
|
2014-02-19 17:45:58 +00:00
|
|
|
|
2015-06-08 04:01:17 +00:00
|
|
|
find $out -name \*.so\* | while read lib; do
|
2015-10-03 11:33:13 +00:00
|
|
|
patchelf --set-interpreter ${glibc.out}/lib/ld-linux*.so.2 $lib || true
|
|
|
|
patchelf --set-rpath "${glibc.out}/lib:${stdenv.cc.cc.lib}/lib:$LIBDIRS" $lib || true
|
2015-06-06 23:14:43 +00:00
|
|
|
done
|
2015-01-19 22:24:47 +00:00
|
|
|
|
2015-06-06 23:14:43 +00: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
|
|
|
|
'';
|
|
|
|
in bootstrap
|