# Maintainer: AndyRTR <andyrtr@archlinux.org>
# Contributor: kusakata <shohei atmark kusakata period com>

pkgname=libixion
pkgver=0.20.0
pkgrel=3
pkgdesc="A general purpose formula parser & interpreter"
arch=('x86_64' 'aarch64')
url="https://gitlab.com/ixion/ixion"
license=('MPL-2.0')
depends=('boost-libs' 'python' 'gcc-libs' 'glibc')
makedepends=('boost' 'mdds' 'spdlog')
source=(https://gitlab.com/api/v4/projects/ixion%2Fixion/packages/generic/source/${pkgver}/libixion-${pkgver}.tar.xz
        https://gitlab.com/ixion/ixion/-/commit/bfe5ab6adadda265d575fec9c192e6f53f2ef9f5.patch)
# https://gitlab.com/ixion/ixion/-/releases
sha256sums=('8466a05f19f60b7568641a449704666308848f7bcaf8335f92ee9474a451e4cd'
            '0fdf9c1e34dfbdf55b4f2f347b9fbb1b8fe6fd35b6a0575d2aa6c58eae160920')

prepare() {
  cd ${pkgname}-${pkgver}
# Fix build with boost 1.89
  patch -p1 -i ../bfe5ab6adadda265d575fec9c192e6f53f2ef9f5.patch
  autoreconf -fiv
}

build() {
  cd ${pkgname}-${pkgver}
  ./configure --prefix=/usr \
    --disable-static
  # improves from 5 down to 3 times Unused shared library
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

check() {
  cd ${pkgname}-${pkgver}
  make -k check
}

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