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.
|
||||
*/
|
||||
architecture =
|
||||
if stdenv.system == "i686-linux" then
|
||||
if stdenv.hostPlatform.system == "i686-linux" then
|
||||
"i386"
|
||||
else if stdenv.system == "x86_64-linux" then
|
||||
else if stdenv.hostPlatform.system == "x86_64-linux" then
|
||||
"amd64"
|
||||
else
|
||||
throw "openjdk requires i686-linux or x86_64 linux";
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
{ stdenv, runCommand, glibc, fetchurl, file
|
||||
{ stdenv
|
||||
, runCommand, fetchurl, file
|
||||
|
||||
, version
|
||||
}:
|
||||
|
||||
assert stdenv.hostPlatform.libc == "glibc";
|
||||
|
||||
let
|
||||
# !!! 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
|
||||
fetchurl {
|
||||
url = "https://www.dropbox.com/s/a0lsq2ig4uguky5/openjdk8-bootstrap-x86_64-linux.tar.xz?dl=1";
|
||||
|
@ -17,7 +20,7 @@ let
|
|||
sha256 = "024gg2sgg4labxbc1nhn8lxls2p7d9h3b82hnsahwaja2pm1hbra";
|
||||
}
|
||||
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
|
||||
fetchurl {
|
||||
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' ':')"
|
||||
|
||||
for i in $out/bin/*; do
|
||||
patchelf --set-interpreter ${glibc.out}/lib/ld-linux*.so.2 $i || true
|
||||
patchelf --set-rpath "${glibc.out}/lib:$LIBDIRS" $i || true
|
||||
done
|
||||
|
||||
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
|
||||
find "$out" -type f -print0 | while IFS= read -r -d "" elf; do
|
||||
isELF "$elf" || continue
|
||||
patchelf --set-interpreter $(cat "${stdenv.cc}/nix-support/dynamic-linker") "$elf" || true
|
||||
patchelf --set-rpath "${stdenv.cc.libc}/lib:$LIBDIRS" "$elf" || 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"
|
||||
find "$out/bin" -type f -print0 | while IFS= read -r -d "" elf; do
|
||||
isELF "$elf" || continue
|
||||
paxmark m "$elf"
|
||||
# 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
|
||||
'';
|
||||
in bootstrap
|
||||
|
|
Loading…
Reference in a new issue