|
| 1 | +class Libidn2 < Formula |
| 2 | + desc "International domain name library (IDNA2008, Punycode and TR46)" |
| 3 | + homepage "https://www.gnu.org/software/libidn/#libidn2" |
| 4 | + url "https://ftp.gnu.org/gnu/libidn/libidn2-2.3.7.tar.gz" |
| 5 | + mirror "https://ftpmirror.gnu.org/libidn/libidn2-2.3.7.tar.gz" |
| 6 | + mirror "http://ftp.gnu.org/gnu/libidn/libidn2-2.3.7.tar.gz" |
| 7 | + sha256 "4c21a791b610b9519b9d0e12b8097bf2f359b12f8dd92647611a929e6bfd7d64" |
| 8 | + license all_of: [ |
| 9 | + { any_of: ["GPL-2.0-or-later", "LGPL-3.0-or-later"] }, # lib |
| 10 | + { all_of: ["Unicode-TOU", "Unicode-DFS-2016"] }, # matching COPYING.unicode |
| 11 | + "GPL-3.0-or-later", # bin |
| 12 | + "LGPL-2.1-or-later", # parts of gnulib |
| 13 | + "FSFAP-no-warranty-disclaimer", # man3 |
| 14 | + ] |
| 15 | + |
| 16 | + livecheck do |
| 17 | + url :stable |
| 18 | + regex(/href=.*?libidn2[._-]v?(\d+(?:\.\d+)+)\.t/i) |
| 19 | + end |
| 20 | + |
| 21 | + bottle do |
| 22 | + root_url "https://github.com/gromgit/homebrew-core-aarch64_linux/releases/download/libidn2-2.3.7" |
| 23 | + sha256 cellar: :any_skip_relocation, aarch64_linux: "8f11ec5a9830450304ac0acc601b93a4b8ddd926953906ef1bdf297e584f50aa" |
| 24 | + end |
| 25 | + |
| 26 | + head do |
| 27 | + url "https://gitlab.com/libidn/libidn2.git", branch: "master" |
| 28 | + |
| 29 | + depends_on "autoconf" => :build |
| 30 | + depends_on "automake" => :build |
| 31 | + depends_on "gengetopt" => :build |
| 32 | + depends_on "gettext" => :build |
| 33 | + depends_on "help2man" => :build |
| 34 | + depends_on "libtool" => :build |
| 35 | + |
| 36 | + uses_from_macos "gperf" => :build |
| 37 | + |
| 38 | + on_macos do |
| 39 | + depends_on "coreutils" => :build |
| 40 | + end |
| 41 | + |
| 42 | + on_system :linux, macos: :ventura_or_newer do |
| 43 | + depends_on "texinfo" => :build |
| 44 | + end |
| 45 | + end |
| 46 | + |
| 47 | + depends_on "pkg-config" => :build |
| 48 | + depends_on "libunistring" |
| 49 | + |
| 50 | + on_macos do |
| 51 | + depends_on "gettext" |
| 52 | + end |
| 53 | + |
| 54 | + def install |
| 55 | + args = ["--disable-silent-rules", "--with-packager=Homebrew"] |
| 56 | + args << "--with-libintl-prefix=#{Formula["gettext"].opt_prefix}" if OS.mac? |
| 57 | + |
| 58 | + if build.head? |
| 59 | + ENV.prepend_path "PATH", Formula["coreutils"].libexec/"gnubin" if OS.mac? |
| 60 | + system "./bootstrap", "--skip-po" |
| 61 | + end |
| 62 | + system "./configure", *args, *std_configure_args |
| 63 | + system "make", "install" |
| 64 | + end |
| 65 | + |
| 66 | + test do |
| 67 | + ENV.delete("LC_CTYPE") |
| 68 | + ENV["CHARSET"] = "UTF-8" |
| 69 | + output = shell_output("#{bin}/idn2 räksmörgås.se") |
| 70 | + assert_equal "xn--rksmrgs-5wao1o.se", output.chomp |
| 71 | + output = shell_output("#{bin}/idn2 blåbærgrød.no") |
| 72 | + assert_equal "xn--blbrgrd-fxak7p.no", output.chomp |
| 73 | + end |
| 74 | +end |
0 commit comments