about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/oraclejdk/jdk14-linux.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-01-10 07:13:44 +0000
committerAlyssa Ross <hi@alyssa.is>2021-01-12 14:07:16 +0000
commite2698550456abba83c6dcd5d5e5a9990a0b96f8a (patch)
tree79a56f0df3fa55e470d84b4dff6059fbf487ec18 /nixpkgs/pkgs/development/compilers/oraclejdk/jdk14-linux.nix
parent1cdc42df888dc98c347e03bd942ed9825a55bcb3 (diff)
parent84d74ae9c9cbed73274b8e4e00be14688ffc93fe (diff)
downloadnixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.gz
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.bz2
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.lz
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.xz
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.zst
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.zip
Merge commit '84d74ae9c9cbed73274b8e4e00be14688ffc93fe'
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/oraclejdk/jdk14-linux.nix')
-rw-r--r--nixpkgs/pkgs/development/compilers/oraclejdk/jdk14-linux.nix54
1 files changed, 54 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/compilers/oraclejdk/jdk14-linux.nix b/nixpkgs/pkgs/development/compilers/oraclejdk/jdk14-linux.nix
new file mode 100644
index 000000000000..427c7cedad15
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/oraclejdk/jdk14-linux.nix
@@ -0,0 +1,54 @@
+{ stdenv
+, requireFile
+, xorg
+, zlib
+, freetype
+, alsaLib
+, setJavaClassPath
+}:
+
+let result = stdenv.mkDerivation rec {
+  pname = "oraclejdk";
+  version = "14.0.2";
+
+  src = requireFile {
+    name = "jdk-${version}_linux-x64_bin.tar.gz";
+    url = "https://www.oracle.com/java/technologies/javase-jdk14-downloads.html";
+    sha256 = "cb811a86926cc0f529d16bec7bd2e25fb73e75125bbd1775cdb9a96998593dde";
+  };
+
+  installPhase = ''
+    mv ../$sourceRoot $out
+
+    mkdir -p $out/nix-support
+    printWords ${setJavaClassPath} > $out/nix-support/propagated-build-inputs
+
+    # Set JAVA_HOME automatically.
+    cat <<EOF >> $out/nix-support/setup-hook
+    if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
+    EOF
+  '';
+
+  postFixup = ''
+    rpath="$out/lib/jli:$out/lib/server:$out/lib:${stdenv.lib.strings.makeLibraryPath [ stdenv.cc.cc zlib xorg.libX11 xorg.libXext xorg.libXtst xorg.libXi xorg.libXrender freetype alsaLib]}"
+
+    for f in $(find $out -name "*.so") $(find $out -type f -perm -0100); do
+      patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$f" || true
+      patchelf --set-rpath   "$rpath"                                    "$f" || true
+    done
+
+    for f in $(find $out -name "*.so") $(find $out -type f -perm -0100); do
+      if ldd "$f" | fgrep 'not found'; then echo "in file $f"; fi
+    done
+  '';
+
+  passthru.jre = result;
+  passthru.home = result;
+
+  dontStrip = true; # See: https://github.com/NixOS/patchelf/issues/10
+
+  meta = with stdenv.lib; {
+    license = licenses.unfree;
+    platforms = [ "x86_64-linux" ];
+  };
+}; in result