aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/mtr.rb
blob: d84ba4391abe8d3d96f982c43f294f119974e7a6 (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
require 'formula'

class Mtr < Formula
  homepage 'http://www.bitwizard.nl/mtr/'
  url 'ftp://ftp.bitwizard.nl/mtr/mtr-0.82.tar.gz'
  sha1 'f1319de27324d85898a9df0a293a438bbaaa12b5'

  depends_on 'gtk+' if ARGV.include? "--with-gtk"

  def options
    [['--with-gtk', "Build with Gtk+ support"]]
  end

  def install
    # We need to add this because nameserver8_compat.h has been removed in Snow Leopard
    ENV['LIBS'] = "-lresolv"
    args = %W[
      --disable-dependency-tracking
      --prefix=#{prefix}
    ]
    args << "--without-gtk" unless ARGV.include? "--with-gtk"
    system "./configure", *args
    system "make install"
  end

  def caveats; <<-EOS.undent
    mtr requires superuser privileges. You can either run the program
    via `sudo`, or change its ownership to root and set the setuid bit:

      sudo chown root:wheel #{sbin}/mtr
      sudo chmod u+s #{sbin}/mtr

    In any case, you should be certain that you trust the software you
    are executing with elevated privileges.
    EOS
  end
end