2011-11-15 17:03:12 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Mercurial < Formula
|
|
|
|
homepage 'http://mercurial.selenic.com/'
|
2012-03-02 20:52:27 +00:00
|
|
|
url 'http://mercurial.selenic.com/release/mercurial-2.1.1.tar.gz'
|
|
|
|
sha1 'd6cc4b649b6705113732e62756788542897ba008'
|
2012-02-29 23:53:16 +00:00
|
|
|
|
2011-11-19 14:49:55 +00:00
|
|
|
head 'http://selenic.com/repo/hg', :using => :hg
|
|
|
|
|
|
|
|
depends_on 'docutils' => :python if ARGV.build_head? or ARGV.include? "--doc"
|
|
|
|
|
|
|
|
def options
|
2012-02-18 17:29:34 +00:00
|
|
|
[["--doc", "build the documentation. Depends on 'docutils' module."]]
|
|
|
|
end
|
|
|
|
|
|
|
|
def patches
|
2012-03-02 20:52:27 +00:00
|
|
|
# Fix xcodebuild handling in setup.py; is present in HEAD
|
|
|
|
"http://selenic.com/hg/raw-rev/5536770b3c88" unless ARGV.build_head?
|
2011-11-19 14:49:55 +00:00
|
|
|
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
|
|
|
|
|
2012-02-27 05:48:00 +00:00
|
|
|
# install the completion script
|
|
|
|
(prefix + 'etc/bash_completion.d').install 'contrib/bash_completion' => 'hg-completion.bash'
|
|
|
|
|
2011-11-15 17:03:12 +00:00
|
|
|
# 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
|
2012-02-29 23:53:16 +00:00
|
|
|
system "make", "doc" if ARGV.build_head? or ARGV.include? "--doc"
|
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.
|
|
|
|
libexec.install Dir["#{lib}/python*/site-packages/*"]
|
|
|
|
|
2011-11-15 17:06:08 +00:00
|
|
|
# Symlink the hg binary into bin
|
2012-02-12 22:46:07 +00:00
|
|
|
bin.install_symlink libexec+'hg'
|
2011-11-15 17:03:12 +00:00
|
|
|
|
|
|
|
# Remove the hard-coded python invocation from hg
|
2012-03-01 04:55:06 +00:00
|
|
|
inreplace bin+'hg', %r[#!/.*/python(/.*)?], '#!/usr/bin/env python'
|
2011-11-15 17:03:12 +00:00
|
|
|
|
|
|
|
# Install some contribs
|
|
|
|
bin.install 'contrib/hgk'
|
|
|
|
|
|
|
|
# Install man pages
|
|
|
|
man1.install 'doc/hg.1'
|
2012-02-12 22:46:07 +00:00
|
|
|
man5.install 'doc/hgignore.5', 'doc/hgrc.5'
|
2011-11-15 17:03:12 +00:00
|
|
|
end
|
2011-11-19 14:49:55 +00:00
|
|
|
|
|
|
|
def caveats
|
2012-02-29 23:53:16 +00:00
|
|
|
if ARGV.build_head? then <<-EOS.undent
|
|
|
|
Mercurial is required to fetch its own repository, so there are now two
|
|
|
|
installations of mercurial on this machine. If the previous installation
|
|
|
|
was done via Homebrew, the old version may need to be cleaned up and new
|
|
|
|
version linked:
|
2011-11-19 14:49:55 +00:00
|
|
|
|
|
|
|
brew cleanup mercurial && brew link mercurial
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|
2011-11-15 17:03:12 +00:00
|
|
|
end
|