aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/yaz.rb
blob: d9dc1fa279afd4b783cf624fb29f736bcc03a0e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# encoding: UTF-8
require "formula"

class Yaz < Formula
  homepage "http://www.indexdata.com/yaz"
  url "http://ftp.indexdata.dk/pub/yaz/yaz-5.1.2.tar.gz"
  sha1 "00eb4c68e4c8dbc9799e3b8f2fa195fe1a984a5e"

  bottle do
    cellar :any
    sha1 "a809abcc63012c87fb41979824d534d9736344bf" => :mavericks
    sha1 "45e2980e9c75e969e27823e366672fdf75bc8533" => :mountain_lion
    sha1 "bec01aad7cc060ddc9c21bd8ef856b1e4df06115" => :lion
  end

  depends_on "pkg-config" => :build
  depends_on "gnutls" => :optional

  def install
    system "./configure", "--disable-dependency-tracking",
                          "--prefix=#{prefix}",
                          "--with-xml2"
    system "make install"
  end

  # This test converts between MARC8, an obscure mostly-obsolete library
  # text encoding supported by yaz-iconv, and UTF8.
  test do
    File.open("marc8.txt", "w") do |f|
      f.write "$1!0-!L,i$3i$si$Ki$Ai$O!+=(B"
    end

    result = `"#{bin}/yaz-iconv" -f marc8 -t utf8 marc8.txt`.chomp
    result.force_encoding(Encoding::UTF_8) if result.respond_to?(:force_encoding)
    assert_equal "世界こんにちは!", result
  end
end