2021-01-22 11:25:31 +00:00
|
|
|
{ lib, stdenv
|
2020-07-20 04:55:05 +00:00
|
|
|
, requireFile
|
|
|
|
, xorg
|
|
|
|
, zlib
|
|
|
|
, freetype
|
2021-06-10 02:57:09 +00:00
|
|
|
, alsa-lib
|
2020-07-20 04:55:05 +00:00
|
|
|
, setJavaClassPath
|
|
|
|
}:
|
|
|
|
|
|
|
|
let result = stdenv.mkDerivation rec {
|
|
|
|
pname = "oraclejdk";
|
2021-02-01 09:04:13 +00:00
|
|
|
version = "11.0.10";
|
2020-07-20 04:55:05 +00:00
|
|
|
|
|
|
|
src = requireFile {
|
|
|
|
name = "jdk-${version}_linux-x64_bin.tar.gz";
|
|
|
|
url = "https://www.oracle.com/java/technologies/javase-jdk11-downloads.html";
|
2021-02-01 09:04:13 +00:00
|
|
|
sha256 = "94bd34f85ee38d3ef59e5289ec7450b9443b924c55625661fffe66b03f2c8de2";
|
2020-07-20 04:55:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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 = ''
|
2021-06-10 02:57:09 +00:00
|
|
|
rpath="$out/lib/jli:$out/lib/server:$out/lib:${lib.strings.makeLibraryPath [ zlib xorg.libX11 xorg.libXext xorg.libXtst xorg.libXi xorg.libXrender freetype alsa-lib]}"
|
2020-07-20 04:55:05 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2021-01-22 11:25:31 +00:00
|
|
|
meta = with lib; {
|
2020-07-20 04:55:05 +00:00
|
|
|
license = licenses.unfree;
|
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
};
|
|
|
|
}; in result
|