111 lines
3.6 KiB
Ruby
111 lines
3.6 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.4/tracker-3.4.2.tar.xz"
|
|
sha256 "4e6df142a4f704878fca98ebb5a224750e5ea546aa2aaabaa726a73540bd1731"
|
|
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_ventura: "25220e2fe811db4a7887b3f071ad49d5136066bb132f859df6f53975a2e2d5a2"
|
|
sha256 arm64_monterey: "0eb8634c38d2b09071c4283442a5df7dcc108c4bcb1fe89af17dbaaebb79cb6c"
|
|
sha256 arm64_big_sur: "5200c2039328369a8f497f65e657ab29e31e0e8b64484f671361655af14188cd"
|
|
sha256 ventura: "1dd30eb22b7f302bb6926ff8cb3e360c440a319ebfb77eaab0898b3f75df07b8"
|
|
sha256 monterey: "e899d719c821a34cc30282a6203be5c8cd4141d9ba917e6804b8f6d8ea855c3d"
|
|
sha256 big_sur: "28f909c8b463cb4ee9b056473850b7adbfc470b36a06ef90d2710be1d6bf6dba"
|
|
sha256 x86_64_linux: "284fc92a1363d399eed150db8c9b323778a48e5d025cf200f705ea9b386187ce"
|
|
end
|
|
|
|
depends_on "gobject-introspection" => :build
|
|
depends_on "meson" => :build
|
|
depends_on "ninja" => :build
|
|
depends_on "pkg-config" => [:build, :test]
|
|
depends_on "pygobject3" => :build
|
|
depends_on "vala" => :build
|
|
depends_on "dbus"
|
|
depends_on "glib"
|
|
depends_on "icu4c"
|
|
depends_on "json-glib"
|
|
depends_on "libsoup"
|
|
depends_on "sqlite"
|
|
|
|
uses_from_macos "python" => :build, since: :catalina
|
|
uses_from_macos "libxml2"
|
|
|
|
def install
|
|
args = std_meson_args + %w[
|
|
-Dman=false
|
|
-Ddocs=false
|
|
-Dsystemd_user_services=false
|
|
-Dtests=false
|
|
-Dsoup=soup3
|
|
]
|
|
|
|
ENV["DESTDIR"] = "/"
|
|
mkdir "build" do
|
|
system "meson", *args, ".."
|
|
# Disable parallel build due to error: 'libtracker-sparql/tracker-sparql-enum-types.h' file not found
|
|
system "ninja", "-v", "-j1"
|
|
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) ontology;
|
|
g_autoptr(TrackerSparqlConnection) connection;
|
|
g_autoptr(TrackerSparqlCursor) cursor;
|
|
int i = 0;
|
|
|
|
ontology = tracker_sparql_get_ontology_nepomuk();
|
|
connection = tracker_sparql_connection_new(0, NULL, 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
|
|
ENV.prepend_path "PKG_CONFIG_PATH", Formula["icu4c"].opt_lib/"pkgconfig" if OS.mac?
|
|
flags = shell_output("pkg-config --cflags --libs tracker-sparql-3.0").chomp.split
|
|
system ENV.cc, "test.c", "-o", "test", *flags
|
|
system "./test"
|
|
end
|
|
end
|