# Maintainer: Developer <dev@opalos.org>
# Maintainer: Developer <dev@opalos.org>

pkgname=xdg-user-dirs
pkgver=%version%
pkgrel=%release%
pkgdesc="Manage user directories like ~/Desktop and ~/Music"
url="https://www.freedesktop.org/wiki/Software/xdg-user-dirs"
arch=(x86_64)
license=(GPL)
depends=(sh systemd)
makedepends=(docbook-xsl git)
backup=(etc/xdg/user-dirs.conf etc/xdg/user-dirs.defaults)
install=xdg-user-dirs.install
options=(!emptydirs)
_commit=52e71ff04416f2ca3adaf6d73193de4b8b83de46  # tags/0.18^0
source=("git+https://gitlab.freedesktop.org/xdg/xdg-user-dirs.git#commit=$_commit"
        xdg-user-dirs-update.service)
sha256sums=('SKIP'
            '53c75f52d782e9492601400236bc8e5bfa76a26f0afd9bce3fe8df1740d341f0')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd $pkgname
  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd $pkgname
  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
  make
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" install 

  # We use a service
  rm "$pkgdir/etc/xdg/autostart/xdg-user-dirs.desktop"
  install -Dt "$pkgdir/usr/lib/systemd/user" -m644 ../xdg-user-dirs-update.service
}
