Skip to content

Commit

Permalink
openjdk: test build with llvm@17
Browse files Browse the repository at this point in the history
Let's test whether this builds with `llvm@17` to help track down the
build failure with Apple Clang 16.
  • Loading branch information
carlocab committed Sep 16, 2024
1 parent 4789368 commit 8b8879c
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions Formula/o/openjdk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Openjdk < Formula
keg_only :shadowed_by_macos

depends_on "autoconf" => :build
depends_on "llvm@17" => :build
depends_on "pkg-config" => :build
depends_on xcode: :build
depends_on "giflib"
Expand All @@ -38,20 +39,6 @@ class Openjdk < Formula
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 <<~EOS
Exception in thread "main" java.lang.ClassFormatError: StackMapTable format error: bad verification type
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64)
at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:52)
EOS
end
end
end

on_linux do
depends_on "alsa-lib"
depends_on "fontconfig"
Expand Down Expand Up @@ -92,10 +79,8 @@ class Openjdk < Formula
end

def install
if DevelopmentTools.clang_build_version == 1600
ENV.llvm_clang
ENV.remove "HOMEBREW_LIBRARY_PATHS", Formula["llvm"].opt_lib
end
ENV["CC"] = Formula["llvm@17"].opt_bin/"clang"
ENV["CXX"] = Formula["llvm@17"].opt_bin/"clang++"

boot_jdk = buildpath/"boot-jdk"
resource("boot-jdk").stage boot_jdk
Expand Down Expand Up @@ -145,8 +130,13 @@ def install
--with-stdc++lib=dynamic
]
end
ldflags += deps.filter_map { |dep| "-L#{dep.to_formula.opt_lib}" if !dep.build? }
args << "--with-extra-ldflags=#{ldflags.join(" ")}"

cflags = deps.filter_map { |dep| "-I#{dep.to_formula.opt_include}" if !dep.build? }
args << "--with-extra-cflags=#{cflags.join(" ")}"
args << "--with-extra-cxxflags=#{cflags.join(" ")}"

system "bash", "configure", *args

ENV["MAKEFLAGS"] = "JOBS=#{ENV.make_jobs}"
Expand Down

0 comments on commit 8b8879c

Please sign in to comment.