# Contributor: Mehdi Chinoune <mehdi.chinoune@hotmail.com>

_realname=coin-or-buildtools
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=0.8.11
pkgrel=1
pkgdesc="COIN-OR BuildTools (mingw-w64)"
arch=('any')
mingw_arch=('ucrt64' 'clang64' 'clangarm64')
url='https://github.com/coin-or-tools/Buildtools'
license=('spdx:EPL-2.0')
groups=("${MINGW_PACKAGE_PREFIX}-coin-or")
source=("https://github.com/coin-or-tools/Buildtools/archive/releases/${pkgver}/${_realname}-${pkgver}.tar.gz"
        "001-allow-shared-libs-with-clang.patch"
        "002-do-not-patch-paths-on-mingw.patch")
sha256sums=('ec4cec2455537b4911b1ce223f1f946f5afa2ea6264fc96ae4da6bea63af34dc'
            'f6c8bee855e20345b008205e3a8a9a646ae885cecfcb0aebaeb23bb01b9082c9'
            'bac59143ef5f7259364fff557c737ea2aed7ca63cbc2fb106d7267305d4667ef')

prepare() {
  cd Buildtools-releases-${pkgver} 
  patch -p1 -i "${srcdir}"/001-allow-shared-libs-with-clang.patch
  patch -p1 -i "${srcdir}"/002-do-not-patch-paths-on-mingw.patch
}

package() {
  mkdir -p "${pkgdir}"${MINGW_PREFIX}/share/${_realname}
  cp -r Buildtools-releases-${pkgver} "${pkgdir}"${MINGW_PREFIX}/share/${_realname}/BuildTools
}
