Skip to content

Commit

Permalink
oraclejdk8: armv7l support
Browse files Browse the repository at this point in the history
  • Loading branch information
elitak committed Jul 16, 2017
1 parent df929d6 commit 0033509
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 21 deletions.
55 changes: 37 additions & 18 deletions pkgs/development/compilers/oraclejdk/jdk-linux-base.nix
Expand Up @@ -3,6 +3,7 @@
, downloadUrl
, sha256_i686
, sha256_x86_64
, sha256_armv7l
, jceName
, jceDownloadUrl
, sha256JCE
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -59,6 +65,14 @@ let
}
else
"";

rSubPaths = [
"lib/${architecture}/jli"
"lib/${architecture}/server"
"lib/${architecture}/xawt"
"lib/${architecture}"
];

in

let result = stdenv.mkDerivation rec {
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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
'';

Expand All @@ -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
1 change: 1 addition & 0 deletions pkgs/development/compilers/oraclejdk/jdk8cpu-linux.nix
Expand Up @@ -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";
Expand Down
1 change: 1 addition & 0 deletions pkgs/development/compilers/oraclejdk/jdk8psu-linux.nix
Expand Up @@ -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";
Expand Down
7 changes: 4 additions & 3 deletions pkgs/top-level/all-packages.nix
Expand Up @@ -5619,8 +5619,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 =
Expand Down Expand Up @@ -5653,7 +5653,8 @@ with pkgs;

supportsJDK =
system == "i686-linux" ||
system == "x86_64-linux";
system == "x86_64-linux" ||
system == "armv7l-linux";

jdkdistro = oraclejdk8distro;

Expand Down

0 comments on commit 0033509

Please sign in to comment.