homebrew-core/Formula/libnotify.rb

75 lines
2.2 KiB
Ruby

class Libnotify < Formula
desc "Library that sends desktop notifications to a notification daemon"
homepage "https://developer.gnome.org/libnotify"
url "https://download.gnome.org/sources/libnotify/0.7/libnotify-0.7.9.tar.xz"
sha256 "66c0517ed16df7af258e83208faaf5069727dfd66995c4bbc51c16954d674761"
license "LGPL-2.1"
# libnotify uses GNOME's "even-numbered minor is stable" version scheme but
# we've been using a development version 0.7.x for many years, so we have to
# match development versions until we're on a stable release.
livecheck do
url :stable
regex(/libnotify-(\d+(?:\.\d+)+)\.t/i)
end
bottle do
cellar :any
sha256 "367a8d51cb565452392b9bc92c753ca641c23f91fc4ff93fb6166b63f2beafda" => :catalina
sha256 "e6d5a6a87f885bf421e6a70c9cef1c6aaf89db46a98216af6c06754246a8f896" => :mojave
sha256 "0560e601843a3e42a4823904dd5534212efd823292444a9588f1cf99ea8bc8f5" => :high_sierra
end
depends_on "docbook-xsl" => :build
depends_on "gobject-introspection" => :build
depends_on "gtk-doc" => :build
depends_on "meson" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "gdk-pixbuf"
def install
ENV["XML_CATALOG_FILES"] = "#{etc}/xml/catalog"
mkdir "build" do
system "meson", *std_meson_args, "-Dtests=false", ".."
system "ninja"
system "ninja", "install"
end
end
test do
(testpath/"test.c").write <<~EOS
#include <libnotify/notify.h>
int main(int argc, char *argv[]) {
g_assert_true(notify_init("testapp"));
return 0;
}
EOS
gettext = Formula["gettext"]
glib = Formula["glib"]
gdk_pixbuf = Formula["gdk-pixbuf"]
flags = %W[
-I#{gettext.opt_include}
-I#{gdk_pixbuf.opt_include}/gdk-pixbuf-2.0
-I#{glib.opt_include}/glib-2.0
-I#{glib.opt_lib}/glib-2.0/include
-I#{include}
-D_REENTRANT
-L#{gettext.opt_lib}
-L#{glib.opt_lib}
-L#{gdk_pixbuf.opt_lib}
-L#{lib}
-lnotify
-lgdk_pixbuf-2.0
-lgio-2.0
-lglib-2.0
-lgobject-2.0
-lintl
]
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end