Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 24.05-beta 184 lines 4.6 kB view raw
1{ stdenv 2, lib 3, fetchurl 4, gettext 5, meson 6, mesonEmulatorHook 7, ninja 8, pkg-config 9, asciidoc 10, gobject-introspection 11, buildPackages 12, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages 13, vala 14, python3 15, gi-docgen 16, graphviz 17, libxml2 18, glib 19, wrapGAppsNoGuiHook 20, sqlite 21, libstemmer 22, gnome 23, icu 24, libuuid 25, libsoup 26, libsoup_3 27, json-glib 28, avahi 29, systemd 30, dbus 31, writeText 32, testers 33}: 34 35stdenv.mkDerivation (finalAttrs: { 36 pname = "tracker"; 37 version = "3.7.3"; 38 39 outputs = [ "out" "dev" "devdoc" ]; 40 41 src = fetchurl { 42 url = with finalAttrs; "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; 43 hash = "sha256-qz1KUJN+BMXteEb227mZ4pCYGUAvOJylku5rd90o0fk="; 44 }; 45 46 strictDeps = true; 47 48 depsBuildBuild = [ 49 pkg-config 50 ]; 51 52 nativeBuildInputs = [ 53 meson 54 ninja 55 pkg-config 56 asciidoc 57 gettext 58 glib 59 wrapGAppsNoGuiHook 60 gi-docgen 61 graphviz 62 (python3.pythonOnBuildForHost.withPackages (p: [ p.pygobject3 ])) 63 ] ++ lib.optionals withIntrospection [ 64 gobject-introspection 65 vala 66 ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ 67 mesonEmulatorHook 68 ]; 69 70 buildInputs = [ 71 glib 72 libxml2 73 sqlite 74 icu 75 libsoup 76 libsoup_3 77 libuuid 78 json-glib 79 avahi 80 libstemmer 81 dbus 82 ] ++ lib.optionals stdenv.isLinux [ 83 systemd 84 ]; 85 86 nativeCheckInputs = [ 87 dbus 88 ]; 89 90 mesonFlags = [ 91 "-Ddocs=true" 92 (lib.mesonEnable "introspection" withIntrospection) 93 (lib.mesonEnable "vapi" withIntrospection) 94 (lib.mesonBool "test_utils" withIntrospection) 95 ] ++ ( 96 let 97 # https://gitlab.gnome.org/GNOME/tracker/-/blob/master/meson.build#L159 98 crossFile = writeText "cross-file.conf" '' 99 [properties] 100 sqlite3_has_fts5 = '${lib.boolToString (lib.hasInfix "-DSQLITE_ENABLE_FTS3" sqlite.NIX_CFLAGS_COMPILE)}' 101 ''; 102 in 103 [ 104 "--cross-file=${crossFile}" 105 ] 106 ) ++ lib.optionals (!stdenv.isLinux) [ 107 "-Dsystemd_user_services=false" 108 ]; 109 110 doCheck = 111 # https://gitlab.gnome.org/GNOME/tracker/-/issues/402 112 !stdenv.isDarwin 113 # https://gitlab.gnome.org/GNOME/tracker/-/issues/398 114 && !stdenv.is32bit; 115 116 postPatch = '' 117 chmod +x \ 118 docs/reference/libtracker-sparql/embed-files.py \ 119 docs/reference/libtracker-sparql/generate-svgs.sh 120 patchShebangs \ 121 utils/data-generators/cc/generate \ 122 docs/reference/libtracker-sparql/embed-files.py \ 123 docs/reference/libtracker-sparql/generate-svgs.sh 124 ''; 125 126 preCheck = 127 let 128 linuxDot0 = lib.optionalString stdenv.isLinux ".0"; 129 darwinDot0 = lib.optionalString stdenv.isDarwin ".0"; 130 extension = stdenv.hostPlatform.extensions.sharedLibrary; 131 in 132 '' 133 # (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 134 export HOME=$(mktemp -d) 135 136 # Our gobject-introspection patches make the shared library paths absolute 137 # in the GIR files. When running functional tests, the library is not yet installed, 138 # though, so we need to replace the absolute path with a local one during build. 139 # We are using a symlink that will be overridden during installation. 140 mkdir -p $out/lib 141 ln -s $PWD/src/libtracker-sparql/libtracker-sparql-3.0${darwinDot0}${extension} $out/lib/libtracker-sparql-3.0${darwinDot0}${extension}${linuxDot0} 142 ''; 143 144 checkPhase = '' 145 runHook preCheck 146 147 dbus-run-session \ 148 --config-file=${dbus}/share/dbus-1/session.conf \ 149 meson test \ 150 --timeout-multiplier 2 \ 151 --print-errorlogs 152 153 runHook postCheck 154 ''; 155 156 postCheck = '' 157 # Clean up out symlinks 158 rm -r $out/lib 159 ''; 160 161 postFixup = '' 162 # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back. 163 moveToOutput "share/doc" "$devdoc" 164 ''; 165 166 passthru = { 167 updateScript = gnome.updateScript { 168 packageName = finalAttrs.pname; 169 }; 170 tests.pkg-config = testers.hasPkgConfigModules { 171 package = finalAttrs.finalPackage; 172 }; 173 }; 174 175 meta = with lib; { 176 homepage = "https://tracker.gnome.org/"; 177 description = "Desktop-neutral user information store, search tool and indexer"; 178 mainProgram = "tracker3"; 179 maintainers = teams.gnome.members; 180 license = licenses.gpl2Plus; 181 platforms = platforms.unix; 182 pkgConfigModules = [ "tracker-sparql-3.0" "tracker-testutils-3.0" ]; 183 }; 184})