APP=curl
VERSION=7.77.0
BUILD=1sml
HOMEPAGE='https://curl.se/'
DOWNLOAD='https://curl.se/download/curl-7.77.0.tar.xz'
DESC="Command line URL data transfer tool"
REQUIRES="zlib openssl brotli libssh2 libidn2 nghttp2 libunistring"

build() {
  mkandenterbuilddir
  rm -rf $APP-$VERSION

  tar xf $SRCDIR/$APP-$VERSION.tar.?z*
  cd $APP-$VERSION
  fixbuilddirpermissions

  ./configure \
    --prefix="" \
    --sysconfdir=/etc \
    --with-libssh2 \
    --without-ca-bundle \
    --with-ca-path=/etc/ssl/certs \
    --with-openssl

  make
  make install DESTDIR=$PKG

  ( cd docs/libcurl 
    make install-man3 DESTDIR=$PKG
    cd opts
    make install-man3 DESTDIR=$PKG
  )

  # We don't ship the related perl script (yet):
  rm -f $PKG/share/man/man1/mk-ca-bundle.1

  strip -g $PKG/lib/libcurl.a

  cp COPYING $PKGDOCS/

  mkfinalpkg
}

SHA512SUMS="
aef92a0e3f8ce8491b258a9a1c4dcea3c07c29b139a1f68f08619caa0295cfde76335d2dfb9cdf434525daea7dd05d8acd22f203f5ccc7735bd317964ec1da76  curl-7.77.0.tar.xz
"
