# Maintainer: gym603 <gui_yuan_miao@163.com>

_realname=gsoap
_ver_major=2
_ver_minor=8
_ver_patch=113
_dir="${_realname}-${_ver_major}.${_ver_minor}"
_file="${_realname}_${_ver_major}.${_ver_minor}.${_ver_patch}.zip"

pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver="${_ver_major}.${_ver_minor}.${_ver_patch}"
pkgrel=1
pkgdesc="An extensive suite of portable C and C++ software to develop XML Web services with powerful type-safe XML data bindings (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
license=('GPL2')
url="http://gsoap2.sourceforge.net"
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "bison")
depends=()
source=(https://prdownloads.sourceforge.net/gsoap2/${_realname}_${pkgver}.zip)
sha256sums=('e73782b618303cf55ea6a45751b75ba96797a7a12967ed9d02e6d5761977e73a')

build() {
  [[ -d "${srcdir}/build-${MINGW_CHOST}" ]] && rm -rf "${srcdir}/build-${MINGW_CHOST}"
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  ../${_dir}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --disable-ssl
  make -j1
}

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

  cd "${srcdir}/${_dir}"
  install -Dm644 LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE.txt"
}
