147 lines
4.8 KiB
Ruby
147 lines
4.8 KiB
Ruby
class OpenjdkAT17 < Formula
|
|
desc "Development kit for the Java programming language"
|
|
homepage "https://openjdk.java.net/"
|
|
url "https://github.com/openjdk/jdk17u/archive/jdk-17.0.4-ga.tar.gz"
|
|
sha256 "6db40d6762416837825da8505a7a664e1001322d6ebd284fe792dbec938c022a"
|
|
license "GPL-2.0-only" => { with: "Classpath-exception-2.0" }
|
|
|
|
livecheck do
|
|
url :stable
|
|
regex(/^jdk[._-]v?(17(?:\.\d+)*)-ga$/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_monterey: "70e3d914c8a21ce7c648751a7d32666ac03effc38786d77b62847b6fbbaa6c63"
|
|
sha256 cellar: :any, arm64_big_sur: "9eb7c3f78a597f89817dba3151ef33dc7ed92d0c2d56e2509fcc935b87342226"
|
|
sha256 cellar: :any, monterey: "c776c051a277ee7b544710482ff6566605487686df319eeee2326765fce8bbc5"
|
|
sha256 cellar: :any, big_sur: "ce37d80cddc3d20932e428867240a1850d655993acb28cc176281f8b969f23f7"
|
|
sha256 cellar: :any, catalina: "235b26d57432fde3f5e507e3717808ec8ee1175bc3f4c5ee42ff983d610326f1"
|
|
sha256 x86_64_linux: "f40d3fa33188be873f1f786b71c59ed1c65e22680fffd75a879d644cd23bafe8"
|
|
end
|
|
|
|
keg_only :versioned_formula
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on xcode: :build
|
|
|
|
on_linux do
|
|
depends_on "pkg-config" => :build
|
|
depends_on "alsa-lib"
|
|
depends_on "cups"
|
|
depends_on "fontconfig"
|
|
depends_on "gcc"
|
|
depends_on "libx11"
|
|
depends_on "libxext"
|
|
depends_on "libxrandr"
|
|
depends_on "libxrender"
|
|
depends_on "libxt"
|
|
depends_on "libxtst"
|
|
depends_on "unzip"
|
|
depends_on "zip"
|
|
|
|
ignore_missing_libraries "libjvm.so"
|
|
end
|
|
|
|
fails_with gcc: "5"
|
|
|
|
# From https://jdk.java.net/archive/
|
|
resource "boot-jdk" do
|
|
on_macos do
|
|
on_arm do
|
|
url "https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_macos-aarch64_bin.tar.gz"
|
|
sha256 "602d7de72526368bb3f80d95c4427696ea639d2e0cc40455f53ff0bbb18c27c8"
|
|
end
|
|
on_intel do
|
|
url "https://download.java.net/java/GA/jdk16.0.2/d4a915d82b4c4fbb9bde534da945d746/7/GPL/openjdk-16.0.2_osx-x64_bin.tar.gz"
|
|
sha256 "e65f2437585f16a01fa8e10139d0d855e8a74396a1dfb0163294ed17edd704b8"
|
|
end
|
|
end
|
|
on_linux do
|
|
url "https://download.java.net/java/GA/jdk16.0.2/d4a915d82b4c4fbb9bde534da945d746/7/GPL/openjdk-16.0.2_linux-x64_bin.tar.gz"
|
|
sha256 "6c714ded7d881ca54970ec949e283f43d673a142fda1de79b646ddd619da9c0c"
|
|
end
|
|
end
|
|
|
|
def install
|
|
boot_jdk = Pathname.pwd/"boot-jdk"
|
|
resource("boot-jdk").stage boot_jdk
|
|
boot_jdk /= "Contents/Home" if OS.mac?
|
|
java_options = ENV.delete("_JAVA_OPTIONS")
|
|
|
|
args = %W[
|
|
--disable-warnings-as-errors
|
|
--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
|
|
]
|
|
|
|
args += if OS.mac?
|
|
%W[
|
|
--enable-dtrace
|
|
--with-extra-ldflags=-headerpad_max_install_names
|
|
--with-sysroot=#{MacOS.sdk_path}
|
|
]
|
|
else
|
|
%W[
|
|
--with-x=#{HOMEBREW_PREFIX}
|
|
--with-cups=#{HOMEBREW_PREFIX}
|
|
--with-fontconfig=#{HOMEBREW_PREFIX}
|
|
]
|
|
end
|
|
|
|
chmod 0755, "configure"
|
|
system "./configure", *args
|
|
|
|
ENV["MAKEFLAGS"] = "JOBS=#{ENV.make_jobs}"
|
|
system "make", "images"
|
|
|
|
if OS.mac?
|
|
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"]
|
|
man1.install_symlink Dir[libexec/"openjdk.jdk/Contents/Home/man/man1/*"]
|
|
else
|
|
libexec.install Dir["build/linux-x86_64-server-release/images/jdk/*"]
|
|
bin.install_symlink Dir[libexec/"bin/*"]
|
|
include.install_symlink Dir[libexec/"include/*.h"]
|
|
include.install_symlink Dir[libexec/"include/linux/*.h"]
|
|
man1.install_symlink Dir[libexec/"man/man1/*"]
|
|
end
|
|
end
|
|
|
|
def caveats
|
|
on_macos do
|
|
<<~EOS
|
|
For the system Java wrappers to find this JDK, symlink it with
|
|
sudo ln -sfn #{opt_libexec}/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.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
|