homebrew-core/Formula/tracker.rb

110 lines
3.2 KiB
Ruby

class Tracker < Formula
desc "Library and daemon that is an efficient search engine and triplestore"
homepage "https://gnome.pages.gitlab.gnome.org/tracker/"
url "https://download.gnome.org/sources/tracker/3.1/tracker-3.1.2.tar.xz"
sha256 "da368962665d587bb2e4f164d75919a81dacb35c7d4cfae6f93a94c60f60ec8f"
license all_of: ["LGPL-2.1-or-later", "GPL-2.0-or-later"]
# Tracker doesn't follow GNOME's "even-numbered minor is stable" version scheme.
livecheck do
url :stable
regex(/tracker[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_big_sur: "22d7bddd7ef62d58620d9590664d5d954b1985bf5ac2f348dc4e5b85aeeb2180"
sha256 big_sur: "b5480a9ef45026bd14856f34bec78aba56235e187c340dacd0b981077bab3b48"
sha256 catalina: "a632269a8bae5af05e365a08766e60219657940035d7383bedf81afcf16ca143"
sha256 mojave: "68bc5591c3593ad5d9b03d25ccb0c6958f7919e783d822ae723ae76594dfe6a7"
end
depends_on "gobject-introspection" => :build
depends_on "meson" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "vala" => :build
depends_on "dbus"
depends_on "json-glib"
depends_on "libsoup"
uses_from_macos "icu4c"
def install
args = std_meson_args + %w[
-Dman=false
-Ddocs=false
-Dsystemd_user_services=false
]
ENV["DESTDIR"] = "/"
mkdir "build" do
system "meson", *args, ".."
system "ninja", "-v"
system "ninja", "install", "-v"
end
end
def post_install
system "#{Formula["glib"].opt_bin}/glib-compile-schemas", "#{HOMEBREW_PREFIX}/share/glib-2.0/schemas"
end
test do
(testpath/"test.c").write <<~EOS
#include <libtracker-sparql/tracker-sparql.h>
gint main(gint argc, gchar *argv[]) {
g_autoptr(GError) error = NULL;
g_autoptr(GFile) store, ontology;
g_autoptr(TrackerSparqlConnection) connection;
g_autoptr(TrackerSparqlCursor) cursor;
int i = 0;
ontology = tracker_sparql_get_ontology_nepomuk();
connection = tracker_sparql_connection_new(0, store, ontology, NULL, &error);
if (error) {
g_critical("Error: %s", error->message);
return 1;
}
cursor = tracker_sparql_connection_query(connection, "SELECT ?r { ?r a rdfs:Resource }", NULL, &error);
if (error) {
g_critical("Couldn't query: %s", error->message);
return 1;
}
while (tracker_sparql_cursor_next(cursor, NULL, &error)) {
if (error) {
g_critical("Couldn't get next: %s", error->message);
return 1;
}
if (i++ < 5) {
if (i == 1) {
g_print("Printing first 5 results:");
}
g_print("%s", tracker_sparql_cursor_get_string(cursor, 0, NULL));
}
}
return 0;
}
EOS
glib = Formula["glib"]
flags = %W[
-I#{glib.opt_include}/glib-2.0
-I#{glib.opt_lib}/glib-2.0/include
-I#{include}/tracker-3.0
-D_REENTRANT
-L#{glib.opt_lib}
-L#{lib}
-ltracker-sparql-3.0
-lgio-2.0
-lglib-2.0
-lgobject-2.0
]
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end