79 lines
2.5 KiB
Ruby
79 lines
2.5 KiB
Ruby
class Yaz < Formula
|
||
desc "Toolkit for Z39.50/SRW/SRU clients/servers"
|
||
homepage "https://www.indexdata.com/yaz"
|
||
url "http://ftp.indexdata.dk/pub/yaz/yaz-5.30.3.tar.gz"
|
||
sha256 "f0497fd8420574efab4e5738ea3b70787a6e8042f585156baa30bdc1911ba552"
|
||
license "BSD-3-Clause"
|
||
revision 1
|
||
|
||
livecheck do
|
||
url "http://ftp.indexdata.dk/pub/yaz/"
|
||
regex(/href=.*?yaz[._-]v?(\d+(?:\.\d+)+)\.t/i)
|
||
end
|
||
|
||
bottle do
|
||
sha256 cellar: :any, arm64_big_sur: "b906d9bcb2853341532644ae7267407cd6ccb90a8c4027ba8d8a7c967c49c221"
|
||
sha256 cellar: :any, big_sur: "b76b437a0ebd9ec194f7a21e76ed19e89cb0e3d4c2bfb3ef28f8ebfd97894d2b"
|
||
sha256 cellar: :any, catalina: "e8d4407c1ccc973908464faa9c2f3d91f8f7a55cba8d3cadba2875d1bcc977db"
|
||
sha256 cellar: :any, mojave: "415ffe9254272f056f57b9860c6785f8d7b2ebaa5ac962c0e9e74ddacb388a33"
|
||
end
|
||
|
||
head do
|
||
url "https://github.com/indexdata/yaz.git"
|
||
depends_on "autoconf" => :build
|
||
depends_on "automake" => :build
|
||
depends_on "libtool" => :build
|
||
end
|
||
|
||
depends_on "pkg-config" => :build
|
||
depends_on "icu4c"
|
||
|
||
uses_from_macos "libxml2"
|
||
|
||
def install
|
||
system "./buildconf.sh" if build.head?
|
||
system "./configure", "--disable-dependency-tracking",
|
||
"--prefix=#{prefix}",
|
||
"--with-xml2"
|
||
system "make", "install"
|
||
end
|
||
|
||
test do
|
||
# This test converts between MARC8, an obscure mostly-obsolete library
|
||
# text encoding supported by yaz-iconv, and UTF8.
|
||
marc8file = testpath/"marc8.txt"
|
||
marc8file.write "$1!0-!L,i$3i$si$Ki$Ai$O!+=(B"
|
||
result = shell_output("#{bin}/yaz-iconv -f marc8 -t utf8 #{marc8file}")
|
||
result.force_encoding(Encoding::UTF_8) if result.respond_to?(:force_encoding)
|
||
assert_equal "世界こんにちは!", result
|
||
|
||
# Test ICU support by running yaz-icu with the example icu_chain
|
||
# from its man page.
|
||
configfile = testpath/"icu-chain.xml"
|
||
configfile.write <<~EOS
|
||
<?xml version="1.0" encoding="UTF-8"?>
|
||
<icu_chain locale="en">
|
||
<transform rule="[:Control:] Any-Remove"/>
|
||
<tokenize rule="w"/>
|
||
<transform rule="[[:WhiteSpace:][:Punctuation:]] Remove"/>
|
||
<transliterate rule="xy > z;"/>
|
||
<display/>
|
||
<casemap rule="l"/>
|
||
</icu_chain>
|
||
EOS
|
||
|
||
inputfile = testpath/"icu-test.txt"
|
||
inputfile.write "yaz-ICU xy!"
|
||
|
||
expectedresult = <<~EOS
|
||
1 1 'yaz' 'yaz'
|
||
2 1 '' ''
|
||
3 1 'icuz' 'ICUz'
|
||
4 1 '' ''
|
||
EOS
|
||
|
||
result = shell_output("#{bin}/yaz-icu -c #{configfile} #{inputfile}")
|
||
assert_equal expectedresult, result
|
||
end
|
||
end
|