homebrew-core/Formula/latexml.rb
2019-04-25 22:47:26 +02:00

57 lines
1.9 KiB
Ruby

class Latexml < Formula
desc "LaTeX to XML/HTML/MathML Converter"
homepage "https://dlmf.nist.gov/LaTeXML/"
url "https://dlmf.nist.gov/LaTeXML/releases/LaTeXML-0.8.3.tar.gz"
sha256 "28a57369b65b85d09c1a2516e69d26bbbe102ab790cae5e2fc9709b26185f62f"
head "https://github.com/brucemiller/LaTeXML.git"
bottle do
cellar :any_skip_relocation
sha256 "f3a5d8f45fdb180e01020f6197a9a07737f81eab6934d949b92f5b711f35041d" => :mojave
sha256 "5fed67a74a9966182e7f998a2184541d517a56e1293be12612b0a14b3380cb17" => :high_sierra
sha256 "405cb6dee92b6c535e03a4841b3961e96bfb259cdfdf2909f1743d4ff2d479df" => :sierra
end
resource "Image::Size" do
url "https://cpan.metacpan.org/authors/id/R/RJ/RJRAY/Image-Size-3.300.tar.gz"
sha256 "53c9b1f86531cde060ee63709d1fda73cabc0cf2d581d29b22b014781b9f026b"
end
resource "Text::Unidecode" do
url "https://cpan.metacpan.org/authors/id/S/SB/SBURKE/Text-Unidecode-1.30.tar.gz"
sha256 "6c24f14ddc1d20e26161c207b73ca184eed2ef57f08b5fb2ee196e6e2e88b1c6"
end
def install
ENV.prepend_create_path "PERL5LIB", libexec+"lib/perl5"
resources.each do |r|
r.stage do
system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}"
system "make"
system "make", "install"
end
end
system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}"
system "make", "install"
doc.install "manual.pdf"
(libexec+"bin").find.each do |path|
next if path.directory?
program = path.basename
(bin+program).write_env_script("#{libexec}/bin/#{program}", :PERL5LIB => ENV["PERL5LIB"])
end
end
test do
(testpath/"test.tex").write <<~EOS
\\documentclass{article}
\\title{LaTeXML Homebrew Test}
\\begin{document}
\\maketitle
\\end{document}
EOS
assert_match %r{<title>LaTeXML Homebrew Test</title>},
shell_output("#{bin}/latexml --quiet #{testpath}/test.tex")
end
end