# Maintainer: Luke Shumaker <lukeshu@parabola.nu>

_pkgname=secp256k1
pkgname=${_pkgname}-git
pkgver=20171207
_gitver=c77fc08597960d662eb0df9e4c670c31bdeb227e
pkgrel=1
pkgdesc='Optimized C library for EC operations on curve secp256k1'
arch=(x86_64 i686 armv7h)
url=https://github.com/bitcoin-core/secp256k1/
license=(MIT)
depends=(gmp)
provides=(
  ${_pkgname}
  lib${pkgname}=$pkgver
  lib${_pkgname}
  lib${_pkgname}.so
)
conflicts=("${provides[@]%=*}")
source=(${_pkgname}-${_gitver}::https://github.com/bitcoin-core/${_pkgname}/archive/${_gitver}.tar.gz)
sha256sums=('19a5d9015458d146cb1494259e4b00de3012ad2521091992e14e07bde711e41e')

prepare() {
  cd $_pkgname-$_gitver
  ./autogen.sh
}

build() {
  cd $_pkgname-$_gitver
  ./configure --prefix=/usr --disable-static
  make
}

check() {
  cd $_pkgname-$_gitver
  make check
}

package() {
  cd $_pkgname-$_gitver
  make DESTDIR="$pkgdir" install
  install -Dm644 COPYING "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
