111 lines
3.4 KiB
Ruby
111 lines
3.4 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.37.1/netdata-v1.37.1.tar.gz"
|
|
sha256 "2caa042d43ca61007a61294a5ececa037d83a1973bd38032233760341eb1706b"
|
|
license "GPL-3.0-or-later"
|
|
|
|
livecheck do
|
|
url :stable
|
|
regex(/^v?(\d+(?:\.\d+)+)$/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 arm64_ventura: "c1fe430f5ce88d9ea72fcf0493c0582a689bacd15507e1b7b5799f8dee662a99"
|
|
sha256 arm64_monterey: "3de0b861ac33fd618b0838e8c6c9dadd12ceca54029ad324a37d6a7edf18bd68"
|
|
sha256 arm64_big_sur: "c656b23f80a25c748c8b2037b5bc9b47441b064d03d5d62b0b06e509eb7fe01b"
|
|
sha256 ventura: "2f2ef21920aefbcb8f153814ad98ac0131bd6531292d450ff5fa620a4b4cef77"
|
|
sha256 monterey: "98853a637787115a4ebdd12f29c87003630d51b8ca1d322610ca5d791820f6e7"
|
|
sha256 big_sur: "85c3e741ae039fde4c90907143745a15fa669ea4691c36a07660ce9a0cf4bcbe"
|
|
sha256 x86_64_linux: "534611878c9a565efbd45c1ea6c23744af699576b72786b274b8a4caf0cface8"
|
|
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@3"
|
|
depends_on "protobuf-c"
|
|
|
|
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
|
|
# https://github.com/protocolbuffers/protobuf/issues/9947
|
|
ENV.append_to_cflags "-DNDEBUG"
|
|
|
|
# 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
|
|
(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
|