# Maintainer: Anatol Pomozov

pkgname=aws-c-common
pkgver=0.9.0
pkgrel=1
pkgdesc='Core c99 package for AWS SDK for C. Includes cross-platform primitives, configuration, data structures, and error handling.'
arch=(x86_64 aarch64)
url='https://github.com/awslabs/aws-c-common'
license=(Apache)
depends=(glibc)
makedepends=(cmake)
source=(aws-c-common-$pkgver.zip::https://github.com/awslabs/aws-c-common/archive/v$pkgver.zip)
sha256sums=('1e5e1c191cc1d4161717690da5313f667389bc1fd0db785bb534f4d5c4ad5b28')

build() {
  cd aws-c-common-$pkgver

  cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=ON -S . -B build
  cmake --build build
}

check() {
  cd aws-c-common-$pkgver
  cmake --build build --target test
}

package() {
  cd aws-c-common-$pkgver

  cmake --build build --target install -- DESTDIR="$pkgdir/"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
