Merge pull request #27419 from elitak/armjdk

oraclejdk8: armv7l support
This commit is contained in:
Jörg Thalheim 2017-07-16 22:31:29 +01:00 committed by GitHub
commit d3ee993a27
4 changed files with 43 additions and 21 deletions

View File

@ -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

View File

@ -4,6 +4,7 @@ import ./jdk-linux-base.nix {
downloadUrl = http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html;
sha256_i686 = "0m3i1n1im1nlwb06wlsdajv19cd3zhrjkw8zbyjfznydn6qs4s80";
sha256_x86_64 = "0dhj623ya01glcl3iir9ajifcrf6awhvpk936x9cxfj8zfyibck2";
sha256_armv7l = "0ja97nqn4x0ji16c7r6i9nnnj3745br7qlbj97jg1s8m2wk7f9jd";
jceName = "jce_policy-8.zip";
jceDownloadUrl = http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html;
sha256JCE = "0n8b6b8qmwb14lllk2lk1q1ahd3za9fnjigz5xn65mpg48whl0pk";

View File

@ -4,6 +4,7 @@ import ./jdk-linux-base.nix {
downloadUrl = http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html;
sha256_i686 = "0m3i1n1im1nlwb06wlsdajv19cd3zhrjkw8zbyjfznydn6qs4s80";
sha256_x86_64 = "0dhj623ya01glcl3iir9ajifcrf6awhvpk936x9cxfj8zfyibck2";
sha256_armv7l = "0ja97nqn4x0ji16c7r6i9nnnj3745br7qlbj97jg1s8m2wk7f9jd";
jceName = "jce_policy-8.zip";
jceDownloadUrl = http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html;
sha256JCE = "0n8b6b8qmwb14lllk2lk1q1ahd3za9fnjigz5xn65mpg48whl0pk";

View File

@ -5621,8 +5621,8 @@ with pkgs;
(lib.addMetaAttrs { outputsToInstall = [ "jre" ]; }
(openjdk7.jre // { outputs = [ "jre" ]; }));
jdk8 = openjdk8 // { outputs = [ "out" ]; };
jre8 = lib.setName "openjre-${lib.getVersion pkgs.openjdk8.jre}"
jdk8 = if stdenv.isArm then oraclejdk8 else openjdk8 // { outputs = [ "out" ]; };
jre8 = if stdenv.isArm then oraclejre8 else lib.setName "openjre-${lib.getVersion pkgs.openjdk8.jre}"
(lib.addMetaAttrs { outputsToInstall = [ "jre" ]; }
(openjdk8.jre // { outputs = [ "jre" ]; }));
jre8_headless =
@ -5655,7 +5655,8 @@ with pkgs;
supportsJDK =
system == "i686-linux" ||
system == "x86_64-linux";
system == "x86_64-linux" ||
system == "armv7l-linux";
jdkdistro = oraclejdk8distro;