From e34a3cd762a4a6939290070ba442c3ed634c2086 Mon Sep 17 00:00:00 2001 From: calvinit <541298948@qq.com> Date: Thu, 17 Oct 2024 14:17:26 +0800 Subject: [PATCH] openjdk@8 1.8.0-432 --- Formula/o/openjdk@8.rb | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/Formula/o/openjdk@8.rb b/Formula/o/openjdk@8.rb index bb067873392c91..0abb3985794461 100644 --- a/Formula/o/openjdk@8.rb +++ b/Formula/o/openjdk@8.rb @@ -1,9 +1,9 @@ class OpenjdkAT8 < Formula desc "Development kit for the Java programming language" homepage "https://openjdk.java.net/" - url "https://github.com/openjdk/jdk8u/archive/refs/tags/jdk8u422-ga.tar.gz" - version "1.8.0-422" - sha256 "3931898b4336f0e583a5e97df7e5c339d859d53afaff6dafe20124107e836ebe" + url "https://github.com/openjdk/jdk8u/archive/refs/tags/jdk8u432-ga.tar.gz" + version "1.8.0-432" + sha256 "6ac8ee2b6932e4632ea2c33fe2320d6ceaca50a67521fac02a67027e40437460" license "GPL-2.0-only" livecheck do @@ -33,6 +33,10 @@ class OpenjdkAT8 < Formula uses_from_macos "unzip" uses_from_macos "zip" + on_sonoma :or_newer do + depends_on xcode: :build + end + on_monterey :or_newer do depends_on "gawk" => :build end @@ -135,13 +139,28 @@ def install ] ldflags << "-F#{javavm_framework_path}" # Fix "'JavaNativeFoundation/JavaNativeFoundation.h' file not found" issue on MacOS Sonoma. - elsif MacOS.version == :sonoma - javavm_framework_path = "/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/System/Library/Frameworks" + elsif MacOS.version >= :sonoma + # We are building the "JavaNativeFoundation.framework" ourselves. + system "git", "clone", "https://github.com/apple/openjdk.git", "apple-openjdk" + cd "apple-openjdk" do + header_search_paths = [ + buildpath/"jdk/src/share/javavm/export", # jni.h + buildpath/"jdk/src/macosx/native/export", # jni_md.h + ] + mkdir_p "build/Frameworks" + xcodebuild "install", + "-project", "apple/JavaNativeFoundation/JavaNativeFoundation.xcodeproj", + "-target", "JavaNativeFoundation", + "-configuration", "Release", + "OTHER_CFLAGS=\"-Wno-strict-prototypes\" DSTROOT=\"#{Pathname.pwd}/build/Frameworks\"", + "HEADER_SEARCH_PATHS=\"#{header_search_paths.join(" ")}\"" + end + jnf_framework_path = buildpath/"apple-openjdk/build/Frameworks" args += %W[ - --with-extra-cflags=-F#{javavm_framework_path} - --with-extra-cxxflags=-F#{javavm_framework_path} + --with-extra-cflags=-F#{jnf_framework_path} + --with-extra-cxxflags=-F#{jnf_framework_path} ] - ldflags << "-F#{javavm_framework_path}" + ldflags << "-F#{jnf_framework_path}" end else args += %W[