Skip to content

Commit

Permalink
Merge pull request #191566 from Homebrew/openjdk@17-llvm
Browse files Browse the repository at this point in the history
openjdk@17: use `llvm` to avoid Apple clang 16 failure
  • Loading branch information
BrewTestBot authored Sep 27, 2024
2 parents ec91a08 + 065e9c6 commit 4a5c74c
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions Formula/o/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,36 @@ class OpenjdkAT17 < Formula

depends_on "autoconf" => :build
depends_on "pkg-config" => :build
depends_on xcode: :build
depends_on xcode: :build # for metal

depends_on "freetype"
depends_on "giflib"
depends_on "harfbuzz"
depends_on "jpeg-turbo"
depends_on "libpng"
depends_on "libxi"
depends_on "little-cms2"

uses_from_macos "cups"
uses_from_macos "unzip"
uses_from_macos "zip"
uses_from_macos "zlib"

on_macos do
if DevelopmentTools.clang_build_version == 1600
depends_on "llvm" => :build

fails_with :clang do
cause "fatal error while optimizing exploded image for BUILD_JIGSAW_TOOLS"
end
end
end

on_linux do
depends_on "alsa-lib"
depends_on "fontconfig"
depends_on "freetype"
depends_on "libx11"
depends_on "libxext"
depends_on "libxi"
depends_on "libxrandr"
depends_on "libxrender"
depends_on "libxt"
Expand Down Expand Up @@ -77,6 +87,16 @@ class OpenjdkAT17 < Formula
end

def install
if DevelopmentTools.clang_build_version == 1600
ENV.llvm_clang
ENV.remove "HOMEBREW_LIBRARY_PATHS", Formula["llvm"].opt_lib
# ptrauth.h is not available in brew LLVM
inreplace "src/hotspot/os_cpu/bsd_aarch64/pauth_bsd_aarch64.inline.hpp" do |s|
s.sub! "#include <ptrauth.h>", ""
s.sub! "return ptrauth_strip(ptr, ptrauth_key_asib);", "return ptr;"
end
end

boot_jdk = buildpath/"boot-jdk"
resource("boot-jdk").stage boot_jdk
boot_jdk /= "Contents/Home" if OS.mac?
Expand All @@ -97,6 +117,7 @@ def install
--with-version-build=#{revision}
--without-version-opt
--without-version-pre
--with-freetype=system
--with-giflib=system
--with-harfbuzz=system
--with-lcms=system
Expand All @@ -109,16 +130,20 @@ def install
args += if OS.mac?
ldflags << "-headerpad_max_install_names"

# Allow unbundling `freetype` on macOS
inreplace "make/autoconf/lib-freetype.m4", '= "xmacosx"', '= ""'

%W[
--enable-dtrace
--with-freetype-include=#{Formula["freetype"].opt_include}
--with-freetype-lib=#{Formula["freetype"].opt_lib}
--with-sysroot=#{MacOS.sdk_path}
]
else
%W[
--with-x=#{HOMEBREW_PREFIX}
--with-cups=#{HOMEBREW_PREFIX}
--with-fontconfig=#{HOMEBREW_PREFIX}
--with-freetype=system
--with-stdc++lib=dynamic
]
end
Expand Down

0 comments on commit 4a5c74c

Please sign in to comment.