openjdk: Clean up platform conditionals
This commit is contained in:
parent
30f171d3e2
commit
933e8663ad
2 changed files with 16 additions and 17 deletions
|
@ -14,9 +14,9 @@ let
|
||||||
* The JRE libraries are in directories that depend on the CPU.
|
* The JRE libraries are in directories that depend on the CPU.
|
||||||
*/
|
*/
|
||||||
architecture =
|
architecture =
|
||||||
if stdenv.system == "i686-linux" then
|
if stdenv.hostPlatform.system == "i686-linux" then
|
||||||
"i386"
|
"i386"
|
||||||
else if stdenv.system == "x86_64-linux" then
|
else if stdenv.hostPlatform.system == "x86_64-linux" then
|
||||||
"amd64"
|
"amd64"
|
||||||
else
|
else
|
||||||
throw "openjdk requires i686-linux or x86_64 linux";
|
throw "openjdk requires i686-linux or x86_64 linux";
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
{ stdenv, runCommand, glibc, fetchurl, file
|
{ stdenv
|
||||||
|
, runCommand, fetchurl, file
|
||||||
|
|
||||||
, version
|
, version
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
assert stdenv.hostPlatform.libc == "glibc";
|
||||||
|
|
||||||
let
|
let
|
||||||
# !!! These should be on nixos.org
|
# !!! These should be on nixos.org
|
||||||
src = if glibc.system == "x86_64-linux" then
|
src = if stdenv.hostPlatform.system == "x86_64-linux" then
|
||||||
(if version == "8" then
|
(if version == "8" then
|
||||||
fetchurl {
|
fetchurl {
|
||||||
url = "https://www.dropbox.com/s/a0lsq2ig4uguky5/openjdk8-bootstrap-x86_64-linux.tar.xz?dl=1";
|
url = "https://www.dropbox.com/s/a0lsq2ig4uguky5/openjdk8-bootstrap-x86_64-linux.tar.xz?dl=1";
|
||||||
|
@ -17,7 +20,7 @@ let
|
||||||
sha256 = "024gg2sgg4labxbc1nhn8lxls2p7d9h3b82hnsahwaja2pm1hbra";
|
sha256 = "024gg2sgg4labxbc1nhn8lxls2p7d9h3b82hnsahwaja2pm1hbra";
|
||||||
}
|
}
|
||||||
else throw "No bootstrap for version")
|
else throw "No bootstrap for version")
|
||||||
else if glibc.system == "i686-linux" then
|
else if stdenv.hostPlatform.system == "i686-linux" then
|
||||||
(if version == "8" then
|
(if version == "8" then
|
||||||
fetchurl {
|
fetchurl {
|
||||||
url = "https://www.dropbox.com/s/rneqjhlerijsw74/openjdk8-bootstrap-i686-linux.tar.xz?dl=1";
|
url = "https://www.dropbox.com/s/rneqjhlerijsw74/openjdk8-bootstrap-i686-linux.tar.xz?dl=1";
|
||||||
|
@ -39,22 +42,18 @@ let
|
||||||
|
|
||||||
LIBDIRS="$(find $out -name \*.so\* -exec dirname {} \; | sort | uniq | tr '\n' ':')"
|
LIBDIRS="$(find $out -name \*.so\* -exec dirname {} \; | sort | uniq | tr '\n' ':')"
|
||||||
|
|
||||||
for i in $out/bin/*; do
|
find "$out" -type f -print0 | while IFS= read -r -d "" elf; do
|
||||||
patchelf --set-interpreter ${glibc.out}/lib/ld-linux*.so.2 $i || true
|
isELF "$elf" || continue
|
||||||
patchelf --set-rpath "${glibc.out}/lib:$LIBDIRS" $i || true
|
patchelf --set-interpreter $(cat "${stdenv.cc}/nix-support/dynamic-linker") "$elf" || true
|
||||||
done
|
patchelf --set-rpath "${stdenv.cc.libc}/lib:$LIBDIRS" "$elf" || true
|
||||||
|
|
||||||
find $out -name \*.so\* | while read lib; do
|
|
||||||
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
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Temporarily, while NixOS's OpenJDK bootstrap tarball doesn't have PaX markings:
|
# 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/: .*$//')
|
find "$out/bin" -type f -print0 | while IFS= read -r -d "" elf; do
|
||||||
for file in $exes; do
|
isELF "$elf" || continue
|
||||||
paxmark m "$file"
|
paxmark m "$elf"
|
||||||
# On x86 for heap sizes over 700MB disable SEGMEXEC and PAGEEXEC as well.
|
# On x86 for heap sizes over 700MB disable SEGMEXEC and PAGEEXEC as well.
|
||||||
${stdenv.lib.optionalString stdenv.isi686 ''paxmark msp "$file"''}
|
${stdenv.lib.optionalString stdenv.isi686 ''paxmark msp "$elf"''}
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
in bootstrap
|
in bootstrap
|
||||||
|
|
Loading…
Reference in a new issue