lol
1{ stdenv
2, lib
3, fetchurl
4, gettext
5, meson
6, ninja
7, pkg-config
8, asciidoc
9, gobject-introspection
10, python3
11, docbook-xsl-nons
12, docbook_xml_dtd_45
13, libxml2
14, glib
15, wrapGAppsNoGuiHook
16, sqlite
17, libxslt
18, libstemmer
19, gnome
20, icu
21, libuuid
22, libsoup
23, libsoup_3
24, json-glib
25, systemd
26, dbus
27, writeText
28}:
29
30stdenv.mkDerivation rec {
31 pname = "tracker";
32 version = "3.4.1";
33
34 outputs = [ "out" "dev" "devdoc" ];
35
36 src = fetchurl {
37 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
38 sha256 = "6p1BqfucK0KtgPwsgjJ7XHE9WUyWmwnhpJvmP7dPT64=";
39 };
40
41 postPatch = ''
42 patchShebangs utils/data-generators/cc/generate
43 '';
44
45 depsBuildBuild = [
46 pkg-config
47 ];
48
49 nativeBuildInputs = [
50 meson
51 ninja
52 pkg-config
53 asciidoc
54 gettext
55 libxslt
56 wrapGAppsNoGuiHook
57 gobject-introspection
58 docbook-xsl-nons
59 docbook_xml_dtd_45
60 (python3.pythonForBuild.withPackages (p: [ p.pygobject3 ]))
61 ];
62
63 buildInputs = [
64 gobject-introspection
65 glib
66 libxml2
67 sqlite
68 icu
69 libsoup
70 libsoup_3
71 libuuid
72 json-glib
73 libstemmer
74 dbus
75 ] ++ lib.optionals stdenv.isLinux [
76 systemd
77 ];
78
79 mesonFlags = [
80 "-Ddocs=true"
81 ] ++ (
82 let
83 # https://gitlab.gnome.org/GNOME/tracker/-/blob/master/meson.build#L159
84 crossFile = writeText "cross-file.conf" ''
85 [properties]
86 sqlite3_has_fts5 = '${lib.boolToString (lib.hasInfix "-DSQLITE_ENABLE_FTS3" sqlite.NIX_CFLAGS_COMPILE)}'
87 '';
88 in
89 [
90 "--cross-file=${crossFile}"
91 ]
92 ) ++ lib.optionals (!stdenv.isLinux) [
93 "-Dsystemd_user_services=false"
94 ];
95
96 doCheck = true;
97
98 preCheck =
99 let
100 linuxDot0 = lib.optionalString stdenv.isLinux ".0";
101 darwinDot0 = lib.optionalString stdenv.isDarwin ".0";
102 extension = stdenv.hostPlatform.extensions.sharedLibrary;
103 in
104 ''
105 # (tracker-store:6194): Tracker-CRITICAL **: 09:34:07.722: Cannot initialize database: Could not open sqlite3 database:'/homeless-shelter/.cache/tracker/meta.db': unable to open database file
106 export HOME=$(mktemp -d)
107
108 # Our gobject-introspection patches make the shared library paths absolute
109 # in the GIR files. When running functional tests, the library is not yet installed,
110 # though, so we need to replace the absolute path with a local one during build.
111 # We are using a symlink that will be overridden during installation.
112 mkdir -p $out/lib
113 ln -s $PWD/src/libtracker-sparql/libtracker-sparql-3.0${darwinDot0}${extension} $out/lib/libtracker-sparql-3.0${darwinDot0}${extension}${linuxDot0}
114 '';
115
116 checkPhase = ''
117 runHook preCheck
118
119 dbus-run-session \
120 --config-file=${dbus.daemon}/share/dbus-1/session.conf \
121 meson test \
122 --timeout-multiplier 2 \
123 --print-errorlogs
124
125 runHook postCheck
126 '';
127
128 postCheck = ''
129 # Clean up out symlinks
130 rm -r $out/lib
131 '';
132
133 passthru = {
134 updateScript = gnome.updateScript {
135 packageName = pname;
136 };
137 };
138
139 meta = with lib; {
140 homepage = "https://wiki.gnome.org/Projects/Tracker";
141 description = "Desktop-neutral user information store, search tool and indexer";
142 maintainers = teams.gnome.members;
143 license = licenses.gpl2Plus;
144 platforms = platforms.unix;
145 };
146}