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