# Maintainer: Joey Yakimowich-Payne <jyapayne@pm.me>
#
# BlueRune's notes search example (examples/extensions/notes-search) for every user: the search
# provider, its key file, app entry and D-Bus service (the bus starts it when a search needs
# it), and its metainfo and icon for the Store (docs/extensions.md, "Packaging an extension").
# The files beside this PKGBUILD that link into the tree are resolved when
# release/publish.sh --extras exports it.
pkgname=bluerune-extension-notes-search
pkgver=1
pkgrel=1
pkgdesc="Your notes in BlueRune's launcher (and GNOME's overview)"
arch=('any')
url='https://bluerune.dev/docs/extensions/'
license=('Apache-2.0 OR MIT')
install=bluerune-extension-notes-search.install
# Search providers in the launcher came after 0.3.3.
depends=('bluerune>0.3.3' 'python' 'python-gobject' 'glib2' 'hicolor-icon-theme')
source=(
    bluerune-notes-search
    org.bluerune.NotesSearch.ini
    org.bluerune.NotesSearch.desktop
    org.bluerune.NotesSearch.service
    org.bluerune.Extension.NotesSearch.metainfo.xml
    org.bluerune.Extension.NotesSearch.svg
    LICENSE-MIT
)
sha256sums=('7be50137ccb9944694870b6fe52d635097fbf6ebd6a7223281db2c0dc11f7af1'
            'edb425be8785db3b3330d4a9bac633281e5ee121c21e2d26d039370afa709e11'
            '306befa27643b7d4d685cc267ee47a12831fbca9336273cd77cc849323c0ac92'
            '5a28ab78029e449e9f9db050cf598245d444984fbc569f6874103a18ea432d5a'
            '3a3050b9911b43e23bfebd01054c88d2e36d88a568c9481971de3a5854718ca4'
            'b6ac70fe650a02a953f792c76b9e23f68235a89dd8a45f9c009c9d1b5bd5ac5e'
            'de6686d0422e16d4c09e5af7bc8b56a0208562a7e57c6d434e8c50ec9b0e5b6d')

package() {
    local program=/usr/lib/bluerune/extensions/notes-search/bluerune-notes-search
    install -Dm755 bluerune-notes-search "$pkgdir$program"
    install -Dm644 -t "$pkgdir/usr/share/gnome-shell/search-providers" org.bluerune.NotesSearch.ini
    # The example's entry runs the program from PATH, where its guide installs it.
    sed "s|^Exec=bluerune-notes-search |Exec=$program |" org.bluerune.NotesSearch.desktop |
        install -Dm644 /dev/stdin "$pkgdir/usr/share/applications/org.bluerune.NotesSearch.desktop"
    install -Dm644 -t "$pkgdir/usr/share/dbus-1/services" org.bluerune.NotesSearch.service
    install -Dm644 -t "$pkgdir/usr/share/metainfo" org.bluerune.Extension.NotesSearch.metainfo.xml
    install -Dm644 -t "$pkgdir/usr/share/icons/hicolor/scalable/apps" org.bluerune.Extension.NotesSearch.svg
    install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE-MIT
}
