# Contributor: Sodface <sod@sodface.com>
# Maintainer: lonjil <alpine@lonjil.xyz>
pkgname=libqalculate
# the pkgver must be kept in sync with: qalculate-gtk, qalculate-qt
pkgver=5.4.0
pkgrel=1
pkgdesc="Library implementing a multi-purpose desktop calculator"
url="https://qalculate.github.io/"
license="GPL-2.0-or-later"
arch="all"
makedepends="
	curl-dev
	diffutils
	gettext-dev
	gmp-dev
	gnu-libiconv-dev
	icu-dev
	intltool
	libxml2-dev
	mpfr-dev
	readline-dev
	"
subpackages="
	$pkgname-dev
	$pkgname-lang
	qalc
	qalc-doc
	"
source="https://github.com/Qalculate/libqalculate/releases/download/v$pkgver/libqalculate-$pkgver.tar.gz
	libqalculate.pc.in.patch
	"
options="!check" # no test suite

build() {
	# Compile with LTO to reduce binary size.
	export CXXFLAGS="$CXXFLAGS -flto=auto"

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--mandir=/usr/share/man
	make
}

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

qalc() {
	pkgdesc="Powerful and easy to use command line calculator"
	amove usr/bin/qalc
}

doc() {
	default_doc
	pkgdesc="Powerful and easy to use command line calculator (documentation)"
}

sha512sums="
0539fe8053c903653b72716d0f7e5bc17d2ba954854d61f51bf62f2d9b6a02d3160be6a9f0208c67960ae5f9d831cc29eae4e80438cae482e6fb97e7686207e4  libqalculate-5.4.0.tar.gz
a44bb2d18b6ac9306587cfaeec21955aa526faa4abe5f639ab5912227331eb052ec900626619ff939c9f93fb0e7a25d0af134b645bcde5bc694f78af8f4b0af5  libqalculate.pc.in.patch
"
