2018-12-17 22:08:56 +00:00
|
|
|
sourcePerArch:
|
2018-10-13 15:42:21 +01:00
|
|
|
|
2019-07-21 20:40:18 +01:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2018-10-13 15:42:21 +01:00
|
|
|
, fetchurl
|
2019-07-21 20:40:18 +01:00
|
|
|
, autoPatchelfHook
|
2018-10-13 15:42:21 +01:00
|
|
|
, alsaLib
|
2019-07-21 20:40:18 +01:00
|
|
|
, freetype
|
2019-08-10 19:47:54 +01:00
|
|
|
, fontconfig
|
2018-10-13 15:42:21 +01:00
|
|
|
, zlib
|
2019-07-21 20:40:18 +01:00
|
|
|
, xorg
|
2018-10-13 15:42:21 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2019-01-23 11:52:02 +00:00
|
|
|
cpuName = stdenv.hostPlatform.parsed.cpu.name;
|
2018-10-13 15:42:21 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
let result = stdenv.mkDerivation rec {
|
2018-12-17 22:08:56 +00:00
|
|
|
name = if sourcePerArch.packageType == "jdk"
|
2019-01-27 09:42:57 +00:00
|
|
|
then "adoptopenjdk-${sourcePerArch.vmType}-bin-${version}"
|
|
|
|
else "adoptopenjdk-${sourcePerArch.packageType}-${sourcePerArch.vmType}-bin-${version}";
|
|
|
|
|
|
|
|
version = sourcePerArch.${cpuName}.version or (throw "unsupported CPU ${cpuName}");
|
2018-10-13 15:42:21 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-01-23 11:52:02 +00:00
|
|
|
inherit (sourcePerArch.${cpuName}) url sha256;
|
2018-10-13 15:42:21 +01:00
|
|
|
};
|
|
|
|
|
2019-07-21 20:40:18 +01:00
|
|
|
buildInputs = [
|
2019-08-10 19:47:54 +01:00
|
|
|
alsaLib freetype fontconfig zlib xorg.libX11 xorg.libXext xorg.libXtst
|
|
|
|
xorg.libXi xorg.libXrender
|
2019-07-21 20:40:18 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ autoPatchelfHook ];
|
2018-10-13 15:42:21 +01:00
|
|
|
|
|
|
|
# See: https://github.com/NixOS/patchelf/issues/10
|
|
|
|
dontStrip = 1;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
mv $sourceRoot $out
|
|
|
|
|
|
|
|
rm -rf $out/demo
|
|
|
|
|
|
|
|
# Remove some broken manpages.
|
|
|
|
rm -rf $out/man/ja*
|
|
|
|
|
2019-03-16 10:37:11 +00:00
|
|
|
# Remove embedded freetype to avoid problems like
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/57733
|
2019-07-21 20:40:18 +01:00
|
|
|
find "$out" -name 'libfreetype.so*' -delete
|
2018-10-13 15:42:21 +01:00
|
|
|
|
|
|
|
mkdir -p $out/nix-support
|
|
|
|
|
|
|
|
# Set JAVA_HOME automatically.
|
2019-08-10 19:47:54 +01:00
|
|
|
cat <<EOF >> "$out/nix-support/setup-hook"
|
2019-11-01 19:30:09 +00:00
|
|
|
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
|
2018-10-13 15:42:21 +01:00
|
|
|
EOF
|
|
|
|
'';
|
|
|
|
|
2019-08-10 19:47:54 +01:00
|
|
|
preFixup = ''
|
|
|
|
find "$out" -name libfontmanager.so -exec \
|
|
|
|
patchelf --add-needed libfontconfig.so {} \;
|
|
|
|
'';
|
|
|
|
|
2018-10-13 15:42:21 +01:00
|
|
|
# FIXME: use multiple outputs or return actual JRE package
|
|
|
|
passthru.jre = result;
|
|
|
|
|
|
|
|
passthru.home = result;
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
license = licenses.gpl2Classpath;
|
|
|
|
description = "AdoptOpenJDK, prebuilt OpenJDK binary";
|
2019-07-21 20:40:18 +01:00
|
|
|
platforms = lib.mapAttrsToList (arch: _: arch + "-linux") sourcePerArch; # some inherit jre.meta.platforms
|
|
|
|
maintainers = with lib.maintainers; [ taku0 ];
|
2018-10-13 15:42:21 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}; in result
|