2011-08-12 10:10:04 +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-08-12 10:10:04 +00:00
|
|
|
class Auctex < Formula
|
2012-03-01 04:42:09 +00:00
|
|
|
homepage 'http://ftp.gnu.org/pub/gnu/auctex'
|
2011-09-12 16:31:30 +00:00
|
|
|
url 'http://ftpmirror.gnu.org/auctex/auctex-11.86.tar.gz'
|
2011-11-30 18:56:07 +00:00
|
|
|
mirror 'http://ftp.gnu.org/gnu/auctex/auctex-11.86.tar.gz'
|
2012-09-03 18:33:56 +00:00
|
|
|
sha1 'af3dd156f8b2db7764c86d9f7de8abd5811d888a'
|
2011-08-12 10:10:04 +00:00
|
|
|
|
2012-09-14 16:07:47 +00:00
|
|
|
env :userpaths
|
|
|
|
|
2012-03-01 04:36:21 +00:00
|
|
|
depends_on TexInstalled.new
|
|
|
|
|
2011-08-12 10:10:04 +00:00
|
|
|
def options
|
2012-03-01 04:42:09 +00:00
|
|
|
[['--with-emacs=</full/path/to/emacs>', "Force a different emacs"]]
|
2011-08-12 10:10:04 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def which_emacs
|
|
|
|
# check arguments for a different emacs
|
|
|
|
ARGV.each do |a|
|
|
|
|
if a.index('--with-emacs')
|
2012-03-01 04:42:09 +00:00
|
|
|
return a.sub('--with-emacs=', '')
|
2011-08-12 10:10:04 +00:00
|
|
|
end
|
|
|
|
end
|
2012-03-01 04:42:09 +00:00
|
|
|
return `which emacs`.chomp
|
2011-08-12 10:10:04 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def install
|
|
|
|
# configure fails if the texmf dir is not there yet
|
2012-03-01 04:42:09 +00:00
|
|
|
brew_texmf = share + 'texmf'
|
2011-08-12 10:10:04 +00:00
|
|
|
brew_texmf.mkpath
|
|
|
|
|
2012-03-01 04:42:09 +00:00
|
|
|
system "./configure", "--prefix=#{prefix}",
|
|
|
|
"--with-texmf-dir=#{brew_texmf}",
|
|
|
|
"--with-emacs=#{which_emacs}",
|
|
|
|
"--with-lispdir=#{share}/emacs/site-lisp"
|
2011-08-12 10:10:04 +00:00
|
|
|
|
|
|
|
system "make"
|
2011-08-27 18:55:51 +00:00
|
|
|
ENV.deparallelize # Needs a serialized install
|
2011-08-12 10:10:04 +00:00
|
|
|
system "make install"
|
|
|
|
end
|
|
|
|
|
|
|
|
def caveats
|
|
|
|
# check if the used emacs is in HOMEBREW_PREFIX/bin
|
|
|
|
# for which case HOMEBREW_PREFIX/share/emacs/site-lisp should already
|
|
|
|
# be by default in the load-path
|
|
|
|
if which_emacs.index("#{HOMEBREW_PREFIX}/bin")
|
|
|
|
dot_emacs = <<-EOS
|
2012-03-01 04:42:09 +00:00
|
|
|
(require 'tex-site)
|
2011-08-12 10:10:04 +00:00
|
|
|
EOS
|
|
|
|
else
|
|
|
|
dot_emacs = <<-EOS
|
2012-03-01 04:42:09 +00:00
|
|
|
(add-to-list 'load-path "#{HOMEBREW_PREFIX}/share/emacs/site-lisp")
|
|
|
|
(require 'tex-site)
|
2011-08-12 10:10:04 +00:00
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
2011-08-30 16:55:37 +00:00
|
|
|
<<-EOS.undent
|
2012-03-01 04:42:09 +00:00
|
|
|
texmf files installed into:
|
|
|
|
#{HOMEBREW_PREFIX}/share/texmf/
|
|
|
|
|
|
|
|
You can add it to your TEXMFHOME using:
|
|
|
|
sudo tlmgr conf texmf TEXMFHOME "~/Library/texmf:#{HOMEBREW_PREFIX}/share/texmf"
|
|
|
|
|
|
|
|
Emacs package installed into:
|
|
|
|
#{HOMEBREW_PREFIX}/share/emacs/site-lisp
|
2011-08-12 10:10:04 +00:00
|
|
|
|
2012-03-01 04:42:09 +00:00
|
|
|
To activate, add the following to your .emacs:
|
2011-08-12 10:10:04 +00:00
|
|
|
#{dot_emacs}
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|