# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>

pkgname=libgsystem
pkgver=2015.2+4+gd606bec
pkgrel=3
pkgdesc='"Copylib" for system service modules using GLib with GCC'
url="https://wiki.gnome.org/Projects/LibGSystem"
license=(GPL2)
arch=(x86_64)
depends=(glib2 systemd-libs attr)
makedepends=(gobject-introspection gtk-doc systemd git)
_commit=d606bec68ddfea78de4b03c3f3568afb71bdc1ce  # master
source=("git+https://gitlab.gnome.org/Archive/libgsystem.git#commit=$_commit"
        "git+https://gitlab.gnome.org/GNOME/libglnx.git")
sha256sums=('SKIP'
            'SKIP')

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

prepare() {
  cd $pkgname

  # Fix header file location
  sed -i 's|attr/xattr|sys/xattr|g' configure.ac

  git submodule init
  git config --local submodule.libglnx.url "$srcdir/libglnx"
  git submodule update

  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd $pkgname
  ./configure --prefix=/usr --disable-static --enable-gtk-doc
  make
}

check() {
  cd $pkgname
  make check
}

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