### this file is sourced not run
PKGVER=2025.06.03
PKGBUILD=1
PKGARCH=x86_64

# source: james
TARBALL=libbf-2025-06-03.tar.gz
MD5SUM=6a6dee10ac898f8a3d51dbb08a9781fd
SRC_URL=https://bellard.org/libbf/$TARBALL
BUNDLE=

DOC_URL_ROOT=http://numcalc.com/

SLACKREQ=
SLACKDESC="bfcalc: bfcalc $PKGVER (Arbitrary precision calculator)
bfcalc: 
bfcalc: BFCalc is a calculator with a Javascript like syntax, supporting 
bfcalc: arbitrarily large integers, decimal and binary arbitrary precision 
bfcalc: floating point numbers, multi-dimensional arrays (matrices and 
bfcalc: tensors), polynomials, series, unit conversion. It is an example of 
bfcalc: libbf, which is s a small library to handle arbitrary precision 
bfcalc: floating point numbers. Included also is bfpi, a program to 
bfcalc: calculate arbitrary digits of pi.
bfcalc: 
bfcalc: https://bellard.org/libbf/
"


### default pkg_download

### prepare
pkg_prepare() {
	pkg_prepare_default &&
	
	# docs is available online as a webpage
	pkg_download_default &&
	for p in index.html calc.js bfcalc-wasm.js; do
		wget -O tmp/pkg/$p $DOC_URL_ROOT/$p || return 1
	done
}

### default pkg_package

### build
pkg_build() {
	cd /tmp/libbf* &&

	# build
	make CONFIG_AVX2=y &&
	install -m755 bfcalc bfpi bfpi-avx2 /usr/bin &&

	# install docs
	install -dm755 /usr/share/doc/bfcalc &&
	install -m644 /tmp/pkg/*.html /tmp/pkg/*.js /usr/share/doc/bfcalc/ &&

	pkg_build_slackdesc
}
