3
0
Fork 0
forked from mirrors/nixpkgs

adoptopenjdk-bin: support darwin platform

This commit is contained in:
taku0 2018-10-20 16:18:56 +09:00 committed by Tim Steinbach
parent 8faebb17ac
commit 7c3dd045ce
3 changed files with 98 additions and 5 deletions

View file

@ -0,0 +1,59 @@
{ name
, url
, sha256
}:
{ swingSupport ? true # not used for now
, stdenv
, fetchurl
}:
let result = stdenv.mkDerivation rec {
inherit name;
src = fetchurl {
inherit url sha256;
};
# See: https://github.com/NixOS/patchelf/issues/10
dontStrip = 1;
installPhase = ''
cd ..
mv $sourceRoot $out
rm -rf $out/Home/demo
# Remove some broken manpages.
rm -rf $out/Home/man/ja*
# for backward compatibility
ln -s $out/Contents/Home $out/jre
ln -s $out/Contents/Home/* $out/
mkdir -p $out/nix-support
# 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;
# for backward compatibility
passthru.architecture = "";
meta = with stdenv.lib; {
license = licenses.gpl2Classpath;
description = "AdoptOpenJDK, prebuilt OpenJDK binary";
platforms = [ "x86_64-darwin" ]; # some inherit jre.meta.platforms
maintainers = with stdenv.lib.maintainers; [ taku0 ];
};
}; in result

View file

@ -0,0 +1,26 @@
let
version = "11";
buildNumber = "28";
baseUrl = "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-${version}%2B${buildNumber}";
makePackage = { packageType, vmType, sha256 }: import ./jdk-darwin-base.nix {
name = if packageType == "jdk"
then
"adoptopenjdk-${vmType}-bin-${version}"
else
"adoptopenjdk-${packageType}-${vmType}-bin-${version}";
url = "${baseUrl}/OpenJDK${version}-${packageType}_x64_mac_${vmType}_${version}_${buildNumber}.tar.gz";
inherit sha256;
};
in
{
jdk-hotspot = makePackage {
packageType = "jdk";
vmType = "hotspot";
sha256 = "ca0ec49548c626904061b491cae0a29b9b4b00fb34d8973dc217e10ab21fb0f3";
};
jre-hotspot = makePackage {
packageType = "jre";
vmType = "hotspot";
sha256 = "ef4dbfe5aed6ab2278fcc14db6cc73abbaab56e95f6ebb023790a7ebc6d7f30c";
};
}

View file

@ -6431,11 +6431,19 @@ with pkgs;
abcl = callPackage ../development/compilers/abcl {};
adoptopenjdk-bin-11-packages = import ../development/compilers/adoptopenjdk-bin/jdk11-linux.nix;
adoptopenjdk-hotspot-bin-11 = callPackage adoptopenjdk-bin-11-packages.jdk-hotspot {};
adoptopenjdk-jre-hotspot-bin-11 = callPackage adoptopenjdk-bin-11-packages.jre-hotspot {};
adoptopenjdk-openj9-bin-11 = callPackage adoptopenjdk-bin-11-packages.jdk-openj9 {};
adoptopenjdk-jre-openj9-bin-11 = callPackage adoptopenjdk-bin-11-packages.jre-openj9 {};
adoptopenjdk-bin-11-packages-linux = import ../development/compilers/adoptopenjdk-bin/jdk11-linux.nix;
adoptopenjdk-bin-11-packages-darwin = import ../development/compilers/adoptopenjdk-bin/jdk11-darwin.nix;
adoptopenjdk-hotspot-bin-11 = if stdenv.isLinux
then callPackage adoptopenjdk-bin-11-packages-linux.jdk-hotspot {}
else callPackage adoptopenjdk-bin-11-packages-darwin.jdk-hotspot {};
adoptopenjdk-jre-hotspot-bin-11 = if stdenv.isLinux
then callPackage adoptopenjdk-bin-11-packages-linux.jre-hotspot {}
else callPackage adoptopenjdk-bin-11-packages-darwin.jre-hotspot {};
# no OpenJ9 for Darwin
adoptopenjdk-openj9-bin-11 = callPackage adoptopenjdk-bin-11-packages-linux.jdk-openj9 {};
adoptopenjdk-jre-openj9-bin-11 = callPackage adoptopenjdk-bin-11-packages-linux.jre-openj9 {};
adoptopenjdk-bin = adoptopenjdk-hotspot-bin-11;
adoptopenjdk-jre-bin = adoptopenjdk-jre-hotspot-bin-11;