class Icu4cAT78 < Formula bottle do root_url "https://homebrew.hyprnet/bottles" sha256 cellar: :any, arm64_sequoia: "d1206febbce23e5014f51b631afd7129b2a247ee18a9f97226cd5889e66c1686" sha256 cellar: :any, arm64_tahoe: "0476be299494b97e50a48b0ba08811255300228aef664058e555480d6aee4fb5" sha256 cellar: :any_skip_relocation, x86_64_linux: "b152f4b6f581af753a52bf6dc5b7a113cd9f77088dcc94deaf6c321109aa43c2" end desc "C/C++ and Java libraries for Unicode and globalization" homepage "https://icu.unicode.org/home" url "https://github.com/unicode-org/icu/releases/download/release-78.3/icu4c-78.3-sources.tgz" sha256 "3a2e7a47604ba702f345878308e6fefeca612ee895cf4a5f222e7955fabfe0c0" license "Unicode-3.0" compatibility_version 1 # We allow the livecheck to detect new `icu4c` major versions in order to # automate version bumps. To make sure PRs are created correctly, we output # an error during installation to notify when a new formula is needed. livecheck do url :stable regex(/^release[._-]v?(\d+(?:[.-]\d+)+)$/i) strategy :git do |tags, regex| tags.filter_map { |tag| tag[regex, 1]&.tr("-", ".") } end end keg_only :shadowed_by_macos, "macOS provides libicucore.dylib (but nothing else)" def install odie "Major version bumps need a new formula!" if version.major.to_s != name[/@(\d+)$/, 1] args = %w[ --disable-samples --disable-tests --enable-static --with-library-bits=64 ] cd "source" do system "./configure", *args, *std_configure_args system "make" system "make", "install" end inreplace [bin/"icu-config", *lib.glob("pkgconfig/icu-*.pc")], prefix, opt_prefix end test do if File.exist? "/usr/share/dict/words" system bin/"gendict", "--uchars", "/usr/share/dict/words", "dict" else (testpath/"hello").write "hello\nworld\n" system bin/"gendict", "--uchars", "hello", "dict" end end end