# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgname=gnome-applets
pkgver=3.40.0
pkgrel=1
pkgdesc="Small applications for the GNOME Panel"
arch=('x86_64')
url="https://wiki.gnome.org/Projects/GnomeApplets"
license=('GPL')
depends=('gnome-panel' 'libgtop' 'tracker3' 'cpupower' 'upower')
makedepends=('autoconf-archive' 'git' 'gnome-settings-daemon' 'intltool' 'python' 'yelp-tools')
optdepends=('tracker3-miners: Search bar')
_commit=7eb9a52f09ec1ab4772cb056044dfc2f0209daac  # tags/3.40.0^0
source=("git+https://gitlab.gnome.org/GNOME/gnome-applets.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd $pkgname

  # Use correct D-Bus config location
  sed -i '/^dbus_confdir =/ s/sysconfdir/datadir/' gnome-applets/cpufreq/cpufreq-selector/Makefile.am

  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd $pkgname
  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libexecdir=/usr/lib/$pkgname \
              --disable-schemas-compile --enable-compile-warnings=minimum
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

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