aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/net-snmp.rb
blob: 4319ba13a271634472cb7e3418ffff8d2266a58e (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
require "formula"

class MaximumMacOSRequirement < Requirement
  fatal true

  def initialize(tags)
    @version = MacOS::Version.from_symbol(tags.first)
    super
  end

  satisfy { MacOS.version <= @version }

  def message
    <<-EOS.undent
      OS X #{@version.pretty_name} or older is required for stable.
      Use `brew install --devel` on newer versions.
    EOS
  end
end

class NetSnmp < Formula
  homepage "http://www.net-snmp.org/"

  stable do
    url "https://downloads.sourceforge.net/project/net-snmp/net-snmp/5.7.2.1/net-snmp-5.7.2.1.tar.gz"
    sha1 "815d4e5520a1ed96a27def33e7534b4190599f0f"

    depends_on MaximumMacOSRequirement => :mountain_lion
  end

  bottle do
    sha1 "6f1ff81bde5defe92b4a2062fba099c8310f9662" => :mountain_lion
    sha1 "cfeb129e4130ed17656443efd728ae0812a78720" => :lion
  end

  devel do
    url "https://downloads.sourceforge.net/project/net-snmp/net-snmp/5.7.3-pre-releases/net-snmp-5.7.3.pre3.tar.gz"
    version "5.7.3.pre3"
    sha1 "5e46232a2508a3cb6543f0438569090f78e4a20e"
  end

  depends_on :python => :optional

  def install
    args = [
      "--disable-debugging",
      "--prefix=#{prefix}",
      "--enable-ipv6",
      "--with-defaults",
      "--with-persistent-directory=#{var}/db/net-snmp",
      "--with-logfile=#{var}/log/snmpd.log",
      "--with-mib-modules=host ucd-snmp/diskio",
      "--without-rpm",
      "--without-kmem-usage",
      "--disable-embedded-perl",
      "--without-perl-modules",
    ]

    if build.with? "python"
      args << "--with-python-modules"
      ENV["PYTHONPROG"] = `which python`
    end

    system "./configure", *args
    system "make"
    system "make", "install"
  end
end