2011-11-15 17:03:12 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Mercurial < Formula
|
2011-11-19 14:49:55 +00:00
|
|
|
url 'http://mercurial.selenic.com/release/mercurial-2.0.tar.gz'
|
2011-11-15 17:03:12 +00:00
|
|
|
homepage 'http://mercurial.selenic.com/'
|
2011-11-19 14:49:55 +00:00
|
|
|
head 'http://selenic.com/repo/hg', :using => :hg
|
|
|
|
sha1 '5ede1b3f54d3be2af0657901e7013dde7c19b7c5'
|
|
|
|
|
|
|
|
depends_on 'docutils' => :python if ARGV.build_head? or ARGV.include? "--doc"
|
|
|
|
|
|
|
|
def options
|
|
|
|
[
|
|
|
|
["--doc", "build the documentation. Depends on 'docutils' module."],
|
|
|
|
]
|
|
|
|
end
|
2011-11-15 17:03:12 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
# Don't add compiler specific flags so we can build against
|
|
|
|
# System-provided Python.
|
|
|
|
ENV.minimal_optimization
|
|
|
|
|
|
|
|
# Force the binary install path to the Cellar
|
|
|
|
inreplace "Makefile",
|
|
|
|
"setup.py $(PURE) install",
|
|
|
|
"setup.py $(PURE) install --install-scripts=\"#{libexec}\""
|
|
|
|
|
|
|
|
# Make Mercurial into the Cellar.
|
2011-11-19 14:49:55 +00:00
|
|
|
# The documentation must be built when using HEAD
|
|
|
|
if ARGV.build_head? or ARGV.include? "--doc"
|
|
|
|
system "make", "doc"
|
|
|
|
end
|
2011-11-15 17:03:12 +00:00
|
|
|
system "make", "PREFIX=#{prefix}", "build"
|
|
|
|
system "make", "PREFIX=#{prefix}", "install-bin"
|
2011-11-15 17:06:08 +00:00
|
|
|
|
2011-11-15 17:03:12 +00:00
|
|
|
# Now we have lib/python2.x/site-packages/ with Mercurial
|
|
|
|
# libs in them. We want to move these out of site-packages into
|
|
|
|
# a self-contained folder. Let's choose libexec.
|
|
|
|
bin.mkpath
|
|
|
|
libexec.mkpath
|
|
|
|
|
|
|
|
libexec.install Dir["#{lib}/python*/site-packages/*"]
|
|
|
|
|
2011-11-15 17:06:08 +00:00
|
|
|
# Symlink the hg binary into bin
|
2011-11-15 17:03:12 +00:00
|
|
|
ln_s libexec+'hg', bin+'hg'
|
|
|
|
|
|
|
|
# Remove the hard-coded python invocation from hg
|
|
|
|
inreplace bin+'hg', %r[#!/.*/python], '#!/usr/bin/env python'
|
|
|
|
|
|
|
|
# Install some contribs
|
|
|
|
bin.install 'contrib/hgk'
|
|
|
|
|
|
|
|
# Install man pages
|
|
|
|
man1.install 'doc/hg.1'
|
|
|
|
man5.install ['doc/hgignore.5', 'doc/hgrc.5']
|
|
|
|
end
|
2011-11-19 14:49:55 +00:00
|
|
|
|
|
|
|
def caveats
|
|
|
|
s = ""
|
|
|
|
if ARGV.build_head?
|
|
|
|
s += <<-EOS.undent
|
|
|
|
As mercurial is required to get its own repository, there is now two
|
|
|
|
installations of mercurial on this machine.
|
|
|
|
If the previous installation has been done through Homebrew, the old version
|
|
|
|
needs to be removed and the new one needs to be linked :
|
|
|
|
|
|
|
|
brew cleanup mercurial && brew link mercurial
|
|
|
|
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
return s
|
|
|
|
end
|
2011-11-15 17:03:12 +00:00
|
|
|
end
|