# Maintainer: James Ross-Gowan <rossymiles@gmail.com>

pkgname=mosh
pkgver=1.4.0
pkgrel=6
pkgdesc="Mobile shell, surviving disconnects with local echo and line editing"
arch=('i686' 'x86_64')
url='https://mosh.org/'
msys2_repository_url="https://github.com/mobile-shell/mosh"
groups=('net-utils')
license=('spdx:GPL-3.0-or-later')
depends=('protobuf' 'ncurses' 'zlib' 'libopenssl' 'openssh' 'perl')
makedepends=('protobuf-devel' 'ncurses-devel' 'zlib-devel' 'openssl-devel' 'bash-completion' 'autotools' 'gcc' 'perl-doc')
source=("https://github.com/mobile-shell/mosh/releases/download/mosh-${pkgver}/mosh-${pkgver}.tar.gz")
sha256sums=('872e4b134e5df29c8933dff12350785054d2fd2839b5ae6b5587b14db1465ddd')
options=(!emptydirs)

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

  CXXFLAGS+=" -D_GNU_SOURCE"
  export MSYSTEM=CYGWIN
  ./configure \
    --host=${CHOST} \
    --build=${CHOST} \
    --prefix=/usr \
    --enable-completion
  make
}

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