diff --git a/pkgs/development/compilers/adoptopenjdk-bin/jdk-darwin-base.nix b/pkgs/development/compilers/adoptopenjdk-bin/jdk-darwin-base.nix new file mode 100644 index 000000000000..c2c13649f885 --- /dev/null +++ b/pkgs/development/compilers/adoptopenjdk-bin/jdk-darwin-base.nix @@ -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 <> $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 diff --git a/pkgs/development/compilers/adoptopenjdk-bin/jdk11-darwin.nix b/pkgs/development/compilers/adoptopenjdk-bin/jdk11-darwin.nix new file mode 100644 index 000000000000..77d9d85aaa93 --- /dev/null +++ b/pkgs/development/compilers/adoptopenjdk-bin/jdk11-darwin.nix @@ -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"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9dd951d681cb..740c3111a200 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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;