homebrew-core/Formula/batik.rb

35 lines
1.1 KiB
Ruby

class Batik < Formula
desc "Java-based toolkit for SVG images"
homepage "https://xmlgraphics.apache.org/batik/"
url "https://www.apache.org/dyn/closer.lua?path=xmlgraphics/batik/binaries/batik-bin-1.14.tar.gz"
mirror "https://archive.apache.org/dist/xmlgraphics/batik/binaries/batik-bin-1.14.tar.gz"
sha256 "0f4eaa81be70752e406a19f39c39c018848f09963f08fa8974640547052c4618"
license "Apache-2.0"
bottle do
rebuild 1
sha256 cellar: :any_skip_relocation, all: "32680f435743d552a10a241bd925fa4810221347f25742dd5c68908f3f579b37"
end
depends_on "openjdk"
def install
libexec.install "lib", Dir["*.jar"]
Dir[libexec/"*.jar"].each do |f|
bin.write_jar_script f, File.basename(f, "-#{version}.jar")
end
end
test do
font_name = (MacOS.version >= :catalina) ? "Arial Unicode.ttf" : "Arial.ttf"
font_path = if OS.mac?
"/Library/Fonts/#{font_name}"
else
"/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"
end
system bin/"batik-ttf2svg", font_path, "-autorange",
"-o", "Arial.svg", "-testcard"
assert_match "abcdefghijklmnopqrstuvwxyz", File.read("Arial.svg")
end
end