pkgname=libssh2
pkgver=1.11.1
pkgdesc="A library implementing the SSH2 protocol as defined by Internet Drafts"
homepage="https://www.libssh2.org/"
arch=('x86_64')
license=('BSD')
depends=('openssl' 'zlib')
sources=("${pkgname}-${pkgver}.tar.gz")
urls=("https://www.libssh2.org/download/${sources[0]}")
md5sums=("38857d10b5c5deb198d6989dacace2e6")

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
}

src_build() {
  local mycmakeargs=(
    -DCMAKE_INSTALL_PREFIX=/usr
    -DBUILD_SHARED_LIBS=ON
    -DBUILD_STATIC_LIBS=OFF
    -DBUILD_TESTING=OFF
    -DCRYPTO_BACKEND=OpenSSL
    -DENABLE_ZLIB_COMPRESSION=ON
  )
  cmake -S . -B build ${mycmakeargs[@]} ..
  cmake --build build
}

src_install() {
  DESTDIR="$pkgdir" cmake --install build
  install -Dm644 COPYING "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

# vim:ft=sh syn=sh et sw=2:
