# Maintainer: David Vachulka <david@konstrukce-cad.com>

_realname=fox
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.6.57
pkgrel=1
pkgdesc="C++ user interface toolkit (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url="http://www.fox-toolkit.org"
license=('LGPLv2+ with exceptions')
groups=("${MINGW_PACKAGE_PREFIX}")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
         "${MINGW_PACKAGE_PREFIX}-libjpeg-turbo"
         "${MINGW_PACKAGE_PREFIX}-libtiff"
         "${MINGW_PACKAGE_PREFIX}-libpng"
         "${MINGW_PACKAGE_PREFIX}-zlib")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
options=('strip')
source=("ftp://ftp.fox-toolkit.org/pub/${_realname}-${pkgver}.tar.gz"
        fox-2-FXTrayIcon.patch)
sha256sums=('65ef15de9e0f3a396dc36d9ea29c158b78fad47f7184780357b929c94d458923'
            '200e604581b20bfaa35a8747c293d43e3024ce554b23c47c466b3ca11341b209')

prepare() {
  cd "${srcdir}"/${_realname}-${pkgver}
  patch -p0 -i ${srcdir}/fox-2-FXTrayIcon.patch
  autoreconf -fvi
}

build() {
  [[ -d ${srcdir}/build-${CARCH} ]] && rm -rf ${srcdir}/build-${CARCH}
  cp -rf ${_realname}-${pkgver} build-${CARCH}
  cd build-${CARCH}

  ./configure \
    --prefix=${MINGW_PREFIX} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --build=${MINGW_CHOST} \
    --enable-release \
    --disable-debug \
    --with-xft=no \
    --with-x=no

  make
}

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