oraclejdk8: armv7l support

This commit is contained in:
Eric Litak
2017-07-16 05:16:59 -07:00
parent df929d6216
commit 00335098a5
4 changed files with 43 additions and 21 deletions
@@ -3,6 +3,7 @@
, downloadUrl
, sha256_i686
, sha256_x86_64
, sha256_armv7l
, jceName
, jceDownloadUrl
, sha256JCE
@@ -34,10 +35,13 @@
, setJavaClassPath
}:
assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux";
assert stdenv.system == "i686-linux"
|| stdenv.system == "x86_64-linux"
|| stdenv.system == "armv7l-linux";
assert swingSupport -> xorg != null;
let
abortArch = abort "jdk requires i686-linux, x86_64-linux, or armv7l-linux";
/**
* The JRE libraries are in directories that depend on the CPU.
@@ -47,8 +51,10 @@ let
"i386"
else if stdenv.system == "x86_64-linux" then
"amd64"
else if stdenv.system == "armv7l-linux" then
"arm"
else
abort "jdk requires i686-linux or x86_64 linux";
abortArch;
jce =
if installjce then
@@ -59,6 +65,14 @@ let
}
else
"";
rSubPaths = [
"lib/${architecture}/jli"
"lib/${architecture}/server"
"lib/${architecture}/xawt"
"lib/${architecture}"
];
in
let result = stdenv.mkDerivation rec {
@@ -78,8 +92,14 @@ let result = stdenv.mkDerivation rec {
url = downloadUrl;
sha256 = sha256_x86_64;
}
else if stdenv.system == "armv7l-linux" then
requireFile {
name = "jdk-${productVersion}u${patchVersion}-linux-arm32-vfp-hflt.tar.gz";
url = downloadUrl;
sha256 = sha256_armv7l;
}
else
abort "jdk requires i686-linux or x86_64 linux";
abortArch;
nativeBuildInputs = [ file ]
++ stdenv.lib.optional installjce unzip;
@@ -134,18 +154,6 @@ let result = stdenv.mkDerivation rec {
cp -v UnlimitedJCEPolicy*/*.jar $jrePath/lib/security
fi
rpath=$rpath''${rpath:+:}$jrePath/lib/${architecture}/jli
rpath=$rpath''${rpath:+:}$jrePath/lib/${architecture}/server
rpath=$rpath''${rpath:+:}$jrePath/lib/${architecture}/xawt
rpath=$rpath''${rpath:+:}$jrePath/lib/${architecture}
# set all the dynamic linkers
find $out -type f -perm -0100 \
-exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "$rpath" {} \;
find $out -name "*.so" -exec patchelf --set-rpath "$rpath" {} \;
if test -z "$pluginSupport"; then
rm -f $out/bin/javaws
if test -n "$installjdk"; then
@@ -163,11 +171,22 @@ let result = stdenv.mkDerivation rec {
cat <<EOF >> $out/nix-support/setup-hook
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
EOF
'';
postFixup = ''
rpath+="''${rpath:+:}${stdenv.lib.concatStringsSep ":" (map (a: "$jrePath/${a}") rSubPaths)}"
# set all the dynamic linkers
find $out -type f -perm -0100 \
-exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "$rpath" {} \;
find $out -name "*.so" -exec patchelf --set-rpath "$rpath" {} \;
# Oracle Java Mission Control needs to know where libgtk-x11 and related is
if test -n "$installjdk"; then
if test -n "$installjdk" -a -x $out/bin/jmc; then
wrapProgram "$out/bin/jmc" \
--suffix-each LD_LIBRARY_PATH ':' "${rpath}"
--suffix-each LD_LIBRARY_PATH ':' "$rpath"
fi
'';
@@ -192,7 +211,7 @@ let result = stdenv.mkDerivation rec {
meta = with stdenv.lib; {
license = licenses.unfree;
platforms = [ "i686-linux" "x86_64-linux" ]; # some inherit jre.meta.platforms
platforms = [ "i686-linux" "x86_64-linux" "armv7l-linux" ]; # some inherit jre.meta.platforms
};
}; in result