# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: AndyRTR <andyrtr@archlinux.org>

pkgname=libcmis
pkgver=0.6.2
pkgrel=2
pkgdesc="a C/C++ client library for the CMIS protocol"
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url="https://github.com/tdf/libcmis"
license=('GPL2' 'LGPL2.1' 'MPL')
depends=('boost-libs' 'curl' 'libxml2' 'gcc-libs' 'glibc')
makedepends=('docbook2x' 'cppunit' 'boost')
source=("https://github.com/tdf/libcmis/releases/download/v${pkgver}/$pkgname-$pkgver.tar.xz"
        libxml2-2.12.patch
        boost-1.86.0.patch)
sha256sums=('1b5c2d7258ff93eb5f9958ff0e4dfd7332dc75a071bb717dde2217a26602a644'
            'ac3f846139ce8548256711304d85fa56bb7531a45582883cfcfa560601461588'
            'ab89f91f2f61cc3a3f63bb51296d3333182b5a41811368d734a26d9d73f7a45e')

prepare() {
  cd "$pkgname-$pkgver"
  # fix build with libxml2 2.12
  patch -Np1 -i ../libxml2-2.12.patch
  # fix build with boost 1.86.0
  # https://github.com/LibreOffice/core/commit/14f00ee63fba32ccf1b91e71da6de38b57794a32
  patch -Np1 -i ../boost-1.86.0.patch
}

build() {
  cd "$pkgname-$pkgver"
  ./configure --prefix=/usr DOCBOOK2MAN='db2x_docbook2man' --disable-werror
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

check() {
  cd "$pkgname-$pkgver"
  # fails a google drive check - fix will be included in the next release
  make check || /bin/true
}

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