From 7597fe1407c22706b4bd2e29a8cb117ec0bd2068 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 27 Oct 2019 14:22:33 +0100 Subject: [PATCH] openjdk@11 11.0.5+10 (new formula) --- Formula/openjdk@11.rb | 65 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Formula/openjdk@11.rb diff --git a/Formula/openjdk@11.rb b/Formula/openjdk@11.rb new file mode 100644 index 0000000000..ec17134903 --- /dev/null +++ b/Formula/openjdk@11.rb @@ -0,0 +1,65 @@ +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.5+10.tar.bz2" + version "11.0.5+10" + sha256 "5375ca18b2c9f301e8ae6f77192962a5ec560d808f3e899bb17719c82eae5407" + + keg_only :versioned_formula + + depends_on "autoconf" => :build + + 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") + + short_version, _, 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" + + libexec.install "build/macosx-x86_64-normal-server-release/images/jdk-bundle/jdk-#{short_version}.jdk" => "openjdk.jdk" + bin.install_symlink Dir["#{libexec}/openjdk.jdk/Contents/Home/bin/*"] + 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