ref_util[_xs]: new perl module recipes

Ref::Util::XS is the faster native implementation of Ref::Util. It is
technically optional, but recommended (and treated as a hard requirement when a
compiler is available at build time), so we add it as a dependency.
This commit is contained in:
Joachim Mairböck
2024-10-26 18:14:06 +02:00
parent 064ffe8d9a
commit 2a8e5a5d38
2 changed files with 114 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
SUMMARY="Utility functions for checking references"
DESCRIPTION="Ref::Util introduces several functions to help identify references in a smarter (and \
usually faster) way."
HOMEPAGE="https://metacpan.org/pod/Ref::Util"
COPYRIGHT="2017 by Sawyer X"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://cpan.metacpan.org/authors/id/A/AR/ARC/Ref-Util-$portVersion.tar.gz"
CHECKSUM_SHA256="415fa73dbacf44f3d5d79c14888cc994562720ab468e6f71f91cd1f769f105e1"
SOURCE_DIR="Ref-Util-$portVersion"
ARCHITECTURES="any"
PROVIDES="
ref_util = $portVersion
"
REQUIRES="
haiku
ref_util_xs
vendor_perl
"
BUILD_REQUIRES="
haiku_devel
"
BUILD_PREREQUIRES="
cmd:make
cmd:perl
"
TEST_REQUIRES="
ref_util_xs
"
BUILD()
{
# Makefile.PL checks whether gcc works to add a dependency on Ref::Util::XS.
# We just add that unconditionally so that users can use the faster implementation,
# the compiler check isn't needed.
perl Makefile.PL PREFIX=$prefix
make
}
INSTALL()
{
make pure_install
# remove architecture-specific files
cd $prefix
rm -r $(perl -V:vendorarch | cut -d\' -f2 | cut -d/ -f5-)
# cut extracts the quoted string and strips the prefix (which is perl's and not ours)
}
TEST()
{
# The tests are using the XS implementation when available (see TEST_REQUIRES),
# but Ref::Util::XS isn't displayed in requirements because Makefile.PL was
# run without gcc available.
make test
}

View File

@@ -0,0 +1,52 @@
SUMMARY="XS implementation for Ref::Util"
DESCRIPTION="Ref::Util::XS is the XS implementation of Ref::Util, which provides several \
functions to help identify references in a more convenient way than the usual approach of \
examining the return value of ref."
HOMEPAGE="https://metacpan.org/pod/Ref::Util::XS"
COPYRIGHT="2018 by Sawyer X"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://cpan.metacpan.org/authors/id/X/XS/XSAWYERX/Ref-Util-XS-$portVersion.tar.gz"
CHECKSUM_SHA256="fb64c5a823787f6600257918febd9fbc6f0305936fc3287b81a30c099b65633c"
SOURCE_DIR="Ref-Util-XS-$portVersion"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
ref_util_xs$secondaryArchSuffix = $portVersion
"
if [ -n "$secondaryArchSuffix" ]; then
PROVIDES+="
ref_util_xs = $portVersion
"
fi
REQUIRES="
haiku$secondaryArchSuffix
vendor_perl
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:make
cmd:perl
"
BUILD()
{
perl Makefile.PL PREFIX=$prefix
make
}
INSTALL()
{
make pure_install
}
TEST()
{
make test
}