# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Evangelos Foutras <evangelos@foutrelis.com>

pkgname=libmemcached
pkgver=1.0.18
pkgrel=4.1
pkgdesc="C and C++ client library to the memcached server"
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url="https://libmemcached.org/"
license=('GPL')
depends=('glibc' 'libsasl' 'libevent')
makedepends=('perl' 'memcached' 'python-sphinx')
source=(https://launchpad.net/$pkgname/1.0/$pkgver/+download/$pkgname-$pkgver.tar.gz
        libmemcached-fix-linking-with-libpthread.patch
        libmemcached-build.patch)
sha256sums=('e22c0bb032fde08f53de9ffbc5a128233041d9f33b5de022c0978a2149885f82'
            '02cd903ed217ef6d023bccefecb8d599ffab9b800a4f1a4e0124f4d71888d0dc'
            'bd62d0080d4ce39981a2e150af54fe80ebe720ba4cfaf5a856c3b9d8a73ecf7d')

prepare() {
  cd "$srcdir/$pkgname-$pkgver"

  # Fix linking against libpthread (patch from Fedora)
  # https://bugzilla.redhat.com/show_bug.cgi?id=1037707
  # https://bugs.launchpad.net/libmemcached/+bug/1281907
  patch -Np1 -i ../libmemcached-fix-linking-with-libpthread.patch

  # https://bugs.launchpad.net/libmemcached/+bug/1663985
  patch -Np1 -i ../libmemcached-build.patch
}

build() {
  cd "$srcdir/$pkgname-$pkgver"
  ./configure --prefix=/usr --build=${CHOST}
  make
}

check() {
  cd "$srcdir/$pkgname-$pkgver"
  #make -k check
}

package() {
  cd "$srcdir/$pkgname-$pkgver"
  make DESTDIR="$pkgdir" install
}

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