mirror of
https://github.com/mistydemeo/tigerbrew.git
synced 2026-11-27 11:29:53 -05:00
New `depends_on :python` Dependency.
New `depends_on :python3` Dependency.
To avoid having multiple formulae with endings -py2 and -py3,
we will handle support for different pythons (2.x vs. 3.x)
in the same formula.
Further brewed vs. external python will be transparently supported.
The formula also gets a new object `python`, which is false if
no Python is available or the user has disabled it. Otherwise
it is defined and provides several support methods:
python.site_packages # the site-packages in the formula's Cellar
python.global_site_packages
python.binary # the full path to the python binary
python.prefix
python.version
python.version.major
python.version.minor
python.xy # => e.g. "python2.7"
python.incdir # includes of python
python.libdir # the python dylib library
python.pkg_config_path # used internally by brew
python.from_osx?
python.framework?
python.universal?
python.pypy?
python.standard_caveats # Text to set PYTHONPATH for python.from_osx?
python.if3then3 # => "" for 2.x and to "3" for 3.x.
Further, to avoid code duplication, `python` takes an optional
block that is run twice if the formula defines depends_on
:python AND :python3.
python do
system python, 'setup.py', "--prefix=#{prefix}"
end
Read more in the Homebrew wiki.
70 lines
1.8 KiB
Ruby
70 lines
1.8 KiB
Ruby
require 'formula'
|
|
|
|
class Asymptote < Formula
|
|
homepage 'http://asymptote.sourceforge.net/'
|
|
url 'http://downloads.sourceforge.net/asymptote/asymptote-2.23.src.tgz'
|
|
sha1 'c24de9766ae7195c1cda947f9d2ae07497a0af8f'
|
|
|
|
depends_on :tex
|
|
depends_on 'texinfo'
|
|
depends_on 'readline'
|
|
depends_on 'bdw-gc'
|
|
depends_on 'fftw' => :optional
|
|
depends_on 'gsl' => :optional
|
|
|
|
def install
|
|
texmfhome = share/'texmf'
|
|
system "./configure", "--prefix=#{prefix}",
|
|
"--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
|
|
system "make install"
|
|
end
|
|
|
|
test do
|
|
ENV['TEXMFHOME'] = "#{HOMEBREW_PREFIX}/share/texmf"
|
|
(testpath/'asy_test.tex').write <<-EOS.undent
|
|
\\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
|
|
|
|
def caveats; <<-EOS.undent
|
|
This formula links the latest version of the Asymptote LaTeX and ConTeXt
|
|
packages into:
|
|
|
|
#{HOMEBREW_PREFIX}/share/texmf
|
|
|
|
In order for these packages to be visible to TeX compilers, the above
|
|
directory will need to be added to the TeX search path:
|
|
|
|
sudo tlmgr conf texmf TEXMFHOME "~/Library/texmf:#{HOMEBREW_PREFIX}/share/texmf"
|
|
|
|
If you wish to use xasy, you must first install the Python Imaging Library:
|
|
|
|
brew install pil
|
|
|
|
EOS
|
|
end
|
|
end
|