homebrew-core/Formula/zabbix.rb

73 lines
2.2 KiB
Ruby

class Zabbix < Formula
desc "Availability and monitoring solution"
homepage "https://www.zabbix.com/"
url "https://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.2.3/zabbix-3.2.3.tar.gz"
sha256 "e6dba74039d8d6efff86ec3da99909f4daeaeb66d48781bbb666e3094533da25"
bottle do
sha256 "11186942afe721513cf62f293506319c14ebfee244e287275cf92175077de477" => :sierra
sha256 "afbeeff30b41bd92c76c2febd99584d534a2fba6df6fd5adb6f1d43525f4f1d9" => :el_capitan
sha256 "12955b6b4ebd4686bb398214633bfebdfda5b21e9fcb9ee1c3ed41b68eb515bb" => :yosemite
end
option "with-mysql", "Use Zabbix Server with MySQL library instead PostgreSQL."
option "without-server-proxy", "Install only the Zabbix Agent without Server and Proxy."
deprecated_option "agent-only" => "without-server-proxy"
if build.with? "server-proxy"
depends_on :mysql => :optional
depends_on :postgresql if build.without? "mysql"
depends_on "fping"
depends_on "libssh2"
end
def brewed_or_shipped(db_config)
brewed_db_config = "#{HOMEBREW_PREFIX}/bin/#{db_config}"
(File.exist?(brewed_db_config) && brewed_db_config) || which(db_config)
end
def install
args = %W[
--disable-dependency-tracking
--prefix=#{prefix}
--enable-agent
--with-iconv=#{MacOS.sdk_path}/usr
]
if build.with? "server-proxy"
args += %w[
--enable-server
--enable-proxy
--enable-ipv6
--with-net-snmp
--with-libcurl
--with-ssh2
]
if build.with? "mysql"
args << "--with-mysql=#{brewed_or_shipped("mysql_config")}"
else
args << "--with-postgresql=#{brewed_or_shipped("pg_config")}"
end
end
if MacOS.version == :el_capitan && MacOS::Xcode.installed? && MacOS::Xcode.version >= "8.0"
inreplace "configure", "clock_gettime(CLOCK_REALTIME, &tp);",
"undefinedgibberish(CLOCK_REALTIME, &tp);"
end
system "./configure", *args
system "make", "install"
if build.with? "server-proxy"
db = build.with?("mysql") ? "mysql" : "postgresql"
pkgshare.install "frontends/php", "database/#{db}"
end
end
test do
system "#{sbin}/zabbix_agentd", "--print"
end
end