aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/mercurial.rb
blob: c2b9c7de24b758ac85a13eccb11ace458c51de9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
require 'formula'

class Mercurial < Formula
  homepage 'http://mercurial.selenic.com/'
  url 'http://mercurial.selenic.com/release/mercurial-2.9.2.tar.gz'
  mirror 'http://fossies.org/linux/misc/mercurial-2.9.2.tar.gz'
  sha1 '35668f2d88afe55d10aa7dbce821021bf0be4f73'

  head 'http://selenic.com/repo/hg', :using => :hg

  option 'enable-docs', "Build the docs (and require docutils)"

  depends_on :python
  depends_on 'docutils' => :python if build.include? 'enable-docs'

  def install
    ENV.minimal_optimization if MacOS.version <= :snow_leopard
    if build.include? 'enable-docs'
      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'

    # install the completion scripts
    bash_completion.install 'contrib/bash_completion' => 'hg-completion.bash'
    zsh_completion.install 'contrib/zsh_completion' => '_hg'
  end

  def caveats
    if build.head?; <<-EOS.undent
      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
  end

  test do
    system "#{bin}/hg", "debuginstall"
  end
end