# Contributor: Alexander Georgievskiy <galeksandrp@gmail.com>

_realname=3proxy
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
conflicts=("${MINGW_PACKAGE_PREFIX}-libproxy")
pkgver=0.9.5
pkgrel=1
pkgdesc='3proxy - tiny free proxy server (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://github.com/z3APA3A/3proxy"
msys2_references=(
  'anitya: 3'
  "cpe: cpe:/a:3proxy:3proxy"
  'gentoo: net-proxy/3proxy'
)
license=('spdx:BSD-3-Clause OR Apache-2.0 OR LGPL-2.1-or-later OR GPL-2.0-or-later')
depends=("${MINGW_PACKAGE_PREFIX}-cc-libs")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc")
source=("${url}/archive/${pkgver}/${_realname}-${pkgver}.tar.gz"
        001-win-install.patch)
sha256sums=('6f6da51d9bba93231e12acd707bb6cf86a1ab9491dc6dd0c79750cb3641541a3'
            'a12af87ccc044e81365b5afdc853f5007b0ce3b55e715c8cf85dd73d0b7bd307')

prepare() {
  cd "${srcdir}"/${_realname}-${pkgver}
  patch -p1 -i "${srcdir}"/001-win-install.patch
  mkdir -p bin
}

build() {
  cd "${srcdir}"/${_realname}-${pkgver}

  make CC=${CC} LN=${CC} -f Makefile.win
}

package() {
  cd "${srcdir}"/${_realname}-${pkgver}
  make CC=${CC} LN=${CC} DESTDIR="${pkgdir}" prefix=${MINGW_PREFIX} install -f Makefile.win
}
