# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=biber
pkgver=2.20
pkgrel=3
pkgdesc="Backend processor for BibLaTeX"
url="https://github.com/plk/biber"
arch="noarch !ppc64le !s390x !riscv64 !loongarch64" # biblatex
license="Artistic-2.0"
# This version should be compatible with biblatex, e.g. 2.20 need biblatex~3.20
# See Section "2.3 Compatibility Matrix" in
# https://markov.htwsaar.de/tex-archive/biblio/biber/base/documentation/biber.pdf
depends="
	biblatex~3.20
	perl
	perl-autovivification
	perl-business-isbn
	perl-business-ismn
	perl-business-issn
	perl-class-accessor
	perl-data-compare
	perl-data-dump
	perl-data-uniqid
	perl-date-simple
	perl-datetime-calendar-julian
	perl-datetime-format-builder
	perl-encode-eucjpascii
	perl-encode-hanextra
	perl-encode-jis2k
	perl-file-slurp
	perl-file-slurper
	perl-io-string
	perl-ipc-run3
	perl-lingua-translit
	perl-list-allutils
	perl-list-moreutils
	perl-list-moreutils-xs
	perl-log-log4perl
	perl-lwp-protocol-https
	perl-mime-charset
	perl-mozilla-ca
	perl-namespace-autoclean
	perl-parse-recdescent
	perl-perlio-utf8_strict
	perl-regexp-common
	perl-sort-key
	perl-text-bibtex
	perl-text-csv
	perl-text-csv_xs
	perl-text-roman
	perl-unicode-collate
	perl-unicode-linebreak
	perl-xml-libxml
	perl-xml-libxml-simple
	perl-xml-libxslt
	perl-xml-writer
	"
 makedepends="
	perl-config-autoconf
	perl-extutils-libbuilder
	perl-module-build
	"
checkdepends="
	perl-file-which
	perl-test-differences
	"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/plk/biber/archive/v$pkgver.tar.gz"

build() {
	export CFLAGS=$(perl -MConfig -E 'say $Config{ccflags}')

	perl Build.PL \
		--installdirs=vendor \
		--create_packlist=0
	./Build
}

check() {
	case "$CARCH" in
	arm*|x86)
		# dateformat tests fail on 32 bit systems
		rm -f t/dateformats.t
		;;
	esac
	./Build test
}

package() {
	./Build install --destdir="$pkgdir"
}

sha512sums="
d46abe992e46be0d10d0d3b084c4ef73fece7cfb4e2ea09979acf369c3333d31d54ebb2734590ae7ec6ed6c1466e0fe619e7c91af2aac47675b20deeccd87973  biber-2.20.tar.gz
"
