adoptopenjdk-bin: add OpenJDK 8

This commit is contained in:
Ben Wolsieffer
2019-08-19 18:54:47 -04:00
parent 18e0f9d39f
commit ded7ec067f
7 changed files with 202 additions and 109 deletions
@@ -1,48 +1,16 @@
sourcePerArch:
{ swingSupport ? true
, stdenv
{ stdenv
, lib
, fetchurl
, file
, xorg ? null
, glib
, libxml2
, ffmpeg_2
, libxslt
, libGL
, freetype
, fontconfig
, gtk2
, pango
, cairo
, autoPatchelfHook
, alsaLib
, atk
, gdk-pixbuf
, freetype
, zlib
, elfutils
, xorg
}:
assert swingSupport -> xorg != null;
let
rSubPaths = [
"lib/jli"
"lib/server"
"lib/compressedrefs" # OpenJ9
"lib/j9vm" # OpenJ9
"lib"
];
libraries = [
stdenv.cc.libc glib libxml2 ffmpeg_2 libxslt libGL
xorg.libXxf86vm alsaLib fontconfig freetype pango gtk2 cairo gdk-pixbuf
atk zlib elfutils
] ++ (stdenv.lib.optionals swingSupport [
xorg.libX11 xorg.libXext xorg.libXtst xorg.libXi xorg.libXp xorg.libXt
xorg.libXrender
stdenv.cc.cc
]);
cpuName = stdenv.hostPlatform.parsed.cpu.name;
in
@@ -57,7 +25,12 @@ let result = stdenv.mkDerivation rec {
inherit (sourcePerArch.${cpuName}) url sha256;
};
nativeBuildInputs = [ file ];
buildInputs = [
alsaLib freetype zlib xorg.libX11 xorg.libXext xorg.libXtst xorg.libXi
xorg.libXrender
];
nativeBuildInputs = [ autoPatchelfHook ];
# See: https://github.com/NixOS/patchelf/issues/10
dontStrip = 1;
@@ -74,10 +47,7 @@ let result = stdenv.mkDerivation rec {
# Remove embedded freetype to avoid problems like
# https://github.com/NixOS/nixpkgs/issues/57733
rm $out/lib/libfreetype.so
# for backward compatibility
ln -s $out $out/jre
find "$out" -name 'libfreetype.so*' -delete
mkdir -p $out/nix-support
@@ -87,32 +57,16 @@ let result = stdenv.mkDerivation rec {
EOF
'';
postFixup = ''
rpath+="''${rpath:+:}${stdenv.lib.concatStringsSep ":" (map (a: "$out/${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" {} \;
'';
rpath = stdenv.lib.strings.makeLibraryPath libraries;
# FIXME: use multiple outputs or return actual JRE package
passthru.jre = result;
passthru.home = result;
# for backward compatibility
passthru.architecture = "";
meta = with stdenv.lib; {
license = licenses.gpl2Classpath;
description = "AdoptOpenJDK, prebuilt OpenJDK binary";
platforms = stdenv.lib.mapAttrsToList (arch: _: arch + "-linux") sourcePerArch; # some inherit jre.meta.platforms
maintainers = with stdenv.lib.maintainers; [ taku0 ];
platforms = lib.mapAttrsToList (arch: _: arch + "-linux") sourcePerArch; # some inherit jre.meta.platforms
maintainers = with lib.maintainers; [ taku0 ];
};
}; in result