80 lines
2.8 KiB
Ruby
80 lines
2.8 KiB
Ruby
class OpenjdkAT11 < Formula
|
|
desc "Development kit for the Java programming language"
|
|
homepage "https://openjdk.java.net/"
|
|
url "https://hg.openjdk.java.net/jdk-updates/jdk11u/archive/jdk-11.0.8-ga.tar.bz2"
|
|
sha256 "0c10838f708a5987d2980aee56c5c50c02637e21387215f3e13358b93d107192"
|
|
license "GPL-2.0"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "5cf17a69c7f88b8f721959391d89eafcf1dc6ebcbe5f1496b99448ac9fce0c1d" => :catalina
|
|
sha256 "a575ebd198211a770bf0fce657c2393c19064d13621dfc88fc6104cadb205250" => :mojave
|
|
sha256 "ebbda44a7ef9c6d4af36185b8fbdbc16f403c9705696b49b2bd477110d7900ad" => :high_sierra
|
|
end
|
|
|
|
keg_only :versioned_formula
|
|
|
|
depends_on "autoconf" => :build
|
|
|
|
on_linux do
|
|
depends_on "pkg-config" => :build
|
|
end
|
|
|
|
resource "boot-jdk" do
|
|
url "https://download.java.net/java/GA/jdk10/10.0.2/19aef61b38124481863b1413dce1855f/13/openjdk-10.0.2_osx-x64_bin.tar.gz"
|
|
sha256 "77ea7675ee29b85aa7df138014790f91047bfdafbc997cb41a1030a0417356d7"
|
|
end
|
|
|
|
def install
|
|
boot_jdk_dir = Pathname.pwd/"boot-jdk"
|
|
resource("boot-jdk").stage boot_jdk_dir
|
|
boot_jdk = boot_jdk_dir/"Contents/Home"
|
|
java_options = ENV.delete("_JAVA_OPTIONS")
|
|
|
|
_, _, build = version.to_s.rpartition("+")
|
|
|
|
chmod 0755, "configure"
|
|
system "./configure", "--without-version-pre",
|
|
"--without-version-opt",
|
|
"--with-version-build=#{build}",
|
|
"--with-toolchain-path=/usr/bin",
|
|
"--with-extra-ldflags=-headerpad_max_install_names",
|
|
"--with-boot-jdk=#{boot_jdk}",
|
|
"--with-boot-jdk-jvmargs=#{java_options}",
|
|
"--with-debug-level=release",
|
|
"--with-native-debug-symbols=none",
|
|
"--enable-dtrace=auto",
|
|
"--with-jvm-variants=server"
|
|
|
|
ENV["MAKEFLAGS"] = "JOBS=#{ENV.make_jobs}"
|
|
system "make", "images"
|
|
|
|
jdk = Dir["build/*/images/jdk-bundle/*"].first
|
|
libexec.install jdk => "openjdk.jdk"
|
|
bin.install_symlink Dir["#{libexec}/openjdk.jdk/Contents/Home/bin/*"]
|
|
include.install_symlink Dir["#{libexec}/openjdk.jdk/Contents/Home/include/*.h"]
|
|
include.install_symlink Dir["#{libexec}/openjdk.jdk/Contents/Home/include/darwin/*.h"]
|
|
end
|
|
|
|
def caveats
|
|
<<~EOS
|
|
For the system Java wrappers to find this JDK, symlink it with
|
|
sudo ln -sfn #{opt_libexec}/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk
|
|
EOS
|
|
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
|