# Maintainer: Alad
# Contributor: Timothy Redaelli <timothy.redaelli@gmail.com>
# Contributor: Sébastien Luttringer
# Contributor: kevku <kevku@msn.com>

pkgname=opensc
pkgver=0.26.1
pkgrel=1
pkgdesc='Tools and libraries for smart cards'
arch=('x86_64')
url='https://github.com/OpenSC/OpenSC/wiki'
license=('LGPL')
backup=('etc/opensc.conf')
makedepends=('docbook-xsl' 'git')
depends=('pcsclite' 'glib2')
options=(!emptydirs !lto)
source=("git+https://github.com/OpenSC/OpenSC.git#tag=${pkgver}")
sha512sums=('92b73ae829595e22de8291672bb4108565ab9065421eaf3dd87efa8f42d855c85a7a406c99b8c4c24c7c6f4ea5b3d6c1703b3b5bef3d019278beb4817217613e')

build() {
  cd OpenSC

  _sheetdir=(/usr/share/xml/docbook/xsl-stylesheets-*-nons)

  ./bootstrap
  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --with-completiondir=/usr/share/bash-completion/completions \
    --enable-man \
    --enable-doc \
    --enable-readline \
    --enable-openssl \
    --enable-pcsc \
    --enable-zlib \
    --enable-sm \
    --with-xsl-stylesheetsdir="$_sheetdir"

  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool

  make
}

package(){
  cd OpenSC

  make DESTDIR="$pkgdir" install

  install -D -m644 etc/opensc.conf "$pkgdir/etc/opensc.conf"
}

# vim:set ts=2 sw=2 et:
