homebrew-core/Formula/openj9.rb

185 lines
5.5 KiB
Ruby

class Openj9 < Formula
desc "High performance, scalable, Java virtual machine"
homepage "https://www.eclipse.org/openj9/"
url "https://github.com/eclipse-openj9/openj9.git",
tag: "openj9-0.32.0",
revision: "9a84ec34ed321967cdbe67b29ddcd732b591d051"
license any_of: [
"EPL-2.0",
"Apache-2.0",
{ "GPL-2.0-only" => { with: "Classpath-exception-2.0" } },
{ "GPL-2.0-only" => { with: "OpenJDK-assembly-exception-1.0" } },
]
livecheck do
url :stable
regex(/^openj9-(\d+(?:\.\d+)+)$/i)
end
bottle do
sha256 cellar: :any, monterey: "bfb85bf3b8fb2467c09737099c9c6d7bad7ac7f2403a788fe7c0378b6411cab4"
sha256 cellar: :any, big_sur: "1758d93cfaef40edff506f410a86da434085c4a9c6647fc40084150387bb7be6"
sha256 cellar: :any, catalina: "fefdcb19393018f7f9ecb749ecbf3681da8f8790eb3d774b767e53670a342292"
end
keg_only :shadowed_by_macos
depends_on "autoconf" => :build
depends_on "bash" => :build
depends_on "cmake" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on arch: :x86_64 # https://github.com/eclipse-openj9/openj9/issues/11164
depends_on "fontconfig"
depends_on "giflib"
depends_on "harfbuzz"
depends_on "jpeg"
depends_on "libpng"
depends_on "little-cms2"
uses_from_macos "cups"
uses_from_macos "libffi"
uses_from_macos "unzip"
uses_from_macos "zip"
uses_from_macos "zlib"
on_linux do
keg_only "it conflicts with openjdk"
depends_on "alsa-lib"
depends_on "libx11"
depends_on "libxext"
depends_on "libxrandr"
depends_on "libxrender"
depends_on "libxt"
depends_on "libxtst"
depends_on "numactl"
end
on_intel do
depends_on "nasm" => :build
end
# From https://github.com/eclipse-openj9/openj9/blob/openj9-#{version}/doc/build-instructions/
resource "boot-jdk" do
on_macos do
url "https://github.com/AdoptOpenJDK/semeru16-binaries/releases/download/jdk-16.0.2%2B7_openj9-0.27.0/ibm-semeru-open-jdk_x64_mac_16.0.2_7_openj9-0.27.0.tar.gz"
sha256 "89e807261145243a358a2a626f64340944c03622f34eaa35429053e2085d7aef"
end
on_linux do
url "https://github.com/AdoptOpenJDK/semeru16-binaries/releases/download/jdk-16.0.2%2B7_openj9-0.27.0/ibm-semeru-open-jdk_x64_linux_16.0.2_7_openj9-0.27.0.tar.gz"
sha256 "1349eb9a1d9af491a1984d66a80126730357c4a5c4fcbe7112a2c832f6c0886e"
end
end
resource "omr" do
url "https://github.com/eclipse-openj9/openj9-omr.git",
tag: "openj9-0.32.0",
revision: "ab24b6666596140516d3f240486aa1c84a726775"
end
resource "openj9-openjdk-jdk" do
url "https://github.com/ibmruntimes/openj9-openjdk-jdk17.git",
branch: "v0.32.0-release",
revision: "9a84ec34ed321967cdbe67b29ddcd732b591d051"
end
def install
openj9_files = buildpath.children
(buildpath/"openj9").install openj9_files
resource("openj9-openjdk-jdk").stage buildpath
resource("omr").stage buildpath/"omr"
boot_jdk = buildpath/"boot-jdk"
resource("boot-jdk").stage boot_jdk
boot_jdk /= "Contents/Home" if OS.mac?
java_options = ENV.delete("_JAVA_OPTIONS")
config_args = %W[
--disable-warnings-as-errors-omr
--disable-warnings-as-errors-openj9
--with-boot-jdk-jvmargs=#{java_options}
--with-boot-jdk=#{boot_jdk}
--with-debug-level=release
--with-jvm-variants=server
--with-native-debug-symbols=none
--with-vendor-bug-url=#{tap.issues_url}
--with-vendor-name=#{tap.user}
--with-vendor-url=#{tap.issues_url}
--with-vendor-version-string=#{tap.user}
--with-vendor-vm-bug-url=#{tap.issues_url}
--with-version-build=#{revision}
--without-version-opt
--without-version-pre
--with-giflib=system
--with-harfbuzz=system
--with-lcms=system
--with-libjpeg=system
--with-libpng=system
--with-zlib=system
--enable-ddr=no
--enable-full-docs=no
]
config_args += if OS.mac?
%W[
--enable-dtrace
--with-sysroot=#{MacOS.sdk_path}
]
else
# Override hardcoded /usr/include directory when checking for numa headers
inreplace "closed/autoconf/custom-hook.m4", "/usr/include/numa", Formula["numactl"].opt_include/"numa"
%W[
--with-x=#{HOMEBREW_PREFIX}
--with-cups=#{Formula["cups"].opt_prefix}
--with-fontconfig=#{Formula["fontconfig"].opt_prefix}
]
end
ENV["CMAKE_CONFIG_TYPE"] = "Release"
system "bash", "./configure", *config_args
system "make", "all", "-j"
jdk = libexec
if OS.mac?
libexec.install Dir["build/*/images/jdk-bundle/*"].first => "openj9.jdk"
jdk /= "openj9.jdk/Contents/Home"
rm jdk/"lib/src.zip"
rm_rf Dir.glob(jdk/"**/*.dSYM")
else
libexec.install Dir["build/linux-x86_64-server-release/images/jdk/*"]
end
bin.install_symlink Dir[jdk/"bin/*"]
include.install_symlink Dir[jdk/"include/*.h"]
include.install_symlink Dir[jdk/"include"/OS.kernel_name.downcase/"*.h"]
man1.install_symlink Dir[jdk/"man/man1/*"]
end
def caveats
on_macos do
<<~EOS
For the system Java wrappers to find this JDK, symlink it with
sudo ln -sfn #{opt_libexec}/openj9.jdk /Library/Java/JavaVirtualMachines/openj9.jdk
EOS
end
end
test do
(testpath/"HelloWorld.java").write <<~EOS
class HelloWorld {
public static void main(String args[]) {
System.out.println("Hello, world!");
}
}
EOS
system bin/"javac", "HelloWorld.java"
assert_match "Hello, world!", shell_output("#{bin}/java HelloWorld")
end
end