113 lines
3.5 KiB
Ruby
113 lines
3.5 KiB
Ruby
class Netdata < Formula
|
|
desc "Diagnose infrastructure problems with metrics, visualizations & alarms"
|
|
homepage "https://netdata.cloud/"
|
|
url "https://github.com/netdata/netdata/releases/download/v1.29.3/netdata-v1.29.3.tar.gz"
|
|
sha256 "eeba8b18519a9123a3cc8b450dcd042e23a3b145a78a7017a14c47ed36d923df"
|
|
license "GPL-3.0-or-later"
|
|
|
|
livecheck do
|
|
url :stable
|
|
regex(/^v?(\d+(?:\.\d+)+)$/i)
|
|
end
|
|
|
|
bottle do
|
|
rebuild 1
|
|
sha256 arm64_monterey: "67ca927390f0945cbb176b79137fd3970dfbf68caf65cd87660c073957735175"
|
|
sha256 arm64_big_sur: "96e5940c2b39c8d0cf4c3d6400f388d17c4d8a2f6a7feeca6937ed2270cdcf8b"
|
|
sha256 monterey: "ed869060ff8e92144956f9bda4bdf88f69df032c7c9ac6d9d9b008fe32aecba8"
|
|
sha256 big_sur: "d3bad874d783b3b59407768d7ef796c4a596e89aca6aaa7ea66194c7b809a193"
|
|
sha256 catalina: "f4c04a549cdacdfce6549bae882621cf91c08c3aeb974947ed61724fc9feb057"
|
|
sha256 mojave: "52acdf9ac5b1986cdc7f02d079a74486db527e32e09036ce2505c38c85c8d125"
|
|
sha256 x86_64_linux: "bd46e05291b7d286be7bc9e50ddb4a04dd162135f71708e5e4a8513996af5266"
|
|
end
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "json-c"
|
|
depends_on "libuv"
|
|
depends_on "lz4"
|
|
depends_on "openssl@1.1"
|
|
|
|
uses_from_macos "zlib"
|
|
|
|
on_linux do
|
|
depends_on "util-linux"
|
|
end
|
|
|
|
resource "judy" do
|
|
url "https://downloads.sourceforge.net/project/judy/judy/Judy-1.0.5/Judy-1.0.5.tar.gz"
|
|
sha256 "d2704089f85fdb6f2cd7e77be21170ced4b4375c03ef1ad4cf1075bd414a63eb"
|
|
end
|
|
|
|
def install
|
|
# We build judy as static library, so we don't need to install it
|
|
# into the real prefix
|
|
judyprefix = "#{buildpath}/resources/judy"
|
|
|
|
resource("judy").stage do
|
|
system "./configure", "--disable-debug", "--disable-dependency-tracking",
|
|
"--disable-shared", "--prefix=#{judyprefix}"
|
|
|
|
# Parallel build is broken
|
|
ENV.deparallelize do
|
|
system "make", "-j1", "install"
|
|
end
|
|
end
|
|
|
|
ENV["PREFIX"] = prefix
|
|
ENV.append "CFLAGS", "-I#{judyprefix}/include"
|
|
ENV.append "LDFLAGS", "-L#{judyprefix}/lib"
|
|
|
|
system "autoreconf", "-ivf"
|
|
args = %W[
|
|
--disable-dependency-tracking
|
|
--disable-silent-rules
|
|
--prefix=#{prefix}
|
|
--sysconfdir=#{etc}
|
|
--localstatedir=#{var}
|
|
--libexecdir=#{libexec}
|
|
--with-math
|
|
--with-zlib
|
|
--enable-dbengine
|
|
--with-user=netdata
|
|
]
|
|
if OS.mac?
|
|
args << "UUID_LIBS=-lc"
|
|
args << "UUID_CFLAGS=-I/usr/include"
|
|
else
|
|
args << "UUID_LIBS=-luuid"
|
|
args << "UUID_CFLAGS=-I#{Formula["util-linux"].opt_include}"
|
|
end
|
|
system "./configure", *args
|
|
system "make", "clean"
|
|
system "make", "install"
|
|
|
|
(etc/"netdata").install "system/netdata.conf"
|
|
end
|
|
|
|
def post_install
|
|
config = etc/"netdata/netdata.conf"
|
|
inreplace config do |s|
|
|
s.gsub!(/web files owner = .*/, "web files owner = #{ENV["USER"]}")
|
|
s.gsub!(/web files group = .*/, "web files group = #{Etc.getgrgid(prefix.stat.gid).name}")
|
|
end
|
|
(var/"cache/netdata/unittest-dbengine/dbengine").mkpath
|
|
(var/"lib/netdata/registry").mkpath
|
|
(var/"log/netdata").mkpath
|
|
(var/"netdata").mkpath
|
|
end
|
|
|
|
service do
|
|
run [opt_sbin/"netdata", "-D"]
|
|
working_dir var
|
|
end
|
|
|
|
test do
|
|
system "#{sbin}/netdata", "-W", "set", "registry", "netdata unique id file",
|
|
"#{testpath}/netdata.unittest.unique.id",
|
|
"-W", "set", "registry", "netdata management api key file",
|
|
"#{testpath}/netdata.api.key"
|
|
end
|
|
end
|