homebrew-core/Formula/mercurial.rb

60 lines
1.9 KiB
Ruby
Raw Normal View History

2011-11-15 17:03:12 +00:00
require 'formula'
class Mercurial < Formula
homepage 'http://mercurial.selenic.com/'
url 'http://mercurial.selenic.com/release/mercurial-2.8.tar.gz'
mirror 'http://fossies.org/linux/misc/mercurial-2.8.tar.gz'
sha1 'a18e47c44bed2149a71d2154d7e0edca226bdd83'
head 'http://selenic.com/repo/hg', :using => :hg
option 'enable-docs', "Build the docs (and require docutils)"
depends_on :python
depends_on :python => 'docutils' if build.include? 'enable-docs'
2011-11-15 17:03:12 +00:00
def install
ENV.minimal_optimization if MacOS.version <= :snow_leopard
python do
# Inside this python do block, the PYTHONPATH (and more) is alreay set up
if python.from_osx? && !MacOS::CLT.installed?
# Help castrated system python on Xcode find the Python.h:
# Setting CFLAGS does not work :-(
inreplace 'setup.py', 'get_python_inc()', "'#{python.incdir}'"
end
if build.include? 'enable-doc'
system "make", "doc", "PREFIX=#{prefix}"
system "make", "install-doc", "PREFIX=#{prefix}"
end
system "make", "PREFIX=#{prefix}", "install-bin"
# Install man pages, which come pre-built in source releases
man1.install 'doc/hg.1'
man5.install 'doc/hgignore.5', 'doc/hgrc.5'
end
2011-11-15 17:03:12 +00:00
# install the completion scripts
bash_completion.install 'contrib/bash_completion' => 'hg-completion.bash'
zsh_completion.install 'contrib/zsh_completion' => '_hg'
2011-11-15 17:03:12 +00:00
end
def caveats
s = ''
if build.head? then s += <<-EOS.undent
2013-07-15 15:42:10 +00:00
To install the --HEAD version of mercurial, you have to:
1. `brew install mercurial` # so brew can use this to fetch sources!
2. `brew unlink mercurial`
3. `brew install mercurial --HEAD`
4. `brew cleanup mercurial` # to remove the older non-HEAD version
EOS
end
s += python.standard_caveats if python
s
end
test do
system "#{bin}/hg", "debuginstall"
end
2011-11-15 17:03:12 +00:00
end