# Maintainer: Bruno Pagani <archange@archlinux.org>
# Contributor: Eli Schwartz <eschwartz@archlinux.org>
# Contributor: Alex Filgueira <alexfilgueira (at antergos.com)>
# Contributor: Nate Simon <aurpkg (at natesimon.net)>

pkgname=xapp
pkgver=2.8.13
pkgrel=1
pkgdesc="Common library for X-Apps project"
arch=(x86_64)
url="https://github.com/linuxmint/${pkgname}"
license=(GPL)
depends=(libdbusmenu-gtk3 libgnomekbd)
optdepends=('python: for mate-desktop status applet')
makedepends=(meson samurai gobject-introspection python-gobject vala glib2-devel)
provides=(xapps)
conflicts=(xapps)
replaces=(xapps)
source=(${url}/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha256sums=('5282727e41c0fe86b22b745b3abd134a67edd7fb9337deaff762376b1f49b140')
b2sums=('d7c17cc9908a12e7a82a9e9c78b50959355d72930f022aff6f4a04109da043eae0e1df6b4c52cb2644fb7e350f166b18af1d3f215b9cb326da8e195a13785a5e')

build() {
  arch-meson ${pkgname}-${pkgver} build \
    --buildtype=debugoptimized
# https://github.com/linuxmint/xapp/issues/169
  samu -C build
}

package(){
  DESTDIR="${pkgdir}" samu -C build install

  # byte-compile python modules since meson does not implement autotools’ py-compile.
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  python -m compileall -o 0 -o 1 -o 2 --hardlink-dupes -s "${pkgdir}" "${pkgdir}"${site_packages}
}
