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

_realname=fox
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.6.59
pkgrel=1
pkgdesc="C++ user interface toolkit (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="http://www.fox-toolkit.org"
license=('LGPLv2+ with exceptions')
depends=("${MINGW_PACKAGE_PREFIX}-cc-libs"
         "${MINGW_PACKAGE_PREFIX}-bzip2"
         "${MINGW_PACKAGE_PREFIX}-libjpeg-turbo"
         "${MINGW_PACKAGE_PREFIX}-libtiff"
         "${MINGW_PACKAGE_PREFIX}-libpng"
         "${MINGW_PACKAGE_PREFIX}-zlib")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc" "${MINGW_PACKAGE_PREFIX}-autotools")
source=("http://fox-toolkit.org/ftp/${_realname}-${pkgver}.tar.gz"
        fox-2-FXTrayIcon.patch)
sha256sums=('48f33d2dd5371c2d48f6518297f0ef5bbf3fcd37719e99f815dc6fc6e0f928ae'
            '200e604581b20bfaa35a8747c293d43e3024ce554b23c47c466b3ca11341b209')

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

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

  CPPFLAGS+=" -Wno-register"

  ./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-${MSYSTEM}
  make DESTDIR="${pkgdir}" install
}
