18f156ad16
Asymptote is a 3D programmatic drawing environment that integrates with TeX/LaTeX. It requires a MacTeX installation (or equivalent). Building asy from source is not exactly straightforward (although not toooo difficult) on Mac OS X due to some dependences; hopefully this formula helps some people out. Signed-off-by: David Höppner <0xffea@gmail.com> * white spaces
91 lines
2.4 KiB
Ruby
91 lines
2.4 KiB
Ruby
require 'formula'
|
|
|
|
class Asymptote <Formula
|
|
url 'http://downloads.sourceforge.net/asymptote/asymptote-2.04.src.tgz'
|
|
homepage 'http://asymptote.sourceforge.net/'
|
|
md5 '6adb5d7714b662152b6f6f16c24f5751'
|
|
|
|
depends_on 'readline'
|
|
depends_on 'bdw-gc'
|
|
|
|
def TeX_installed?
|
|
texbin = `which latex`
|
|
if texbin==''
|
|
return false
|
|
else
|
|
return true
|
|
end
|
|
end
|
|
|
|
def link_asy_texmfhome
|
|
|
|
texmfhome = `kpsewhich -var-value=TEXMFHOME`
|
|
texmflocl = `kpsewhich -var-value=TEXMFLOCAL`
|
|
texmfhome.chop!
|
|
texmflocl.chop!
|
|
|
|
asyhome = "#{texmfhome}/tex/latex/asymptote-brew"
|
|
asylocl = "#{texmflocl}/tex/latex/asymptote"
|
|
system "mkdir -p #{asyhome}"
|
|
|
|
for asyfile in ['asycolors.sty','asymptote.sty','ocg.sty','latexmkrc']
|
|
system "ln -s -f #{asylocl}/#{asyfile} #{asyhome}/#{asyfile}"
|
|
end
|
|
|
|
end
|
|
|
|
def install
|
|
if TeX_installed?
|
|
system "./configure",
|
|
"--prefix=#{prefix}",
|
|
"--enable-gc=#{HOMEBREW_PREFIX}",
|
|
"--disable-fftw", "--disable-gsl" # follow TeX Live
|
|
|
|
system "make install"
|
|
|
|
link_asy_texmfhome
|
|
|
|
else
|
|
onoe <<-EOS.undent
|
|
Asymptote requires a TeX/LaTeX installation; aborting now.
|
|
You can obtain the TeX distribution for Mac OS X from
|
|
http://www.tug.org/mactex/
|
|
EOS
|
|
end
|
|
|
|
end
|
|
|
|
def caveats
|
|
caveats = <<-EOS
|
|
1) This formula links the latest version of asymptote.sty into your user
|
|
texmf directory:
|
|
|
|
~/Library/texmf/tex/asymptote-brew/asymptote.sty
|
|
|
|
This file links back to where the Asymptote source installer puts it:
|
|
|
|
/usr/local/texlive/texmf-local/tex/latex/asymptote/asymptote.sty
|
|
|
|
Other users of your machine will not be able to use the source-installed
|
|
version of asymptote.sty unless they perform a similar linking operation;
|
|
e.g.,
|
|
|
|
mkdir -p ~/Library/texmf/tex/asymptote-brew/
|
|
ln -s /usr/local/texlive/texmf-local/tex/latex/asymptote/asymptote.sty ~/Library/texmf/tex/asymptote-brew/asymptote.sty
|
|
|
|
and similarly for asycolors.sty, ocg.sty, and latexmkrc.
|
|
|
|
If you are not using MacTeX / TeX Live or you have customised your TeX
|
|
distribution, the paths shown above may not match your particular system,
|
|
but you get the idea.
|
|
|
|
|
|
2) If you wish to use xasy, run the following command to install the Python
|
|
Imaging Library (PIL):
|
|
|
|
easy_install http://effbot.org/downloads/Imaging-1.1.7.tar.gz
|
|
|
|
EOS
|
|
end
|
|
|
|
end
|