|
| 1 | +class Icu4cAT77 < Formula |
| 2 | + desc "C/C++ and Java libraries for Unicode and globalization" |
| 3 | + homepage "https://icu.unicode.org/home" |
| 4 | + url "https://github.com/unicode-org/icu/releases/download/release-77-1/icu4c-77_1-src.tgz" |
| 5 | + version "77.1" |
| 6 | + sha256 "588e431f77327c39031ffbb8843c0e3bc122c211374485fa87dc5f3faff24061" |
| 7 | + license "ICU" |
| 8 | + |
| 9 | + # We allow the livecheck to detect new `icu4c` major versions in order to |
| 10 | + # automate version bumps. To make sure PRs are created correctly, we output |
| 11 | + # an error during installation to notify when a new formula is needed. |
| 12 | + livecheck do |
| 13 | + url :stable |
| 14 | + regex(/^release[._-]v?(\d+(?:[.-]\d+)+)$/i) |
| 15 | + strategy :git do |tags, regex| |
| 16 | + tags.filter_map { |tag| tag[regex, 1]&.tr("-", ".") } |
| 17 | + end |
| 18 | + end |
| 19 | + |
| 20 | + bottle do |
| 21 | + sha256 cellar: :any, arm64_sequoia: "19f6b5fef0cdf1dfc7f136ca103348ec8530ffdf8012273f6ee4a6159cdfaf75" |
| 22 | + sha256 cellar: :any, arm64_sonoma: "f2b3a9d78e046b3b1ca1f06227272c0ea25490bd8efa4c98a33ffdcc734452ff" |
| 23 | + sha256 cellar: :any, arm64_ventura: "425a38eb7a7a1bb54dd25ac58194ef89d79caf1777a01fb244ed37487c1f7d80" |
| 24 | + sha256 cellar: :any, sonoma: "54d609febedd08e8a4a825435d85f6d4db045f586523edb8965434e8e9c93fa6" |
| 25 | + sha256 cellar: :any, ventura: "6f04d1757707495212ff68722bab629766329874ef7d0531e756903dff5022cb" |
| 26 | + sha256 cellar: :any_skip_relocation, x86_64_linux: "f82d4ca07fbdcf99cb5553ae9cf298bbff475a465f13e1c5d934dcbcb1e14741" |
| 27 | + end |
| 28 | + |
| 29 | + keg_only :shadowed_by_macos, "macOS provides libicucore.dylib (but nothing else)" |
| 30 | + |
| 31 | + def install |
| 32 | + odie "Major version bumps need a new formula!" if version.major.to_s != name[/@(\d+)$/, 1] |
| 33 | + |
| 34 | + args = %w[ |
| 35 | + --disable-samples |
| 36 | + --disable-tests |
| 37 | + --enable-static |
| 38 | + --with-library-bits=64 |
| 39 | + ] |
| 40 | + |
| 41 | + cd "source" do |
| 42 | + system "./configure", *args, *std_configure_args |
| 43 | + system "make" |
| 44 | + system "make", "install" |
| 45 | + end |
| 46 | + end |
| 47 | + |
| 48 | + test do |
| 49 | + if File.exist? "/usr/share/dict/words" |
| 50 | + system bin/"gendict", "--uchars", "/usr/share/dict/words", "dict" |
| 51 | + else |
| 52 | + (testpath/"hello").write "hello\nworld\n" |
| 53 | + system bin/"gendict", "--uchars", "hello", "dict" |
| 54 | + end |
| 55 | + end |
| 56 | +end |
0 commit comments