homebrew-core/Formula/latexml.rb
2019-06-28 12:48:23 +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.4.tar.gz"
sha256 "92599b45fb587ac14b2ba9cc84b85d9ddc2deaf1cbdc2e89e7a6559e1fbb34cc"
head "https://github.com/brucemiller/LaTeXML.git"
bottle do
cellar :any_skip_relocation
sha256 "e7c78acf6bb580fdb949777719972a806c1d7d349d9e826b338572bedde6cf5c" => :mojave
sha256 "388dbf99df85e55879cccfa48eed9b6ef362d13f3ffe83dbfd09b1e7fb12fa1f" => :high_sierra
sha256 "b911ac9897012edcc7c32d96785e4ca3830ce8cbddff78da0942263c7fb0d0bb" => :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