# Maintainer: Martell Malone <martellmalone@gmail.com>

pkgname=cygrunsrv
pkgver=1.64
pkgrel=1
pkgdesc="${pkgname} is a windows services tool"
_realname=cygrunsrv
arch=('i686' 'x86_64')
url="https://cygwin.org/"
license=('spdx:GPL-3.0-or-later')
makedepends=('gcc' 'git' 'autotools')
source=(${pkgname}-${pkgver}::git+https://sourceware.org/git/cygwin-apps/${pkgname}.git#tag=rel${pkgver//./-}
        msysize.patch)
sha256sums=('SKIP'
            'fa01c51f6030f5249fafa10413cd2ae5dac86d127e715dd5aabde72eb43db846')

prepare(){
  cd ${pkgname}-${pkgver}
  patch -p1 -i ${srcdir}/msysize.patch

  autoreconf -fi
}

build() {

  mkdir -p "${srcdir}/build-${CHOST}"
  cd "${srcdir}/build-${CHOST}"

  export MSYSTEM=CYGWIN
  ../${pkgname}-${pkgver}/configure \
    --prefix=/usr \
    --build=${CHOST} \
    --host=${CHOST} \
    --target=${CHOST}

  make
}

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