# Maintainer: Øystein Krog <oystein.krog@gmail.com>
# Maintainer: Tom Schoonjans <Tom.Schoonjans@rfi.ac.uk>

_realname=hub
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=2.14.2
pkgrel=1
pkgdesc="hub introduces git to GitHub (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
url="https://hub.github.com"
license=('MIT')
options=('!strip')
#TODO: change this when git-for-windows is upstreamed
#depends=('${MINGW_PACKAGE_PREFIX}-git')
depends=('git')
makedepends=("git" "${MINGW_PACKAGE_PREFIX}-go")
source=(${_realname}-${pkgver}.tar.gz::https://github.com/github/${_realname}/archive/v${pkgver}.tar.gz)
sha256sums=('e19e0fdfd1c69c401e1c24dd2d4ecf3fd9044aa4bd3f8d6fd942ed1b2b2ad21a')

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  export GOROOT=${MINGW_PREFIX}/lib/go
  make
}

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

  make install prefix=${pkgdir}${MINGW_PREFIX}

  install -Dm644 "LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
  install -Dm644 "etc/hub.bash_completion.sh" "${pkgdir}/usr/share/bash-completion/completions/hub"
  install -Dm644 "etc/hub.zsh_completion" "${pkgdir}/usr/share/zsh/site-functions/_hub"
}
