pkgname=bc
pkgver=7.0.3
pkgdesc='An arbitrary precision calculator language'
homepage="https://git.gavinhoward.com/gavin/bc"
license=('GPL-3.0-only')
sources=("${pkgname}-${pkgver}.tar.xz")
urls=("https://github.com/gavinhoward/bc/releases/download/${pkgver}/${sources[0]}")
md5sums=("ad4db5a0eb4fdbb3f6813be4b6b3da74")

options=(!strip)

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

src_build() {
  CFLAGS+=" -O3 -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"       \
  CFLAGS+=" -std=gnu17" # fix bug
  CC=gcc    \
  ./configure --prefix=/usr -G -r
  make
}

src_check() {
  make test
}

src_install() {
  make DESTDIR="$pkgdir" install
}
