2010-08-30 11:57:49 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2012-03-01 04:36:21 +00:00
|
|
|
class TexInstalled < Requirement
|
|
|
|
def message; <<-EOS.undent
|
|
|
|
A TeX/LaTeX installation is required to install.
|
|
|
|
You can obtain the TeX distribution for Mac OS X from:
|
|
|
|
http://www.tug.org/mactex/
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
def satisfied?
|
|
|
|
which 'latex'
|
|
|
|
end
|
|
|
|
def fatal?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Asymptote < Formula
|
2010-08-30 11:57:49 +00:00
|
|
|
homepage 'http://asymptote.sourceforge.net/'
|
2012-02-11 01:19:14 +00:00
|
|
|
url 'http://downloads.sourceforge.net/asymptote/asymptote-2.15.src.tgz'
|
2012-09-03 18:33:56 +00:00
|
|
|
sha1 'e0fb336c195fb21a39e3d0f3acd4881ce5e170a7'
|
2010-08-30 11:57:49 +00:00
|
|
|
|
2012-03-01 04:36:21 +00:00
|
|
|
depends_on TexInstalled.new
|
2012-10-07 22:51:48 +00:00
|
|
|
env :userpaths # To find TeX
|
2012-03-01 04:36:21 +00:00
|
|
|
|
2012-11-11 03:12:26 +00:00
|
|
|
depends_on 'readline'
|
2010-08-30 11:57:49 +00:00
|
|
|
depends_on 'bdw-gc'
|
|
|
|
|
|
|
|
def install
|
2012-03-01 04:36:21 +00:00
|
|
|
texmfhome = share+'texmf'
|
2011-08-27 19:46:35 +00:00
|
|
|
|
2012-02-11 21:14:08 +00:00
|
|
|
# see: https://sourceforge.net/tracker/?func=detail&aid=3486838&group_id=120000&atid=685683
|
|
|
|
inreplace 'configure', '--no-var-tracking', '' if ENV.compiler == :clang
|
|
|
|
|
2010-09-27 20:25:32 +00:00
|
|
|
system "./configure", "--prefix=#{prefix}",
|
2011-08-27 19:46:35 +00:00
|
|
|
"--enable-gc=#{HOMEBREW_PREFIX}",
|
|
|
|
"--with-latex=#{texmfhome}/tex/latex",
|
|
|
|
"--with-context=#{texmfhome}/tex/context/third",
|
|
|
|
# So that `texdoc` can find manuals
|
|
|
|
"--with-docdir=#{texmfhome}/doc"
|
|
|
|
system "make"
|
|
|
|
ENV.deparallelize
|
2010-09-27 20:25:32 +00:00
|
|
|
system "make install"
|
2010-08-30 11:57:49 +00:00
|
|
|
end
|
|
|
|
|
2011-08-27 20:48:38 +00:00
|
|
|
def test
|
|
|
|
ENV['TEXMFHOME'] = "#{HOMEBREW_PREFIX}/share/texmf"
|
|
|
|
mktemp do
|
2012-02-21 06:04:21 +00:00
|
|
|
(Pathname.pwd+'asy_test.tex').write <<-EOS.undent
|
2011-08-27 20:48:38 +00:00
|
|
|
\\nonstopmode
|
|
|
|
|
|
|
|
\\documentclass{minimal}
|
|
|
|
\\usepackage{asymptote}
|
|
|
|
|
|
|
|
\\begin{document}
|
|
|
|
Hello, Asymptote!
|
|
|
|
|
|
|
|
\\begin{asy}
|
|
|
|
size(3cm);
|
|
|
|
draw((0,0)--(1,0)--(1,1)--(0,1)--cycle);
|
|
|
|
\\end{asy}
|
|
|
|
|
|
|
|
\\end{document}
|
|
|
|
EOS
|
|
|
|
|
|
|
|
system "pdflatex asy_test"
|
|
|
|
system "asy asy_test-1.asy"
|
|
|
|
system "pdflatex asy_test"
|
|
|
|
end
|
|
|
|
|
|
|
|
return (not $? == 0)
|
|
|
|
end
|
|
|
|
|
2010-08-30 11:57:49 +00:00
|
|
|
def caveats
|
|
|
|
caveats = <<-EOS
|
2011-08-27 19:46:35 +00:00
|
|
|
1) This formula links the latest version of the Asymptote LaTeX and ConTeXt
|
|
|
|
packages into:
|
2010-08-30 11:57:49 +00:00
|
|
|
|
2011-08-27 19:46:35 +00:00
|
|
|
#{HOMEBREW_PREFIX}/share/texmf
|
2010-08-30 11:57:49 +00:00
|
|
|
|
2011-08-27 19:46:35 +00:00
|
|
|
In order for these packages to be visible to TeX compilers, the above
|
|
|
|
directory will need to be added to the TeX search path:
|
2010-08-30 11:57:49 +00:00
|
|
|
|
2011-08-27 19:46:35 +00:00
|
|
|
sudo tlmgr conf texmf TEXMFHOME "~/Library/texmf:#{HOMEBREW_PREFIX}/share/texmf"
|
2010-08-30 11:57:49 +00:00
|
|
|
|
|
|
|
|
2010-10-18 12:23:48 +00:00
|
|
|
2) If you want to have Asymptote compiled with support for fftw or gsl
|
|
|
|
(fast fourier transforms or the GNU Scientific Library) they must be
|
|
|
|
manually installed first:
|
|
|
|
|
|
|
|
brew install fftw
|
|
|
|
brew install gsl
|
|
|
|
|
|
|
|
They are not compiled by default because they take a long time to compile
|
|
|
|
and they are not required by most users. (And they're not included in the
|
|
|
|
TeX Live build of Asymptote.)
|
|
|
|
|
|
|
|
|
|
|
|
3) If you wish to use xasy, you must first install the Python Imaging
|
|
|
|
Library (PIL):
|
2010-08-30 11:57:49 +00:00
|
|
|
|
|
|
|
easy_install http://effbot.org/downloads/Imaging-1.1.7.tar.gz
|
|
|
|
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|