homebrew-core/Formula/openj9.rb

185 lines
5.6 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.33.1",
revision: "1d9d16830f713e97410e8eeed1c350e58f34fadb"
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: "b029a1987b8d3a86badaef9f8d3e1616dadda33c541c4f4caa0b8f0fa9a57786"
sha256 cellar: :any, big_sur: "e948d8ba9ffcfcd5b29cb9c6f7e9f2a5c59f5e65d47fa8d1ad4917c3d7cbe229"
sha256 cellar: :any, catalina: "d4f8a526b2f1a5827589d5af0b4c174d97b6eb43d3dfe3f4b1e75f0a852652cb"
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-turbo"
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.33.1",
revision: "b58aa2708c095efadf522f67aaef9f7de2a7cbc7"
end
resource "openj9-openjdk-jdk" do
url "https://github.com/ibmruntimes/openj9-openjdk-jdk17.git",
tag: "openj9-0.33.1",
revision: "1f4d354e6540e1aee3634ef067d3949516a337f5"
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