2021-03-19 16:36:28 +01:00
|
|
|
{ sourcePerArch, knownVulnerabilities ? [] }:
|
2018-10-20 09:18:56 +02:00
|
|
|
|
|
|
|
{ swingSupport ? true # not used for now
|
2021-01-22 12:25:31 +01:00
|
|
|
, lib, stdenv
|
2018-10-20 09:18:56 +02:00
|
|
|
, fetchurl
|
2020-12-12 08:19:55 +01:00
|
|
|
, setJavaClassPath
|
2018-10-20 09:18:56 +02:00
|
|
|
}:
|
|
|
|
|
2021-06-01 11:19:52 +02:00
|
|
|
assert (stdenv.isDarwin && stdenv.isx86_64);
|
|
|
|
|
2019-01-23 12:52:02 +01:00
|
|
|
let cpuName = stdenv.hostPlatform.parsed.cpu.name;
|
2019-08-13 23:52:01 +02:00
|
|
|
result = stdenv.mkDerivation {
|
2018-12-17 23:08:56 +01:00
|
|
|
name = if sourcePerArch.packageType == "jdk"
|
2019-01-23 12:52:02 +01:00
|
|
|
then "adoptopenjdk-${sourcePerArch.vmType}-bin-${sourcePerArch.${cpuName}.version}"
|
|
|
|
else "adoptopenjdk-${sourcePerArch.packageType}-${sourcePerArch.vmType}-bin-${sourcePerArch.${cpuName}.version}";
|
2018-10-20 09:18:56 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-01-23 12:52:02 +01:00
|
|
|
inherit (sourcePerArch.${cpuName}) url sha256;
|
2018-10-20 09:18:56 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
# See: https://github.com/NixOS/patchelf/issues/10
|
|
|
|
dontStrip = 1;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
mv $sourceRoot $out
|
|
|
|
|
2021-01-23 07:33:57 +01:00
|
|
|
# jni.h expects jni_md.h to be in the header search path.
|
|
|
|
ln -s $out/Contents/Home/include/darwin/*_md.h $out/Contents/Home/include/
|
|
|
|
|
2018-10-20 09:18:56 +02:00
|
|
|
rm -rf $out/Home/demo
|
|
|
|
|
|
|
|
# Remove some broken manpages.
|
|
|
|
rm -rf $out/Home/man/ja*
|
|
|
|
|
|
|
|
ln -s $out/Contents/Home/* $out/
|
|
|
|
|
2020-12-12 08:19:55 +01:00
|
|
|
# Propagate the setJavaClassPath setup hook from the JDK so that
|
|
|
|
# any package that depends on the JDK has $CLASSPATH set up
|
|
|
|
# properly.
|
2018-10-20 09:18:56 +02:00
|
|
|
mkdir -p $out/nix-support
|
2020-12-12 08:19:55 +01:00
|
|
|
printWords ${setJavaClassPath} > $out/nix-support/propagated-build-inputs
|
2018-10-20 09:18:56 +02:00
|
|
|
|
|
|
|
# Set JAVA_HOME automatically.
|
|
|
|
cat <<EOF >> $out/nix-support/setup-hook
|
2019-11-01 20:30:09 +01:00
|
|
|
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
|
2018-10-20 09:18:56 +02:00
|
|
|
EOF
|
|
|
|
'';
|
|
|
|
|
|
|
|
# FIXME: use multiple outputs or return actual JRE package
|
|
|
|
passthru.jre = result;
|
|
|
|
|
|
|
|
passthru.home = result;
|
|
|
|
|
2021-01-22 12:25:31 +01:00
|
|
|
meta = with lib; {
|
2018-10-20 09:18:56 +02:00
|
|
|
license = licenses.gpl2Classpath;
|
|
|
|
description = "AdoptOpenJDK, prebuilt OpenJDK binary";
|
|
|
|
platforms = [ "x86_64-darwin" ]; # some inherit jre.meta.platforms
|
2021-01-22 12:25:31 +01:00
|
|
|
maintainers = with lib.maintainers; [ taku0 ];
|
2021-03-19 16:36:28 +01:00
|
|
|
inherit knownVulnerabilities;
|
2021-04-29 15:48:57 +02:00
|
|
|
mainProgram = "java";
|
2018-10-20 09:18:56 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}; in result
|