NAME="accountsservice"
DESC="Provides a set of D-Bus interfaces for querying and manipulating user account information"
VERSION="23.13.9"

FILES=("https://www.freedesktop.org/software/accountsservice/accountsservice-${VERSION}.tar.xz")
HASHES=("03dccfe1b306b7ca19743e86d118e64d")

DEPENDS=("polkit" "gobject-introspection")

PACKAGE() {
  tar xf "${NAME}-${VERSION}.tar.xz"
  cd "${NAME}-${VERSION}"

  mv tests/dbusmock{,-tests}
  sed -e '/accounts_service\.py/s/dbusmock/dbusmock-tests/' \
      -e 's/assertEquals/assertEqual/'                      \
      -i tests/test-libaccountsservice.py
  sed -i '/^SIMULATED_SYSTEM_LOCALE/s/en_IE.UTF-8/en_HK.iso88591/' tests/test-daemon.py

  mkdir build
  cd    build

  meson setup ..            \
        --prefix=/usr       \
        --buildtype=release \
        -Dadmin_group=adm

  # print_indent is not defined in netgroup-debug.c, just put a defination
  # in a random header so gcc doesnt complain
  echo "void print_indent(FILE *stream, unsigned int indent);" >> ../subprojects/mocklibc-1.0/src/netgroup-debug.h

  ninja
  DESTDIR="${ROOTDIR}" ninja install

  cd ../.. && rm -r "${NAME}-${VERSION}"
}
