# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andreas Radke <andyrtr@archlinux.org>
# Contributor: spider-mario <spidermario@free.fr>
# Contributor: Daniel Ehlers <danielehlers@mindeye.net>

pkgname=coin-or-mp
pkgver=1.8.4
pkgrel=7
pkgdesc='C-API library that supports most of the functionality of CLP (Coin LP), CBC (Coin Branch-and-Cut), and CGL (Cut Generation Library) projects'
arch=(x86_64 aarch64)
url='https://projects.coin-or.org/CoinMP'
license=(CPL-1.0)
groups=(coin-or)
depends=(coin-or-cbc
         glibc
         libgcc
         libstdc++)
makedepends=(git)
source=(git+https://github.com/coin-or/CoinMP#tag=releases/$pkgver)
sha256sums=('ca675f20c3008618ba8d6827191a0d64f9f08995b613adfd8aa2a40f47d3d2e2')

prepare() {
  cd CoinMP/CoinMP
  # Apply same fix as for coin-or-coinutils
  cp -vf /usr/share/autoconf/build-aux/config.guess .
  cp -vf /usr/share/autoconf/build-aux/config.sub .
}

build() {
  cd CoinMP
  export CXXFLAGS+=" -Wp,-U_GLIBCXX_ASSERTIONS"
  ./configure \
    --prefix=/usr \
    --with-cbc-lib="-lCbcSolver -lCbc" \
    --with-cbc-incdir="/usr/include/coin/"
  make
}

check() {
  cd CoinMP
  make test
}

package() {
  cd CoinMP

  make DESTDIR="$pkgdir" install
  rm -rv "$pkgdir"/"$(dirname "${srcdir}")"
}
