112 lines
3.7 KiB
Ruby
112 lines
3.7 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.1.tar.xz"
|
|
sha256 "ea9d41a9fb9c2b42ad80fc2c82327b5c713d594c969b09e1a49be63fb74f4fae"
|
|
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: "d042f24c2c9d9573b589e53932b1d2175db61af7d031a97209544faa7eb913ae"
|
|
sha256 arm64_monterey: "cb6ca6a5912870098e1ca387311a0902d92018ad5cc0f46a615b959d18c77a30"
|
|
sha256 arm64_big_sur: "f55db3219384185dffe058a2849d57b4bcfbbe28ea1c04185381e90b0313bc10"
|
|
sha256 ventura: "a901228c0dce04129cea33796f1f81b0e4ed3e89687800720944d33902e31059"
|
|
sha256 monterey: "1ed6c8de2983a9991230ccf8e32c6fee32cd1d5d18cc2c7d303b0d6bb76df9b5"
|
|
sha256 big_sur: "1825b70268c0b02075686c7623bbc9bfa000ce42badb09693c7b655fa12645d3"
|
|
sha256 catalina: "f09dbe67cd27bd66748b220fc0596b8c2007ac14b6dcd077d21bc94d8078cd6d"
|
|
sha256 x86_64_linux: "c8a5a3209753d81aebf2f49dcbf4212f4784a6c84fdcfd82238b376cf8f8c9b5"
|
|
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
|