2012-09-10 03:42:11 +00:00
|
|
|
require 'formula'
|
2013-07-08 16:39:31 +00:00
|
|
|
require 'ostruct'
|
2012-09-10 03:42:11 +00:00
|
|
|
|
|
|
|
class ProofGeneral < Formula
|
|
|
|
homepage 'http://proofgeneral.inf.ed.ac.uk'
|
2012-12-17 08:47:52 +00:00
|
|
|
url 'http://proofgeneral.inf.ed.ac.uk/releases/ProofGeneral-4.2.tgz'
|
|
|
|
sha1 'c8d2e4457478b9dbf4080d3cf8255325fcffe619'
|
2012-09-10 03:42:11 +00:00
|
|
|
|
2013-07-08 16:39:31 +00:00
|
|
|
option 'with-doc', 'Install HTML documentation'
|
2013-07-08 17:06:26 +00:00
|
|
|
option 'with-emacs=', 'Re-compile lisp files with specified emacs'
|
2012-09-10 03:42:11 +00:00
|
|
|
|
|
|
|
def which_emacs
|
2013-07-08 17:06:26 +00:00
|
|
|
emacs_binary = ARGV.value('with-emacs')
|
|
|
|
if emacs_binary.nil?
|
|
|
|
return OpenStruct.new(
|
|
|
|
:binary => "",
|
|
|
|
:major => 0,
|
|
|
|
:empty? => true)
|
2012-09-10 03:42:11 +00:00
|
|
|
end
|
2013-07-08 17:06:26 +00:00
|
|
|
|
2013-12-09 19:44:45 +00:00
|
|
|
raise "#{emacs_binary} not found" if not File.exist? "#{emacs_binary}"
|
2013-07-08 17:06:26 +00:00
|
|
|
|
|
|
|
version_info = `#{emacs_binary} --version`
|
|
|
|
version_info =~ /GNU Emacs (\d+)\./
|
|
|
|
major = $1
|
|
|
|
|
|
|
|
if major != '23' && major != '24'
|
|
|
|
raise "Emacs 23.x or 24.x is required; #{major}.x provided."
|
|
|
|
end
|
|
|
|
|
2013-07-08 16:39:31 +00:00
|
|
|
return OpenStruct.new(
|
2013-07-08 17:06:26 +00:00
|
|
|
:binary => emacs_binary,
|
|
|
|
:major => major,
|
|
|
|
:empty? => false)
|
2012-09-10 03:42:11 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def install
|
2013-07-08 17:06:50 +00:00
|
|
|
ENV.j1 # Otherwise lisp compilation can result in 0-byte files
|
|
|
|
|
2012-09-10 03:42:11 +00:00
|
|
|
emacs = which_emacs
|
|
|
|
args = ["PREFIX=#{prefix}",
|
|
|
|
"DEST_PREFIX=#{prefix}",
|
|
|
|
"ELISPP=share/emacs/site-lisp/ProofGeneral",
|
|
|
|
"ELISP_START=#{share}/emacs/site-lisp/site-start.d",
|
2013-07-08 16:39:31 +00:00
|
|
|
"EMACS=#{emacs.binary}"];
|
2012-09-10 03:42:11 +00:00
|
|
|
|
|
|
|
Dir.chdir "ProofGeneral" do
|
2013-07-08 16:39:31 +00:00
|
|
|
unless emacs.empty?
|
|
|
|
# http://proofgeneral.inf.ed.ac.uk/trac/ticket/458
|
|
|
|
if emacs.major == "24"
|
|
|
|
inreplace 'Makefile', '(setq byte-compile-error-on-warn t)', ''
|
|
|
|
end
|
2012-09-10 03:42:11 +00:00
|
|
|
system "make clean"
|
|
|
|
system "make", "compile", *args
|
|
|
|
end
|
|
|
|
system "make", "install", *args
|
|
|
|
man1.install "doc/proofgeneral.1"
|
|
|
|
info.install "doc/ProofGeneral.info", "doc/PG-adapting.info"
|
|
|
|
|
|
|
|
doc.install "doc/ProofGeneral", "doc/PG-adapting" if build.include? 'with-doc'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def caveats
|
|
|
|
doc = ""
|
|
|
|
if build.include? 'with-doc'
|
|
|
|
doc += <<-EOS.undent
|
2013-07-08 16:39:31 +00:00
|
|
|
HTML documentation is available in:
|
|
|
|
#{HOMEBREW_PREFIX}/share/doc/proof-general
|
2012-09-10 03:42:11 +00:00
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
<<-EOS.undent
|
|
|
|
To use ProofGeneral with Emacs, add the following line to your ~/.emacs file:
|
|
|
|
(load-file "#{HOMEBREW_PREFIX}/share/emacs/site-lisp/ProofGeneral/generic/proof-site.el")
|
|
|
|
#{doc}
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|