From 2a8e5a5d3810a4d43e1cd5976725440783077d6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Mairb=C3=B6ck?= Date: Sat, 26 Oct 2024 18:14:06 +0200 Subject: [PATCH] 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. --- dev-perl/ref_util/ref_util-0.204.recipe | 62 +++++++++++++++++++ dev-perl/ref_util_xs/ref_util_xs-0.117.recipe | 52 ++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 dev-perl/ref_util/ref_util-0.204.recipe create mode 100644 dev-perl/ref_util_xs/ref_util_xs-0.117.recipe diff --git a/dev-perl/ref_util/ref_util-0.204.recipe b/dev-perl/ref_util/ref_util-0.204.recipe new file mode 100644 index 000000000..32b81958f --- /dev/null +++ b/dev-perl/ref_util/ref_util-0.204.recipe @@ -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 +} diff --git a/dev-perl/ref_util_xs/ref_util_xs-0.117.recipe b/dev-perl/ref_util_xs/ref_util_xs-0.117.recipe new file mode 100644 index 000000000..2df17cfa5 --- /dev/null +++ b/dev-perl/ref_util_xs/ref_util_xs-0.117.recipe @@ -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 +}