# Template file for 'perl-Text-BibTeX'
pkgname=perl-Text-BibTeX
version=0.88
revision=3
wrksrc="${pkgname/perl-/}-${version}"
build_style=perl-ModuleBuild
hostmakedepends="perl-ExtUtils-LibBuilder perl-Config-AutoConf"
makedepends="perl perl-Capture-Tiny"
depends="${makedepends}"
short_desc="Text::BibTeX - interface to read and parse BibTeX files"
maintainer="svenper <svenper@tuta.io>"
license="Artistic-1.0-Perl, GPL-1.0-or-later"
homepage="https://metacpan.org/release/Text-BibTeX/"
distfiles="${CPAN_SITE}/Text/${pkgname/perl-/}-${version}.tar.gz"
checksum=b014586e68bdbcafb0a2cfa0401eb0a04ea5de8c4d5bc36dd0f7faeab6acf42c
shlib_requires="libperl.so.5.34"

if [ "$CROSS_BUILD" ]; then
	export PERL5LIB=${XBPS_STATEDIR}/perlprefix-${XBPS_TARGET_MACHINE}
fi

post_configure() {
	[ "$CROSS_BUILD" ] || return 0
	mkdir -p $PERL5LIB
	cp "$XBPS_CROSS_BASE/usr/lib/perl5/core_perl/Config"*.p? $PERL5LIB
	cp "$XBPS_CROSS_BASE/usr/lib/perl5/core_perl/Errno.pm" $PERL5LIB
	sed -i -e "s;archlibexp => '\(.*\)';archlibexp => '${XBPS_CROSS_BASE}\1';" \
		${PERL5LIB}/Config.pm
	sed -i -e "s;^archlibexp='\(.*\)';archlibexp='${XBPS_CROSS_BASE}\1';" \
		${PERL5LIB}/Config_heavy.pl
}

do_install() {
	LD="$CC" ./Build ${make_install_args} install
}
