168 lines
5.3 KiB
Ruby
168 lines
5.3 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.5-ga.tar.gz"
|
|
sha256 "a3a72a1897b6c01a68307a80a3b987114b7722f2541debd018e362a7c0917b85"
|
|
license "GPL-2.0-only" => { with: "Classpath-exception-2.0" }
|
|
|
|
livecheck do
|
|
url :stable
|
|
regex(/^jdk[._-]v?(17(?:\.\d+)*)-ga$/i)
|
|
end
|
|
|
|
bottle do
|
|
rebuild 1
|
|
sha256 cellar: :any, arm64_ventura: "566d9586e90fc9f0cc3796788557e925dac1f4740870e75e3d6443c829f4bc42"
|
|
sha256 cellar: :any, arm64_monterey: "97a7577c516e2a23c0c6a2f195f23f5014fd2aa21b84503a07a8dbdd95889a97"
|
|
sha256 cellar: :any, arm64_big_sur: "9622f533acaceda168d8f934c9db17d39287ecada94d4133221355c4648953ca"
|
|
sha256 cellar: :any, ventura: "ff335f31da3df5c713607b25b81673fad376cc1bf33a23d1fc8cd961f8e40ecf"
|
|
sha256 cellar: :any, monterey: "d4c45935c0f1edaecd0a695a24268fb265fbd83eb108d8d03645bad34f916169"
|
|
sha256 cellar: :any, big_sur: "d60c7b04fb0e8695015519d773238ad6eeccf2fb1265f6add47fcdc9f7633b09"
|
|
sha256 x86_64_linux: "85db60921d8edf43af2eb8dea4e6d3ba29486bc1972e473afd6fdbd442b704db"
|
|
end
|
|
|
|
keg_only :versioned_formula
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on xcode: :build
|
|
depends_on "giflib"
|
|
depends_on "harfbuzz"
|
|
depends_on "jpeg-turbo"
|
|
depends_on "libpng"
|
|
depends_on "little-cms2"
|
|
|
|
uses_from_macos "cups"
|
|
uses_from_macos "unzip"
|
|
uses_from_macos "zip"
|
|
uses_from_macos "zlib"
|
|
|
|
on_linux do
|
|
depends_on "alsa-lib"
|
|
depends_on "fontconfig"
|
|
depends_on "freetype"
|
|
depends_on "libx11"
|
|
depends_on "libxext"
|
|
depends_on "libxrandr"
|
|
depends_on "libxrender"
|
|
depends_on "libxt"
|
|
depends_on "libxtst"
|
|
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
|
|
on_arm do
|
|
url "https://download.java.net/java/GA/jdk16.0.2/d4a915d82b4c4fbb9bde534da945d746/7/GPL/openjdk-16.0.2_linux-aarch64_bin.tar.gz"
|
|
sha256 "1ffb9c7748334945d9056b3324de3f797d906fce4dad86beea955153aa1e28fe"
|
|
end
|
|
on_intel 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
|
|
end
|
|
|
|
def install
|
|
boot_jdk = buildpath/"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
|
|
--with-giflib=system
|
|
--with-harfbuzz=system
|
|
--with-lcms=system
|
|
--with-libjpeg=system
|
|
--with-libpng=system
|
|
--with-zlib=system
|
|
]
|
|
|
|
ldflags = ["-Wl,-rpath,#{loader_path.gsub("$", "\\$$")}/server"]
|
|
args += if OS.mac?
|
|
ldflags << "-headerpad_max_install_names"
|
|
|
|
%W[
|
|
--enable-dtrace
|
|
--with-sysroot=#{MacOS.sdk_path}
|
|
]
|
|
else
|
|
%W[
|
|
--with-x=#{HOMEBREW_PREFIX}
|
|
--with-cups=#{HOMEBREW_PREFIX}
|
|
--with-fontconfig=#{HOMEBREW_PREFIX}
|
|
--with-freetype=system
|
|
--with-stdc++lib=dynamic
|
|
]
|
|
end
|
|
args << "--with-extra-ldflags=#{ldflags.join(" ")}"
|
|
|
|
system "bash", "configure", *args
|
|
|
|
ENV["MAKEFLAGS"] = "JOBS=#{ENV.make_jobs}"
|
|
system "make", "images"
|
|
|
|
jdk = libexec
|
|
if OS.mac?
|
|
libexec.install Dir["build/*/images/jdk-bundle/*"].first => "openjdk.jdk"
|
|
jdk /= "openjdk.jdk/Contents/Home"
|
|
else
|
|
libexec.install Dir["build/linux-*-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}/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
|