eclass/perl-module: Sync with Gentoo

It's from Gentoo commit a7f997b3232b4bb1869dd2d3d97c5bfc89cf47de.
This commit is contained in:
Krzesimir Nowak 2024-08-02 16:04:35 +02:00
parent 7a0ad0c597
commit 3d8ff012a0

View File

@ -1,4 +1,4 @@
# Copyright 1999-2022 Gentoo Authors # Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# @ECLASS: perl-module.eclass # @ECLASS: perl-module.eclass
@ -21,11 +21,11 @@
case ${EAPI} in case ${EAPI} in
7) 7)
inherit multiprocessing perl-functions inherit multiprocessing perl-functions toolchain-funcs
PERL_EXPF="src_prepare src_configure src_compile src_test src_install" PERL_EXPF="src_prepare src_configure src_compile src_test src_install"
;; ;;
8) 8)
inherit multiprocessing perl-functions readme.gentoo-r1 inherit multiprocessing perl-functions readme.gentoo-r1 toolchain-funcs
PERL_EXPF="src_prepare src_configure src_compile src_test src_install" PERL_EXPF="src_prepare src_configure src_compile src_test src_install"
;; ;;
*) *)
@ -44,6 +44,28 @@ esac
# a use-conditional build time dependency on virtual/perl-Test-Simple, and # a use-conditional build time dependency on virtual/perl-Test-Simple, and
# the required RESTRICT setting. # the required RESTRICT setting.
# @ECLASS_VARIABLE: PERL_USEDEP
# @OUTPUT_VARIABLE
# @DESCRIPTION:
# An eclass-generated USE-dependency string for the features of the
# installed Perl. While by far not as critical as for Python, this should
# be used to depend at least on Perl packages installing compiled
# (binary) files.
#
# Example use:
# @CODE
# RDEPEND=dev-perl/DBI[${PERL_USEDEP}]
# @CODE
#
# Example value:
# @CODE
# perl_features_debug=,perl_features_ithreads=,perl_features_quadmath=
# @CODE
PERL_USEDEP="perl_features_debug=,perl_features_ithreads=,perl_features_quadmath="
GENTOO_PERL_DEPSTRING=">=dev-lang/perl-5.38.2-r3[${PERL_USEDEP}]"
GENTOO_PERL_USESTRING="perl_features_debug perl_features_ithreads perl_features_quadmath"
case ${EAPI} in case ${EAPI} in
7) 7)
[[ ${CATEGORY} == perl-core ]] && \ [[ ${CATEGORY} == perl-core ]] && \
@ -51,14 +73,16 @@ case ${EAPI} in
case "${GENTOO_DEPEND_ON_PERL:-yes}" in case "${GENTOO_DEPEND_ON_PERL:-yes}" in
yes) yes)
DEPEND="dev-lang/perl" IUSE=${GENTOO_PERL_USESTRING}
BDEPEND="dev-lang/perl" DEPEND=${GENTOO_PERL_DEPSTRING}
RDEPEND="dev-lang/perl:=" BDEPEND=${GENTOO_PERL_DEPSTRING}
RDEPEND="${GENTOO_PERL_DEPSTRING} dev-lang/perl:="
;; ;;
noslotop) noslotop)
DEPEND="dev-lang/perl" IUSE=${GENTOO_PERL_USESTRING}
BDEPEND="dev-lang/perl" DEPEND=${GENTOO_PERL_DEPSTRING}
RDEPEND="dev-lang/perl" BDEPEND=${GENTOO_PERL_DEPSTRING}
RDEPEND=${GENTOO_PERL_DEPSTRING}
;; ;;
esac esac
@ -78,17 +102,18 @@ case ${EAPI} in
case "${GENTOO_DEPEND_ON_PERL:-yes}" in case "${GENTOO_DEPEND_ON_PERL:-yes}" in
yes|noslotop) yes|noslotop)
DEPEND="dev-lang/perl" IUSE=${GENTOO_PERL_USESTRING}
BDEPEND="dev-lang/perl DEPEND=${GENTOO_PERL_DEPSTRING}
test? ( virtual/perl-Test-Simple )" BDEPEND="${GENTOO_PERL_DEPSTRING}
IUSE="test" test? ( >=virtual/perl-Test-Simple-1 )"
IUSE+=" test"
RESTRICT="!test? ( test )" RESTRICT="!test? ( test )"
;;& ;;&
yes) yes)
RDEPEND="dev-lang/perl:=" RDEPEND="${GENTOO_PERL_DEPSTRING} dev-lang/perl:="
;; ;;
noslotop) noslotop)
RDEPEND="dev-lang/perl" RDEPEND=${GENTOO_PERL_DEPSTRING}
;; ;;
esac esac
@ -209,6 +234,10 @@ perl-module_src_prepare() {
perl-module_src_configure() { perl-module_src_configure() {
debug-print-function ${FUNCNAME} "$@" debug-print-function ${FUNCNAME} "$@"
# Perl runs LD with LDFLAGS
export CCLD=$(tc-getCC)
unset LD
perl_check_env perl_check_env
perl_set_version perl_set_version
@ -216,6 +245,8 @@ perl-module_src_configure() {
[[ -z ${pm_echovar} ]] && export PERL_MM_USE_DEFAULT=1 [[ -z ${pm_echovar} ]] && export PERL_MM_USE_DEFAULT=1
# Disable ExtUtils::AutoInstall from prompting # Disable ExtUtils::AutoInstall from prompting
export PERL_EXTUTILS_AUTOINSTALL="--skipdeps" export PERL_EXTUTILS_AUTOINSTALL="--skipdeps"
# Noisy and not really appropriate to show to the user in a PM
export PERL_CANARY_STABILITY_DISABLE=1
if [[ $(declare -p myconf 2>&-) != "declare -a myconf="* ]]; then if [[ $(declare -p myconf 2>&-) != "declare -a myconf="* ]]; then
local myconf_local=(${myconf}) local myconf_local=(${myconf})
@ -241,8 +272,15 @@ perl-module_src_configure() {
set -- \ set -- \
--installdirs=vendor \ --installdirs=vendor \
--libdoc= \ --libdoc= \
--destdir="${D}" \
--create_packlist=1 \ --create_packlist=1 \
--config ar="$(tc-getAR)" \
--config cc="$(tc-getCC)" \
--config cpp="$(tc-getCPP)" \
--config ld="$(tc-getCC)" \
--config nm="$(tc-getNM)" \
--config ranlib="$(tc-getRANLIB)" \
--config optimize="${CFLAGS}" \
--config ldflags="${LDFLAGS}" \
"${myconf_local[@]}" "${myconf_local[@]}"
einfo "perl Build.PL" "$@" einfo "perl Build.PL" "$@"
perl Build.PL "$@" <<< "${pm_echovar}" \ perl Build.PL "$@" <<< "${pm_echovar}" \
@ -250,10 +288,17 @@ perl-module_src_configure() {
elif [[ -f Makefile.PL ]] ; then elif [[ -f Makefile.PL ]] ; then
einfo "Using ExtUtils::MakeMaker" einfo "Using ExtUtils::MakeMaker"
set -- \ set -- \
PREFIX=${EPREFIX}/usr \ AR="$(tc-getAR)" \
CC="$(tc-getCC)" \
CPP="$(tc-getCPP)" \
LD="$(tc-getCC)" \
NM="$(tc-getNM)" \
RANLIB="$(tc-getRANLIB)" \
OPTIMIZE="${CFLAGS}" \
LDFLAGS="${LDFLAGS}" \
PREFIX="${EPREFIX}"/usr \
INSTALLDIRS=vendor \ INSTALLDIRS=vendor \
INSTALLMAN3DIR='none' \ INSTALLMAN3DIR='none' \
DESTDIR="${D}" \
"${myconf_local[@]}" "${myconf_local[@]}"
einfo "perl Makefile.PL" "$@" einfo "perl Makefile.PL" "$@"
perl Makefile.PL "$@" <<< "${pm_echovar}" \ perl Makefile.PL "$@" <<< "${pm_echovar}" \
@ -329,6 +374,7 @@ perl-module_src_test() {
local my_test_control local my_test_control
local my_test_verbose local my_test_verbose
local my_test_makeopts
[[ -n "${DIST_TEST_OVERRIDE}" ]] && ewarn "DIST_TEST_OVERRIDE is set to ${DIST_TEST_OVERRIDE}" [[ -n "${DIST_TEST_OVERRIDE}" ]] && ewarn "DIST_TEST_OVERRIDE is set to ${DIST_TEST_OVERRIDE}"
my_test_control=${DIST_TEST_OVERRIDE:-${DIST_TEST:-do parallel}} my_test_control=${DIST_TEST_OVERRIDE:-${DIST_TEST:-do parallel}}
@ -338,6 +384,10 @@ perl-module_src_test() {
return 0 return 0
fi fi
if has 'do' ${my_test_control} && ! has 'parallel' ${my_test_control} ; then
my_test_makeopts="-j1"
fi
if has verbose ${my_test_control} ; then if has verbose ${my_test_control} ; then
my_test_verbose=1 my_test_verbose=1
else else
@ -354,6 +404,13 @@ perl-module_src_test() {
export NO_NETWORK_TESTING=1 export NO_NETWORK_TESTING=1
fi fi
# See https://www.perlmonks.org/?node_id=1225311
# * AUTOMATED_TESTING appears inappropriate for us, as it affects
# exit codes and might mask failures if configuration is wrong.
# * EXTENDED_TESTING is something we could consider if we had
# some way to opt-in to expensive tests.
export NONINTERACTIVE_TESTING=1
case ${EAPI} in case ${EAPI} in
7) 7)
;; ;;
@ -370,7 +427,7 @@ perl-module_src_test() {
if [[ -f Build ]] ; then if [[ -f Build ]] ; then
./Build test verbose=${my_test_verbose} || die "test failed" ./Build test verbose=${my_test_verbose} || die "test failed"
elif [[ -f Makefile ]] ; then elif [[ -f Makefile ]] ; then
emake test TEST_VERBOSE=${my_test_verbose} emake ${my_test_makeopts} test TEST_VERBOSE=${my_test_verbose}
fi fi
} }
@ -387,7 +444,7 @@ perl-module_src_install() {
if [[ -f Build ]]; then if [[ -f Build ]]; then
mytargets="${mytargets:-install}" mytargets="${mytargets:-install}"
mbparams="${mbparams:---pure}" mbparams="${mbparams:---destdir="${D}" --pure}"
einfo "./Build ${mytargets} ${mbparams}" einfo "./Build ${mytargets} ${mbparams}"
./Build ${mytargets} ${mbparams} \ ./Build ${mytargets} ${mbparams} \
|| die "./Build ${mytargets} ${mbparams} failed" || die "./Build ${mytargets} ${mbparams} failed"
@ -401,7 +458,7 @@ perl-module_src_install() {
else else
local myinst_local=("${myinst[@]}") local myinst_local=("${myinst[@]}")
fi fi
emake "${myinst_local[@]}" ${mytargets} emake DESTDIR="${D}" "${myinst_local[@]}" ${mytargets}
fi fi
case ${EAPI} in case ${EAPI} in