diff --git a/Aliases/openjdk@14 b/Aliases/openjdk@15 similarity index 100% rename from Aliases/openjdk@14 rename to Aliases/openjdk@15 diff --git a/Formula/openjdk.rb b/Formula/openjdk.rb index 3a35e2aee7c..bb960749b1e 100644 --- a/Formula/openjdk.rb +++ b/Formula/openjdk.rb @@ -1,8 +1,8 @@ class Openjdk < Formula desc "Development kit for the Java programming language" homepage "https://openjdk.java.net/" - url "https://hg.openjdk.java.net/jdk-updates/jdk14u/archive/jdk-14.0.1-ga.tar.bz2" - sha256 "f9c4a55ac858f858222bc5fe6e4b890f9b4a3f942fd0211575b0418aec5c14d6" + url "https://hg.openjdk.java.net/jdk-updates/jdk15u/archive/jdk-15.0.1-ga.tar.bz2" + sha256 "9c5be662f5b166b5c82c27de29b71f867cff3ff4570f4c8fa646490c4529135a" bottle do cellar :any @@ -22,8 +22,22 @@ class Openjdk < Formula # From https://jdk.java.net/archive/ resource "boot-jdk" do - url "https://download.java.net/java/GA/jdk13.0.2/d4173c853231432d94f001e99d882ca7/8/GPL/openjdk-13.0.2_osx-x64_bin.tar.gz" - sha256 "08fd2db3a3ab6fb82bb9091a035f9ffe8ae56c31725f4e17d573e48c39ca10dd" + url "https://download.java.net/java/GA/jdk14.0.2/205943a0976c4ed48cb16f1043c5c647/12/GPL/openjdk-14.0.2_osx-x64_bin.tar.gz" + sha256 "386a96eeef63bf94b450809d69ceaa1c9e32a97230e0a120c1b41786b743ae84" + end + + # Fix build on Xcode 12 + # https://bugs.openjdk.java.net/browse/JDK-8253375 + patch do + url "https://github.com/openjdk/jdk/commit/f80a6066e45c3d53a61715abfe71abc3b2e162a1.patch?full_index=1" + sha256 "5320e5e8db5f94432925d7c240f41c12b10ff9a0afc2f7a8ab0728a114c43cdb" + end + + # Fix build on Xcode 12 + # https://bugs.openjdk.java.net/browse/JDK-8253791 + patch do + url "https://github.com/openjdk/jdk/commit/4622a18a72c30c4fc72c166bee7de42903e1d036.patch?full_index=1" + sha256 "4e4448a5bf68843c21bf96f510ea270aa795c5fac41fd9088f716822788d0f57" end def install @@ -32,19 +46,37 @@ class Openjdk < Formula boot_jdk = boot_jdk_dir/"Contents/Home" java_options = ENV.delete("_JAVA_OPTIONS") - _, _, build = version.to_s.rpartition("+") + # Inspecting .hg_archival.txt to find a build number + # The file looks like this: + # + # repo: fd16c54261b32be1aaedd863b7e856801b7f8543 + # node: e3f940bd3c8fcdf4ca704c6eb1ac745d155859d5 + # branch: default + # tag: jdk-15+36 + # tag: jdk-15-ga + # + # Since openjdk has move their development from mercurial to git and GitHub + # this approach may need some changes in the future + # + build = File.read(".hg_archival.txt") + .scan(/^tag: jdk-#{version}\+(.+)$/) + .map(&:first) + .map(&:to_i) + .max + raise "cannot find build number in .hg_archival.txt" if build.nil? chmod 0755, "configure" system "./configure", "--without-version-pre", "--without-version-opt", "--with-version-build=#{build}", "--with-toolchain-path=/usr/bin", + "--with-sysroot=#{MacOS.sdk_path}", "--with-extra-ldflags=-headerpad_max_install_names", "--with-boot-jdk=#{boot_jdk}", "--with-boot-jdk-jvmargs=#{java_options}", "--with-debug-level=release", "--with-native-debug-symbols=none", - "--enable-dtrace=auto", + "--enable-dtrace", "--with-jvm-variants=server" ENV["MAKEFLAGS"] = "JOBS=#{ENV.make_jobs}"