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

pkgname=aisleriot
pkgver=3.22.9
pkgrel=1
pkgdesc="A collection of patience games written in guile scheme"
url="https://wiki.gnome.org/Apps/Aisleriot"
arch=(x86_64)
license=(GPL)
depends=(guile gtk3 librsvg libcanberra dconf)
makedepends=(appdata-tools gnome-common git)
optdepends=('libkdegames: KDE card sets'
            'pysolfc: PySol card sets'
            'pysolfc-cardsets: PySol card sets')
options=(!emptydirs)
_commit=a2d1187bc052e599ef73ee640a28cbb2c4f23c2f  # tags/3.22.9^0
source=("git+https://gitlab.gnome.org/GNOME/aisleriot.git#commit=$_commit")
sha256sums=('SKIP')

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

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

build() {
  cd $pkgname

  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --libexecdir=/usr/lib \
    --disable-static \
    --with-platform=gtk-only \
    --with-kde-card-theme-path=/usr/share/carddecks \
    --with-pysol-card-theme-path=/usr/share/PySolFC

  # https://bugzilla.gnome.org/show_bug.cgi?id=655517
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool

  make
}

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