public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-lang/perl/files/, dev-lang/perl/
@ 2016-12-29 16:53 Andreas Hüttel
  0 siblings, 0 replies; 12+ messages in thread
From: Andreas Hüttel @ 2016-12-29 16:53 UTC (permalink / raw
  To: gentoo-commits

commit:     1ddfb9cc7eb204864bcf113b74ca4c5c9780c84a
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 29 16:53:20 2016 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Dec 29 16:53:44 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1ddfb9cc

dev-lang/perl: Restore MANIFEST sort order, bug 589302

Package-Manager: Portage-2.3.3, Repoman-2.3.1

 dev-lang/perl/files/perl-patchlevel-manifest.patch | 10 ++++++++++
 dev-lang/perl/perl-5.24.1_rc4.ebuild               |  6 +++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/dev-lang/perl/files/perl-patchlevel-manifest.patch b/dev-lang/perl/files/perl-patchlevel-manifest.patch
new file mode 100644
index 00000000..3592ae0
--- /dev/null
+++ b/dev-lang/perl/files/perl-patchlevel-manifest.patch
@@ -0,0 +1,10 @@
+--- a/MANIFEST
++++ b/MANIFEST
+@@ -4678,6 +4678,7 @@
+ pad.h				Scratchpad headers
+ parser.h			parser object header
++patchlevel-gentoo.h			Gentoo's Perl patch level
+ patchlevel.h			The current patch level of perl
+ perlapi.c			Perl API functions
+ perlapi.h			Perl API function declarations
+ perl.c				main()

diff --git a/dev-lang/perl/perl-5.24.1_rc4.ebuild b/dev-lang/perl/perl-5.24.1_rc4.ebuild
index 47bd73d..e560ac1 100644
--- a/dev-lang/perl/perl-5.24.1_rc4.ebuild
+++ b/dev-lang/perl/perl-5.24.1_rc4.ebuild
@@ -215,7 +215,6 @@ src_prepare_update_patchlevel_h() {
 	# it under the same terms as Perl itself.
 	local patchdir="${WORKDIR}/patches"
 	local prefix
-	local patchoutput="patchlevel-gentoo.h"
 
 	[[ -f ${patchdir}/series ]] || return 0
 
@@ -253,8 +252,9 @@ do
 	# label: prepend to the hold space
 	:prepend x; H; d;
 	'
-done < "${WORKDIR}"/patches/series > "${S}/${patchoutput}"
-echo "${patchoutput}" >> "${S}/MANIFEST"
+done < "${WORKDIR}"/patches/series > "${S}/patchlevel-gentoo.h"
+
+	eapply "${FILESDIR}/perl-patchlevel-manifest.patch"
 }
 
 src_prepare() {


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-lang/perl/files/, dev-lang/perl/
@ 2017-01-05  9:43 Andreas Hüttel
  0 siblings, 0 replies; 12+ messages in thread
From: Andreas Hüttel @ 2017-01-05  9:43 UTC (permalink / raw
  To: gentoo-commits

commit:     1d7266e35487144b7a48370571072c74c09c6347
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Jan  5 09:40:54 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Jan  5 09:42:53 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1d7266e3

Revert "dev-lang/perl: Restore MANIFEST sort order, bug 589302"

This commit / patch is not needed since we already have a fix for the bug.
See https://github.com/gentoo-perl/perl-patchset/commit/23179a630d04c3d40e7c09bccbf2f38f3ad72b93

This reverts commit 1ddfb9cc7eb204864bcf113b74ca4c5c9780c84a.

 dev-lang/perl/files/perl-patchlevel-manifest.patch | 10 ----------
 dev-lang/perl/perl-5.24.1_rc4.ebuild               |  6 +++---
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/dev-lang/perl/files/perl-patchlevel-manifest.patch b/dev-lang/perl/files/perl-patchlevel-manifest.patch
deleted file mode 100644
index 3592ae0..00000000
--- a/dev-lang/perl/files/perl-patchlevel-manifest.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/MANIFEST
-+++ b/MANIFEST
-@@ -4678,6 +4678,7 @@
- pad.h				Scratchpad headers
- parser.h			parser object header
-+patchlevel-gentoo.h			Gentoo's Perl patch level
- patchlevel.h			The current patch level of perl
- perlapi.c			Perl API functions
- perlapi.h			Perl API function declarations
- perl.c				main()

diff --git a/dev-lang/perl/perl-5.24.1_rc4.ebuild b/dev-lang/perl/perl-5.24.1_rc4.ebuild
index e560ac1..47bd73d 100644
--- a/dev-lang/perl/perl-5.24.1_rc4.ebuild
+++ b/dev-lang/perl/perl-5.24.1_rc4.ebuild
@@ -215,6 +215,7 @@ src_prepare_update_patchlevel_h() {
 	# it under the same terms as Perl itself.
 	local patchdir="${WORKDIR}/patches"
 	local prefix
+	local patchoutput="patchlevel-gentoo.h"
 
 	[[ -f ${patchdir}/series ]] || return 0
 
@@ -252,9 +253,8 @@ do
 	# label: prepend to the hold space
 	:prepend x; H; d;
 	'
-done < "${WORKDIR}"/patches/series > "${S}/patchlevel-gentoo.h"
-
-	eapply "${FILESDIR}/perl-patchlevel-manifest.patch"
+done < "${WORKDIR}"/patches/series > "${S}/${patchoutput}"
+echo "${patchoutput}" >> "${S}/MANIFEST"
 }
 
 src_prepare() {


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-lang/perl/files/, dev-lang/perl/
@ 2018-02-22 23:48 Andreas Hüttel
  0 siblings, 0 replies; 12+ messages in thread
From: Andreas Hüttel @ 2018-02-22 23:48 UTC (permalink / raw
  To: gentoo-commits

commit:     32f2d135ae0be4622f332480c630b5d31134ef78
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 22 23:47:52 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Feb 22 23:48:12 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=32f2d135

dev-lang/perl: No pointless linking to libnsl, no including xlocale.h

Bug: https://bugs.gentoo.org/648460
Package-Manager: Portage-2.3.24, Repoman-2.3.6

 dev-lang/perl/files/perl-5.24-libnsl.patch |  13 +
 dev-lang/perl/perl-5.24.3-r1.ebuild        | 572 ++++++++++++++++++++++++++
 dev-lang/perl/perl-5.26.1-r2.ebuild        | 627 +++++++++++++++++++++++++++++
 3 files changed, 1212 insertions(+)

diff --git a/dev-lang/perl/files/perl-5.24-libnsl.patch b/dev-lang/perl/files/perl-5.24-libnsl.patch
new file mode 100644
index 00000000000..5cd6f88c998
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.24-libnsl.patch
@@ -0,0 +1,13 @@
+diff --git a/Configure b/Configure
+index e32d18ce1f..85ab0249bc 100755
+--- a/Configure
++++ b/Configure
+@@ -1497,7 +1497,7 @@ archname=''
+ usereentrant='undef'
+ : List of libraries we want.
+ : If anyone needs extra -lxxx, put those in a hint file.
+-libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
++libswanted="cl pthread socket bind inet ndbm gdbm dbm db malloc dl ld"
+ libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
+ : We probably want to search /usr/shlib before most other libraries.
+ : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.

diff --git a/dev-lang/perl/perl-5.24.3-r1.ebuild b/dev-lang/perl/perl-5.24.3-r1.ebuild
new file mode 100644
index 00000000000..0d11fd1d39d
--- /dev/null
+++ b/dev-lang/perl/perl-5.24.3-r1.ebuild
@@ -0,0 +1,572 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit eutils alternatives flag-o-matic toolchain-funcs multilib multiprocessing
+
+PATCH_VER=2
+CROSS_VER=1.1.7
+PATCH_BASE="perl-5.24.3-patches-${PATCH_VER}"
+
+PERL_OLDVERSEN="5.24.2 5.24.1 5.24.0"
+DIST_AUTHOR=SHAY
+
+SHORT_PV="${PV%.*}"
+MY_P="perl-${PV/_rc/-RC}"
+MY_PV="${PV%_rc*}"
+
+DESCRIPTION="Larry Wall's Practical Extraction and Report Language"
+
+SRC_URI="
+	mirror://cpan/src/5.0/${MY_P}.tar.xz
+	mirror://cpan/authors/id/${DIST_AUTHOR:0:1}/${DIST_AUTHOR:0:2}/${DIST_AUTHOR}/${MY_P}.tar.xz
+	https://github.com/gentoo-perl/perl-patchset/releases/download/${PATCH_BASE}/${PATCH_BASE}.tar.xz
+	mirror://gentoo/${PATCH_BASE}.tar.xz
+	https://dev.gentoo.org/~kentnl/distfiles/${PATCH_BASE}.tar.xz
+	https://github.com/arsv/perl-cross/releases/download/${CROSS_VER}/perl-cross-${CROSS_VER}.tar.gz
+"
+HOMEPAGE="https://www.perl.org/"
+
+LICENSE="|| ( Artistic GPL-1+ )"
+SLOT="0/${SHORT_PV}"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="berkdb debug doc gdbm ithreads"
+
+RDEPEND="
+	berkdb? ( sys-libs/db:= )
+	gdbm? ( >=sys-libs/gdbm-1.8.3 )
+	app-arch/bzip2
+	sys-libs/zlib
+"
+DEPEND="${RDEPEND}
+	!prefix? ( elibc_FreeBSD? ( sys-freebsd/freebsd-mk-defs ) )
+"
+PDEPEND="
+	>=app-admin/perl-cleaner-2.5
+	>=virtual/perl-File-Path-2.130.0
+	>=virtual/perl-File-Temp-0.230.400-r2
+	>=virtual/perl-Data-Dumper-2.154.0
+	virtual/perl-Test-Harness
+"
+# bug 390719, bug 523624, bug 620304
+# virtual/perl-Test-Harness is here for the bundled ExtUtils::MakeMaker
+
+S="${WORKDIR}/${MY_P}"
+
+PATCHES=( "${FILESDIR}/perl-5.24-libnsl.patch" )
+
+dual_scripts() {
+	src_remove_dual      perl-core/Archive-Tar        2.40.100_rc   ptar ptardiff ptargrep
+	src_remove_dual      perl-core/CPAN               2.110.100_rc  cpan
+	src_remove_dual      perl-core/Digest-SHA         5.950.100_rc  shasum
+	src_remove_dual      perl-core/Encode             2.800.100_rc  enc2xs piconv
+	src_remove_dual      perl-core/ExtUtils-MakeMaker 7.100.200_rc  instmodsh
+	src_remove_dual      perl-core/ExtUtils-ParseXS   3.310.0       xsubpp
+	src_remove_dual      perl-core/IO-Compress        2.69.1_rc          zipdetails
+	src_remove_dual      perl-core/JSON-PP            2.273.0.100_rc     json_pp
+	src_remove_dual      perl-core/Module-CoreList    5.201.709.222.400_rc  corelist
+	src_remove_dual      perl-core/Pod-Parser         1.630.0       pod2usage podchecker podselect
+	src_remove_dual      perl-core/Pod-Perldoc        3.250.300_rc  perldoc
+	src_remove_dual      perl-core/Test-Harness       3.360.100_rc  prove
+	src_remove_dual      perl-core/podlators          4.70.0        pod2man pod2text
+	src_remove_dual_man  perl-core/podlators          4.70.0        /usr/share/man/man1/perlpodstyle.1
+}
+
+check_rebuild() {
+	# Fresh install
+	if [[ -z "${REPLACING_VERSIONS}" ]]; then
+		return 0;
+	# Major Upgrade
+	# doesn't matter if there's multiple copies, it still needs a rebuild
+	# if the string is anything other than "5.CURRENTMAJOR"
+	elif [[ "${REPLACING_VERSIONS%.*}" != "${PV%.*}" ]]; then
+		echo ""
+		ewarn "UPDATE THE PERL MODULES:"
+		ewarn "After updating dev-lang/perl the installed Perl modules"
+		ewarn "have to be re-installed. In most cases, this is done automatically"
+		ewarn "by the package manager, but subsequent steps are still recommended"
+		ewarn "to ensure system consistency."
+		ewarn
+		ewarn "You should start with a depclean to remove any unused perl dependencies"
+		ewarn "that may confuse portage in future. Regular depcleans are also encouraged"
+		ewarn "as part of your regular update cycle, as that will keep perl upgrades working."
+		ewarn "Recommended: emerge --depclean -va"
+		ewarn
+		ewarn "You should then call perl-cleaner to clean up any old files and trigger any"
+		ewarn "remaining rebuilds portage may have missed."
+		ewarn "Use: perl-cleaner --all"
+		return 0;
+
+	# Reinstall w/ USE Change
+	elif (   use ithreads && ! has_version dev-lang/perl[ithreads] ) || \
+		 ( ! use ithreads &&   has_version dev-lang/perl[ithreads] ) || \
+		 (   use debug    && ! has_version dev-lang/perl[debug]    ) || \
+		 ( ! use debug    &&   has_version dev-lang/perl[debug]    ) ; then
+		echo ""
+		ewarn "TOGGLED USE-FLAGS WARNING:"
+		ewarn "You changed one of the use-flags ithreads or debug."
+		ewarn "You must rebuild all perl-modules installed."
+		ewarn "Use: perl-cleaner --modules ; perl-cleaner --force --libperl"
+	fi
+}
+
+pkg_setup() {
+	case ${CHOST} in
+		*-freebsd*)   osname="freebsd" ;;
+		*-dragonfly*) osname="dragonfly" ;;
+		*-netbsd*)    osname="netbsd" ;;
+		*-openbsd*)   osname="openbsd" ;;
+		*-darwin*)    osname="darwin" ;;
+		*-interix*)   osname="interix" ;;
+		*-aix*)       osname="aix" ;;
+		*-cygwin*)    osname="cygwin" ;;
+		*)            osname="linux" ;;
+	esac
+
+	myarch="${CHOST%%-*}-${osname}"
+	if use debug ; then
+		myarch+="-debug"
+	fi
+	if use ithreads ; then
+		mythreading="-multi"
+		myarch+="-thread"
+	fi
+
+	LIBPERL="libperl$(get_libname ${MY_PV} )"
+	PRIV_LIB="/usr/$(get_libdir)/perl5/${MY_PV}"
+	ARCH_LIB="/usr/$(get_libdir)/perl5/${MY_PV}/${myarch}${mythreading}"
+	SITE_LIB="/usr/local/$(get_libdir)/perl5/${MY_PV}"
+	SITE_ARCH="/usr/local/$(get_libdir)/perl5/${MY_PV}/${myarch}${mythreading}"
+	VENDOR_LIB="/usr/$(get_libdir)/perl5/vendor_perl/${MY_PV}"
+	VENDOR_ARCH="/usr/$(get_libdir)/perl5/vendor_perl/${MY_PV}/${myarch}${mythreading}"
+
+	dual_scripts
+}
+
+src_remove_dual_file() {
+	local i pkg ver
+	pkg="$1"
+	ver="$2"
+	shift 2
+	case "${EBUILD_PHASE:-none}" in
+		postinst|postrm)
+			for i in "$@" ; do
+				alternatives_auto_makesym "${i}" "${i}-[0-9]*"
+			done
+			;;
+		setup)
+			for i in "$@" ; do
+				if [[ -f ${EROOT}${i} && ! -h ${EROOT}${i} ]] ; then
+					has_version ${pkg} && ewarn "You must reinstall ${pkg} !"
+					break
+				fi
+			done
+			;;
+		install)
+			for i in "$@" ; do
+				if ! [[ -f "${ED}"${i} ]] ; then
+					ewarn "${i} does not exist!"
+					continue
+				fi
+				mv "${ED}"${i}{,-${ver}-${P}} || die
+			done
+			;;
+	esac
+}
+
+src_remove_dual_man() {
+	local i pkg ver ff
+	pkg="$1"
+	ver="$2"
+	shift 2
+	case "${EBUILD_PHASE:-none}" in
+		postinst|postrm)
+			for i in "$@" ; do
+				ff=`echo "${EROOT}${i%.[0-9]}-${ver}-${P}${i#${i%.[0-9]}}"*`
+				ff=${ff##*${i#${i%.[0-9]}}}
+				alternatives_auto_makesym "${i}${ff}" "${i%.[0-9]}-[0-9]*"
+			done
+			;;
+		install)
+			for i in "$@" ; do
+				if ! [[ -f "${ED}"${i} ]] ; then
+					ewarn "${i} does not exist!"
+					continue
+				fi
+				mv "${ED}"${i} "${ED}"${i%.[0-9]}-${ver}-${P}${i#${i%.[0-9]}} || die
+			done
+			;;
+	esac
+}
+
+src_remove_dual() {
+	local i pkg ver
+	pkg="$1"
+	ver="$2"
+	shift 2
+	for i in "$@" ; do
+		src_remove_dual_file  "${pkg}" "${ver}" "/usr/bin/${i}"
+		src_remove_dual_man   "${pkg}" "${ver}" "/usr/share/man/man1/${i}.1"
+	done
+}
+
+src_prepare_update_patchlevel_h() {
+	# Copied and modified from debian:
+	# Copyright 2011 Niko Tyni
+	# This program is free software; you can redistribute it and/or modify
+	# it under the same terms as Perl itself.
+	local patchdir="${WORKDIR}/patches"
+	local prefix
+	local patchoutput="patchlevel-gentoo.h"
+
+	[[ -f ${patchdir}/series ]] || return 0
+
+while read patch
+do
+	patchname=$(echo $patch | sed 's/\.diff$//')
+	< $patchdir/$patch sed -e '/^Subject:/ { N; s/\n / / }' | sed -n -e '
+
+	# massage the patch headers
+	s|^Bug: .*https\?://rt\.perl\.org/.*id=\(.*\).*|[perl #\1]|; tprepend;
+	s|^Bug: .*https\?://rt\.cpan\.org/.*id=\(.*\).*|[rt.cpan.org #\1]|; tprepend;
+	s|^Bug-Gentoo: ||; tprepend;
+	s/^\(Subject\|Description\): //; tappend;
+	s|^Origin: .*http://perl5\.git\.perl\.org/perl\.git/commit\(diff\)\?/\(.......\).*|[\2]|; tprepend;
+
+	# post-process at the end of input
+	$ { x;
+		# include the version number in the patchlevel.h description (if available)
+		s/List packaged patches/&'" for ${PF}(#${PATCH_VER})"'/;
+
+		# escape any backslashes and double quotes
+		s|\\|\\\\|g; s|"|\\"|g;
+
+		# add a prefix
+		s|^|\t,"'"$prefix$patchname"' - |;
+		# newlines away
+		s/\n/ /g; s/  */ /g;
+		# add a suffix
+		s/ *$/"/; p
+	};
+	# stop all processing
+	d;
+	# label: append to the hold space
+	:append H; d;
+	# label: prepend to the hold space
+	:prepend x; H; d;
+	'
+done < "${WORKDIR}"/patches/series > "${S}/${patchoutput}"
+echo "${patchoutput}" >> "${S}/MANIFEST"
+}
+
+src_prepare() {
+	local patch
+	EPATCH_OPTS+=" -p1"
+	einfo "Applying patches from ${MY_P}-${PATCH_VER} ..."
+	while read patch ; do
+		EPATCH_SINGLE_MSG="  ${patch} ..."
+		epatch "${WORKDIR}"/patches/${patch}
+	done < "${WORKDIR}"/patches/series
+
+	src_prepare_update_patchlevel_h
+
+	if tc-is-cross-compiler; then
+		cp -a ../perl-cross-${CROSS_VER}/* . || die
+
+		sed -i \
+			-e 's/(15 + $CLEANUP)/(13 + $CLEANUP)/' \
+			cnf/diffs/perl5-${PV}/makemaker-test.patch || die
+
+		sed -i \
+			-e 's/MakeMaker\.pm .*/MakeMaker.pm bf9174c70a0e50ff2fee4552c7df89b37d292da1/' \
+			-e 's/MM_Unix\.pm .*/MM_Unix.pm b0ec308fe2d7dcfcef5732880db0fae1f4ea80fa/' \
+			cnf/diffs/perl5-${PV}/customized.patch || die
+
+		sed -i \
+			-e 's|^lib/unicore/CombiningClass.pl pod/perluniprops.pod:|lib/unicore/CombiningClass.pl pod/perluniprops.pod: $(CONFIGPM)|' \
+			Makefile || die
+
+		# bug 604072
+		MAKEOPTS+=" -j1"
+		export MAKEOPTS
+	fi
+
+	if ! tc-is-static-only ; then
+		ln -s ${LIBPERL} libperl$(get_libname ${SHORT_PV}) || die
+		ln -s ${LIBPERL} libperl$(get_libname ) || die
+	fi
+
+	if use gdbm; then
+		sed -i "s:INC => .*:INC => \"-I${EROOT}usr/include/gdbm\":g" \
+			ext/NDBM_File/Makefile.PL || die
+	fi
+
+	default
+}
+
+myconf() {
+	# the myconf array is declared in src_configure
+	myconf=( "${myconf[@]}" "$@" )
+}
+
+src_configure() {
+	declare -a myconf
+
+	export LC_ALL="C"
+	[[ ${COLUMNS:-1} -ge 1 ]] || unset COLUMNS # bug #394091
+
+	# some arches and -O do not mix :)
+	use ppc && replace-flags -O? -O1
+
+	# Perl has problems compiling with -Os in your flags with glibc
+	use elibc_uclibc || replace-flags "-Os" "-O2"
+
+	# xlocale.h is going away in glibc-2.26, so it's counterproductive
+	# if we use it and include it in CORE/perl.h ... Perl builds just
+	# fine with glibc and locale.h only.
+	# However, the darwin prefix people have no locale.h ...
+	use elibc_glibc && myconf -Ui_xlocale
+
+	# This flag makes compiling crash in interesting ways
+	filter-flags "-malign-double"
+
+	# Fixes bug #97645
+	use ppc && filter-flags "-mpowerpc-gpopt"
+
+	# Fixes bug #143895 on gcc-4.1.1
+	filter-flags "-fsched2-use-superblocks"
+
+	use sparc && myconf -Ud_longdbl
+
+	export BUILD_BZIP2=0
+	export BZIP2_INCLUDE=${EROOT}/usr/include
+	export BZIP2_LIB=${EROOT}/usr/$(get_libdir)
+
+	export BUILD_ZLIB=False
+	export ZLIB_INCLUDE=${EROOT}/usr/include
+	export ZLIB_LIB=${EROOT}/usr/$(get_libdir)
+
+	# allow either gdbm to provide ndbm (in <gdbm/ndbm.h>) or db1
+	myndbm='U'
+	mygdbm='U'
+	mydb='U'
+	if use gdbm ; then
+		mygdbm='D'
+		if use berkdb ; then
+			myndbm='D'
+		fi
+	fi
+	if use berkdb ; then
+		mydb='D'
+		has_version '=sys-libs/db-1*' && myndbm='D'
+	fi
+
+	myconf "-${myndbm}i_ndbm" "-${mygdbm}i_gdbm" "-${mydb}i_db"
+
+	if use alpha && [[ "$(tc-getCC)" = "ccc" ]] ; then
+		ewarn "Perl will not be built with berkdb support, use gcc if you needed it..."
+		myconf -Ui_db -Ui_ndbm
+	fi
+
+	use ithreads && myconf -Dusethreads
+
+	if use debug ; then
+		append-cflags "-g"
+		myconf -DDEBUGGING
+	elif [[ ${CFLAGS} == *-g* ]] ; then
+		myconf -DDEBUGGING=-g
+	else
+		myconf -DDEBUGGING=none
+	fi
+
+	if [[ -n ${PERL_OLDVERSEN} ]] ; then
+		local inclist=$(for v in ${PERL_OLDVERSEN}; do echo -n "${v}/${myarch}${mythreading} ${v} "; done )
+		myconf -Dinc_version_list="${inclist}"
+	fi
+
+	[[ ${ELIBC} == "FreeBSD" ]] && myconf "-Dlibc=/usr/$(get_libdir)/libc.a"
+
+	# Make sure we can do the final link #523730, need to set deployment
+	# target to override hardcoded 10.3 which breaks on modern OSX
+	[[ ${CHOST} == *-darwin* ]] && \
+		myconf "-Dld=env MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} $(tc-getCC)"
+
+	# Prefix: the host system needs not to follow Gentoo multilib stuff, and in
+	# Prefix itself we don't do multilib either, so make sure perl can find
+	# something compatible.
+	if use prefix ; then
+		# Set a hook to check for each detected library whether it actually works.
+		export libscheck="
+			( echo 'main(){}' > '${T}'/conftest.c &&
+			  $(tc-getCC) -o '${T}'/conftest '${T}'/conftest.c -l\$thislib >/dev/null 2>/dev/null
+			) || xxx=/dev/null"
+
+		# Use all host paths that might contain useful stuff, the hook above will filter out bad choices.
+		local paths="/lib/*-linux-gnu /usr/lib/*-linux-gnu /lib64 /lib/64 /usr/lib64 /usr/lib/64 /lib32 /usr/lib32 /lib /usr/lib"
+		myconf "-Dlibpth=${EPREFIX}/$(get_libdir) ${EPREFIX}/usr/$(get_libdir) ${paths}"
+	elif [[ $(get_libdir) != "lib" ]] ; then
+		# We need to use " and not ', as the written config.sh use ' ...
+		myconf "-Dlibpth=/usr/local/$(get_libdir) /$(get_libdir) /usr/$(get_libdir)"
+	fi
+
+	# don't try building ODBM, bug #354453
+	disabled_extensions="ODBM_File"
+
+	if ! use gdbm ; then
+		# workaround for bug #157774: don't try building GDBM related stuff with USE="-gdbm"
+		disabled_extensions="${disabled_extensions} GDBM_File NDBM_File"
+	fi
+
+	myconf -Dnoextensions="${disabled_extensions}"
+
+	[[ -n "${EXTRA_ECONF}" ]] && ewarn During Perl build, EXTRA_ECONF=${EXTRA_ECONF}
+	# allow fiddling via EXTRA_ECONF, bug 558070
+	eval "local -a EXTRA_ECONF=(${EXTRA_ECONF})"
+
+	myconf \
+		-Duseshrplib \
+		-Darchname="${myarch}" \
+		-Dcc="$(tc-getCC)" \
+		-Doptimize="${CFLAGS}" \
+		-Dldflags="${LDFLAGS}" \
+		-Dprefix="${EPREFIX}"'/usr' \
+		-Dsiteprefix="${EPREFIX}"'/usr/local' \
+		-Dvendorprefix="${EPREFIX}"'/usr' \
+		-Dscriptdir="${EPREFIX}"'/usr/bin' \
+		-Dprivlib="${EPREFIX}${PRIV_LIB}" \
+		-Darchlib="${EPREFIX}${ARCH_LIB}" \
+		-Dsitelib="${EPREFIX}${SITE_LIB}" \
+		-Dsitearch="${EPREFIX}${SITE_ARCH}" \
+		-Dvendorlib="${EPREFIX}${VENDOR_LIB}" \
+		-Dvendorarch="${EPREFIX}${VENDOR_ARCH}" \
+		-Dman1dir="${EPREFIX}"/usr/share/man/man1 \
+		-Dman3dir="${EPREFIX}"/usr/share/man/man3 \
+		-Dsiteman1dir="${EPREFIX}"/usr/local/man/man1 \
+		-Dsiteman3dir="${EPREFIX}"/usr/local/man/man3 \
+		-Dvendorman1dir="${EPREFIX}"/usr/share/man/man1 \
+		-Dvendorman3dir="${EPREFIX}"/usr/share/man/man3 \
+		-Dman1ext='1' \
+		-Dman3ext='3pm' \
+		-Dlibperl="${LIBPERL}" \
+		-Dlocincpth="${EPREFIX}"'/usr/include ' \
+		-Dglibpth="${EPREFIX}/$(get_libdir) ${EPREFIX}/usr/$(get_libdir)"' ' \
+		-Duselargefiles \
+		-Dd_semctl_semun \
+		-Dcf_by='Gentoo' \
+		-Dmyhostname='localhost' \
+		-Dperladmin='root@localhost' \
+		-Ud_csh \
+		-Dsh="${EPREFIX}"/bin/sh \
+		-Dtargetsh="${EPREFIX}"/bin/sh \
+		-Uusenm \
+		"${myconf[@]}" \
+		"${EXTRA_ECONF[@]}"
+
+	if tc-is-cross-compiler; then
+		./configure \
+			--target="${CHOST}" \
+			--build="${CBUILD}" \
+			-Dinstallprefix='' \
+			-Dinstallusrbinperl='undef' \
+			-Dusevendorprefix='define' \
+			"${myconf[@]}" \
+			|| die "Unable to configure"
+	else
+		sh Configure \
+			-des \
+			-Dinstallprefix="${EPREFIX}"'/usr' \
+			-Dinstallusrbinperl='n' \
+			"${myconf[@]}" \
+			|| die "Unable to configure"
+	fi
+}
+
+src_test() {
+	export NO_GENTOO_NETWORK_TESTS=1;
+	if [[ ${EUID} == 0 ]] ; then
+		ewarn "Test fails with a sandbox error (#328793) if run as root. Skipping tests..."
+		return 0
+	fi
+	use elibc_uclibc && export MAKEOPTS+=" -j1"
+	TEST_JOBS="$(makeopts_jobs)" make test_harness || die "test failed"
+}
+
+src_install() {
+	local i
+	local coredir="${ARCH_LIB}/CORE"
+
+	emake DESTDIR="${D}" install
+
+	rm -f "${ED}/usr/bin/perl${MY_PV}"
+	ln -s perl "${ED}"/usr/bin/perl${MY_PV} || die
+
+	if ! tc-is-static-only ; then
+		dolib.so "${ED}"${coredir}/${LIBPERL}
+		rm -f "${ED}"${coredir}/${LIBPERL}
+		ln -sf ${LIBPERL} "${ED}"/usr/$(get_libdir)/libperl$(get_libname ${SHORT_PV}) || die
+		ln -sf ${LIBPERL} "${ED}"/usr/$(get_libdir)/libperl$(get_libname) || die
+		ln -sf ../../../../../$(get_libdir)/${LIBPERL} "${ED}"${coredir}/${LIBPERL} || die
+		ln -sf ../../../../../$(get_libdir)/${LIBPERL} "${ED}"${coredir}/libperl$(get_libname ${SHORT_PV}) || die
+		ln -sf ../../../../../$(get_libdir)/${LIBPERL} "${ED}"${coredir}/libperl$(get_libname) || die
+	fi
+
+	rm -rf "${ED}"/usr/share/man/man3 || die "Unable to remove module man pages"
+
+	# This removes ${D} from Config.pm
+	for i in $(find "${D}" -iname "Config.pm" ) ; do
+		einfo "Removing ${D} from ${i}..."
+		sed -i -e "s:${D}::" "${i}" || die "Sed failed"
+	done
+
+	dodoc Changes* README AUTHORS
+
+	if use doc ; then
+		# HTML Documentation
+		# We expect errors, warnings, and such with the following.
+
+		dodir /usr/share/doc/${PF}/html
+		LD_LIBRARY_PATH=. ./perl installhtml \
+			--podroot='.' \
+			--podpath='lib:ext:pod:vms' \
+			--recurse \
+			--htmldir="${ED}/usr/share/doc/${PF}/html"
+	fi
+
+	[[ -d ${ED}/usr/local ]] && rm -r "${ED}"/usr/local
+
+	dual_scripts
+}
+
+pkg_preinst() {
+	check_rebuild
+}
+
+pkg_postinst() {
+	dual_scripts
+
+	if [[ "${ROOT}" = "/" ]] ; then
+		local INC DIR file
+		INC=$(perl -e 'for $line (@INC) { next if $line eq "."; next if $line =~ m/'${SHORT_PV}'|etc|local|perl$/; print "$line\n" }')
+		einfo "Removing old .ph files"
+		for DIR in ${INC} ; do
+			if [[ -d "${DIR}" ]] ; then
+				for file in $(find "${DIR}" -name "*.ph" -type f ) ; do
+					rm -f "${file}"
+					einfo "<< ${file}"
+				done
+			fi
+		done
+		# Silently remove the now empty dirs
+		for DIR in ${INC} ; do
+			if [[ -d "${DIR}" ]] ; then
+				find "${DIR}" -depth -type d -print0 | xargs -0 -r rmdir &> /dev/null
+			fi
+		done
+
+	fi
+}
+
+pkg_postrm(){
+	dual_scripts
+}

diff --git a/dev-lang/perl/perl-5.26.1-r2.ebuild b/dev-lang/perl/perl-5.26.1-r2.ebuild
new file mode 100644
index 00000000000..2b6ee9d381d
--- /dev/null
+++ b/dev-lang/perl/perl-5.26.1-r2.ebuild
@@ -0,0 +1,627 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit eutils alternatives flag-o-matic toolchain-funcs multilib multiprocessing
+
+PATCH_VER=1
+CROSS_VER=1.1.7
+PATCH_BASE="perl-5.26.1-patches-${PATCH_VER}"
+
+DIST_AUTHOR=SHAY
+
+# Greatest first, don't include yourself
+# Devel point-releases are not ABI-intercompatible, but stable point releases are
+# BIN_OLDVERSEN is contains only C-ABI-intercompatible versions
+PERL_BIN_OLDVERSEN="5.26.0"
+if [[ "${PV##*.}" == "9999" ]]; then
+	DIST_VERSION=5.26.1-RC1
+else
+	DIST_VERSION="${PV/_rc/-RC}"
+fi
+SHORT_PV="${DIST_VERSION%.*}"
+# Even numbered major versions are ABI intercompatible
+# Odd numbered major versions are not
+if [[ $(( ${SHORT_PV#*.} % 2 )) == 1 ]]; then
+	SUBSLOT="${DIST_VERSION%-RC*}"
+else
+	SUBSLOT="${DIST_VERSION%.*}"
+fi
+# Used only in tar paths
+MY_P="perl-${DIST_VERSION}"
+# Used in library paths
+MY_PV="${DIST_VERSION%-RC*}"
+
+DESCRIPTION="Larry Wall's Practical Extraction and Report Language"
+
+SRC_URI="
+	mirror://cpan/src/5.0/${MY_P}.tar.xz
+	mirror://cpan/authors/id/${DIST_AUTHOR:0:1}/${DIST_AUTHOR:0:2}/${DIST_AUTHOR}/${MY_P}.tar.xz
+	https://github.com/gentoo-perl/perl-patchset/releases/download/${PATCH_BASE}/${PATCH_BASE}.tar.xz
+	mirror://gentoo/${PATCH_BASE}.tar.xz
+	https://dev.gentoo.org/~kentnl/distfiles/${PATCH_BASE}.tar.xz
+	https://github.com/arsv/perl-cross/releases/download/${CROSS_VER}/perl-cross-${CROSS_VER}.tar.gz
+"
+HOMEPAGE="https://www.perl.org/"
+
+LICENSE="|| ( Artistic GPL-1+ )"
+SLOT="0/${SUBSLOT}"
+
+if [[ "${PV##*.}" != "9999" ]]; then
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+
+IUSE="berkdb debug doc gdbm ithreads"
+
+RDEPEND="
+	berkdb? ( sys-libs/db:= )
+	gdbm? ( >=sys-libs/gdbm-1.8.3 )
+	app-arch/bzip2
+	sys-libs/zlib
+"
+DEPEND="${RDEPEND}
+	!prefix? ( elibc_FreeBSD? ( sys-freebsd/freebsd-mk-defs ) )
+"
+PDEPEND="
+	>=app-admin/perl-cleaner-2.5
+	>=virtual/perl-File-Temp-0.230.400-r2
+	>=virtual/perl-Data-Dumper-2.154.0
+	virtual/perl-Test-Harness
+"
+# bug 390719, bug 523624
+# virtual/perl-Test-Harness is here for the bundled ExtUtils::MakeMaker
+
+S="${WORKDIR}/${MY_P}"
+
+PATCHES=( "${FILESDIR}/perl-5.24-libnsl.patch" )
+
+dual_scripts() {
+	src_remove_dual      perl-core/Archive-Tar        2.240.0       ptar ptardiff ptargrep
+	src_remove_dual      perl-core/CPAN               2.180.0       cpan
+	src_remove_dual      perl-core/Digest-SHA         5.960.0       shasum
+	src_remove_dual      perl-core/Encode             2.880.0       enc2xs piconv
+	src_remove_dual      perl-core/ExtUtils-MakeMaker 7.240.0       instmodsh
+	src_remove_dual      perl-core/ExtUtils-ParseXS   3.340.0       xsubpp
+	src_remove_dual      perl-core/IO-Compress        2.74.0        zipdetails
+	src_remove_dual      perl-core/JSON-PP            2.274.0.200_rc   json_pp
+	src_remove_dual      perl-core/Module-CoreList    5.201.709.222.600_rc corelist
+	src_remove_dual      perl-core/Pod-Parser         1.630.0       pod2usage podchecker podselect
+	src_remove_dual      perl-core/Pod-Perldoc        3.280.0       perldoc
+	src_remove_dual      perl-core/Test-Harness       3.380.0       prove
+	src_remove_dual      perl-core/podlators          4.90.0        pod2man pod2text
+	src_remove_dual_man  perl-core/podlators          4.90.0        /usr/share/man/man1/perlpodstyle.1
+}
+
+check_rebuild() {
+	# Fresh install
+	if [[ -z "${REPLACING_VERSIONS}" ]]; then
+		return 0;
+	# Major Upgrade
+	# doesn't matter if there's multiple copies, it still needs a rebuild
+	# if the string is anything other than "5.CURRENTMAJOR"
+	elif [[ "${REPLACING_VERSIONS%.*}" != "${PV%.*}" ]]; then
+		echo ""
+		ewarn "UPDATE THE PERL MODULES:"
+		ewarn "After updating dev-lang/perl the installed Perl modules"
+		ewarn "have to be re-installed. In most cases, this is done automatically"
+		ewarn "by the package manager, but subsequent steps are still recommended"
+		ewarn "to ensure system consistency."
+		ewarn
+		ewarn "You should start with a depclean to remove any unused perl dependencies"
+		ewarn "that may confuse portage in future. Regular depcleans are also encouraged"
+		ewarn "as part of your regular update cycle, as that will keep perl upgrades working."
+		ewarn "Recommended: emerge --depclean -va"
+		ewarn
+		ewarn "You should then call perl-cleaner to clean up any old files and trigger any"
+		ewarn "remaining rebuilds portage may have missed."
+		ewarn "Use: perl-cleaner --all"
+		return 0;
+
+	# Reinstall w/ USE Change
+	elif (   use ithreads && ! has_version dev-lang/perl[ithreads] ) || \
+		 ( ! use ithreads &&   has_version dev-lang/perl[ithreads] ) || \
+		 (   use debug    && ! has_version dev-lang/perl[debug]    ) || \
+		 ( ! use debug    &&   has_version dev-lang/perl[debug]    ) ; then
+		echo ""
+		ewarn "TOGGLED USE-FLAGS WARNING:"
+		ewarn "You changed one of the use-flags ithreads or debug."
+		ewarn "You must rebuild all perl-modules installed."
+		ewarn "Use: perl-cleaner --modules ; perl-cleaner --force --libperl"
+	fi
+}
+
+pkg_setup() {
+	case ${CHOST} in
+		*-freebsd*)   osname="freebsd" ;;
+		*-dragonfly*) osname="dragonfly" ;;
+		*-netbsd*)    osname="netbsd" ;;
+		*-openbsd*)   osname="openbsd" ;;
+		*-darwin*)    osname="darwin" ;;
+		*-interix*)   osname="interix" ;;
+		*-aix*)       osname="aix" ;;
+		*-cygwin*)    osname="cygwin" ;;
+		*)            osname="linux" ;;
+	esac
+
+	myarch="${CHOST%%-*}-${osname}"
+	if use debug ; then
+		myarch+="-debug"
+	fi
+	if use ithreads ; then
+		mythreading="-multi"
+		myarch+="-thread"
+	fi
+
+	PRIV_BASE="/usr/$(get_libdir)/perl5"
+	SITE_BASE="/usr/local/$(get_libdir)/perl5"
+	VENDOR_BASE="/usr/$(get_libdir)/perl5/vendor_perl"
+
+	LIBPERL="libperl$(get_libname ${MY_PV} )"
+	PRIV_LIB="${PRIV_BASE}/${MY_PV}"
+	ARCH_LIB="${PRIV_BASE}/${MY_PV}/${myarch}${mythreading}"
+	SITE_LIB="${SITE_BASE}/${MY_PV}"
+	SITE_ARCH="${SITE_BASE}/${MY_PV}/${myarch}${mythreading}"
+	VENDOR_LIB="${VENDOR_BASE}/${MY_PV}"
+	VENDOR_ARCH="${VENDOR_BASE}/${MY_PV}/${myarch}${mythreading}"
+
+	dual_scripts
+}
+
+src_remove_dual_file() {
+	local i pkg ver
+	pkg="$1"
+	ver="$2"
+	shift 2
+	case "${EBUILD_PHASE:-none}" in
+		postinst|postrm)
+			for i in "$@" ; do
+				alternatives_auto_makesym "${i}" "${i}-[0-9]*"
+			done
+			;;
+		setup)
+			for i in "$@" ; do
+				if [[ -f ${EROOT}${i} && ! -h ${EROOT}${i} ]] ; then
+					has_version ${pkg} && ewarn "You must reinstall ${pkg} !"
+					break
+				fi
+			done
+			;;
+		install)
+			for i in "$@" ; do
+				if ! [[ -f "${ED}"${i} ]] ; then
+					ewarn "${i} does not exist!"
+					continue
+				fi
+				mv "${ED}"${i}{,-${ver}-${P}} || die
+			done
+			;;
+	esac
+}
+
+src_remove_dual_man() {
+	local i pkg ver ff
+	pkg="$1"
+	ver="$2"
+	shift 2
+	case "${EBUILD_PHASE:-none}" in
+		postinst|postrm)
+			for i in "$@" ; do
+				ff=`echo "${EROOT}${i%.[0-9]}-${ver}-${P}${i#${i%.[0-9]}}"*`
+				ff=${ff##*${i#${i%.[0-9]}}}
+				alternatives_auto_makesym "${i}${ff}" "${i%.[0-9]}-[0-9]*"
+			done
+			;;
+		install)
+			for i in "$@" ; do
+				if ! [[ -f "${ED}"${i} ]] ; then
+					ewarn "${i} does not exist!"
+					continue
+				fi
+				mv "${ED}"${i} "${ED}"${i%.[0-9]}-${ver}-${P}${i#${i%.[0-9]}} || die
+			done
+			;;
+	esac
+}
+
+src_remove_dual() {
+	local i pkg ver
+	pkg="$1"
+	ver="$2"
+	shift 2
+	for i in "$@" ; do
+		src_remove_dual_file  "${pkg}" "${ver}" "/usr/bin/${i}"
+		src_remove_dual_man   "${pkg}" "${ver}" "/usr/share/man/man1/${i}.1"
+	done
+}
+
+src_prepare_update_patchlevel_h() {
+	# Copied and modified from debian:
+	# Copyright 2011 Niko Tyni
+	# This program is free software; you can redistribute it and/or modify
+	# it under the same terms as Perl itself.
+	local patchdir="${WORKDIR}/patches"
+	local prefix
+	local patchoutput="patchlevel-gentoo.h"
+
+	[[ -f ${patchdir}/series ]] || return 0
+
+while read patch
+do
+	patchname=$(echo $patch | sed 's/\.diff$//')
+	< $patchdir/$patch sed -e '/^Subject:/ { N; s/\n / / }' | sed -n -e '
+
+	# massage the patch headers
+	s|^Bug: .*https\?://rt\.perl\.org/.*id=\(.*\).*|[perl #\1]|; tprepend;
+	s|^Bug: .*https\?://rt\.cpan\.org/.*id=\(.*\).*|[rt.cpan.org #\1]|; tprepend;
+	s|^Bug-Gentoo: ||; tprepend;
+	s/^\(Subject\|Description\): //; tappend;
+	s|^Origin: .*http://perl5\.git\.perl\.org/perl\.git/commit\(diff\)\?/\(.......\).*|[\2]|; tprepend;
+
+	# post-process at the end of input
+	$ { x;
+		# include the version number in the patchlevel.h description (if available)
+		s/List packaged patches/&'" for ${PF}(#${PATCH_VER})"'/;
+
+		# escape any backslashes and double quotes
+		s|\\|\\\\|g; s|"|\\"|g;
+
+		# add a prefix
+		s|^|\t,"'"$prefix$patchname"' - |;
+		# newlines away
+		s/\n/ /g; s/  */ /g;
+		# add a suffix
+		s/ *$/"/; p
+	};
+	# stop all processing
+	d;
+	# label: append to the hold space
+	:append H; d;
+	# label: prepend to the hold space
+	:prepend x; H; d;
+	'
+done < "${WORKDIR}"/patches/series > "${S}/${patchoutput}"
+echo "${patchoutput}" >> "${S}/MANIFEST"
+}
+
+src_prepare_perlcross() {
+	cp -a ../perl-cross-${CROSS_VER}/* . || die
+
+	sed -i \
+		-e 's/MakeMaker\.pm .*/MakeMaker.pm bf9174c70a0e50ff2fee4552c7df89b37d292da1/' \
+		-e 's/MM_Unix\.pm .*/MM_Unix.pm b0ec308fe2d7dcfcef5732880db0fae1f4ea80fa/' \
+		cnf/diffs/perl5-${PV}/customized.patch || die
+
+	sed -i \
+		-e 's|^lib/unicore/CombiningClass.pl pod/perluniprops.pod:|lib/unicore/CombiningClass.pl pod/perluniprops.pod: $(CONFIGPM)|' \
+		Makefile || die
+
+	# bug 604072
+	MAKEOPTS+=" -j1"
+	export MAKEOPTS
+}
+src_prepare_dynamic() {
+	ln -s ${LIBPERL} libperl$(get_libname ${SHORT_PV}) || die
+	ln -s ${LIBPERL} libperl$(get_libname ) || die
+}
+
+src_prepare() {
+	local patch
+	EPATCH_OPTS+=" -p1"
+	einfo "Applying patches from ${PATCH_BASE} ..."
+	while read patch ; do
+		EPATCH_SINGLE_MSG="  ${patch} ..."
+		epatch "${WORKDIR}"/patches/${patch}
+	done < "${WORKDIR}"/patches/series
+
+	src_prepare_update_patchlevel_h
+
+	tc-is-cross-compiler && src_prepare_perlcross
+
+	tc-is-static-only || src_prepare_dynamic
+
+	if use gdbm; then
+		sed -i "s:INC => .*:INC => \"-I${EROOT}usr/include/gdbm\":g" \
+			ext/NDBM_File/Makefile.PL || die
+	fi
+
+	default
+}
+
+myconf() {
+	# the myconf array is declared in src_configure
+	myconf=( "${myconf[@]}" "$@" )
+}
+
+src_configure() {
+	declare -a myconf
+
+	export LC_ALL="C"
+	[[ ${COLUMNS:-1} -ge 1 ]] || unset COLUMNS # bug #394091
+
+	# some arches and -O do not mix :)
+	use ppc && replace-flags -O? -O1
+
+	# Perl has problems compiling with -Os in your flags with glibc
+	use elibc_uclibc || replace-flags "-Os" "-O2"
+
+	# xlocale.h is going away in glibc-2.26, so it's counterproductive
+	# if we use it and include it in CORE/perl.h ... Perl builds just
+	# fine with glibc and locale.h only.
+	# However, the darwin prefix people have no locale.h ...
+	use elibc_glibc && myconf -Ui_xlocale
+
+	# This flag makes compiling crash in interesting ways
+	filter-flags "-malign-double"
+
+	# Fixes bug #97645
+	use ppc && filter-flags "-mpowerpc-gpopt"
+
+	# Fixes bug #143895 on gcc-4.1.1
+	filter-flags "-fsched2-use-superblocks"
+
+	use sparc && myconf -Ud_longdbl
+
+	export BUILD_BZIP2=0
+	export BZIP2_INCLUDE=${EROOT}/usr/include
+	export BZIP2_LIB=${EROOT}/usr/$(get_libdir)
+
+	export BUILD_ZLIB=False
+	export ZLIB_INCLUDE=${EROOT}/usr/include
+	export ZLIB_LIB=${EROOT}/usr/$(get_libdir)
+
+	# allow either gdbm to provide ndbm (in <gdbm/ndbm.h>) or db1
+	myndbm='U'
+	mygdbm='U'
+	mydb='U'
+	if use gdbm ; then
+		mygdbm='D'
+		if use berkdb ; then
+			myndbm='D'
+		fi
+	fi
+	if use berkdb ; then
+		mydb='D'
+		has_version '=sys-libs/db-1*' && myndbm='D'
+	fi
+
+	myconf "-${myndbm}i_ndbm" "-${mygdbm}i_gdbm" "-${mydb}i_db"
+
+	if use alpha && [[ "$(tc-getCC)" = "ccc" ]] ; then
+		ewarn "Perl will not be built with berkdb support, use gcc if you needed it..."
+		myconf -Ui_db -Ui_ndbm
+	fi
+
+	use ithreads && myconf -Dusethreads
+
+	if use debug ; then
+		append-cflags "-g"
+		myconf -DDEBUGGING
+	elif [[ ${CFLAGS} == *-g* ]] ; then
+		myconf -DDEBUGGING=-g
+	else
+		myconf -DDEBUGGING=none
+	fi
+
+	# Autodiscover all old version directories, some of them will even be newer
+	# if you downgrade
+	if [[ -z ${PERL_OLDVERSEN} ]]; then
+		PERL_OLDVERSEN="$(
+			find "${EROOT%/}${PRIV_BASE}" "${EROOT%/}${SITE_BASE}" "${EROOT%/}${VENDOR_BASE}" \
+				   -maxdepth 1 -mindepth 1 -type d -regex '.*/5[.][0-9]+[.][0-9]+$' \
+				   -printf "%f "  2>/dev/null )"
+	fi
+	# Fixup versions, removing self match, fixing order and dupes
+	PERL_OLDVERSEN="$(
+		echo "${PERL_OLDVERSEN}"           |\
+			tr " " "\n" 				   |\
+			grep -vF "${DIST_VERSION%-RC}" |\
+			sort -u -nr -t'.' -k1,1 -k2,2 -k3,3
+	)"
+
+	# Experts who want a "Pure" install can set PERL_OLDVERSEN to an empty string
+	if [[ -n "${PERL_OLDVERSEN// }" ]]; then
+		local inclist="$(
+				for v in ${PERL_OLDVERSEN};	do
+					has "${v}" ${PERL_BIN_OLDVERSEN} && echo -n "${v}/${myarch}${mythreading} ";
+					echo -n "${v} ";
+				done )"
+		einfo "This version of perl may partially support modules previously"
+		einfo "installed in any of the following paths:"
+		for incpath in ${inclist}; do
+			[[ -e "${EROOT%/}${VENDOR_BASE}/${incpath}" ]] && einfo " ${EROOT%/}${VENDOR_BASE}/${incpath}"
+			[[ -e "${EROOT%/}${PRIV_BASE}/${incpath}"   ]] && einfo " ${EROO%/T}${PRIV_BASE}/${incpath}"
+			[[ -e "${EROOT%/}${SITE_BASE}/${incpath}"   ]] && einfo " ${EROOT%/}${SITE_BASE}/${incpath}"
+		done
+		einfo "This is a temporary measure and you should aim to cleanup these paths"
+		einfo "via world updates and perl-cleaner"
+		myconf -Dinc_version_list="${inclist}"
+	fi
+
+	[[ ${ELIBC} == "FreeBSD" ]] && myconf "-Dlibc=/usr/$(get_libdir)/libc.a"
+
+	# Make sure we can do the final link #523730, need to set deployment
+	# target to override hardcoded 10.3 which breaks on modern OSX
+	[[ ${CHOST} == *-darwin* ]] && \
+		myconf "-Dld=env MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} $(tc-getCC)"
+
+	# Prefix: the host system needs not to follow Gentoo multilib stuff, and in
+	# Prefix itself we don't do multilib either, so make sure perl can find
+	# something compatible.
+	if use prefix ; then
+		# Set a hook to check for each detected library whether it actually works.
+		export libscheck="
+			( echo 'main(){}' > '${T}'/conftest.c &&
+			  $(tc-getCC) -o '${T}'/conftest '${T}'/conftest.c -l\$thislib >/dev/null 2>/dev/null
+			) || xxx=/dev/null"
+
+		# Use all host paths that might contain useful stuff, the hook above will filter out bad choices.
+		local paths="/lib/*-linux-gnu /usr/lib/*-linux-gnu /lib64 /lib/64 /usr/lib64 /usr/lib/64 /lib32 /usr/lib32 /lib /usr/lib"
+		myconf "-Dlibpth=${EPREFIX}/$(get_libdir) ${EPREFIX}/usr/$(get_libdir) ${paths}"
+	elif [[ $(get_libdir) != "lib" ]] ; then
+		# We need to use " and not ', as the written config.sh use ' ...
+		myconf "-Dlibpth=/usr/local/$(get_libdir) /$(get_libdir) /usr/$(get_libdir)"
+	fi
+
+	# don't try building ODBM, bug #354453
+	disabled_extensions="ODBM_File"
+
+	if ! use gdbm ; then
+		# workaround for bug #157774: don't try building GDBM related stuff with USE="-gdbm"
+		disabled_extensions="${disabled_extensions} GDBM_File NDBM_File"
+	fi
+
+	myconf -Dnoextensions="${disabled_extensions}"
+
+	[[ "${PV##*.}" == "9999" ]] && myconf -Dusedevel -Uversiononly
+
+	[[ -n "${EXTRA_ECONF}" ]] && ewarn During Perl build, EXTRA_ECONF=${EXTRA_ECONF}
+	# allow fiddling via EXTRA_ECONF, bug 558070
+	eval "local -a EXTRA_ECONF=(${EXTRA_ECONF})"
+
+	myconf \
+		-Duseshrplib \
+		-Darchname="${myarch}" \
+		-Dcc="$(tc-getCC)" \
+		-Doptimize="${CFLAGS}" \
+		-Dldflags="${LDFLAGS}" \
+		-Dprefix="${EPREFIX}"'/usr' \
+		-Dsiteprefix="${EPREFIX}"'/usr/local' \
+		-Dvendorprefix="${EPREFIX}"'/usr' \
+		-Dscriptdir="${EPREFIX}"'/usr/bin' \
+		-Dprivlib="${EPREFIX}${PRIV_LIB}" \
+		-Darchlib="${EPREFIX}${ARCH_LIB}" \
+		-Dsitelib="${EPREFIX}${SITE_LIB}" \
+		-Dsitearch="${EPREFIX}${SITE_ARCH}" \
+		-Dvendorlib="${EPREFIX}${VENDOR_LIB}" \
+		-Dvendorarch="${EPREFIX}${VENDOR_ARCH}" \
+		-Dman1dir="${EPREFIX}"/usr/share/man/man1 \
+		-Dman3dir="${EPREFIX}"/usr/share/man/man3 \
+		-Dsiteman1dir="${EPREFIX}"/usr/local/man/man1 \
+		-Dsiteman3dir="${EPREFIX}"/usr/local/man/man3 \
+		-Dvendorman1dir="${EPREFIX}"/usr/share/man/man1 \
+		-Dvendorman3dir="${EPREFIX}"/usr/share/man/man3 \
+		-Dman1ext='1' \
+		-Dman3ext='3pm' \
+		-Dlibperl="${LIBPERL}" \
+		-Dlocincpth="${EPREFIX}"'/usr/include ' \
+		-Dglibpth="${EPREFIX}/$(get_libdir) ${EPREFIX}/usr/$(get_libdir)"' ' \
+		-Duselargefiles \
+		-Dd_semctl_semun \
+		-Dcf_by='Gentoo' \
+		-Dmyhostname='localhost' \
+		-Dperladmin='root@localhost' \
+		-Ud_csh \
+		-Dsh="${EPREFIX}"/bin/sh \
+		-Dtargetsh="${EPREFIX}"/bin/sh \
+		-Uusenm \
+		"${myconf[@]}" \
+		"${EXTRA_ECONF[@]}"
+
+	if tc-is-cross-compiler; then
+		./configure \
+			--target="${CHOST}" \
+			--build="${CBUILD}" \
+			-Dinstallprefix='' \
+			-Dinstallusrbinperl='undef' \
+			-Dusevendorprefix='define' \
+			"${myconf[@]}" \
+			|| die "Unable to configure"
+	else
+		sh Configure \
+			-des \
+			-Dinstallprefix="${EPREFIX}"'/usr' \
+			-Dinstallusrbinperl='n' \
+			"${myconf[@]}" \
+			|| die "Unable to configure"
+	fi
+}
+
+src_test() {
+	export NO_GENTOO_NETWORK_TESTS=1;
+	if [[ ${EUID} == 0 ]] ; then
+		ewarn "Test fails with a sandbox error (#328793) if run as root. Skipping tests..."
+		return 0
+	fi
+	use elibc_uclibc && export MAKEOPTS+=" -j1"
+	TEST_JOBS="$(makeopts_jobs)" make test_harness || die "test failed"
+}
+
+src_install() {
+	local i
+	local coredir="${ARCH_LIB}/CORE"
+
+	emake DESTDIR="${D}" install
+
+	rm -f "${ED}/usr/bin/perl${MY_PV}"
+	ln -s perl "${ED}"/usr/bin/perl${MY_PV} || die
+
+	if ! tc-is-static-only ; then
+		dolib.so "${ED}"${coredir}/${LIBPERL}
+		rm -f "${ED}"${coredir}/${LIBPERL}
+		ln -sf ${LIBPERL} "${ED}"/usr/$(get_libdir)/libperl$(get_libname ${SHORT_PV}) || die
+		ln -sf ${LIBPERL} "${ED}"/usr/$(get_libdir)/libperl$(get_libname) || die
+		ln -sf ../../../../../$(get_libdir)/${LIBPERL} "${ED}"${coredir}/${LIBPERL} || die
+		ln -sf ../../../../../$(get_libdir)/${LIBPERL} "${ED}"${coredir}/libperl$(get_libname ${SHORT_PV}) || die
+		ln -sf ../../../../../$(get_libdir)/${LIBPERL} "${ED}"${coredir}/libperl$(get_libname) || die
+	fi
+
+	rm -rf "${ED}"/usr/share/man/man3 || die "Unable to remove module man pages"
+
+	# This removes ${D} from Config.pm
+	for i in $(find "${D}" -iname "Config.pm" ) ; do
+		einfo "Removing ${D} from ${i}..."
+		sed -i -e "s:${D}::" "${i}" || die "Sed failed"
+	done
+
+	dodoc Changes* README AUTHORS
+
+	if use doc ; then
+		# HTML Documentation
+		# We expect errors, warnings, and such with the following.
+
+		dodir /usr/share/doc/${PF}/html
+		LD_LIBRARY_PATH=. ./perl installhtml \
+			--podroot='.' \
+			--podpath='lib:ext:pod:vms' \
+			--recurse \
+			--htmldir="${ED}/usr/share/doc/${PF}/html"
+	fi
+
+	[[ -d ${ED}/usr/local ]] && rm -r "${ED}"/usr/local
+
+	dual_scripts
+}
+
+pkg_preinst() {
+	check_rebuild
+}
+
+pkg_postinst() {
+	dual_scripts
+
+	if [[ "${ROOT}" = "/" ]] ; then
+		local INC DIR file
+		INC=$(perl -e 'for $line (@INC) { next if $line eq "."; next if $line =~ m/'${SHORT_PV}'|etc|local|perl$/; print "$line\n" }')
+		einfo "Removing old .ph files"
+		for DIR in ${INC} ; do
+			if [[ -d "${DIR}" ]] ; then
+				for file in $(find "${DIR}" -name "*.ph" -type f ) ; do
+					rm -f "${file}"
+					einfo "<< ${file}"
+				done
+			fi
+		done
+		# Silently remove the now empty dirs
+		for DIR in ${INC} ; do
+			if [[ -d "${DIR}" ]] ; then
+				find "${DIR}" -depth -type d -print0 | xargs -0 -r rmdir &> /dev/null
+			fi
+		done
+
+	fi
+}
+
+pkg_postrm(){
+	dual_scripts
+}


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-lang/perl/files/, dev-lang/perl/
@ 2018-12-30 21:26 Andreas K. Hüttel
  0 siblings, 0 replies; 12+ messages in thread
From: Andreas K. Hüttel @ 2018-12-30 21:26 UTC (permalink / raw
  To: gentoo-commits

commit:     e576790a512945d1884868c55e87721b4d75b56b
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 30 21:26:22 2018 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Dec 30 21:26:38 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e576790a

dev-lang/perl: Add hppa workaround, bug 634162

Patch from Debian, see https://bugs.debian.org/869122

Closes: https://bugs.gentoo.org/634162
Package-Manager: Portage-2.3.53, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 dev-lang/perl/files/perl-5.26.2-hppa.patch | 105 +++++++++++++++++++++++++++++
 dev-lang/perl/perl-5.26.2.ebuild           |   4 ++
 dev-lang/perl/perl-5.26.9999.ebuild        |   4 ++
 dev-lang/perl/perl-5.28.0.ebuild           |   4 ++
 dev-lang/perl/perl-5.28.9999.ebuild        |   4 ++
 5 files changed, 121 insertions(+)

diff --git a/dev-lang/perl/files/perl-5.26.2-hppa.patch b/dev-lang/perl/files/perl-5.26.2-hppa.patch
new file mode 100644
index 00000000000..83ed944353e
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.26.2-hppa.patch
@@ -0,0 +1,105 @@
+https://bugs.gentoo.org/634162
+
+Source:
+https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=869122
+
+Index: perl-5.26.0/op.c
+===================================================================
+--- perl-5.26.0.orig/op.c
++++ perl-5.26.0/op.c
+@@ -14832,6 +14832,7 @@ Perl_custom_op_get_field(pTHX_ const OP
+     SV *keysv;
+     HE *he = NULL;
+     XOP *xop;
++    XOPRETANY any;
+ 
+     static const XOP xop_null = { 0, 0, 0, 0, 0 };
+ 
+@@ -14874,58 +14875,37 @@ Perl_custom_op_get_field(pTHX_ const OP
+ 	else
+ 	    xop = INT2PTR(XOP *, SvIV(HeVAL(he)));
+     }
+-    {
+-	XOPRETANY any;
+-	if(field == XOPe_xop_ptr) {
+-	    any.xop_ptr = xop;
+-	} else {
+-	    const U32 flags = XopFLAGS(xop);
+-	    if(flags & field) {
+-		switch(field) {
+-		case XOPe_xop_name:
+-		    any.xop_name = xop->xop_name;
+-		    break;
+-		case XOPe_xop_desc:
+-		    any.xop_desc = xop->xop_desc;
+-		    break;
+-		case XOPe_xop_class:
+-		    any.xop_class = xop->xop_class;
+-		    break;
+-		case XOPe_xop_peep:
+-		    any.xop_peep = xop->xop_peep;
+-		    break;
+-		default:
+-		    NOT_REACHED; /* NOTREACHED */
+-		    break;
+-		}
+-	    } else {
+-		switch(field) {
+-		case XOPe_xop_name:
+-		    any.xop_name = XOPd_xop_name;
+-		    break;
+-		case XOPe_xop_desc:
+-		    any.xop_desc = XOPd_xop_desc;
+-		    break;
+-		case XOPe_xop_class:
+-		    any.xop_class = XOPd_xop_class;
+-		    break;
+-		case XOPe_xop_peep:
+-		    any.xop_peep = XOPd_xop_peep;
+-		    break;
+-		default:
+-		    NOT_REACHED; /* NOTREACHED */
+-		    break;
+-		}
+-	    }
++
++    if(field == XOPe_xop_ptr) {
++        any.xop_ptr = xop;
++    } else {
++        const U32 flags = XopFLAGS(xop);
++        switch(field) {
++        case XOPe_xop_name:
++            any.xop_name = (flags & field) ? xop->xop_name : XOPd_xop_name;
++            break;
++        case XOPe_xop_desc:
++            any.xop_desc = (flags & field) ? xop->xop_desc : XOPd_xop_desc;
++            break;
++        case XOPe_xop_class:
++            any.xop_class = (flags & field) ? xop->xop_class : XOPd_xop_class;
++            break;
++        case XOPe_xop_peep:
++            any.xop_peep = (flags & field) ? xop->xop_peep : XOPd_xop_peep;
++            break;
++        default:
++            NOT_REACHED; /* NOTREACHED */
++            break;
+ 	}
+-        /* On some platforms (HP-UX, IA64) gcc emits a warning for this function:
+-         * op.c: In function 'Perl_custom_op_get_field':
+-         * op.c:...: warning: 'any.xop_name' may be used uninitialized in this function [-Wmaybe-uninitialized]
+-         * This is because on those platforms (with -DEBUGGING) NOT_REACHED
+-         * expands to assert(0), which expands to ((0) ? (void)0 :
+-         * __assert(...)), and gcc doesn't know that __assert can never return. */
+-	return any;
+     }
++
++    /* On some platforms (HP-UX, IA64) gcc emits a warning for this function:
++     * op.c: In function 'Perl_custom_op_get_field':
++     * op.c:...: warning: 'any.xop_name' may be used uninitialized in this function [-Wmaybe-uninitialized]
++     * This is because on those platforms (with -DEBUGGING) NOT_REACHED
++     * expands to assert(0), which expands to ((0) ? (void)0 :
++     * __assert(...)), and gcc doesn't know that __assert can never return. */
++    return any;
+ }
+ 
+ /*

diff --git a/dev-lang/perl/perl-5.26.2.ebuild b/dev-lang/perl/perl-5.26.2.ebuild
index e2af84bf47d..3efe8267e5b 100644
--- a/dev-lang/perl/perl-5.26.2.ebuild
+++ b/dev-lang/perl/perl-5.26.2.ebuild
@@ -307,6 +307,10 @@ src_prepare() {
 	local patch
 	EPATCH_OPTS+=" -p1"
 
+	if use hppa ; then
+		epatch "${FILESDIR}/${PN}-5.26.2-hppa.patch" # bug 634162
+	fi
+
 	if [[ ${CHOST} == *-solaris* ]] ; then
 		# do NOT mess with nsl, on Solaris this is always necessary,
 		# when -lsocket is used e.g. to get h_errno

diff --git a/dev-lang/perl/perl-5.26.9999.ebuild b/dev-lang/perl/perl-5.26.9999.ebuild
index e2af84bf47d..3efe8267e5b 100644
--- a/dev-lang/perl/perl-5.26.9999.ebuild
+++ b/dev-lang/perl/perl-5.26.9999.ebuild
@@ -307,6 +307,10 @@ src_prepare() {
 	local patch
 	EPATCH_OPTS+=" -p1"
 
+	if use hppa ; then
+		epatch "${FILESDIR}/${PN}-5.26.2-hppa.patch" # bug 634162
+	fi
+
 	if [[ ${CHOST} == *-solaris* ]] ; then
 		# do NOT mess with nsl, on Solaris this is always necessary,
 		# when -lsocket is used e.g. to get h_errno

diff --git a/dev-lang/perl/perl-5.28.0.ebuild b/dev-lang/perl/perl-5.28.0.ebuild
index a88e2d54acf..13cbdc3c005 100644
--- a/dev-lang/perl/perl-5.28.0.ebuild
+++ b/dev-lang/perl/perl-5.28.0.ebuild
@@ -307,6 +307,10 @@ src_prepare() {
 	local patch
 	EPATCH_OPTS+=" -p1"
 
+	if use hppa ; then
+		epatch "${FILESDIR}/${PN}-5.26.2-hppa.patch" # bug 634162
+	fi
+
 	if [[ ${CHOST} == *-solaris* ]] ; then
 		# do NOT mess with nsl, on Solaris this is always necessary,
 		# when -lsocket is used e.g. to get h_errno

diff --git a/dev-lang/perl/perl-5.28.9999.ebuild b/dev-lang/perl/perl-5.28.9999.ebuild
index a88e2d54acf..13cbdc3c005 100644
--- a/dev-lang/perl/perl-5.28.9999.ebuild
+++ b/dev-lang/perl/perl-5.28.9999.ebuild
@@ -307,6 +307,10 @@ src_prepare() {
 	local patch
 	EPATCH_OPTS+=" -p1"
 
+	if use hppa ; then
+		epatch "${FILESDIR}/${PN}-5.26.2-hppa.patch" # bug 634162
+	fi
+
 	if [[ ${CHOST} == *-solaris* ]] ; then
 		# do NOT mess with nsl, on Solaris this is always necessary,
 		# when -lsocket is used e.g. to get h_errno


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-lang/perl/files/, dev-lang/perl/
@ 2019-04-07 14:10 Andreas K. Hüttel
  0 siblings, 0 replies; 12+ messages in thread
From: Andreas K. Hüttel @ 2019-04-07 14:10 UTC (permalink / raw
  To: gentoo-commits

commit:     52243e596e533c9a9aaac42213bc08a3d734a7e1
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  7 14:10:32 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Apr  7 14:10:49 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=52243e59

dev-lang/perl: Backport dirhandle exhaustion fix, bug 677306

Closes: https://bugs.gentoo.org/677306
Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 dev-lang/perl/files/perl-5.28.0-dirhandle.patch |  99 ++++
 dev-lang/perl/perl-5.28.0-r1.ebuild             | 654 ++++++++++++++++++++++++
 2 files changed, 753 insertions(+)

diff --git a/dev-lang/perl/files/perl-5.28.0-dirhandle.patch b/dev-lang/perl/files/perl-5.28.0-dirhandle.patch
new file mode 100644
index 00000000000..02debe5ac2b
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.28.0-dirhandle.patch
@@ -0,0 +1,99 @@
+From e0eae03760cafde89463c4d3d238be9a629f7fca Mon Sep 17 00:00:00 2001
+From: Tony Cook <tony@develop-help.com>
+Date: Mon, 2 Jul 2018 10:43:19 +1000
+Subject: [PATCH] (perl #133314) always close the directory handle on clean up
+
+Previously the directory handle was only closed if the rest of the
+magic free clean up is done, but in most success cases that code
+doesn't run, leaking the directory handle.
+
+So always close the directory if our AV is available.
+
+(cherry picked from commit 3d5e9c119db6b727684fe75dfcfe5831c4351bec)
+---
+ doio.c | 56 +++++++++++++++++++++++++++++++-------------------------
+ 1 file changed, 31 insertions(+), 25 deletions(-)
+
+diff --git a/doio.c b/doio.c
+index 4b8923f77c..16daf9fd11 100644
+--- a/doio.c
++++ b/doio.c
+@@ -1163,44 +1163,50 @@ S_argvout_free(pTHX_ SV *io, MAGIC *mg) {
+ 
+     /* mg_obj can be NULL if a thread is created with the handle open, in which
+      case we leave any clean up to the parent thread */
+-    if (mg->mg_obj && IoIFP(io)) {
+-        SV **pid_psv;
++    if (mg->mg_obj) {
+ #ifdef ARGV_USE_ATFUNCTIONS
+         SV **dir_psv;
+         DIR *dir;
++
++        dir_psv = av_fetch((AV*)mg->mg_obj, ARGVMG_ORIG_DIRP, FALSE);
++        assert(dir_psv && *dir_psv && SvIOK(*dir_psv));
++        dir = INT2PTR(DIR *, SvIV(*dir_psv));
+ #endif
+-        PerlIO *iop = IoIFP(io);
++        if (IoIFP(io)) {
++            SV **pid_psv;
++            PerlIO *iop = IoIFP(io);
+ 
+-        assert(SvTYPE(mg->mg_obj) == SVt_PVAV);
++            assert(SvTYPE(mg->mg_obj) == SVt_PVAV);
+ 
+-        pid_psv = av_fetch((AV*)mg->mg_obj, ARGVMG_ORIG_PID, FALSE);
++            pid_psv = av_fetch((AV*)mg->mg_obj, ARGVMG_ORIG_PID, FALSE);
+ 
+-        assert(pid_psv && *pid_psv);
++            assert(pid_psv && *pid_psv);
+ 
+-        if (SvIV(*pid_psv) == (IV)PerlProc_getpid()) {
+-            /* if we get here the file hasn't been closed explicitly by the
+-               user and hadn't been closed implicitly by nextargv(), so
+-               abandon the edit */
+-            SV **temp_psv = av_fetch((AV*)mg->mg_obj, ARGVMG_TEMP_NAME, FALSE);
+-            const char *temp_pv = SvPVX(*temp_psv);
++            if (SvIV(*pid_psv) == (IV)PerlProc_getpid()) {
++                /* if we get here the file hasn't been closed explicitly by the
++                   user and hadn't been closed implicitly by nextargv(), so
++                   abandon the edit */
++                SV **temp_psv = av_fetch((AV*)mg->mg_obj, ARGVMG_TEMP_NAME, FALSE);
++                const char *temp_pv = SvPVX(*temp_psv);
+ 
+-            assert(temp_psv && *temp_psv && SvPOK(*temp_psv));
+-            (void)PerlIO_close(iop);
+-            IoIFP(io) = IoOFP(io) = NULL;
++                assert(temp_psv && *temp_psv && SvPOK(*temp_psv));
++                (void)PerlIO_close(iop);
++                IoIFP(io) = IoOFP(io) = NULL;
+ #ifdef ARGV_USE_ATFUNCTIONS
+-            dir_psv = av_fetch((AV*)mg->mg_obj, ARGVMG_ORIG_DIRP, FALSE);
+-            assert(dir_psv && *dir_psv && SvIOK(*dir_psv));
+-            dir = INT2PTR(DIR *, SvIV(*dir_psv));
+-            if (dir) {
+-                if (unlinkat(my_dirfd(dir), temp_pv, 0) < 0 &&
+-                    NotSupported(errno))
+-                    (void)UNLINK(temp_pv);
+-                closedir(dir);
+-            }
++                if (dir) {
++                    if (unlinkat(my_dirfd(dir), temp_pv, 0) < 0 &&
++                        NotSupported(errno))
++                        (void)UNLINK(temp_pv);
++                }
+ #else
+-            (void)UNLINK(temp_pv);
++                (void)UNLINK(temp_pv);
+ #endif
++            }
+         }
++#ifdef ARGV_USE_ATFUNCTIONS
++        if (dir)
++            closedir(dir);
++#endif
+     }
+ 
+     return 0;
+-- 
+2.21.0
+

diff --git a/dev-lang/perl/perl-5.28.0-r1.ebuild b/dev-lang/perl/perl-5.28.0-r1.ebuild
new file mode 100644
index 00000000000..500797a2101
--- /dev/null
+++ b/dev-lang/perl/perl-5.28.0-r1.ebuild
@@ -0,0 +1,654 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit eutils alternatives flag-o-matic toolchain-funcs multilib multiprocessing
+
+PATCH_VER=1
+CROSS_VER=1.2.2
+PATCH_BASE="perl-5.28.0-patches-${PATCH_VER}"
+
+PATCHES=( "${FILESDIR}/${P}-dirhandle.patch" ) #bug 677306
+
+DIST_AUTHOR=XSAWYERX
+
+# Greatest first, don't include yourself
+# Devel point-releases are not ABI-intercompatible, but stable point releases are
+# BIN_OLDVERSEN is contains only C-ABI-intercompatible versions
+PERL_BIN_OLDVERSEN=""
+if [[ "${PV##*.}" == "9999" ]]; then
+	DIST_VERSION=5.28.0
+else
+	DIST_VERSION="${PV/_rc/-RC}"
+fi
+SHORT_PV="${DIST_VERSION%.*}"
+# Even numbered major versions are ABI intercompatible
+# Odd numbered major versions are not
+if [[ $(( ${SHORT_PV#*.} % 2 )) == 1 ]]; then
+	SUBSLOT="${DIST_VERSION%-RC*}"
+else
+	SUBSLOT="${DIST_VERSION%.*}"
+fi
+# Used only in tar paths
+MY_P="perl-${DIST_VERSION}"
+# Used in library paths
+MY_PV="${DIST_VERSION%-RC*}"
+
+DESCRIPTION="Larry Wall's Practical Extraction and Report Language"
+
+SRC_URI="
+	mirror://cpan/src/5.0/${MY_P}.tar.xz
+	mirror://cpan/authors/id/${DIST_AUTHOR:0:1}/${DIST_AUTHOR:0:2}/${DIST_AUTHOR}/${MY_P}.tar.xz
+	https://github.com/gentoo-perl/perl-patchset/releases/download/${PATCH_BASE}/${PATCH_BASE}.tar.xz
+	mirror://gentoo/${PATCH_BASE}.tar.xz
+	https://dev.gentoo.org/~kentnl/distfiles/${PATCH_BASE}.tar.xz
+	https://github.com/arsv/perl-cross/releases/download/${CROSS_VER}/perl-cross-${CROSS_VER}.tar.gz
+"
+HOMEPAGE="https://www.perl.org/"
+
+LICENSE="|| ( Artistic GPL-1+ )"
+SLOT="0/${SUBSLOT}"
+
+if [[ "${PV##*.}" != "9999" ]]; then
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+
+IUSE="berkdb debug doc gdbm ithreads"
+
+RDEPEND="
+	berkdb? ( sys-libs/db:= )
+	gdbm? ( >=sys-libs/gdbm-1.8.3:= )
+	app-arch/bzip2
+	sys-libs/zlib
+"
+DEPEND="${RDEPEND}
+	!prefix? ( elibc_FreeBSD? ( sys-freebsd/freebsd-mk-defs ) )
+"
+PDEPEND="
+	>=app-admin/perl-cleaner-2.5
+	>=virtual/perl-File-Temp-0.230.400-r2
+	>=virtual/perl-Data-Dumper-2.154.0
+	virtual/perl-Test-Harness
+"
+# bug 390719, bug 523624
+# virtual/perl-Test-Harness is here for the bundled ExtUtils::MakeMaker
+
+S="${WORKDIR}/${MY_P}"
+
+dual_scripts() {
+	src_remove_dual      perl-core/Archive-Tar        2.280.0       ptar ptardiff ptargrep
+	src_remove_dual      perl-core/CPAN               2.200.0       cpan
+	src_remove_dual      perl-core/Digest-SHA         6.10.0        shasum
+	src_remove_dual      perl-core/Encode             2.970.0       enc2xs piconv
+	src_remove_dual      perl-core/ExtUtils-MakeMaker 7.340.0       instmodsh
+	src_remove_dual      perl-core/ExtUtils-ParseXS   3.390.0       xsubpp
+	src_remove_dual      perl-core/IO-Compress        2.74.0        zipdetails
+	src_remove_dual      perl-core/JSON-PP            2.970.10      json_pp
+	src_remove_dual      perl-core/Module-CoreList    5.201.806.220 corelist
+	src_remove_dual      perl-core/Pod-Parser         1.630.0       pod2usage podchecker podselect
+	src_remove_dual      perl-core/Pod-Perldoc        3.280.100     perldoc
+	src_remove_dual      perl-core/Test-Harness       3.420.0       prove
+	src_remove_dual      perl-core/podlators          4.100.0       pod2man pod2text
+	src_remove_dual_man  perl-core/podlators          4.100.0       /usr/share/man/man1/perlpodstyle.1
+}
+
+check_rebuild() {
+	# Fresh install
+	if [[ -z "${REPLACING_VERSIONS}" ]]; then
+		return 0;
+	# Major Upgrade
+	# doesn't matter if there's multiple copies, it still needs a rebuild
+	# if the string is anything other than "5.CURRENTMAJOR"
+	elif [[ "${REPLACING_VERSIONS%.*}" != "${PV%.*}" ]]; then
+		echo ""
+		ewarn "UPDATE THE PERL MODULES:"
+		ewarn "After updating dev-lang/perl the installed Perl modules"
+		ewarn "have to be re-installed. In most cases, this is done automatically"
+		ewarn "by the package manager, but subsequent steps are still recommended"
+		ewarn "to ensure system consistency."
+		ewarn
+		ewarn "You should start with a depclean to remove any unused perl dependencies"
+		ewarn "that may confuse portage in future. Regular depcleans are also encouraged"
+		ewarn "as part of your regular update cycle, as that will keep perl upgrades working."
+		ewarn "Recommended: emerge --depclean -va"
+		ewarn
+		ewarn "You should then call perl-cleaner to clean up any old files and trigger any"
+		ewarn "remaining rebuilds portage may have missed."
+		ewarn "Use: perl-cleaner --all"
+		return 0;
+
+	# Reinstall w/ USE Change
+	elif (   use ithreads && ! has_version dev-lang/perl[ithreads] ) || \
+		 ( ! use ithreads &&   has_version dev-lang/perl[ithreads] ) || \
+		 (   use debug    && ! has_version dev-lang/perl[debug]    ) || \
+		 ( ! use debug    &&   has_version dev-lang/perl[debug]    ) ; then
+		echo ""
+		ewarn "TOGGLED USE-FLAGS WARNING:"
+		ewarn "You changed one of the use-flags ithreads or debug."
+		ewarn "You must rebuild all perl-modules installed."
+		ewarn "Use: perl-cleaner --modules ; perl-cleaner --force --libperl"
+	fi
+}
+
+pkg_setup() {
+	case ${CHOST} in
+		*-freebsd*)   osname="freebsd" ;;
+		*-dragonfly*) osname="dragonfly" ;;
+		*-netbsd*)    osname="netbsd" ;;
+		*-openbsd*)   osname="openbsd" ;;
+		*-darwin*)    osname="darwin" ;;
+		*-solaris*)   osname="solaris" ;;
+		*-interix*)   osname="interix" ;;
+		*-aix*)       osname="aix" ;;
+		*-cygwin*)    osname="cygwin" ;;
+		*)            osname="linux" ;;
+	esac
+
+	myarch="${CHOST%%-*}-${osname}"
+	if use debug ; then
+		myarch+="-debug"
+	fi
+	if use ithreads ; then
+		mythreading="-multi"
+		myarch+="-thread"
+	fi
+
+	PRIV_BASE="/usr/$(get_libdir)/perl5"
+	SITE_BASE="/usr/local/$(get_libdir)/perl5"
+	VENDOR_BASE="/usr/$(get_libdir)/perl5/vendor_perl"
+
+	LIBPERL="libperl$(get_libname ${MY_PV} )"
+	PRIV_LIB="${PRIV_BASE}/${MY_PV}"
+	ARCH_LIB="${PRIV_BASE}/${MY_PV}/${myarch}${mythreading}"
+	SITE_LIB="${SITE_BASE}/${MY_PV}"
+	SITE_ARCH="${SITE_BASE}/${MY_PV}/${myarch}${mythreading}"
+	VENDOR_LIB="${VENDOR_BASE}/${MY_PV}"
+	VENDOR_ARCH="${VENDOR_BASE}/${MY_PV}/${myarch}${mythreading}"
+
+	dual_scripts
+}
+
+src_remove_dual_file() {
+	local i pkg ver
+	pkg="$1"
+	ver="$2"
+	shift 2
+	case "${EBUILD_PHASE:-none}" in
+		postinst|postrm)
+			for i in "$@" ; do
+				alternatives_auto_makesym "${i}" "${i}-[0-9]*"
+			done
+			;;
+		setup)
+			for i in "$@" ; do
+				if [[ -f ${EROOT}${i} && ! -h ${EROOT}${i} ]] ; then
+					has_version ${pkg} && ewarn "You must reinstall ${pkg} !"
+					break
+				fi
+			done
+			;;
+		install)
+			for i in "$@" ; do
+				if ! [[ -f "${ED}"${i} ]] ; then
+					ewarn "${i} does not exist!"
+					continue
+				fi
+				mv "${ED}"${i}{,-${ver}-${P}} || die
+			done
+			;;
+	esac
+}
+
+src_remove_dual_man() {
+	local i pkg ver ff
+	pkg="$1"
+	ver="$2"
+	shift 2
+	case "${EBUILD_PHASE:-none}" in
+		postinst|postrm)
+			for i in "$@" ; do
+				ff=`echo "${EROOT}${i%.[0-9]}-${ver}-${P}${i#${i%.[0-9]}}"*`
+				ff=${ff##*${i#${i%.[0-9]}}}
+				alternatives_auto_makesym "${i}${ff}" "${i%.[0-9]}-[0-9]*"
+			done
+			;;
+		install)
+			for i in "$@" ; do
+				if ! [[ -f "${ED}"${i} ]] ; then
+					ewarn "${i} does not exist!"
+					continue
+				fi
+				mv "${ED}"${i} "${ED}"${i%.[0-9]}-${ver}-${P}${i#${i%.[0-9]}} || die
+			done
+			;;
+	esac
+}
+
+src_remove_dual() {
+	local i pkg ver
+	pkg="$1"
+	ver="$2"
+	shift 2
+	for i in "$@" ; do
+		src_remove_dual_file  "${pkg}" "${ver}" "/usr/bin/${i}"
+		src_remove_dual_man   "${pkg}" "${ver}" "/usr/share/man/man1/${i}.1"
+	done
+}
+
+src_prepare_update_patchlevel_h() {
+	# Copied and modified from debian:
+	# Copyright 2011 Niko Tyni
+	# This program is free software; you can redistribute it and/or modify
+	# it under the same terms as Perl itself.
+	local patchdir="${WORKDIR}/patches"
+	local prefix
+	local patchoutput="patchlevel-gentoo.h"
+
+	[[ -f ${patchdir}/series ]] || return 0
+
+while read patch
+do
+	patchname=$(echo $patch | sed 's/\.diff$//')
+	< $patchdir/$patch sed -e '/^Subject:/ { N; s/\n / / }' | sed -n -e '
+
+	# massage the patch headers
+	s|^Bug: .*https\?://rt\.perl\.org/.*id=\(.*\).*|[perl #\1]|; tprepend;
+	s|^Bug: .*https\?://rt\.cpan\.org/.*id=\(.*\).*|[rt.cpan.org #\1]|; tprepend;
+	s|^Bug-Gentoo: ||; tprepend;
+	s/^\(Subject\|Description\): //; tappend;
+	s|^Origin: .*http://perl5\.git\.perl\.org/perl\.git/commit\(diff\)\?/\(.......\).*|[\2]|; tprepend;
+
+	# post-process at the end of input
+	$ { x;
+		# include the version number in the patchlevel.h description (if available)
+		s/List packaged patches/&'" for ${PF}(#${PATCH_VER})"'/;
+
+		# escape any backslashes and double quotes
+		s|\\|\\\\|g; s|"|\\"|g;
+
+		# add a prefix
+		s|^|\t,"'"$prefix$patchname"' - |;
+		# newlines away
+		s/\n/ /g; s/  */ /g;
+		# add a suffix
+		s/ *$/"/; p
+	};
+	# stop all processing
+	d;
+	# label: append to the hold space
+	:append H; d;
+	# label: prepend to the hold space
+	:prepend x; H; d;
+	'
+done < "${WORKDIR}"/patches/series > "${S}/${patchoutput}"
+echo "${patchoutput}" >> "${S}/MANIFEST"
+}
+
+src_prepare_perlcross() {
+	cp -a ../perl-cross-${CROSS_VER}/* . || die
+
+	# bug 604072
+	MAKEOPTS+=" -j1"
+	export MAKEOPTS
+}
+src_prepare_dynamic() {
+	ln -s ${LIBPERL} libperl$(get_libname ${SHORT_PV}) || die
+	ln -s ${LIBPERL} libperl$(get_libname ) || die
+}
+
+src_prepare() {
+	local patch
+	EPATCH_OPTS+=" -p1"
+
+	if use hppa ; then
+		epatch "${FILESDIR}/${PN}-5.26.2-hppa.patch" # bug 634162
+	fi
+
+	if [[ ${CHOST} == *-solaris* ]] ; then
+		# do NOT mess with nsl, on Solaris this is always necessary,
+		# when -lsocket is used e.g. to get h_errno
+		sed -i '/gentoo\/no-nsl\.patch/d' "${WORKDIR}/patches/series" || die
+	fi
+
+	einfo "Applying patches from ${PATCH_BASE} ..."
+	while read patch ; do
+		EPATCH_SINGLE_MSG="  ${patch} ..."
+		epatch "${WORKDIR}"/patches/${patch}
+	done < "${WORKDIR}"/patches/series
+
+	src_prepare_update_patchlevel_h
+
+	tc-is-cross-compiler && src_prepare_perlcross
+
+	tc-is-static-only || src_prepare_dynamic
+
+	if use gdbm; then
+		sed -i "s:INC => .*:INC => \"-I${EROOT}usr/include/gdbm\":g" \
+			ext/NDBM_File/Makefile.PL || die
+	fi
+
+	# Use errno.h from prefix rather than from host system, bug #645804
+	if use prefix && [[ -e "${EPREFIX}"/usr/include/errno.h ]] ; then
+		sed -i "/my..sysroot/s:'':'${EPREFIX}':" ext/Errno/Errno_pm.PL || die
+	fi
+
+	if [[ ${CHOST} == *-solaris* ]] ; then
+		# set a soname, fix linking against just built libperl
+		sed -i -e 's/netbsd\*/netbsd*|solaris*/' Makefile.SH || die
+	fi
+
+	default
+}
+
+myconf() {
+	# the myconf array is declared in src_configure
+	myconf=( "${myconf[@]}" "$@" )
+}
+
+src_configure() {
+	declare -a myconf
+
+	export LC_ALL="C"
+	[[ ${COLUMNS:-1} -ge 1 ]] || unset COLUMNS # bug #394091
+
+	# some arches and -O do not mix :)
+	use ppc && replace-flags -O? -O1
+
+	# Perl has problems compiling with -Os in your flags with glibc
+	use elibc_uclibc || replace-flags "-Os" "-O2"
+
+	# xlocale.h is going away in glibc-2.26, so it's counterproductive
+	# if we use it and include it in CORE/perl.h ... Perl builds just
+	# fine with glibc and locale.h only.
+	# However, the darwin prefix people have no locale.h ...
+	use elibc_glibc && myconf -Ui_xlocale
+
+	# This flag makes compiling crash in interesting ways
+	filter-flags "-malign-double"
+
+	# Fixes bug #97645
+	use ppc && filter-flags "-mpowerpc-gpopt"
+
+	# Fixes bug #143895 on gcc-4.1.1
+	filter-flags "-fsched2-use-superblocks"
+
+	# Generic LTO broken since 5.28, triggers EUMM failures
+	filter-flags "-flto"
+
+	use sparc && myconf -Ud_longdbl
+
+	export BUILD_BZIP2=0
+	export BZIP2_INCLUDE=${EROOT}/usr/include
+	export BZIP2_LIB=${EROOT}/usr/$(get_libdir)
+
+	export BUILD_ZLIB=False
+	export ZLIB_INCLUDE=${EROOT}/usr/include
+	export ZLIB_LIB=${EROOT}/usr/$(get_libdir)
+
+	# allow either gdbm to provide ndbm (in <gdbm/ndbm.h>) or db1
+	myndbm='U'
+	mygdbm='U'
+	mydb='U'
+	if use gdbm ; then
+		mygdbm='D'
+		if use berkdb ; then
+			myndbm='D'
+		fi
+	fi
+	if use berkdb ; then
+		mydb='D'
+		has_version '=sys-libs/db-1*' && myndbm='D'
+	fi
+
+	myconf "-${myndbm}i_ndbm" "-${mygdbm}i_gdbm" "-${mydb}i_db"
+
+	if use alpha && [[ "$(tc-getCC)" = "ccc" ]] ; then
+		ewarn "Perl will not be built with berkdb support, use gcc if you needed it..."
+		myconf -Ui_db -Ui_ndbm
+	fi
+
+	use ithreads && myconf -Dusethreads
+
+	if use debug ; then
+		append-cflags "-g"
+		myconf -DDEBUGGING
+	elif [[ ${CFLAGS} == *-g* ]] ; then
+		myconf -DDEBUGGING=-g
+	else
+		myconf -DDEBUGGING=none
+	fi
+
+	# Autodiscover all old version directories, some of them will even be newer
+	# if you downgrade
+	if [[ -z ${PERL_OLDVERSEN} ]]; then
+		PERL_OLDVERSEN="$(
+			find "${EROOT%/}${PRIV_BASE}" "${EROOT%/}${SITE_BASE}" "${EROOT%/}${VENDOR_BASE}" \
+				   -maxdepth 1 -mindepth 1 -type d -regex '.*/5[.][0-9]+[.][0-9]+$' \
+				   -printf "%f "  2>/dev/null )"
+	fi
+	# Fixup versions, removing self match, fixing order and dupes
+	PERL_OLDVERSEN="$(
+		echo "${PERL_OLDVERSEN}"           |\
+			tr " " "\n" 				   |\
+			grep -vF "${DIST_VERSION%-RC}" |\
+			sort -u -nr -t'.' -k1,1 -k2,2 -k3,3
+	)"
+
+	# Experts who want a "Pure" install can set PERL_OLDVERSEN to an empty string
+	if [[ -n "${PERL_OLDVERSEN// }" ]]; then
+		local inclist="$(
+				for v in ${PERL_OLDVERSEN};	do
+					has "${v}" ${PERL_BIN_OLDVERSEN} && echo -n "${v}/${myarch}${mythreading} ";
+					echo -n "${v} ";
+				done )"
+		einfo "This version of perl may partially support modules previously"
+		einfo "installed in any of the following paths:"
+		for incpath in ${inclist}; do
+			[[ -e "${EROOT%/}${VENDOR_BASE}/${incpath}" ]] && einfo " ${EROOT%/}${VENDOR_BASE}/${incpath}"
+			[[ -e "${EROOT%/}${PRIV_BASE}/${incpath}"   ]] && einfo " ${EROO%/T}${PRIV_BASE}/${incpath}"
+			[[ -e "${EROOT%/}${SITE_BASE}/${incpath}"   ]] && einfo " ${EROOT%/}${SITE_BASE}/${incpath}"
+		done
+		einfo "This is a temporary measure and you should aim to cleanup these paths"
+		einfo "via world updates and perl-cleaner"
+		myconf -Dinc_version_list="${inclist}"
+	fi
+
+	[[ ${ELIBC} == "FreeBSD" ]] && myconf "-Dlibc=/usr/$(get_libdir)/libc.a"
+
+	# Make sure we can do the final link #523730, need to set deployment
+	# target to override hardcoded 10.3 which breaks on modern OSX
+	[[ ${CHOST} == *-darwin* ]] && \
+		myconf "-Dld=env MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} $(tc-getCC)"
+
+	# Older macOS with non-Apple GCC chokes on inline in system headers
+	# using c89 mode as injected by cflags.SH
+	[[ ${CHOST} == *-darwin* && ${CHOST##*darwin} -le 9 ]] && tc-is-gcc && \
+		append-cflags -Dinline=__inline__
+
+	# fix unaligned access misdetection
+	# https://rt.perl.org/Public/Bug/Display.html?id=133495
+	[[ ${CHOST} == sparc*-solaris* ]] && myconf "-Dd_u32align='define'"
+
+	# Prefix: the host system needs not to follow Gentoo multilib stuff, and in
+	# Prefix itself we don't do multilib either, so make sure perl can find
+	# something compatible.
+	if use prefix ; then
+		# Set a hook to check for each detected library whether it actually works.
+		export libscheck="
+			( echo 'main(){}' > '${T}'/conftest.c &&
+			  $(tc-getCC) -o '${T}'/conftest '${T}'/conftest.c -l\$thislib >/dev/null 2>/dev/null
+			) || xxx=/dev/null"
+
+		# Use all host paths that might contain useful stuff, the hook above will filter out bad choices.
+		local paths="/lib/*-linux-gnu /usr/lib/*-linux-gnu /lib64 /lib/64 /usr/lib64 /usr/lib/64 /lib32 /usr/lib32 /lib /usr/lib"
+		myconf "-Dlibpth=${EPREFIX}/$(get_libdir) ${EPREFIX}/usr/$(get_libdir) ${paths}"
+	elif [[ $(get_libdir) != "lib" ]] ; then
+		# We need to use " and not ', as the written config.sh use ' ...
+		myconf "-Dlibpth=/usr/local/$(get_libdir) /$(get_libdir) /usr/$(get_libdir)"
+	fi
+
+	# don't try building ODBM, bug #354453
+	disabled_extensions="ODBM_File"
+
+	if ! use gdbm ; then
+		# workaround for bug #157774: don't try building GDBM related stuff with USE="-gdbm"
+		disabled_extensions="${disabled_extensions} GDBM_File NDBM_File"
+	fi
+
+	myconf -Dnoextensions="${disabled_extensions}"
+
+	[[ "${PV##*.}" == "9999" ]] && myconf -Dusedevel -Uversiononly
+
+	[[ -n "${EXTRA_ECONF}" ]] && ewarn During Perl build, EXTRA_ECONF=${EXTRA_ECONF}
+	# allow fiddling via EXTRA_ECONF, bug 558070
+	eval "local -a EXTRA_ECONF=(${EXTRA_ECONF})"
+
+	myconf \
+		-Duseshrplib \
+		-Darchname="${myarch}" \
+		-Dcc="$(tc-getCC)" \
+		-Doptimize="${CFLAGS}" \
+		-Dldflags="${LDFLAGS}" \
+		-Dprefix="${EPREFIX}"'/usr' \
+		-Dsiteprefix="${EPREFIX}"'/usr/local' \
+		-Dvendorprefix="${EPREFIX}"'/usr' \
+		-Dscriptdir="${EPREFIX}"'/usr/bin' \
+		-Dprivlib="${EPREFIX}${PRIV_LIB}" \
+		-Darchlib="${EPREFIX}${ARCH_LIB}" \
+		-Dsitelib="${EPREFIX}${SITE_LIB}" \
+		-Dsitearch="${EPREFIX}${SITE_ARCH}" \
+		-Dvendorlib="${EPREFIX}${VENDOR_LIB}" \
+		-Dvendorarch="${EPREFIX}${VENDOR_ARCH}" \
+		-Dman1dir="${EPREFIX}"/usr/share/man/man1 \
+		-Dman3dir="${EPREFIX}"/usr/share/man/man3 \
+		-Dsiteman1dir="${EPREFIX}"/usr/local/man/man1 \
+		-Dsiteman3dir="${EPREFIX}"/usr/local/man/man3 \
+		-Dvendorman1dir="${EPREFIX}"/usr/share/man/man1 \
+		-Dvendorman3dir="${EPREFIX}"/usr/share/man/man3 \
+		-Dman1ext='1' \
+		-Dman3ext='3pm' \
+		-Dlibperl="${LIBPERL}" \
+		-Dlocincpth="${EPREFIX}"'/usr/include ' \
+		-Dglibpth="${EPREFIX}/$(get_libdir) ${EPREFIX}/usr/$(get_libdir)"' ' \
+		-Duselargefiles \
+		-Dd_semctl_semun \
+		-Dcf_by='Gentoo' \
+		-Dmyhostname='localhost' \
+		-Dperladmin='root@localhost' \
+		-Ud_csh \
+		-Dsh="${EPREFIX}"/bin/sh \
+		-Dtargetsh="${EPREFIX}"/bin/sh \
+		-Uusenm \
+		"${myconf[@]}" \
+		"${EXTRA_ECONF[@]}"
+
+	if tc-is-cross-compiler; then
+		./configure \
+			--target="${CHOST}" \
+			--build="${CBUILD}" \
+			-Dinstallprefix='' \
+			-Dinstallusrbinperl='undef' \
+			-Dusevendorprefix='define' \
+			"${myconf[@]}" \
+			|| die "Unable to configure"
+	else
+		sh Configure \
+			-des \
+			-Dinstallprefix="${EPREFIX}"'/usr' \
+			-Dinstallusrbinperl='n' \
+			"${myconf[@]}" \
+			|| die "Unable to configure"
+	fi
+}
+
+src_test() {
+	export NO_GENTOO_NETWORK_TESTS=1;
+	export GENTOO_ASSUME_SANDBOXED="${GENTOO_ASSUME_SANDBOXED:-1}"
+	export GENTOO_NO_PORTING_TESTS="${GENTOO_NO_PORTING_TESTS:-1}"
+	if [[ ${EUID} == 0 ]] ; then
+		ewarn "Test fails with a sandbox error (#328793) if run as root. Skipping tests..."
+		return 0
+	fi
+	use elibc_uclibc && export MAKEOPTS+=" -j1"
+	TEST_JOBS="$(makeopts_jobs)" make test_harness || die "test failed"
+}
+
+src_install() {
+	local i
+	local coredir="${ARCH_LIB}/CORE"
+
+	emake DESTDIR="${D}" install
+
+	rm -f "${ED}/usr/bin/perl${MY_PV}"
+	ln -s perl "${ED}"/usr/bin/perl${MY_PV} || die
+
+	if ! tc-is-static-only ; then
+		dolib.so "${ED}"${coredir}/${LIBPERL}
+		rm -f "${ED}"${coredir}/${LIBPERL}
+		ln -sf ${LIBPERL} "${ED}"/usr/$(get_libdir)/libperl$(get_libname ${SHORT_PV}) || die
+		ln -sf ${LIBPERL} "${ED}"/usr/$(get_libdir)/libperl$(get_libname) || die
+		ln -sf ../../../../../$(get_libdir)/${LIBPERL} "${ED}"${coredir}/${LIBPERL} || die
+		ln -sf ../../../../../$(get_libdir)/${LIBPERL} "${ED}"${coredir}/libperl$(get_libname ${SHORT_PV}) || die
+		ln -sf ../../../../../$(get_libdir)/${LIBPERL} "${ED}"${coredir}/libperl$(get_libname) || die
+	fi
+
+	rm -rf "${ED}"/usr/share/man/man3 || die "Unable to remove module man pages"
+
+	# This removes ${D} from Config.pm
+	for i in $(find "${D}" -iname "Config.pm" ) ; do
+		einfo "Removing ${D} from ${i}..."
+		sed -i -e "s:${D}::" "${i}" || die "Sed failed"
+	done
+
+	dodoc Changes* README AUTHORS
+
+	if use doc ; then
+		# HTML Documentation
+		# We expect errors, warnings, and such with the following.
+
+		dodir /usr/share/doc/${PF}/html
+		LD_LIBRARY_PATH=. ./perl installhtml \
+			--podroot='.' \
+			--podpath='lib:ext:pod:vms' \
+			--recurse \
+			--htmldir="${ED}/usr/share/doc/${PF}/html"
+	fi
+
+	[[ -d ${ED}/usr/local ]] && rm -r "${ED}"/usr/local
+
+	dual_scripts
+}
+
+pkg_preinst() {
+	check_rebuild
+}
+
+pkg_postinst() {
+	dual_scripts
+
+	if [[ "${ROOT}" = "/" ]] ; then
+		local INC DIR file
+		INC=$(perl -e 'for $line (@INC) { next if $line eq "."; next if $line =~ m/'${SHORT_PV}'|etc|local|perl$/; print "$line\n" }')
+		einfo "Removing old .ph files"
+		for DIR in ${INC} ; do
+			if [[ -d "${DIR}" ]] ; then
+				for file in $(find "${DIR}" -name "*.ph" -type f ) ; do
+					rm -f "${file}"
+					einfo "<< ${file}"
+				done
+			fi
+		done
+		# Silently remove the now empty dirs
+		for DIR in ${INC} ; do
+			if [[ -d "${DIR}" ]] ; then
+				find "${DIR}" -depth -type d -print0 | xargs -0 -r rmdir &> /dev/null
+			fi
+		done
+
+	fi
+}
+
+pkg_postrm(){
+	dual_scripts
+}


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-lang/perl/files/, dev-lang/perl/
@ 2020-03-21 22:59 Sergei Trofimovich
  0 siblings, 0 replies; 12+ messages in thread
From: Sergei Trofimovich @ 2020-03-21 22:59 UTC (permalink / raw
  To: gentoo-commits

commit:     3f58732f2213d0453bbbe165c4f08694b3653df7
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 21 22:56:19 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Mar 21 22:59:45 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3f58732f

dev-lang/perl: tweak for gcc-10, bug #708744

Perl's Configure detected gcc-10 as gcc-1 and applied
-fpcc-struct-return option that breakw C ABI. This caused
mini-interpreter to crash early at bootstrap time.

The change is a direct backport of upstreams
6bd6308fcea3541e50565 ("Adapt Configure to GCC version 10").

Closes: https://bugs.gentoo.org/708744
Package-Manager: Portage-2.3.94, Repoman-2.3.21
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 dev-lang/perl/files/perl-5.30.1-gcc-10.patch | 99 ++++++++++++++++++++++++++++
 dev-lang/perl/perl-5.30.1.ebuild             |  1 +
 2 files changed, 100 insertions(+)

diff --git a/dev-lang/perl/files/perl-5.30.1-gcc-10.patch b/dev-lang/perl/files/perl-5.30.1-gcc-10.patch
new file mode 100644
index 00000000000..bb92527853f
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.30.1-gcc-10.patch
@@ -0,0 +1,99 @@
+https://bugs.gentoo.org/708744
+
+From 6bd6308fcea3541e505651bf8e8127a4a03d22cd Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
+Date: Tue, 12 Nov 2019 09:19:18 +0100
+Subject: [PATCH] Adapt Configure to GCC version 10
+
+I got a notice from Jeff Law <law@redhat.com>:
+
+    Your particular package fails its testsuite. This was ultimately
+    tracked down to a Configure problem. The perl configure script treated
+    gcc-10 as gcc-1 and turned on -fpcc-struct-return. This is an ABI
+    changing flag and caused Perl to not be able to interact properly with
+    the dbm libraries on the system leading to a segfault.
+
+His proposed patch corrected only this one instance of the version
+mismatch. Reading the Configure script revealed more issues. This
+patch fixes all of them I found.
+
+Please note I do not have GCC 10 available, I tested it by faking the version
+with:
+
+--- a/Configure
++++ b/Configure
+@@ -4701,7 +4701,7 @@ else
+ fi
+ $rm -f try try.*
+ case "$gccversion" in
+-1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
++1.*) cpp=`./loc gcc-cpp $cpp $pth` ;;
+ esac
+ case "$gccversion" in
+ '') gccosandvers='' ;;
+@@ -4741,7 +4741,7 @@ esac
+ # gcc 3.* complain about adding -Idirectories that they already know about,
+ # so we will take those off from locincpth.
+ case "$gccversion" in
+-3*)
++3.*)
+     echo "main(){}">try.c
+     for incdir in $locincpth; do
+        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
+@@ -5467,13 +5467,13 @@ fi
+ case "$hint" in
+ default|recommended)
+ 	case "$gccversion" in
+-	1*) dflt="$dflt -fpcc-struct-return" ;;
++	1.*) dflt="$dflt -fpcc-struct-return" ;;
+ 	esac
+ 	case "$optimize:$DEBUGGING" in
+ 	*-g*:old) dflt="$dflt -DDEBUGGING";;
+ 	esac
+ 	case "$gccversion" in
+-	2*) if $test -d /etc/conf/kconfig.d &&
++	2.*) if $test -d /etc/conf/kconfig.d &&
+ 			$contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
+ 		then
+ 			# Interactive Systems (ISC) POSIX mode.
+@@ -5482,7 +5482,7 @@ default|recommended)
+ 		;;
+ 	esac
+ 	case "$gccversion" in
+-	1*) ;;
++	1.*) ;;
+ 	2.[0-8]*) ;;
+ 	?*)	set strict-aliasing -fno-strict-aliasing
+ 		eval $checkccflag
+@@ -5600,7 +5600,7 @@ case "$cppflags" in
+     ;;
+ esac
+ case "$gccversion" in
+-1*) cppflags="$cppflags -D__GNUC__"
++1.*) cppflags="$cppflags -D__GNUC__"
+ esac
+ case "$mips_type" in
+ '');;
+@@ -23103,7 +23103,7 @@ fi
+ 
+ : add -D_FORTIFY_SOURCE if feasible and not already there
+ case "$gccversion" in
+-[456789].*)	case "$optimize$ccflags" in
++[456789].*|[1-9][0-9]*)	case "$optimize$ccflags" in
+ 	*-O*)	case "$ccflags$cppsymbols" in
+ 		*_FORTIFY_SOURCE=*) # Don't add it again.
+ 			echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
+--- a/cflags.SH
++++ b/cflags.SH
+@@ -156,7 +156,7 @@ esac
+ 
+ case "$gccversion" in
+ '') ;;
+-[12]*) ;; # gcc versions 1 (gasp!) and 2 are not good for this.
++[12].*) ;; # gcc versions 1 (gasp!) and 2 are not good for this.
+ Intel*) ;; # # Is that you, Intel C++?
+ #
+ # NOTE 1: the -std=c89 without -pedantic is a bit pointless.
+-- 
+2.25.0
+

diff --git a/dev-lang/perl/perl-5.30.1.ebuild b/dev-lang/perl/perl-5.30.1.ebuild
index 98cca9ef571..a67b61738c8 100644
--- a/dev-lang/perl/perl-5.30.1.ebuild
+++ b/dev-lang/perl/perl-5.30.1.ebuild
@@ -304,6 +304,7 @@ src_prepare() {
 	if use hppa ; then
 		epatch "${FILESDIR}/${PN}-5.26.2-hppa.patch" # bug 634162
 	fi
+	eapply "${FILESDIR}"/${PN}-5.30.1-gcc-10.patch # bug 708744
 
 	if [[ ${CHOST} == *-solaris* ]] ; then
 		# do NOT mess with nsl, on Solaris this is always necessary,


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-lang/perl/files/, dev-lang/perl/
@ 2020-08-07 21:05 Kent Fredric
  0 siblings, 0 replies; 12+ messages in thread
From: Kent Fredric @ 2020-08-07 21:05 UTC (permalink / raw
  To: gentoo-commits

commit:     5986e6616f0f43983f003792cb4a6c043ff6d37d
Author:     Kent Fredric <kentnl <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 26 08:00:52 2020 +0000
Commit:     Kent Fredric <kentnl <AT> gentoo <DOT> org>
CommitDate: Fri Aug  7 21:04:26 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5986e661

dev-lang/perl: 5.30.3-r2 rework patching bundle logic

This change reworks the patching logic entirely to avoid the use of a
sequence file, instead, relying on directory sort order and numerically
prefixed filenames.

In addition to this change, work is done on the patchset authoring side
to pre-extract important fields like "bugs" and "description" for the
patches and puts them in easy to read files, in order to more clearly
generate patchlevel_gentoo.h ( seen in Perl -V )

Perl -V now includes more verbose details, including fully qualified bug
URLs.

Additionally, its more straight forward to add records to the patch
bundle within the ebuild, using the new "add_patch" helper, so that even
files applied from ${FILESDIR} can be shown in `perl -V`

Patches are fully re-rolled as git patches against perl v5.30.3

Sourcing from "mirror://gentoo" is now implicit, as this syntax is
discouraged.

Patch for Net::SNMP removed from bundle as it just now introduces
redundant documentation.

Patch for gentoo-libdirs now bundled, and properly rehashed to avoid
failing in various porting tests.

Package-Manager: Portage-2.3.100, Repoman-2.3.22
Signed-off-by: Kent Fredric <kentnl <AT> gentoo.org>

 dev-lang/perl/Manifest                             |   1 +
 .../perl/files/perl-5.30.3-gentoo-libdirs.patch    | 135 --------------
 dev-lang/perl/perl-5.30.3-r2.ebuild                | 195 ++++++++++++++-------
 3 files changed, 131 insertions(+), 200 deletions(-)

diff --git a/dev-lang/perl/Manifest b/dev-lang/perl/Manifest
index 0168a19f9ce..863119a0edd 100644
--- a/dev-lang/perl/Manifest
+++ b/dev-lang/perl/Manifest
@@ -1,4 +1,5 @@
 DIST perl-5.30.0-patches-1.tar.xz 17352 BLAKE2B 67eb1c4ce6ada27e05962d06fa9c5675ca1d22623b5fd172ce8ceaa17f2e51d61f9451955f9f6acf6d97ea7d71c72b583be1378ccbf9174c88580baec2049a48 SHA512 4fe1f2de5e72e56890858148d20b772df63dce34cb3977ec47d8ed5323c4843929130f660f1558c282c97e65efa1c6d2fdacf9e2dcc0ef1d487a0b69dbb5bbb4
+DIST perl-5.30.3-patches-1.tar.xz 20292 BLAKE2B 34ca8dbdf08650deaaa59bba634c3a40c6da7d91b282365eec217cc421b17678837b1ae02de5d6b0b632858a0251b796ce28ddbdd7a86aca6697f18a527fcb62 SHA512 ba9aafcaff405c931b61ffc917be8ef71e538fd5277a3bcfafbaffc965b53f9c1811670558a0bc75c538586a30f11aba3ce59bd2214982eaad3b5afa64e67999
 DIST perl-5.30.3.tar.xz 12375128 BLAKE2B ff0668c896e46ea35a1b8bd4a7d800c8668d6995185cd8c43fca332da2fa63965bb5276b2d5cf9738c0b7fb735140f6e33f1b4582899017903f86753065f417b SHA512 0ea62cf17532ee99217a218c39aa530472857c7a1982494f3a01693683062b4cdebe383a79f7b64452c713337b554ed5e0fd6eda018ea29e83c3538a13c24f3c
 DIST perl-5.32.0.tar.xz 12717336 BLAKE2B 4abad9f1ddabaad5f2bbfe8ab6d061aeb8c558e458d4bf1bcf737a8ecc1cf20f7dffaddd0bc867578b457787ec284fa81be3fae1edd7f72d58aeec7b5cd744e5 SHA512 1540247415893bbd94dfeede7b4fba6052688dc0bf27ced817f448246fcdc6e9a6486abc34577dec5b00bf02ed607b2d24ccd4977c3b3c51e8e6edfc0b81c760
 DIST perl-cross-1.3.2.tar.gz 108350 BLAKE2B ddb352fdbec66a04de62425f5cae1aaa3bc7251b9d6f4837b66a0bd79c53c60212fad3997dad4c38055774a2769d45b5b83927bf48b0fb00a130fee429eba702 SHA512 d61d25066a8d87c34aeacc5b9bd86fab964b33c4c65e84a89e4077fe1d8011c0bdf810a304631af44fae32edcffd6c99fc17b0c584ea83d1ce5ce492aaedfea5

diff --git a/dev-lang/perl/files/perl-5.30.3-gentoo-libdirs.patch b/dev-lang/perl/files/perl-5.30.3-gentoo-libdirs.patch
deleted file mode 100644
index b9e36223a94..00000000000
--- a/dev-lang/perl/files/perl-5.30.3-gentoo-libdirs.patch
+++ /dev/null
@@ -1,135 +0,0 @@
-From 7572be1afb16621a537e9da02f96cf04cb10b655 Mon Sep 17 00:00:00 2001
-From: Kent Fredric <kentnl@gentoo.org>
-Date: Sat, 20 Jun 2020 22:14:22 +1200
-Subject: Add support for -Dgentoolibdirs
-
-Which just adds the libdirs verbatim in the right place without
-having perl molest it in the process.
----
- Configure        | 26 ++++++++++++++++++++++++++
- config_h.SH      |  5 +++++
- perl.c           |  1 +
- perl_inc_macro.h |  8 ++++++++
- uconfig.sh       |  1 +
- 5 files changed, 41 insertions(+)
-
-diff --git a/Configure b/Configure
-index cef8c3c078..77258e8f43 100755
---- a/Configure
-+++ b/Configure
-@@ -1181,6 +1181,8 @@ orderlib=''
- ranlib=''
- d_perl_otherlibdirs=''
- otherlibdirs=''
-+gentoolibdirs=''
-+d_gentoolibdirs=''
- package=''
- spackage=''
- pager=''
-@@ -8101,6 +8103,28 @@ esac
- set d_perl_otherlibdirs
- eval $setvar
- 
-+case "$gentoolibdirs" in
-+''|' ') dflt='none' ;;
-+*) dflt="$gentoolibdirs" ;;
-+esac
-+$cat <<EOM
-+Enter a colon-seperated list of explicit gentoo paths to stuff in @INC
-+unmolested, or enter 'none' for no extra paths
-+
-+EOM
-+rp='Colon-seperated list of gentoo-specific perl library search dirs?'
-+. ./myread
-+case "$ans" in
-+' '|''|none) gentoolibdirs=' ';;
-+*) gentoolibdirs="$ans" ;;
-+esac
-+case "$gentoolibdirs" in
-+' ') val=$undef ;;
-+*) val=$define ;;
-+esac
-+set d_gentoolibdirs
-+eval $setvar
-+
- : DTrace support
- dflt_dtrace='/usr/sbin/dtrace'
- $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
-@@ -24402,6 +24426,7 @@ d_openat='$d_openat'
- d_pathconf='$d_pathconf'
- d_pause='$d_pause'
- d_perl_otherlibdirs='$d_perl_otherlibdirs'
-+d_gentoolibdirs='$d_gentoolibdirs'
- d_phostname='$d_phostname'
- d_pipe2='$d_pipe2'
- d_pipe='$d_pipe'
-@@ -24937,6 +24962,7 @@ orderlib='$orderlib'
- osname='$osname'
- osvers='$osvers'
- otherlibdirs='$otherlibdirs'
-+gentoolibdirs='$gentoolibdirs'
- package='$package'
- pager='$pager'
- passcat='$passcat'
-diff --git a/config_h.SH b/config_h.SH
-index 08c5923ef8..5563082969 100755
---- a/config_h.SH
-+++ b/config_h.SH
-@@ -1308,6 +1308,11 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
-  */
- #$d_perl_otherlibdirs PERL_OTHERLIBDIRS "$otherlibdirs"		/**/
- 
-+/* GENTOO_LIBDIRS:
-+ * Like PERL_OTHERLIBDIRS, but doesn't stuff ARCH dirs in when not wanted
-+ */
-+#$d_gentoolibdirs GENTOO_LIBDIRS "$gentoolibdirs"		/**/
-+
- /* PRIVLIB:
-  *	This symbol contains the name of the private library for this package.
-  *	The library is private in the sense that it needn't be in anyone's
-diff --git a/perl.c b/perl.c
-index 2013a76026..62e67cfaa2 100644
---- a/perl.c
-+++ b/perl.c
-@@ -4750,6 +4750,7 @@ S_init_perllib(pTHX)
-     INCPUSH_ARCHLIB_EXP
-     INCPUSH_PRIVLIB_EXP
-     INCPUSH_PERL_OTHERLIBDIRS
-+    INCPUSH_GENTOO_LIBDIRS
-     INCPUSH_PERL5LIB
-     INCPUSH_APPLLIB_OLD_EXP
-     INCPUSH_SITELIB_STEM
-diff --git a/perl_inc_macro.h b/perl_inc_macro.h
-index 5a2f20dfae..4b69b39199 100644
---- a/perl_inc_macro.h
-+++ b/perl_inc_macro.h
-@@ -143,6 +143,14 @@
- 		      INCPUSH_ADD_OLD_VERS|INCPUSH_CAN_RELOCATE);
- #endif
- 
-+#ifdef GENTOO_LIBDIRS
-+# define INCPUSH_GENTOO_LIBDIRS S_incpush_use_sep(aTHX_ STR_WITH_LEN(GENTOO_LIBDIRS), \
-+    INCPUSH_ADD_OLD_VERS|INCPUSH_CAN_RELOCATE);
-+#endif
-+#ifndef INCPUSH_GENTOO_LIBDIRS
-+# define INCPUSH_GENTOO_LIBDIRS
-+#endif
-+
- #ifdef PERL_OTHERLIBDIRS
- #	define INCPUSH_PERL_OTHERLIBDIRS_ARCHONLY  S_incpush_use_sep(aTHX_ STR_WITH_LEN(PERL_OTHERLIBDIRS), \
- 		      INCPUSH_ADD_OLD_VERS|INCPUSH_ADD_ARCHONLY_SUB_DIRS|INCPUSH_CAN_RELOCATE);
-diff --git a/uconfig.sh b/uconfig.sh
-index 1d4a0f4a57..fba825acad 100644
---- a/uconfig.sh
-+++ b/uconfig.sh
-@@ -185,6 +185,7 @@ d_futimes='undef'
- d_gai_strerror='undef'
- d_gdbm_ndbm_h_uses_prototypes='undef'
- d_gdbmndbm_h_uses_prototypes='undef'
-+d_gentoolibdirs='undef'
- d_getaddrinfo='undef'
- d_getcwd='undef'
- d_getespwnam='undef'
--- 
-2.27.0
-

diff --git a/dev-lang/perl/perl-5.30.3-r2.ebuild b/dev-lang/perl/perl-5.30.3-r2.ebuild
index 18013a31588..1e58cc17ee5 100644
--- a/dev-lang/perl/perl-5.30.3-r2.ebuild
+++ b/dev-lang/perl/perl-5.30.3-r2.ebuild
@@ -7,8 +7,8 @@ inherit alternatives flag-o-matic toolchain-funcs multilib multiprocessing
 
 PATCH_VER=1
 CROSS_VER=1.3.4
-PATCH_BASE="perl-5.30.0-patches-${PATCH_VER}"
-PATCH_DEV=dilfridge
+PATCH_BASE="perl-5.30.3-patches-${PATCH_VER}"
+PATCH_DEV=kentnl
 
 DIST_AUTHOR=XSAWYERX
 
@@ -41,7 +41,6 @@ SRC_URI="
 	mirror://cpan/src/5.0/${MY_P}.tar.xz
 	mirror://cpan/authors/id/${DIST_AUTHOR:0:1}/${DIST_AUTHOR:0:2}/${DIST_AUTHOR}/${MY_P}.tar.xz
 	https://github.com/gentoo-perl/perl-patchset/releases/download/${PATCH_BASE}/${PATCH_BASE}.tar.xz
-	mirror://gentoo/${PATCH_BASE}.tar.xz
 	https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${PATCH_BASE}.tar.xz
 	https://github.com/arsv/perl-cross/releases/download/${CROSS_VER}/perl-cross-${CROSS_VER}.tar.gz
 "
@@ -252,55 +251,6 @@ src_remove_dual() {
 	done
 }
 
-src_prepare_update_patchlevel_h() {
-	# Copied and modified from debian:
-	# Copyright 2011 Niko Tyni
-	# This program is free software; you can redistribute it and/or modify
-	# it under the same terms as Perl itself.
-	local patchdir="${WORKDIR}/patches"
-	local prefix
-	local patchoutput="patchlevel-gentoo.h"
-
-	[[ -f ${patchdir}/series ]] || return 0
-
-while read patch
-do
-	patchname=$(echo $patch | sed 's/\.diff$//')
-	< $patchdir/$patch sed -e '/^Subject:/ { N; s/\n / / }' | sed -n -e '
-
-	# massage the patch headers
-	s|^Bug: .*https\?://rt\.perl\.org/.*id=\(.*\).*|[perl #\1]|; tprepend;
-	s|^Bug: .*https\?://rt\.cpan\.org/.*id=\(.*\).*|[rt.cpan.org #\1]|; tprepend;
-	s|^Bug-Gentoo: ||; tprepend;
-	s/^\(Subject\|Description\): //; tappend;
-	s|^Origin: .*http://perl5\.git\.perl\.org/perl\.git/commit\(diff\)\?/\(.......\).*|[\2]|; tprepend;
-
-	# post-process at the end of input
-	$ { x;
-		# include the version number in the patchlevel.h description (if available)
-		s/List packaged patches/&'" for ${PF}(#${PATCH_VER})"'/;
-
-		# escape any backslashes and double quotes
-		s|\\|\\\\|g; s|"|\\"|g;
-
-		# add a prefix
-		s|^|\t,"'"$prefix$patchname"' - |;
-		# newlines away
-		s/\n/ /g; s/  */ /g;
-		# add a suffix
-		s/ *$/"/; p
-	};
-	# stop all processing
-	d;
-	# label: append to the hold space
-	:append H; d;
-	# label: prepend to the hold space
-	:prepend x; H; d;
-	'
-done < "${WORKDIR}"/patches/series > "${S}/${patchoutput}"
-echo "${patchoutput}" >> "${S}/MANIFEST"
-}
-
 src_prepare_perlcross() {
 	cp -a ../perl-cross-${CROSS_VER}/* . || die
 
@@ -313,28 +263,143 @@ src_prepare_dynamic() {
 	ln -s ${LIBPERL} libperl$(get_libname ) || die
 }
 
+# Copy a patch into the patch series
+# add_patch SRC_PATH DEST_NAME ['description'] ['bug'] ['bug']
+# - description is optional, but recommended
+# - all arguments after descriptions are bug URLs
+add_patch() {
+	local patchdir="${WORKDIR}/patches"
+	local infodir="${WORKDIR}/patch-info"
+	local src_name dest_name desc
+	src_name="$1"
+	dest_name="$2"
+	desc="$3"
+	shift; shift; shift;
+	einfo "Adding ${dest_name} to patch bundle"
+	cp "${src_name}" "${patchdir}/${dest_name}" || die "Couldn't copy ${src_name} to ${dest_name}"
+	if [[ -n "${desc}" ]]; then
+		printf "%s" "${desc}" > "${infodir}/${dest_name}.desc" || die "Couldn't write ${dest_name}.desc"
+	fi
+	if [[ $# -gt 0 ]]; then
+		# Note: when $@ is more than one element, this emits a
+		# line for each element
+		printf "%s\n" "$@" > "${infodir}/${dest_name}.bugs" || die "Couldn't write ${dest_name}.bugs"
+	fi
+}
+# Remove a patch using a glob expr
+# eg:
+#	 rm_patch *-darin-Use-CC*
+#
+rm_patch() {
+	local patchdir="${WORKDIR}/patches"
+	local expr="$1"
+	local patch="$( cd "${patchdir}"; echo $expr )"
+	einfo "Removing $patch ($expr) from patch bundle"
+	if [[ -e "${patchdir}/${patch}" ]]; then
+		rm -f "${patchdir}/${patch}" || die "Can't remove ${patch} ( $expr )"
+	else
+		ewarn "No ${expr} found in ${patchdir} to remove"
+	fi
+}
+# Yes, this is a reasonable amount of code for something seemingly simple
+# but this is far easier to debug when things go wrong, and things went wrong
+# multiple times while I was getting the exact number of slashes right, which
+# requires circumnavigating both bash and sed escape mechanisms.
+c_escape_string() {
+	local slash dquote
+	slash='\'
+	dquote='"'
+	re_slash="${slash}${slash}"
+	re_dquote="${slash}${dquote}"
+
+	# Convert \ to \\,
+	#         " to \"
+	echo "$1" |\
+		sed "s|${re_slash}|${re_slash}${re_slash}|g" |\
+		sed "s|${re_dquote}|${re_slash}${re_dquote}|g"
+}
+c_escape_file() {
+	c_escape_string "$(cat "$1")"
+}
+
+apply_patchdir() {
+	local patchdir="${WORKDIR}/patches"
+	local infodir="${WORKDIR}/patch-info"
+	local patchoutput="patchlevel-gentoo.h"
+
+	# Inject Patch-Level info into description for patchlevel.h patch
+	# to show in -V
+	local patch_expr="*List-packaged-patches*"
+	local patch="$( cd "${patchdir}"; echo $patch_expr )";
+	einfo "Injecting patch-level info into ${patch}.desc ( $patch_expr )"
+
+	if [[ -e "${patchdir}/${patch}" ]]; then
+		printf "List packaged patches for %s(%s) in patchlevel.h" "${PF}" "${PATCH_BASE}"\
+			>"${infodir}/${patch}.desc" || die "Can't rewrite ${patch}.desc"
+	else
+		eerror "No $patch_expr found in ${patchdir}"
+	fi
+
+	# Compute patch list to apply
+	# different name other than PATCHES to stop default
+	# reapplying it
+	# Single depth is currently only supported, as artifacts can reside
+	# from the old layout being multiple-directories, as well as it grossly
+	# simplifying the patchlevel_gentoo.h generation.
+	local PERL_PATCHES=($(
+		find "${patchdir}" -maxdepth 1 -mindepth 1 -type f -printf "%f\n" |\
+			grep -E '[.](diff|patch)$' |\
+			sort -n
+	))
+
+	for patch in "${PERL_PATCHES[@]}"; do
+		eapply "${WORKDIR}"/patches/${patch}
+	done
+
+	einfo "Generating $patchoutput"
+
+	# This code creates a header file, each iteration
+	# creates one-or-more-lines for each entry found in PERL_PATCHES
+	# and STDOUT is redirected to the .h file
+	for patch in "${PERL_PATCHES[@]}"; do
+		local desc_f="${infodir}/${patch}.desc"
+		local bugs_f="${infodir}/${patch}.bugs"
+
+		printf ',"%s"\n' "${patch}"
+		if [[ ! -e "${desc_f}" ]]; then
+			ewarn "No description provided for ${patch} (expected: ${desc_f} )"
+		else
+			local desc="$(c_escape_file "${desc_f}")"
+			printf ',"- %s"\n' "${desc}"
+		fi
+		if [[ -e "${bugs_f}" ]]; then
+			while read -d $'\n' -r line; do
+				local esc_line="$(c_escape_string "${line}")"
+				printf ',"- Bug: %s"\n' "${esc_line}"
+			done <"${bugs_f}"
+		fi
+	done > "${S}/${patchoutput}"
+	printf "%s\n" "${patchoutput}" >> "${S}/MANIFEST"
+
+}
 src_prepare() {
-	local patch
+	local patchdir="${WORKDIR}/patches"
 
+	# Prepare Patch dir with additional patches / remove unwanted patches
+	# Inject bug/desc entries for perl -V
 	if use hppa ; then
-		eapply "${FILESDIR}/${PN}-5.26.2-hppa.patch" # bug 634162
+		# bug 634162
+		add_patch "${FILESDIR}/${PN}-5.26.2-hppa.patch" "100-5.26.2-hppa.patch"\
+			"Fix broken miniperl on hppa"\
+			"https://bugs.debian.org/869122" "https://bugs.gentoo.org/634162"
 	fi
-
 	if [[ ${CHOST} == *-solaris* ]] ; then
 		# do NOT mess with nsl, on Solaris this is always necessary,
 		# when -lsocket is used e.g. to get h_errno
-		sed -i '/gentoo\/no-nsl-cl\.patch/d' "${WORKDIR}/patches/series" || die
+		rm_patch "*-nsl-and-cl*"
 	fi
 
-	einfo "[ Applying patches from ${PATCH_BASE} ]"
-	while read patch ; do
-		eapply "${WORKDIR}"/patches/${patch}
-	done < "${WORKDIR}"/patches/series
-	einfo "[ Done with ${PATCH_BASE} ]"
-
-	eapply "${FILESDIR}/${PN}-5.30.3-gentoo-libdirs.patch"
-
-	src_prepare_update_patchlevel_h
+	apply_patchdir
 
 	tc-is-cross-compiler && src_prepare_perlcross
 


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-lang/perl/files/, dev-lang/perl/
@ 2021-10-09 14:26 Andreas K. Hüttel
  0 siblings, 0 replies; 12+ messages in thread
From: Andreas K. Hüttel @ 2021-10-09 14:26 UTC (permalink / raw
  To: gentoo-commits

commit:     d170e2a4277744193407903b9fe8e7f23ce15f63
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct  9 14:25:05 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct  9 14:25:05 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d170e2a4

dev-lang/perl: Fix functionality with recent gdbm

Bug: https://bugs.gentoo.org/802945
Bug: https://bugs.gentoo.org/797460
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 dev-lang/perl/files/perl-5.34.0-gdbm-1.20.patch |  40 ++
 dev-lang/perl/perl-5.34.0-r3.ebuild             | 827 ++++++++++++++++++++++++
 2 files changed, 867 insertions(+)

diff --git a/dev-lang/perl/files/perl-5.34.0-gdbm-1.20.patch b/dev-lang/perl/files/perl-5.34.0-gdbm-1.20.patch
new file mode 100644
index 00000000000..fc4c55c6899
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.34.0-gdbm-1.20.patch
@@ -0,0 +1,40 @@
+From: Sergey Poznyakoff <gray@gnu.org>
+Date: Wed, 23 Jun 2021 10:26:50 +0300
+Subject: Fix GDBM_File to compile with version 1.20 and earlier
+
+* ext/GDBM_File/GDBM_File.xs (ITEM_NOT_FOUND): Define conditionally,
+depending on the GDBM_VERSION_MAJOR and GDBM_VERSION_MINOR.
+Don't assume GDBM_ITEM_NOT_FOUND is a define (it isn't since
+gdbm commit d3e27957).
+
+Origin: backport, https://github.com/Perl/perl5/pull/18924/commits/aacd2398e766500cb5d83c4d76b642fcf31d997a
+Bug: https://github.com/Perl/perl5/issues/18915
+Bug-Debian: https://bugs.debian.org/993514
+---
+ ext/GDBM_File/GDBM_File.xs | 11 +++++------
+ 1 file changed, 5 insertions(+), 6 deletions(-)
+
+diff --git a/ext/GDBM_File/GDBM_File.xs b/ext/GDBM_File/GDBM_File.xs
+index cd0bb6f..494c288 100644
+--- a/ext/GDBM_File/GDBM_File.xs
++++ b/ext/GDBM_File/GDBM_File.xs
+@@ -145,14 +145,13 @@ output_datum(pTHX_ SV *arg, char *str, int size)
+ #define gdbm_setopt(db,optflag,optval,optlen) not_here("gdbm_setopt")
+ #endif
+ 
+-#ifndef GDBM_ITEM_NOT_FOUND
+-# define GDBM_ITEM_NOT_FOUND GDBM_NO_ERROR
+-#endif
+-
++#if GDBM_VERSION_MAJOR == 1 && GDBM_VERSION_MINOR < 13        
+ /* Prior to 1.13, gdbm_fetch family functions set gdbm_errno to GDBM_NO_ERROR
+    if the requested key did not exist */
+-#define ITEM_NOT_FOUND()                                                \
+-    (gdbm_errno == GDBM_ITEM_NOT_FOUND || gdbm_errno == GDBM_NO_ERROR)
++# define ITEM_NOT_FOUND()  (gdbm_errno == GDBM_NO_ERROR)
++#else
++# define ITEM_NOT_FOUND()  (gdbm_errno == GDBM_ITEM_NOT_FOUND)
++#endif
+ 
+ #define CHECKDB(db) do {                        \
+     if (!db->dbp) {                             \

diff --git a/dev-lang/perl/perl-5.34.0-r3.ebuild b/dev-lang/perl/perl-5.34.0-r3.ebuild
new file mode 100644
index 00000000000..2c21f1c00ae
--- /dev/null
+++ b/dev-lang/perl/perl-5.34.0-r3.ebuild
@@ -0,0 +1,827 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit alternatives flag-o-matic toolchain-funcs multilib multiprocessing
+
+PATCH_VER=1
+CROSS_VER=1.3.6
+PATCH_BASE="perl-5.34.0-patches-${PATCH_VER}"
+PATCH_DEV=dilfridge
+
+DIST_AUTHOR=XSAWYERX
+
+# Greatest first, don't include yourself
+# Devel point-releases are not ABI-intercompatible, but stable point releases are
+# BIN_OLDVERSEN is contains only C-ABI-intercompatible versions
+PERL_BIN_OLDVERSEN=""
+
+# Yes we can.
+PERL_SINGLE_SLOT=y
+
+if [[ "${PV##*.}" == "9999" ]]; then
+	DIST_VERSION=5.30.0
+else
+	DIST_VERSION="${PV/_rc/-RC}"
+fi
+SHORT_PV="${DIST_VERSION%.*}"
+# Even numbered major versions are ABI intercompatible
+# Odd numbered major versions are not
+if [[ $(( ${SHORT_PV#*.} % 2 )) == 1 ]]; then
+	SUBSLOT="${DIST_VERSION%-RC*}"
+else
+	SUBSLOT="${DIST_VERSION%.*}"
+fi
+# Used only in tar paths
+MY_P="perl-${DIST_VERSION}"
+# Used in library paths
+MY_PV="${DIST_VERSION%-RC*}"
+
+DESCRIPTION="Larry Wall's Practical Extraction and Report Language"
+
+SRC_URI="
+	mirror://cpan/src/5.0/${MY_P}.tar.xz
+	mirror://cpan/authors/id/${DIST_AUTHOR:0:1}/${DIST_AUTHOR:0:2}/${DIST_AUTHOR}/${MY_P}.tar.xz
+	https://github.com/gentoo-perl/perl-patchset/releases/download/${PATCH_BASE}/${PATCH_BASE}.tar.xz
+	https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${PATCH_BASE}.tar.xz
+	https://github.com/arsv/perl-cross/releases/download/${CROSS_VER}/perl-cross-${CROSS_VER}.tar.gz
+"
+HOMEPAGE="https://www.perl.org/"
+
+LICENSE="|| ( Artistic GPL-1+ )"
+SLOT="0/${SUBSLOT}"
+
+if [[ "${PV##*.}" != "9999" ]] && [[ "${PV/rc//}" == "${PV}" ]] ; then
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+
+IUSE="berkdb debug doc gdbm ithreads minimal"
+
+RDEPEND="
+	berkdb? ( sys-libs/db:= )
+	gdbm? ( >=sys-libs/gdbm-1.8.3:= )
+	app-arch/bzip2
+	sys-libs/zlib
+	virtual/libcrypt:=
+"
+DEPEND="${RDEPEND}"
+BDEPEND="${RDEPEND}"
+
+PDEPEND="
+	!minimal? (
+		>=app-admin/perl-cleaner-2.5
+		>=virtual/perl-Encode-3.120.0
+		>=virtual/perl-File-Temp-0.230.400-r2
+		>=virtual/perl-Data-Dumper-2.154.0
+		virtual/perl-Test-Harness
+	)
+"
+# bug 390719, bug 523624
+# virtual/perl-Test-Harness is here for the bundled ExtUtils::MakeMaker
+
+S="${WORKDIR}/${MY_P}"
+
+dual_scripts() {
+	src_remove_dual      perl-core/Archive-Tar        2.380.0       ptar ptardiff ptargrep
+	src_remove_dual      perl-core/CPAN               2.280.0       cpan
+	src_remove_dual      perl-core/Digest-SHA         6.20.0        shasum
+	src_remove_dual      perl-core/Encode             3.80.0        enc2xs piconv
+	src_remove_dual      perl-core/ExtUtils-MakeMaker 7.620.0       instmodsh
+	src_remove_dual      perl-core/ExtUtils-ParseXS   3.430.0       xsubpp
+	src_remove_dual      perl-core/IO-Compress        2.102.0        zipdetails
+	src_remove_dual      perl-core/JSON-PP            4.60.0        json_pp
+	src_remove_dual      perl-core/Module-CoreList    5.202.105.200 corelist
+	src_remove_dual      perl-core/Pod-Checker        1.740.0       podchecker
+	src_remove_dual      perl-core/Pod-Perldoc        3.280.100     perldoc
+	src_remove_dual      perl-core/Pod-Usage          2.10.0       pod2usage
+	src_remove_dual      perl-core/Test-Harness       3.430.0       prove
+	src_remove_dual      perl-core/podlators          4.140.0       pod2man pod2text
+	src_remove_dual_man  perl-core/podlators          4.140.0       /usr/share/man/man1/perlpodstyle.1
+}
+
+check_rebuild() {
+	# Fresh install
+	if [[ -z "${REPLACING_VERSIONS}" ]]; then
+		return 0;
+	# Major Upgrade
+	# doesn't matter if there's multiple copies, it still needs a rebuild
+	# if the string is anything other than "5.CURRENTMAJOR"
+	elif [[ "${REPLACING_VERSIONS%.*}" != "${PV%.*}" ]]; then
+		echo ""
+		ewarn "UPDATE THE PERL MODULES:"
+		ewarn "After updating dev-lang/perl the installed Perl modules"
+		ewarn "have to be re-installed. In most cases, this is done automatically"
+		ewarn "by the package manager, but subsequent steps are still recommended"
+		ewarn "to ensure system consistency."
+		ewarn
+		ewarn "You should start with a depclean to remove any unused perl dependencies"
+		ewarn "that may confuse portage in future. Regular depcleans are also encouraged"
+		ewarn "as part of your regular update cycle, as that will keep perl upgrades working."
+		ewarn "Recommended: emerge --depclean -va"
+		ewarn
+		ewarn "You should then call perl-cleaner to clean up any old files and trigger any"
+		ewarn "remaining rebuilds portage may have missed."
+		ewarn "Use: perl-cleaner --all"
+		return 0;
+
+	# Reinstall w/ USE Change
+	elif (   use ithreads && ! has_version dev-lang/perl[ithreads] ) || \
+		 ( ! use ithreads &&   has_version dev-lang/perl[ithreads] ) || \
+		 (   use debug    && ! has_version dev-lang/perl[debug]    ) || \
+		 ( ! use debug    &&   has_version dev-lang/perl[debug]    ) ; then
+		echo ""
+		ewarn "TOGGLED USE-FLAGS WARNING:"
+		ewarn "You changed one of the use-flags ithreads or debug."
+		ewarn "You must rebuild all perl-modules installed."
+		ewarn "Use: perl-cleaner --modules ; perl-cleaner --force --libperl"
+	fi
+}
+
+pkg_setup() {
+	case ${CHOST} in
+		*-freebsd*)   osname="freebsd" ;;
+		*-dragonfly*) osname="dragonfly" ;;
+		*-netbsd*)    osname="netbsd" ;;
+		*-openbsd*)   osname="openbsd" ;;
+		*-darwin*)    osname="darwin" ;;
+		*-solaris*)   osname="solaris" ;;
+		*-cygwin*)    osname="cygwin" ;;
+		*)            osname="linux" ;;
+	esac
+
+	myarch="${CHOST%%-*}-${osname}"
+	if use debug ; then
+		myarch+="-debug"
+	fi
+	if use ithreads ; then
+		mythreading="-multi"
+		myarch+="-thread"
+	fi
+
+	PRIV_BASE="/usr/$(get_libdir)/perl5"
+	SITE_BASE="/usr/local/$(get_libdir)/perl5"
+	VENDOR_BASE="/usr/$(get_libdir)/perl5/vendor_perl"
+
+	LIBPERL="libperl$(get_libname ${MY_PV} )"
+
+	# This ENV var tells perl to build with a directory like "5.30"
+	# regardless of its patch version. This is for experts only
+	# at this point.
+	if [[ -z "${PERL_SINGLE_SLOT}" ]]; then
+		PRIV_LIB="${PRIV_BASE}/${MY_PV}"
+		ARCH_LIB="${PRIV_BASE}/${MY_PV}/${myarch}${mythreading}"
+		SITE_LIB="${SITE_BASE}/${MY_PV}"
+		SITE_ARCH="${SITE_BASE}/${MY_PV}/${myarch}${mythreading}"
+		VENDOR_LIB="${VENDOR_BASE}/${MY_PV}"
+		VENDOR_ARCH="${VENDOR_BASE}/${MY_PV}/${myarch}${mythreading}"
+	else
+		PRIV_LIB="${PRIV_BASE}/${SUBSLOT}"
+		ARCH_LIB="${PRIV_BASE}/${SUBSLOT}/${myarch}${mythreading}"
+		SITE_LIB="${SITE_BASE}/${SUBSLOT}"
+		SITE_ARCH="${SITE_BASE}/${SUBSLOT}/${myarch}${mythreading}"
+		VENDOR_LIB="${VENDOR_BASE}/${SUBSLOT}"
+		VENDOR_ARCH="${VENDOR_BASE}/${SUBSLOT}/${myarch}${mythreading}"
+	fi
+
+	dual_scripts
+}
+
+src_remove_dual_file() {
+	local i pkg ver
+	pkg="$1"
+	ver="$2"
+	shift 2
+	case "${EBUILD_PHASE:-none}" in
+		postinst|postrm)
+			for i in "$@" ; do
+				alternatives_auto_makesym "${i}" "${i}-[0-9]*"
+			done
+			;;
+		setup)
+			for i in "$@" ; do
+				if [[ -f ${EROOT}${i} && ! -h ${EROOT}${i} ]] ; then
+					has_version ${pkg} && ewarn "You must reinstall ${pkg} !"
+					break
+				fi
+			done
+			;;
+		install)
+			for i in "$@" ; do
+				if ! [[ -f "${ED}"${i} ]] ; then
+					ewarn "${i} does not exist!"
+					continue
+				fi
+				mv "${ED}"${i}{,-${ver}-${P}} || die
+			done
+			;;
+	esac
+}
+
+src_remove_dual_man() {
+	local i pkg ver ff
+	pkg="$1"
+	ver="$2"
+	shift 2
+	case "${EBUILD_PHASE:-none}" in
+		postinst|postrm)
+			for i in "$@" ; do
+				ff=`echo "${EROOT}${i%.[0-9]}-${ver}-${P}${i#${i%.[0-9]}}"*`
+				ff=${ff##*${i#${i%.[0-9]}}}
+				alternatives_auto_makesym "${i}${ff}" "${i%.[0-9]}-[0-9]*"
+			done
+			;;
+		install)
+			for i in "$@" ; do
+				if ! [[ -f "${ED}"${i} ]] ; then
+					ewarn "${i} does not exist!"
+					continue
+				fi
+				mv "${ED}"${i} "${ED}"${i%.[0-9]}-${ver}-${P}${i#${i%.[0-9]}} || die
+			done
+			;;
+	esac
+}
+
+src_remove_dual() {
+	local i pkg ver
+	pkg="$1"
+	ver="$2"
+	shift 2
+	for i in "$@" ; do
+		src_remove_dual_file  "${pkg}" "${ver}" "/usr/bin/${i}"
+		src_remove_dual_man   "${pkg}" "${ver}" "/usr/share/man/man1/${i}.1"
+	done
+}
+
+src_prepare_perlcross() {
+	cp -a ../perl-cross-${CROSS_VER}/* . || die
+
+	# bug 794463, needs further analysis what is exactly wrong here
+	eapply "${FILESDIR}/perl-5.34.0-crossfit.patch"
+
+	# bug 604072
+	MAKEOPTS+=" -j1"
+	export MAKEOPTS
+}
+src_prepare_dynamic() {
+	ln -s ${LIBPERL} libperl$(get_libname ${SHORT_PV}) || die
+	ln -s ${LIBPERL} libperl$(get_libname ) || die
+}
+
+# Copy a patch into the patch series
+# add_patch SRC_PATH DEST_NAME ['description'] ['bug'] ['bug']
+# - description is optional, but recommended
+# - all arguments after descriptions are bug URLs
+add_patch() {
+	local patchdir="${WORKDIR}/patches"
+	local infodir="${WORKDIR}/patch-info"
+	local src_name dest_name desc
+	src_name="$1"
+	dest_name="$2"
+	desc="$3"
+	shift; shift; shift;
+	einfo "Adding ${dest_name} to patch bundle"
+	cp "${src_name}" "${patchdir}/${dest_name}" || die "Couldn't copy ${src_name} to ${dest_name}"
+	if [[ -n "${desc}" ]]; then
+		printf "%s" "${desc}" > "${infodir}/${dest_name}.desc" || die "Couldn't write ${dest_name}.desc"
+	fi
+	if [[ $# -gt 0 ]]; then
+		# Note: when $@ is more than one element, this emits a
+		# line for each element
+		printf "%s\n" "$@" > "${infodir}/${dest_name}.bugs" || die "Couldn't write ${dest_name}.bugs"
+	fi
+}
+# Remove a patch using a glob expr
+# eg:
+#	 rm_patch *-darin-Use-CC*
+#
+rm_patch() {
+	local patchdir="${WORKDIR}/patches"
+	local expr="$1"
+	local patch="$( cd "${patchdir}"; echo $expr )"
+	einfo "Removing $patch ($expr) from patch bundle"
+	if [[ -e "${patchdir}/${patch}" ]]; then
+		rm -f "${patchdir}/${patch}" || die "Can't remove ${patch} ( $expr )"
+	else
+		ewarn "No ${expr} found in ${patchdir} to remove"
+	fi
+}
+# Yes, this is a reasonable amount of code for something seemingly simple
+# but this is far easier to debug when things go wrong, and things went wrong
+# multiple times while I was getting the exact number of slashes right, which
+# requires circumnavigating both bash and sed escape mechanisms.
+c_escape_string() {
+	local slash dquote
+	slash='\'
+	dquote='"'
+	re_slash="${slash}${slash}"
+	re_dquote="${slash}${dquote}"
+
+	# Convert \ to \\,
+	#         " to \"
+	echo "$1" |\
+		sed "s|${re_slash}|${re_slash}${re_slash}|g" |\
+		sed "s|${re_dquote}|${re_slash}${re_dquote}|g"
+}
+c_escape_file() {
+	c_escape_string "$(cat "$1")"
+}
+
+apply_patchdir() {
+	local patchdir="${WORKDIR}/patches"
+	local infodir="${WORKDIR}/patch-info"
+	local patchoutput="patchlevel-gentoo.h"
+
+	# Inject Patch-Level info into description for patchlevel.h patch
+	# to show in -V
+	local patch_expr="*List-packaged-patches*"
+	local patch="$( cd "${patchdir}"; echo $patch_expr )";
+	einfo "Injecting patch-level info into ${patch}.desc ( $patch_expr )"
+
+	if [[ -e "${patchdir}/${patch}" ]]; then
+		printf "List packaged patches for %s(%s) in patchlevel.h" "${PF}" "${PATCH_BASE}"\
+			>"${infodir}/${patch}.desc" || die "Can't rewrite ${patch}.desc"
+	else
+		eerror "No $patch_expr found in ${patchdir}"
+	fi
+
+	# Compute patch list to apply
+	# different name other than PATCHES to stop default
+	# reapplying it
+	# Single depth is currently only supported, as artifacts can reside
+	# from the old layout being multiple-directories, as well as it grossly
+	# simplifying the patchlevel_gentoo.h generation.
+	local PERL_PATCHES=($(
+		find "${patchdir}" -maxdepth 1 -mindepth 1 -type f -printf "%f\n" |\
+			grep -E '[.](diff|patch)$' |\
+			sort -n
+	))
+
+	for patch in "${PERL_PATCHES[@]}"; do
+		eapply "${WORKDIR}"/patches/${patch}
+	done
+
+	einfo "Generating $patchoutput"
+
+	# This code creates a header file, each iteration
+	# creates one-or-more-lines for each entry found in PERL_PATCHES
+	# and STDOUT is redirected to the .h file
+	for patch in "${PERL_PATCHES[@]}"; do
+		local desc_f="${infodir}/${patch}.desc"
+		local bugs_f="${infodir}/${patch}.bugs"
+
+		printf ',"%s"\n' "${patch}"
+		if [[ ! -e "${desc_f}" ]]; then
+			ewarn "No description provided for ${patch} (expected: ${desc_f} )"
+		else
+			local desc="$(c_escape_file "${desc_f}")"
+			printf ',"- %s"\n' "${desc}"
+		fi
+		if [[ -e "${bugs_f}" ]]; then
+			while read -d $'\n' -r line; do
+				local esc_line="$(c_escape_string "${line}")"
+				printf ',"- Bug: %s"\n' "${esc_line}"
+			done <"${bugs_f}"
+		fi
+	done > "${S}/${patchoutput}"
+	printf "%s\n" "${patchoutput}" >> "${S}/MANIFEST"
+
+}
+src_prepare() {
+	local patchdir="${WORKDIR}/patches"
+
+	# Prepare Patch dir with additional patches / remove unwanted patches
+	# Inject bug/desc entries for perl -V
+	# Old example:
+	# add_patch "${FILESDIR}/${PN}-5.26.2-hppa.patch" "100-5.26.2-hppa.patch"\
+	#		"Fix broken miniperl on hppa"\
+	#		"https://bugs.debian.org/869122" "https://bugs.gentoo.org/634162"
+
+	add_patch "${FILESDIR}/${P}-gdbm-1.20.patch" "0101-Fix-build-with-gdb120.patch"\
+			"Fix GDBM_File to compile with version 1.20 and earlier"\
+			"https://bugs.gentoo.org/802945"
+
+	if [[ ${CHOST} == *-solaris* ]] ; then
+		# do NOT mess with nsl, on Solaris this is always necessary,
+		# when -lsocket is used e.g. to get h_errno
+		rm_patch "*-nsl-and-cl*"
+	fi
+
+	apply_patchdir
+
+	tc-is-cross-compiler && src_prepare_perlcross
+
+	tc-is-static-only || src_prepare_dynamic
+
+	if use gdbm; then
+		sed -i "s:INC => .*:INC => \"-I${EROOT}/usr/include/gdbm\":g" \
+			ext/NDBM_File/Makefile.PL || die
+	fi
+
+	# Use errno.h from prefix rather than from host system, bug #645804
+	if use prefix && [[ -e "${EPREFIX}"/usr/include/errno.h ]] ; then
+		sed -i "/my..sysroot/s:'':'${EPREFIX}':" ext/Errno/Errno_pm.PL || die
+	fi
+
+	if [[ ${CHOST} == *-solaris* ]] ; then
+		# set a soname, fix linking against just built libperl
+		sed -i -e 's/netbsd\*/netbsd*|solaris*/' Makefile.SH || die
+	fi
+
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		# fix install_name (soname) not to reference $D
+		sed -i -e '/install_name `pwd/s/`pwd`/\\$(shrpdir)/' Makefile.SH || die
+	fi
+
+	default
+}
+
+myconf() {
+	# the myconf array is declared in src_configure
+	myconf=( "${myconf[@]}" "$@" )
+}
+
+# Outputs a list of versions which have been seen in any of the
+# primary perl @INC prefix paths, such as:
+#  /usr/lib64/perl5/<NUMBER>
+#  /usr/local/lib64/perl5/<NUMBER>
+#  /usr/lib64/perl5/vendor_perl/<NUMBER>
+#
+# All values of NUMBER must be like "5.x.y", unless PERL_SUPPORT_SINGLE_SLOT
+# is enabled, where it will also allow numbers like "5.x"
+#
+# PERL_SUPPORT_SINGLE_SLOT should only be used to transition *away* from PERL_SINGLE_SLOT
+# if you used that.
+find_candidate_inc_versions() {
+	local regex='.*/5[.][0-9]+[.][0-9]+$';
+	if [[ ! -z "${PERL_SUPPORT_SINGLE_SLOT}" || ! -z "${PERL_SINGLE_SLOT}" ]]; then
+		regex='.*/5[.][0-9]+\([.][0-9]+\|\)$'
+	fi
+	local dirs=(
+		"${EROOT}${PRIV_BASE}"
+		"${EROOT}${SITE_BASE}"
+		"${EROOT}${VENDOR_BASE}"
+	)
+	for dir in "${dirs[@]}"; do
+		if [[ ! -e "${dir}" ]]; then
+			continue
+		fi
+		# Without access to readdir() on these dirs, find will not be able
+		# to reveal any @INC directories inside them, and will subsequently prune
+		# them from the built perl's @INC support, breaking our compatiblity options
+		# entirely.
+		if [[ ! -r "${dir}" || ! -x "${dir}" ]]; then
+			eerror "Bad permissions on ${dir}, this will probably break things"
+			eerror "Ensure ${dir} is +rx for at least uid=$EUID"
+			eerror "Recommended permission is +rx for all"
+			eerror "> chmod o+rx ${dir}"
+		fi
+	done
+	einfo "Scanning for old @INC dirs matching '$regex' in: ${dirs[*]}"
+	find "${dirs[@]}" -maxdepth 1 -mindepth 1 -type d -regex "${regex}" -printf "%f "  2>/dev/null
+}
+# Sort versions passed versiony-ly, remove self-version if present
+# dedup. Takes each version as an argument
+sanitize_inc_versions() {
+	local vexclude="${DIST_VERSION%-RC}"
+	if [[ ! -z "${PERL_SINGLE_SLOT}" ]]; then
+		vexclude="${SUBSLOT}"
+	fi
+	einfo "Normalizing/Sorting candidate list: $*"
+	einfo " to remove '${vexclude}'"
+	# Note, general numeric sort has to be used
+	# for the last component, or unique will convert
+	#  5.30.0 + 5.30 into just 5.30
+	printf "%s\n" "$@" |\
+		grep -vxF "${vexclude}" |\
+		sort -u -nr -t'.' -k1,1rn -k2,2rn -k3,3rg
+}
+
+versions_to_inclist() {
+	local oldv="${PERL_BIN_OLDVERSEN}"
+	if [[ ! -z "${PERL_SINGLE_SLOT}" ]]; then
+		oldv="${DIST_VERSION%-RC} ${PERL_BIN_OLDVERSEN}"
+	fi
+	for v;	do
+			has "${v}" ${oldv} && echo -n "${v}/${myarch}${mythreading}/ ";
+			echo -n "${v}/ ";
+	done
+}
+versions_to_gentoolibdirs() {
+	local oldv="${PERL_BIN_OLDVERSEN}"
+	local root
+	local v
+	if [[ ! -z "${PERL_SINGLE_SLOT}" ]]; then
+		oldv="${DIST_VERSION%-RC} ${PERL_BIN_OLDVERSEN}"
+	fi
+	for v;	do
+		for root in "${PRIV_BASE}" "${VENDOR_BASE}" "${SITE_BASE}"; do
+			local fullpath="${EROOT}${root}/${v}"
+			if [[ -e "${fullpath}" ]]; then
+				has "${v}" ${oldv} && printf "%s:" "${fullpath}/${myarch}${mythreading}";
+				printf "%s:" "${fullpath}"
+			fi
+		done
+	done
+}
+
+src_configure() {
+	declare -a myconf
+
+	export LC_ALL="C"
+	[[ ${COLUMNS:-1} -ge 1 ]] || unset COLUMNS # bug #394091
+
+	# Perl has problems compiling with -Os in your flags with glibc
+	use elibc_uclibc || replace-flags "-Os" "-O2"
+
+	# xlocale.h is going away in glibc-2.26, so it's counterproductive
+	# if we use it and include it in CORE/perl.h ... Perl builds just
+	# fine with glibc and locale.h only.
+	# However, the darwin prefix people have no locale.h ...
+	use elibc_glibc && myconf -Ui_xlocale
+
+	# This flag makes compiling crash in interesting ways
+	filter-flags "-malign-double"
+
+	# Generic LTO broken since 5.28, triggers EUMM failures
+	filter-flags "-flto"
+
+	use sparc && myconf -Ud_longdbl
+
+	export BUILD_BZIP2=0
+	export BZIP2_INCLUDE=${EROOT}/usr/include
+	export BZIP2_LIB=${EROOT}/usr/$(get_libdir)
+
+	export BUILD_ZLIB=False
+	export ZLIB_INCLUDE=${EROOT}/usr/include
+	export ZLIB_LIB=${EROOT}/usr/$(get_libdir)
+
+	# allow either gdbm to provide ndbm (in <gdbm/ndbm.h>) or db1
+	myndbm='U'
+	mygdbm='U'
+	mydb='U'
+	if use gdbm ; then
+		mygdbm='D'
+		if use berkdb ; then
+			myndbm='D'
+		fi
+	fi
+	if use berkdb ; then
+		mydb='D'
+		has_version '=sys-libs/db-1*' && myndbm='D'
+	fi
+
+	myconf "-${myndbm}i_ndbm" "-${mygdbm}i_gdbm" "-${mydb}i_db"
+
+	if use alpha && [[ "$(tc-getCC)" = "ccc" ]] ; then
+		ewarn "Perl will not be built with berkdb support, use gcc if you needed it..."
+		myconf -Ui_db -Ui_ndbm
+	fi
+
+	use ithreads && myconf -Dusethreads
+
+	if use debug ; then
+		append-cflags "-g"
+		myconf -DDEBUGGING
+	elif [[ ${CFLAGS} == *-g* ]] ; then
+		myconf -DDEBUGGING=-g
+	else
+		myconf -DDEBUGGING=none
+	fi
+
+	# modifying 'optimize' prevents cross configure script from appending required flags
+	if tc-is-cross-compiler; then
+		append-cflags "-fwrapv -fno-strict-aliasing"
+	fi
+
+	# Autodiscover all old version directories, some of them will even be newer
+	# if you downgrade
+	if [[ -z ${PERL_OLDVERSEN} ]]; then
+		PERL_OLDVERSEN="$( find_candidate_inc_versions )"
+	fi
+
+	# Fixup versions, removing self match, fixing order and dupes
+	PERL_OLDVERSEN="$( sanitize_inc_versions ${PERL_OLDVERSEN} )"
+
+	# Experts who want a "Pure" install can set PERL_OLDVERSEN to an empty string
+	if [[ -n "${PERL_OLDVERSEN// }" ]]; then
+		local inclist="$( versions_to_inclist ${PERL_OLDVERSEN} )"
+		einfo "This version of perl may partially support modules previously"
+		einfo "installed in any of the following paths:"
+		for incpath in ${inclist}; do
+			[[ -e "${EROOT}${VENDOR_BASE}/${incpath}" ]] && einfo " ${EROOT}${VENDOR_BASE}/${incpath}"
+			[[ -e "${EROOT}${PRIV_BASE}/${incpath}"   ]] && einfo " ${EROOT}${PRIV_BASE}/${incpath}"
+			[[ -e "${EROOT}${SITE_BASE}/${incpath}"   ]] && einfo " ${EROOT}${SITE_BASE}/${incpath}"
+		done
+		einfo "This is a temporary measure and you should aim to cleanup these paths"
+		einfo "via world updates and perl-cleaner"
+		# myconf -Dinc_version_list="${inclist}"
+		myconf -Dgentoolibdirs="$( versions_to_gentoolibdirs ${PERL_OLDVERSEN} )"
+	fi
+
+	[[ ${ELIBC} == "FreeBSD" ]] && myconf "-Dlibc=/usr/$(get_libdir)/libc.a"
+
+	# Make sure we can do the final link #523730, need to set deployment
+	# target to override hardcoded 10.3 which breaks on modern OSX
+	[[ ${CHOST} == *-darwin* ]] && \
+		myconf "-Dld=env MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} $(tc-getCC)"
+
+	# Older macOS with non-Apple GCC chokes on inline in system headers
+	# using c89 mode as injected by cflags.SH
+	[[ ${CHOST} == *-darwin* && ${CHOST##*darwin} -le 9 ]] && tc-is-gcc && \
+		append-cflags -Dinline=__inline__
+
+	# flock on 32-bit sparc Solaris is broken, fall back to fcntl
+	[[ ${CHOST} == sparc-*-solaris* ]] && \
+		myconf -Ud_flock
+
+	# Prefix: the host system needs not to follow Gentoo multilib stuff, and in
+	# Prefix itself we don't do multilib either, so make sure perl can find
+	# something compatible.
+	if use prefix ; then
+		# Set a hook to check for each detected library whether it actually works.
+		export libscheck="
+			( echo 'main(){}' > '${T}'/conftest.c &&
+				$(tc-getCC) -o '${T}'/conftest '${T}'/conftest.c -l\$thislib >/dev/null 2>/dev/null
+			) || xxx=/dev/null"
+
+		# Use all host paths that might contain useful stuff, the hook above will filter out bad choices.
+		local paths="/lib/*-linux-gnu /usr/lib/*-linux-gnu /lib64 /lib/64 /usr/lib64 /usr/lib/64 /lib32 /usr/lib32 /lib /usr/lib"
+		myconf "-Dlibpth=${EPREFIX}/$(get_libdir) ${EPREFIX}/usr/$(get_libdir) ${paths}"
+	elif [[ $(get_libdir) != "lib" ]] ; then
+		# We need to use " and not ', as the written config.sh use ' ...
+		myconf "-Dlibpth=/usr/local/$(get_libdir) /$(get_libdir) /usr/$(get_libdir)"
+	fi
+
+	# don't try building ODBM, bug #354453
+	disabled_extensions="ODBM_File"
+
+	if ! use gdbm ; then
+		# workaround for bug #157774: don't try building GDBM related stuff with USE="-gdbm"
+		disabled_extensions="${disabled_extensions} GDBM_File NDBM_File"
+	fi
+
+	myconf -Dnoextensions="${disabled_extensions}"
+
+	[[ "${PV##*.}" == "9999" ]] && myconf -Dusedevel -Uversiononly
+
+	[[ -n "${EXTRA_ECONF}" ]] && ewarn During Perl build, EXTRA_ECONF=${EXTRA_ECONF}
+	# allow fiddling via EXTRA_ECONF, bug 558070
+	eval "local -a EXTRA_ECONF=(${EXTRA_ECONF})"
+
+	# setting -Dld= to tc-getLD breaks perl and all perl things
+	# https://github.com/Perl/perl5/issues/17791#issuecomment-630145202
+	myconf \
+		-Duseshrplib \
+		-Darchname="${myarch}" \
+		-Dcc="$(tc-getCC)" \
+		-Dar="$(tc-getAR)" \
+		-Dnm="$(tc-getNM)" \
+		-Dcpp="$(tc-getCPP)" \
+		-Dranlib="$(tc-getRANLIB)" \
+		-Doptimize="${CFLAGS}" \
+		-Dldflags="${LDFLAGS}" \
+		-Dprefix="${EPREFIX}"'/usr' \
+		-Dsiteprefix="${EPREFIX}"'/usr/local' \
+		-Dvendorprefix="${EPREFIX}"'/usr' \
+		-Dscriptdir="${EPREFIX}"'/usr/bin' \
+		-Dprivlib="${EPREFIX}${PRIV_LIB}" \
+		-Darchlib="${EPREFIX}${ARCH_LIB}" \
+		-Dsitelib="${EPREFIX}${SITE_LIB}" \
+		-Dsitearch="${EPREFIX}${SITE_ARCH}" \
+		-Dvendorlib="${EPREFIX}${VENDOR_LIB}" \
+		-Dvendorarch="${EPREFIX}${VENDOR_ARCH}" \
+		-Dman1dir="${EPREFIX}"/usr/share/man/man1 \
+		-Dman3dir="${EPREFIX}"/usr/share/man/man3 \
+		-Dsiteman1dir="${EPREFIX}"/usr/local/man/man1 \
+		-Dsiteman3dir="${EPREFIX}"/usr/local/man/man3 \
+		-Dvendorman1dir="${EPREFIX}"/usr/share/man/man1 \
+		-Dvendorman3dir="${EPREFIX}"/usr/share/man/man3 \
+		-Dman1ext='1' \
+		-Dman3ext='3pm' \
+		-Dlibperl="${LIBPERL}" \
+		-Dlocincpth="${EPREFIX}"'/usr/include ' \
+		-Dglibpth="${EPREFIX}/$(get_libdir) ${EPREFIX}/usr/$(get_libdir)"' ' \
+		-Duselargefiles \
+		-Dd_semctl_semun \
+		-Dcf_by='Gentoo' \
+		-Dmyhostname='localhost' \
+		-Dperladmin='root@localhost' \
+		-Ud_csh \
+		-Dsh="${EPREFIX}"/bin/sh \
+		-Dtargetsh="${EPREFIX}"/bin/sh \
+		-Uusenm \
+		"${myconf[@]}" \
+		"${EXTRA_ECONF[@]}"
+
+	if tc-is-cross-compiler; then
+		./configure \
+			--target="${CHOST}" \
+			--build="${CBUILD}" \
+			-Dinstallprefix='' \
+			-Dinstallusrbinperl='undef' \
+			-Dusevendorprefix='define' \
+			"${myconf[@]}" \
+			|| die "Unable to configure"
+	else
+		sh Configure \
+			-des \
+			-Dinstallprefix="${EPREFIX}"'/usr' \
+			-Dinstallusrbinperl='n' \
+			"${myconf[@]}" \
+			|| die "Unable to configure"
+	fi
+}
+
+src_test() {
+	export NO_GENTOO_NETWORK_TESTS=1;
+	export GENTOO_ASSUME_SANDBOXED="${GENTOO_ASSUME_SANDBOXED:-1}"
+	export GENTOO_NO_PORTING_TESTS="${GENTOO_NO_PORTING_TESTS:-1}"
+	if [[ ${EUID} == 0 ]] ; then
+		ewarn "Test fails with a sandbox error (#328793) if run as root. Skipping tests..."
+		return 0
+	fi
+	use elibc_uclibc && export MAKEOPTS+=" -j1"
+	TEST_JOBS="$(makeopts_jobs)" make test_harness || die "test failed"
+}
+
+src_install() {
+	local i
+	local coredir="${ARCH_LIB}/CORE"
+
+	emake DESTDIR="${D}" install
+
+	rm -f "${ED}/usr/bin/perl${MY_PV}"
+	ln -s perl "${ED}"/usr/bin/perl${MY_PV} || die
+
+	if ! tc-is-static-only ; then
+		dolib.so "${ED}"${coredir}/${LIBPERL}
+		rm -f "${ED}"${coredir}/${LIBPERL}
+		ln -sf ${LIBPERL} "${ED}"/usr/$(get_libdir)/libperl$(get_libname ${SHORT_PV}) || die
+		ln -sf ${LIBPERL} "${ED}"/usr/$(get_libdir)/libperl$(get_libname) || die
+
+		ln -sf ../../../../${LIBPERL} "${ED}"${coredir}/${LIBPERL} || die
+		ln -sf ../../../../${LIBPERL} "${ED}"${coredir}/libperl$(get_libname ${SHORT_PV}) || die
+		ln -sf ../../../../${LIBPERL} "${ED}"${coredir}/libperl$(get_libname) || die
+	fi
+
+	rm -rf "${ED}"/usr/share/man/man3 || die "Unable to remove module man pages"
+
+	# This removes ${D} from Config.pm
+	for i in $(find "${D}" -iname "Config.pm" ) ; do
+		einfo "Removing ${D} from ${i}..."
+		sed -i -e "s:${D}::" "${i}" || die "Sed failed"
+	done
+
+	dodoc Changes* README AUTHORS
+
+	if use doc ; then
+		# HTML Documentation
+		# We expect errors, warnings, and such with the following.
+
+		dodir /usr/share/doc/${PF}/html
+		LD_LIBRARY_PATH=. ./perl installhtml \
+			--podroot='.' \
+			--podpath='lib:ext:pod:vms' \
+			--recurse \
+			--htmldir="${ED}/usr/share/doc/${PF}/html"
+	fi
+
+	[[ -d ${ED}/usr/local ]] && rm -r "${ED}"/usr/local
+
+	dual_scripts
+}
+
+pkg_preinst() {
+	check_rebuild
+}
+
+pkg_postinst() {
+	dual_scripts
+
+	if [[ "${ROOT}" = "/" ]] ; then
+		local INC DIR file
+		INC=$(perl -e 'for $line (@INC) { next if $line eq "."; next if $line =~ m/'${SHORT_PV}'|etc|local|perl$/; print "$line\n" }')
+		einfo "Removing old .ph files"
+		for DIR in ${INC} ; do
+			if [[ -d "${DIR}" ]] ; then
+				for file in $(find "${DIR}" -name "*.ph" -type f ) ; do
+					rm -f "${file}"
+					einfo "<< ${file}"
+				done
+			fi
+		done
+		# Silently remove the now empty dirs
+		for DIR in ${INC} ; do
+			if [[ -d "${DIR}" ]] ; then
+				find "${DIR}" -depth -type d -print0 | xargs -0 -r rmdir &> /dev/null
+			fi
+		done
+
+	fi
+}
+
+pkg_postrm() {
+	dual_scripts
+}


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-lang/perl/files/, dev-lang/perl/
@ 2023-01-19  2:27 Sam James
  0 siblings, 0 replies; 12+ messages in thread
From: Sam James @ 2023-01-19  2:27 UTC (permalink / raw
  To: gentoo-commits

commit:     32a4f6e001d9118b5ea5a1c6b53900d2ce02eab6
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 19 02:26:24 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jan 19 02:26:24 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=32a4f6e0

dev-lang/perl: fix configure+build w/ clang 16

Closes: https://bugs.gentoo.org/879857
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-lang/perl/files/perl-5.36.0-clang16.patch | 129 ++++
 dev-lang/perl/perl-5.36.0-r2.ebuild           | 825 ++++++++++++++++++++++++++
 2 files changed, 954 insertions(+)

diff --git a/dev-lang/perl/files/perl-5.36.0-clang16.patch b/dev-lang/perl/files/perl-5.36.0-clang16.patch
new file mode 100644
index 000000000000..dc7305a3acf1
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.36.0-clang16.patch
@@ -0,0 +1,129 @@
+https://bugs.gentoo.org/879857
+https://github.com/Perl/perl5/commit/e1ca9a418fa6b7d26fbb1931c9164141035262c3
+https://github.com/Perl/perl5/commit/fc35cee89c1a42558f50a37a6b4d5186b77f058b
+
+From e1ca9a418fa6b7d26fbb1931c9164141035262c3 Mon Sep 17 00:00:00 2001
+From: Peter Levine <plevine457@gmail.com>
+Date: Tue, 17 Jan 2023 02:47:12 -0500
+Subject: [PATCH] Add parameter types to declarations for clang-16
+
+ANSI C style function declarations without parameter types are errors with clang-16.
+--- a/Configure
++++ b/Configure
+@@ -7927,10 +7927,10 @@ $cat >malloc.c <<END
+ #include <stdlib.h>
+ #endif
+ #ifdef TRY_MALLOC
+-void *malloc();
++void *malloc(size_t);
+ #endif
+ #ifdef TRY_FREE
+-void free();
++void free(void *);
+ #endif
+ END
+ case "$malloctype" in
+
+From fc35cee89c1a42558f50a37a6b4d5186b77f058b Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer@redhat.com>
+Date: Tue, 17 Jan 2023 19:07:54 +0100
+Subject: [PATCH] Configure: Add various C99 compatibility improvements
+
+Two C99 compatibility issues are fixed by these changes: Return
+types are made explicit where they previously defaulted to int,
+and all called functions are now declared explicitly (either by
+including additional headers, or by adding prototypes manually).
+
+This avoids implict ints and implicit function declarations,
+both legacy C language features removed in the 1999 revision
+of the language.
+
+Verified with an instrumented GCC compiler on GNU/Linux.
+--- a/Configure
++++ b/Configure
+@@ -4655,7 +4655,7 @@ esac
+ # so we will take those off from locincpth.
+ case "$gccversion" in
+ 3.*)
+-    echo "main(){}">try.c
++    echo "int main(){}">try.c
+     for incdir in $locincpth; do
+        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
+ 	     grep '^c[cp]p*[01]: warning: changing search order '`
+@@ -5798,6 +5798,7 @@ case "$intsize" in
+ #ifdef I_STDLIB
+ #include <stdlib.h>
+ #endif
++#include <stdio.h>
+ int main()
+ {
+ 	printf("intsize=%d;\n", (int)sizeof(int));
+@@ -6871,6 +6872,7 @@ case "$doublesize" in
+ #ifdef I_STDLIB
+ #include <stdlib.h>
+ #endif
++#include <stdio.h>
+ int main()
+ {
+     printf("%d\n", (int)sizeof(double));
+@@ -12660,7 +12662,7 @@ case "$dlsrc" in
+ dl_dlopen.xs)
+ 	echo "Checking whether your dlsym() needs a leading underscore ..." >&4
+ 	$cat >dyna.c <<'EOM'
+-fred () { }
++void fred (void) { }
+ EOM
+ 
+ $cat >fred.c<<EOM
+@@ -12679,7 +12681,7 @@ $cat >fred.c<<EOM
+ #include <link.h>
+ #endif
+ 
+-extern int fred() ;
++extern void fred(void) ;
+ 
+ int main()
+ {
+@@ -13713,6 +13715,7 @@ $cat >try.c <<EOP
+ #ifdef I_STDLIB
+ #include <stdlib.h>
+ #endif
++#include <string.h>
+ #define FILE_ptr(fp)	$stdio_ptr
+ #define FILE_cnt(fp)	$stdio_cnt
+ int main() {
+@@ -16220,6 +16223,7 @@ echo "Checking to see if your libm supports _LIB_VERSION..." >&4
+ $cat >try.c <<EOCP
+ #include <unistd.h>
+ #include <math.h>
++#include <stdio.h>
+ int main (int argc, char *argv[])
+ {
+     printf ("%d\n", _LIB_VERSION);
+@@ -22168,13 +22172,15 @@ pager="$ans"
+ : see if ar generates random libraries by itself
+ echo " "
+ echo "Checking how to generate random libraries on your machine..." >&4
+-echo 'int bar1() { return bar2(); }' > bar1.c
++echo 'extern int bar2(); int bar1() { return bar2(); }' > bar1.c
+ echo 'int bar2() { return 2; }' > bar2.c
+ $cat > foo.c <<EOP
+ #$i_stdlib I_STDLIB
+ #ifdef I_STDLIB
+ #include <stdlib.h>
+ #endif
++#include <stdio.h>
++extern int bar1();
+ int main() { printf("%d\n", bar1()); exit(0); }
+ EOP
+ $cc $ccflags -c bar1.c >/dev/null 2>&1
+@@ -22400,7 +22406,7 @@ EOM
+ 			for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
+ 				for tmo in 'struct timeval *' 'const struct timeval *'; do
+ 					case "$val" in
+-					'')	try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
++					'')	try="$extern_C int select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
+ 						if ./protochk "$try" $hdrs; then
+ 							echo "Your system accepts $xxx."
+ 							val="$xxx"
+

diff --git a/dev-lang/perl/perl-5.36.0-r2.ebuild b/dev-lang/perl/perl-5.36.0-r2.ebuild
new file mode 100644
index 000000000000..a6ed13d97de4
--- /dev/null
+++ b/dev-lang/perl/perl-5.36.0-r2.ebuild
@@ -0,0 +1,825 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit alternatives flag-o-matic toolchain-funcs multilib multiprocessing
+
+PATCH_VER=1
+CROSS_VER=1.4
+PATCH_BASE="perl-5.36.0-patches-${PATCH_VER}"
+PATCH_DEV=dilfridge
+
+DIST_AUTHOR=RJBS
+
+# Greatest first, don't include yourself
+# Devel point-releases are not ABI-intercompatible, but stable point releases are
+# BIN_OLDVERSEN contains only C-ABI-intercompatible versions
+PERL_BIN_OLDVERSEN=""
+
+if [[ "${PV##*.}" == "9999" ]]; then
+	DIST_VERSION=5.30.0
+else
+	DIST_VERSION="${PV/_rc/-RC}"
+fi
+SHORT_PV="${DIST_VERSION%.*}"
+
+# Even numbered major versions are ABI intercompatible
+# Odd numbered major versions are not
+if [[ $(( ${SHORT_PV#*.} % 2 )) == 1 ]]; then
+	SUBSLOT="${DIST_VERSION%-RC*}"
+else
+	SUBSLOT="${DIST_VERSION%.*}"
+fi
+
+# Used only in tar paths
+MY_P="perl-${DIST_VERSION}"
+# Used in library paths
+MY_PV="${DIST_VERSION%-RC*}"
+
+DESCRIPTION="Larry Wall's Practical Extraction and Report Language"
+
+SRC_URI="
+	mirror://cpan/src/5.0/${MY_P}.tar.xz
+	mirror://cpan/authors/id/${DIST_AUTHOR:0:1}/${DIST_AUTHOR:0:2}/${DIST_AUTHOR}/${MY_P}.tar.xz
+	https://github.com/gentoo-perl/perl-patchset/releases/download/${PATCH_BASE}/${PATCH_BASE}.tar.xz
+	https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${PATCH_BASE}.tar.xz
+	https://github.com/arsv/perl-cross/releases/download/${CROSS_VER}/perl-cross-${CROSS_VER}.tar.gz
+"
+
+HOMEPAGE="https://www.perl.org/"
+
+LICENSE="|| ( Artistic GPL-1+ )"
+SLOT="0/${SUBSLOT}"
+
+if [[ "${PV##*.}" != "9999" ]] && [[ "${PV/rc//}" == "${PV}" ]] ; then
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+
+IUSE="berkdb debug doc gdbm ithreads minimal quadmath"
+
+RDEPEND="
+	berkdb? ( sys-libs/db:= )
+	gdbm? ( >=sys-libs/gdbm-1.8.3:= )
+	app-arch/bzip2
+	>=sys-libs/zlib-1.2.12
+	virtual/libcrypt:=
+"
+DEPEND="${RDEPEND}"
+BDEPEND="${RDEPEND}"
+
+PDEPEND="
+	!minimal? (
+		>=app-admin/perl-cleaner-2.5
+		>=virtual/perl-CPAN-2.290.0
+		>=virtual/perl-Encode-3.120.0
+		>=virtual/perl-File-Temp-0.230.400-r2
+		>=virtual/perl-Data-Dumper-2.154.0
+		virtual/perl-Test-Harness
+	)
+"
+# bug 390719, bug 523624
+# virtual/perl-Test-Harness is here for the bundled ExtUtils::MakeMaker
+
+S="${WORKDIR}/${MY_P}"
+
+dual_scripts() {
+	src_remove_dual      perl-core/Archive-Tar        2.400.0       ptar ptardiff ptargrep
+	src_remove_dual      perl-core/CPAN               2.330.0       cpan
+	src_remove_dual      perl-core/Digest-SHA         6.20.0        shasum
+	src_remove_dual      perl-core/Encode             3.170.0       enc2xs piconv
+	src_remove_dual      perl-core/ExtUtils-MakeMaker 7.640.0       instmodsh
+	src_remove_dual      perl-core/ExtUtils-ParseXS   3.450.0       xsubpp
+	src_remove_dual      perl-core/IO-Compress        2.106.0       zipdetails
+	src_remove_dual      perl-core/JSON-PP            4.70.0        json_pp
+	src_remove_dual      perl-core/Module-CoreList    5.202.205.200 corelist
+	src_remove_dual      perl-core/Pod-Checker        1.740.0       podchecker
+	src_remove_dual      perl-core/Pod-Perldoc        3.280.100     perldoc
+	src_remove_dual      perl-core/Pod-Usage          2.10.0       pod2usage
+	src_remove_dual      perl-core/Test-Harness       3.440.0       prove
+	src_remove_dual      perl-core/podlators          4.140.0       pod2man pod2text
+	src_remove_dual_man  perl-core/podlators          4.140.0       /usr/share/man/man1/perlpodstyle.1
+}
+
+check_rebuild() {
+	# Fresh install
+	if [[ -z "${REPLACING_VERSIONS}" ]]; then
+		return 0;
+	# Major Upgrade
+	# doesn't matter if there's multiple copies, it still needs a rebuild
+	# if the string is anything other than "5.CURRENTMAJOR"
+	elif [[ "${REPLACING_VERSIONS%.*}" != "${PV%.*}" ]]; then
+		echo ""
+		ewarn "UPDATE THE PERL MODULES:"
+		ewarn "After updating dev-lang/perl the installed Perl modules"
+		ewarn "have to be re-installed. In most cases, this is done automatically"
+		ewarn "by the package manager, but subsequent steps are still recommended"
+		ewarn "to ensure system consistency."
+		ewarn
+		ewarn "You should start with a depclean to remove any unused perl dependencies"
+		ewarn "that may confuse portage in future. Regular depcleans are also encouraged"
+		ewarn "as part of your regular update cycle, as that will keep perl upgrades working."
+		ewarn "Recommended: emerge --depclean -va"
+		ewarn
+		ewarn "You should then call perl-cleaner to clean up any old files and trigger any"
+		ewarn "remaining rebuilds portage may have missed."
+		ewarn "Use: perl-cleaner --all"
+		return 0;
+
+	# Reinstall w/ USE Change
+	elif
+		 (   use ithreads && ! has_version dev-lang/perl[ithreads] ) || \
+		 ( ! use ithreads &&   has_version dev-lang/perl[ithreads] ) || \
+		 (   use quadmath && ! has_version dev-lang/perl[quadmath] ) || \
+		 ( ! use quadmath &&   has_version dev-lang/perl[quadmath] ) || \
+		 (   use debug    && ! has_version dev-lang/perl[debug]    ) || \
+		 ( ! use debug    &&   has_version dev-lang/perl[debug]    ) ; then
+		echo ""
+		ewarn "TOGGLED USE-FLAGS WARNING:"
+		ewarn "You changed one of the use-flags ithreads, quadmath, or debug."
+		ewarn "You must rebuild all perl-modules installed."
+		ewarn "Use: perl-cleaner --modules ; perl-cleaner --force --libperl"
+	fi
+}
+
+pkg_setup() {
+	case ${CHOST} in
+		*-freebsd*)   osname="freebsd" ;;
+		*-dragonfly*) osname="dragonfly" ;;
+		*-netbsd*)    osname="netbsd" ;;
+		*-openbsd*)   osname="openbsd" ;;
+		*-darwin*)    osname="darwin" ;;
+		*-solaris*)   osname="solaris" ;;
+		*-cygwin*)    osname="cygwin" ;;
+		*)            osname="linux" ;;
+	esac
+
+	myarch="${CHOST%%-*}-${osname}"
+	if use debug ; then
+		myarch+="-debug"
+	fi
+	if use quadmath ; then
+		myarch+="-quadmath"
+	fi
+	if use ithreads ; then
+		mythreading="-multi"
+		myarch+="-thread"
+	fi
+
+	PRIV_BASE="/usr/$(get_libdir)/perl5"
+	SITE_BASE="/usr/local/$(get_libdir)/perl5"
+	VENDOR_BASE="/usr/$(get_libdir)/perl5/vendor_perl"
+
+	LIBPERL="libperl$(get_libname ${MY_PV} )"
+
+	PRIV_LIB="${PRIV_BASE}/${SUBSLOT}"
+	ARCH_LIB="${PRIV_BASE}/${SUBSLOT}/${myarch}${mythreading}"
+	SITE_LIB="${SITE_BASE}/${SUBSLOT}"
+	SITE_ARCH="${SITE_BASE}/${SUBSLOT}/${myarch}${mythreading}"
+	VENDOR_LIB="${VENDOR_BASE}/${SUBSLOT}"
+	VENDOR_ARCH="${VENDOR_BASE}/${SUBSLOT}/${myarch}${mythreading}"
+
+	dual_scripts
+}
+
+src_remove_dual_file() {
+	local i pkg ver
+	pkg="$1"
+	ver="$2"
+	shift 2
+	case "${EBUILD_PHASE:-none}" in
+		postinst|postrm)
+			for i in "$@" ; do
+				alternatives_auto_makesym "${i}" "${i}-[0-9]*"
+			done
+			;;
+		setup)
+			for i in "$@" ; do
+				if [[ -f ${EROOT}${i} && ! -h ${EROOT}${i} ]] ; then
+					has_version ${pkg} && ewarn "You must reinstall ${pkg} !"
+					break
+				fi
+			done
+			;;
+		install)
+			for i in "$@" ; do
+				if ! [[ -f "${ED}"${i} ]] ; then
+					ewarn "${i} does not exist!"
+					continue
+				fi
+				mv "${ED}"${i}{,-${ver}-${P}} || die
+			done
+			;;
+	esac
+}
+
+src_remove_dual_man() {
+	local i pkg ver ff
+	pkg="$1"
+	ver="$2"
+	shift 2
+	case "${EBUILD_PHASE:-none}" in
+		postinst|postrm)
+			for i in "$@" ; do
+				ff=`echo "${EROOT}${i%.[0-9]}-${ver}-${P}${i#${i%.[0-9]}}"*`
+				ff=${ff##*${i#${i%.[0-9]}}}
+				alternatives_auto_makesym "${i}${ff}" "${i%.[0-9]}-[0-9]*"
+			done
+			;;
+		install)
+			for i in "$@" ; do
+				if ! [[ -f "${ED}"${i} ]] ; then
+					ewarn "${i} does not exist!"
+					continue
+				fi
+				mv "${ED}"${i} "${ED}"${i%.[0-9]}-${ver}-${P}${i#${i%.[0-9]}} || die
+			done
+			;;
+	esac
+}
+
+src_remove_dual() {
+	local i pkg ver
+	pkg="$1"
+	ver="$2"
+	shift 2
+	for i in "$@" ; do
+		src_remove_dual_file  "${pkg}" "${ver}" "/usr/bin/${i}"
+		src_remove_dual_man   "${pkg}" "${ver}" "/usr/share/man/man1/${i}.1"
+	done
+}
+
+src_prepare_perlcross() {
+	cp -a ../perl-cross-${CROSS_VER}/* . || die
+
+	# bug 794463, needs further analysis what is exactly wrong here
+	eapply "${FILESDIR}/perl-5.34.0-crossfit.patch"
+
+	# bug 604072
+	MAKEOPTS+=" -j1"
+	export MAKEOPTS
+}
+
+src_prepare_dynamic() {
+	ln -s ${LIBPERL} libperl$(get_libname ${SHORT_PV}) || die
+	ln -s ${LIBPERL} libperl$(get_libname ) || die
+}
+
+# Copy a patch into the patch series
+# add_patch SRC_PATH DEST_NAME ['description'] ['bug'] ['bug']
+# - description is optional, but recommended
+# - all arguments after descriptions are bug URLs
+add_patch() {
+	local patchdir="${WORKDIR}/patches"
+	local infodir="${WORKDIR}/patch-info"
+	local src_name dest_name desc
+	src_name="$1"
+	dest_name="$2"
+	desc="$3"
+	shift; shift; shift;
+	einfo "Adding ${dest_name} to patch bundle"
+	cp "${src_name}" "${patchdir}/${dest_name}" || die "Couldn't copy ${src_name} to ${dest_name}"
+	if [[ -n "${desc}" ]]; then
+		printf "%s" "${desc}" > "${infodir}/${dest_name}.desc" || die "Couldn't write ${dest_name}.desc"
+	fi
+	if [[ $# -gt 0 ]]; then
+		# Note: when $@ is more than one element, this emits a
+		# line for each element
+		printf "%s\n" "$@" > "${infodir}/${dest_name}.bugs" || die "Couldn't write ${dest_name}.bugs"
+	fi
+}
+
+# Remove a patch using a glob expr
+# eg:
+#	 rm_patch *-darwin-Use-CC*
+#
+rm_patch() {
+	local patchdir="${WORKDIR}/patches"
+	local expr="$1"
+	local patch="$( cd "${patchdir}"; echo $expr )"
+	einfo "Removing $patch ($expr) from patch bundle"
+	if [[ -e "${patchdir}/${patch}" ]]; then
+		rm -f "${patchdir}/${patch}" || die "Can't remove ${patch} ( $expr )"
+	else
+		ewarn "No ${expr} found in ${patchdir} to remove"
+	fi
+}
+
+# Yes, this is a reasonable amount of code for something seemingly simple
+# but this is far easier to debug when things go wrong, and things went wrong
+# multiple times while I was getting the exact number of slashes right, which
+# requires circumnavigating both bash and sed escape mechanisms.
+c_escape_string() {
+	local slash dquote
+	slash='\'
+	dquote='"'
+	re_slash="${slash}${slash}"
+	re_dquote="${slash}${dquote}"
+
+	# Convert \ to \\,
+	#         " to \"
+	echo "$1" |\
+		sed "s|${re_slash}|${re_slash}${re_slash}|g" |\
+		sed "s|${re_dquote}|${re_slash}${re_dquote}|g"
+}
+c_escape_file() {
+	c_escape_string "$(cat "$1")"
+}
+
+apply_patchdir() {
+	local patchdir="${WORKDIR}/patches"
+	local infodir="${WORKDIR}/patch-info"
+	local patchoutput="patchlevel-gentoo.h"
+
+	# Inject Patch-Level info into description for patchlevel.h patch
+	# to show in -V
+	local patch_expr="*List-packaged-patches*"
+	local patch="$( cd "${patchdir}"; echo $patch_expr )";
+	einfo "Injecting patch-level info into ${patch}.desc ( $patch_expr )"
+
+	if [[ -e "${patchdir}/${patch}" ]]; then
+		printf "List packaged patches for %s(%s) in patchlevel.h" "${PF}" "${PATCH_BASE}"\
+			>"${infodir}/${patch}.desc" || die "Can't rewrite ${patch}.desc"
+	else
+		eerror "No $patch_expr found in ${patchdir}"
+	fi
+
+	# Compute patch list to apply
+	# different name other than PATCHES to stop default
+	# reapplying it
+	# Single depth is currently only supported, as artifacts can reside
+	# from the old layout being multiple-directories, as well as it grossly
+	# simplifying the patchlevel_gentoo.h generation.
+	local PERL_PATCHES=($(
+		find "${patchdir}" -maxdepth 1 -mindepth 1 -type f -printf "%f\n" |\
+			grep -E '[.](diff|patch)$' |\
+			sort -n
+	))
+
+	for patch in "${PERL_PATCHES[@]}"; do
+		eapply "${WORKDIR}"/patches/${patch}
+	done
+
+	einfo "Generating $patchoutput"
+
+	# This code creates a header file, each iteration
+	# creates one-or-more-lines for each entry found in PERL_PATCHES
+	# and STDOUT is redirected to the .h file
+	for patch in "${PERL_PATCHES[@]}"; do
+		local desc_f="${infodir}/${patch}.desc"
+		local bugs_f="${infodir}/${patch}.bugs"
+
+		printf ',"%s"\n' "${patch}"
+		if [[ ! -e "${desc_f}" ]]; then
+			ewarn "No description provided for ${patch} (expected: ${desc_f} )"
+		else
+			local desc="$(c_escape_file "${desc_f}")"
+			printf ',"- %s"\n' "${desc}"
+		fi
+		if [[ -e "${bugs_f}" ]]; then
+			while read -d $'\n' -r line; do
+				local esc_line="$(c_escape_string "${line}")"
+				printf ',"- Bug: %s"\n' "${esc_line}"
+			done <"${bugs_f}"
+		fi
+	done > "${S}/${patchoutput}"
+	printf "%s\n" "${patchoutput}" >> "${S}/MANIFEST"
+
+}
+
+src_prepare() {
+	local patchdir="${WORKDIR}/patches"
+
+	# Prepare Patch dir with additional patches / remove unwanted patches
+	# Inject bug/desc entries for perl -V
+	# Old example:
+	# add_patch "${FILESDIR}/${PN}-5.26.2-hppa.patch" "100-5.26.2-hppa.patch"\
+	#		"Fix broken miniperl on hppa"\
+	#		"https://bugs.debian.org/869122" "https://bugs.gentoo.org/634162"
+	add_patch "${FILESDIR}/${PN}-5.36.0-clang16.patch" "100-5.36.0-clang16.patch" \
+			"Fix Clang 16 / modern C issues in configure" \
+			"https://bugs.gentoo.org/879857" "https://github.com/Perl/perl5/issues/20715"
+
+	if [[ ${CHOST} == *-solaris* ]] ; then
+		# do NOT mess with nsl, on Solaris this is always necessary,
+		# when -lsocket is used e.g. to get h_errno
+		rm_patch "*-nsl-and-cl*"
+	fi
+
+	apply_patchdir
+
+	tc-is-cross-compiler && src_prepare_perlcross
+
+	tc-is-static-only || src_prepare_dynamic
+
+	if use gdbm; then
+		sed -i "s:INC => .*:INC => \"-I${EROOT}/usr/include/gdbm\":g" \
+			ext/NDBM_File/Makefile.PL || die
+	fi
+
+	# Use errno.h from prefix rather than from host system, bug #645804
+	if use prefix && [[ -e "${EPREFIX}"/usr/include/errno.h ]] ; then
+		sed -i "/my..sysroot/s:'':'${EPREFIX}':" ext/Errno/Errno_pm.PL || die
+	fi
+
+	if [[ ${CHOST} == *-solaris* ]] ; then
+		# set a soname, fix linking against just built libperl
+		sed -i -e 's/netbsd\*/netbsd*|solaris*/' Makefile.SH || die
+	fi
+
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		# fix install_name (soname) not to reference $D
+		sed -i -e '/install_name `pwd/s/`pwd`/\\$(shrpdir)/' Makefile.SH || die
+
+		# fix environ linkage absence (only a real issue on Darwin9)
+		if [[ ${CHOST##*-darwin} -le 9 ]] ; then
+			sed -i -e '/^PLDLFLAGS =/s/=/= -include crt_externs.h -Denviron="(*_NSGetEnviron())"/' \
+				Makefile.SH || die
+		fi
+	fi
+
+	default
+}
+
+myconf() {
+	# the myconf array is declared in src_configure
+	myconf=( "${myconf[@]}" "$@" )
+}
+
+# Outputs a list of versions which have been seen in any of the
+# primary perl @INC prefix paths, such as:
+#  /usr/lib64/perl5/<NUMBER>
+#  /usr/local/lib64/perl5/<NUMBER>
+#  /usr/lib64/perl5/vendor_perl/<NUMBER>
+#
+# All values of NUMBER must be like "5.x.y" or like "5.x"
+#
+find_candidate_inc_versions() {
+	local regex='.*/5[.][0-9]+\([.][0-9]+\|\)$'
+	local dirs=(
+		"${EROOT}${PRIV_BASE}"
+		"${EROOT}${SITE_BASE}"
+		"${EROOT}${VENDOR_BASE}"
+	)
+	for dir in "${dirs[@]}"; do
+		if [[ ! -e "${dir}" ]]; then
+			continue
+		fi
+		# Without access to readdir() on these dirs, find will not be able
+		# to reveal any @INC directories inside them, and will subsequently prune
+		# them from the built perl's @INC support, breaking our compatiblity options
+		# entirely.
+		if [[ ! -r "${dir}" || ! -x "${dir}" ]]; then
+			eerror "Bad permissions on ${dir}, this will probably break things"
+			eerror "Ensure ${dir} is +rx for at least uid=$EUID"
+			eerror "Recommended permission is +rx for all"
+			eerror "> chmod o+rx ${dir}"
+		fi
+	done
+	einfo "Scanning for old @INC dirs matching '$regex' in: ${dirs[*]}"
+	find "${dirs[@]}" -maxdepth 1 -mindepth 1 -type d -regex "${regex}" -printf "%f "  2>/dev/null
+}
+
+# Sort versions passed versiony-ly, remove self-version if present
+# dedup. Takes each version as an argument
+sanitize_inc_versions() {
+	local vexclude="${SUBSLOT}"
+	einfo "Normalizing/Sorting candidate list: $*"
+	einfo " to remove '${vexclude}'"
+	# Note, general numeric sort has to be used
+	# for the last component, or unique will convert
+	#  5.30.0 + 5.30 into just 5.30
+	printf "%s\n" "$@" |\
+		grep -vxF "${vexclude}" |\
+		sort -u -nr -t'.' -k1,1rn -k2,2rn -k3,3rg
+}
+
+versions_to_inclist() {
+	local oldv="${DIST_VERSION%-RC} ${PERL_BIN_OLDVERSEN}"
+
+	for v;	do
+			has "${v}" ${oldv} && echo -n "${v}/${myarch}${mythreading}/ ";
+			echo -n "${v}/ ";
+	done
+}
+
+versions_to_gentoolibdirs() {
+	local oldv="${DIST_VERSION%-RC} ${PERL_BIN_OLDVERSEN}"
+	local root
+	local v
+	for v;	do
+		for root in "${PRIV_BASE}" "${VENDOR_BASE}" "${SITE_BASE}"; do
+			local fullpath="${EROOT}${root}/${v}"
+			if [[ -e "${fullpath}" ]]; then
+				has "${v}" ${oldv} && printf "%s:" "${fullpath}/${myarch}${mythreading}";
+				printf "%s:" "${fullpath}"
+			fi
+		done
+	done
+}
+
+src_configure() {
+	declare -a myconf
+
+	export LC_ALL="C"
+	[[ ${COLUMNS:-1} -ge 1 ]] || unset COLUMNS # bug #394091
+
+	# Perl has problems compiling with -Os in your flags with glibc
+	replace-flags "-Os" "-O2"
+
+	# xlocale.h is going away in glibc-2.26, so it's counterproductive
+	# if we use it and include it in CORE/perl.h ... Perl builds just
+	# fine with glibc and locale.h only.
+	# However, the darwin prefix people have no locale.h ...
+	use elibc_glibc && myconf -Ui_xlocale
+
+	# This flag makes compiling crash in interesting ways
+	filter-flags "-malign-double"
+
+	# Generic LTO broken since 5.28, triggers EUMM failures
+	filter-flags "-flto"
+
+	use sparc && myconf -Ud_longdbl
+
+	export BUILD_BZIP2=0
+	export BZIP2_INCLUDE=${EROOT}/usr/include
+	export BZIP2_LIB=${EROOT}/usr/$(get_libdir)
+
+	export BUILD_ZLIB=False
+	export ZLIB_INCLUDE=${EROOT}/usr/include
+	export ZLIB_LIB=${EROOT}/usr/$(get_libdir)
+
+	# allow either gdbm to provide ndbm (in <gdbm/ndbm.h>) or db1
+	myndbm='U'
+	mygdbm='U'
+	mydb='U'
+	if use gdbm ; then
+		mygdbm='D'
+		if use berkdb ; then
+			myndbm='D'
+		fi
+	fi
+	if use berkdb ; then
+		mydb='D'
+		has_version '=sys-libs/db-1*' && myndbm='D'
+	fi
+
+	myconf "-${myndbm}i_ndbm" "-${mygdbm}i_gdbm" "-${mydb}i_db"
+
+	if use alpha && [[ "$(tc-getCC)" = "ccc" ]] ; then
+		ewarn "Perl will not be built with berkdb support, use gcc if you needed it..."
+		myconf -Ui_db -Ui_ndbm
+	fi
+
+	use ithreads && myconf -Dusethreads
+
+	use quadmath && myconf -Dusequadmath
+
+	if use debug ; then
+		append-cflags "-g"
+		myconf -DDEBUGGING
+	elif [[ ${CFLAGS} == *-g* ]] ; then
+		myconf -DDEBUGGING=-g
+	else
+		myconf -DDEBUGGING=none
+	fi
+
+	# modifying 'optimize' prevents cross configure script from appending required flags
+	if tc-is-cross-compiler; then
+		append-cflags "-fwrapv"
+	fi
+
+	# bug #877659, bug #821577
+	append-cflags -fno-strict-aliasing
+
+	# Autodiscover all old version directories, some of them will even be newer
+	# if you downgrade
+	if [[ -z ${PERL_OLDVERSEN} ]]; then
+		PERL_OLDVERSEN="$( find_candidate_inc_versions )"
+	fi
+
+	# Fixup versions, removing self match, fixing order and dupes
+	PERL_OLDVERSEN="$( sanitize_inc_versions ${PERL_OLDVERSEN} )"
+
+	# Experts who want a "Pure" install can set PERL_OLDVERSEN to an empty string
+	if [[ -n "${PERL_OLDVERSEN// }" ]]; then
+		local inclist="$( versions_to_inclist ${PERL_OLDVERSEN} )"
+		einfo "This version of perl may partially support modules previously"
+		einfo "installed in any of the following paths:"
+		for incpath in ${inclist}; do
+			[[ -e "${EROOT}${VENDOR_BASE}/${incpath}" ]] && einfo " ${EROOT}${VENDOR_BASE}/${incpath}"
+			[[ -e "${EROOT}${PRIV_BASE}/${incpath}"   ]] && einfo " ${EROOT}${PRIV_BASE}/${incpath}"
+			[[ -e "${EROOT}${SITE_BASE}/${incpath}"   ]] && einfo " ${EROOT}${SITE_BASE}/${incpath}"
+		done
+		einfo "This is a temporary measure and you should aim to cleanup these paths"
+		einfo "via world updates and perl-cleaner"
+		# myconf -Dinc_version_list="${inclist}"
+		myconf -Dgentoolibdirs="$( versions_to_gentoolibdirs ${PERL_OLDVERSEN} )"
+	fi
+
+	[[ ${ELIBC} == "FreeBSD" ]] && myconf "-Dlibc=/usr/$(get_libdir)/libc.a"
+
+	# Make sure we can do the final link #523730, need to set deployment
+	# target to override hardcoded 10.3 which breaks on modern OSX
+	[[ ${CHOST} == *-darwin* ]] && \
+		myconf "-Dld=env MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} $(tc-getCC)"
+
+	# Older macOS with non-Apple GCC chokes on inline in system headers
+	# using c89 mode as injected by cflags.SH, in addition, we override
+	# cflags, so we loose PERL_DARWIN which enables compat code that
+	# apparently on more recent macOS releases is no longer necessary
+	[[ ${CHOST} == *-darwin* && ${CHOST##*darwin} -le 9 ]] && tc-is-gcc && \
+		append-cflags -Dinline=__inline__ -DPERL_DARWIN
+
+	# flock on 32-bit sparc Solaris is broken, fall back to fcntl
+	[[ ${CHOST} == sparc-*-solaris* ]] && \
+		myconf -Ud_flock
+
+	# Prefix: the host system needs not to follow Gentoo multilib stuff, and in
+	# Prefix itself we don't do multilib either, so make sure perl can find
+	# something compatible.
+	if use prefix ; then
+		# Set a hook to check for each detected library whether it actually works.
+		export libscheck="
+			( echo 'main(){}' > '${T}'/conftest.c &&
+				$(tc-getCC) -o '${T}'/conftest '${T}'/conftest.c -l\$thislib >/dev/null 2>/dev/null
+			) || xxx=/dev/null"
+
+		# Use all host paths that might contain useful stuff, the hook above will filter out bad choices.
+		local paths="/lib/*-linux-gnu /usr/lib/*-linux-gnu /lib64 /lib/64 /usr/lib64 /usr/lib/64 /lib32 /usr/lib32 /lib /usr/lib"
+		myconf "-Dlibpth=${EPREFIX}/$(get_libdir) ${EPREFIX}/usr/$(get_libdir) ${paths}"
+	elif [[ $(get_libdir) != "lib" ]] ; then
+		# We need to use " and not ', as the written config.sh use ' ...
+		myconf "-Dlibpth=/usr/local/$(get_libdir) /$(get_libdir) /usr/$(get_libdir)"
+	fi
+
+	# don't try building ODBM, bug #354453
+	disabled_extensions="ODBM_File"
+
+	if ! use gdbm ; then
+		# workaround for bug #157774: don't try building GDBM related stuff with USE="-gdbm"
+		disabled_extensions="${disabled_extensions} GDBM_File NDBM_File"
+	fi
+
+	myconf -Dnoextensions="${disabled_extensions}"
+
+	[[ "${PV##*.}" == "9999" ]] && myconf -Dusedevel -Uversiononly
+
+	[[ -n "${EXTRA_ECONF}" ]] && ewarn During Perl build, EXTRA_ECONF=${EXTRA_ECONF}
+	# allow fiddling via EXTRA_ECONF, bug 558070
+	eval "local -a EXTRA_ECONF=(${EXTRA_ECONF})"
+
+	# setting -Dld= to tc-getLD breaks perl and all perl things
+	# https://github.com/Perl/perl5/issues/17791#issuecomment-630145202
+	myconf \
+		-Duseshrplib \
+		-Darchname="${myarch}" \
+		-Dcc="$(tc-getCC)" \
+		-Dar="$(tc-getAR)" \
+		-Dnm="$(tc-getNM)" \
+		-Dcpp="$(tc-getCPP)" \
+		-Dranlib="$(tc-getRANLIB)" \
+		-Accflags="${CFLAGS}" \
+		-Doptimize="${CFLAGS}" \
+		-Dldflags="${LDFLAGS}" \
+		-Dprefix="${EPREFIX}"'/usr' \
+		-Dsiteprefix="${EPREFIX}"'/usr/local' \
+		-Dvendorprefix="${EPREFIX}"'/usr' \
+		-Dscriptdir="${EPREFIX}"'/usr/bin' \
+		-Dprivlib="${EPREFIX}${PRIV_LIB}" \
+		-Darchlib="${EPREFIX}${ARCH_LIB}" \
+		-Dsitelib="${EPREFIX}${SITE_LIB}" \
+		-Dsitearch="${EPREFIX}${SITE_ARCH}" \
+		-Dvendorlib="${EPREFIX}${VENDOR_LIB}" \
+		-Dvendorarch="${EPREFIX}${VENDOR_ARCH}" \
+		-Dman1dir="${EPREFIX}"/usr/share/man/man1 \
+		-Dman3dir="${EPREFIX}"/usr/share/man/man3 \
+		-Dsiteman1dir="${EPREFIX}"/usr/local/man/man1 \
+		-Dsiteman3dir="${EPREFIX}"/usr/local/man/man3 \
+		-Dvendorman1dir="${EPREFIX}"/usr/share/man/man1 \
+		-Dvendorman3dir="${EPREFIX}"/usr/share/man/man3 \
+		-Dman1ext='1' \
+		-Dman3ext='3pm' \
+		-Dlibperl="${LIBPERL}" \
+		-Dlocincpth="${EPREFIX}"'/usr/include ' \
+		-Dglibpth="${EPREFIX}/$(get_libdir) ${EPREFIX}/usr/$(get_libdir)"' ' \
+		-Duselargefiles \
+		-Dd_semctl_semun \
+		-Dcf_by='Gentoo' \
+		-Dmyhostname='localhost' \
+		-Dperladmin='root@localhost' \
+		-Ud_csh \
+		-Dsh="${EPREFIX}"/bin/sh \
+		-Dtargetsh="${EPREFIX}"/bin/sh \
+		-Uusenm \
+		"${EXTRA_ECONF[@]}"
+
+	if tc-is-cross-compiler; then
+		./configure \
+			--target="${CHOST}" \
+			--build="${CBUILD}" \
+			-Dinstallprefix='' \
+			-Dinstallusrbinperl='undef' \
+			-Dusevendorprefix='define' \
+			"${myconf[@]}" \
+			|| die "Unable to configure"
+	else
+		sh Configure \
+			-des \
+			-Dinstallprefix="${EPREFIX}"'/usr' \
+			-Dinstallusrbinperl='n' \
+			"${myconf[@]}" \
+			|| die "Unable to configure"
+	fi
+}
+
+src_test() {
+	export NO_GENTOO_NETWORK_TESTS=1;
+	export GENTOO_ASSUME_SANDBOXED="${GENTOO_ASSUME_SANDBOXED:-1}"
+	export GENTOO_NO_PORTING_TESTS="${GENTOO_NO_PORTING_TESTS:-1}"
+	if [[ ${EUID} == 0 ]] ; then
+		ewarn "Test fails with a sandbox error (#328793) if run as root. Skipping tests..."
+		return 0
+	fi
+	TEST_JOBS="$(makeopts_jobs)" make test_harness || die "test failed"
+}
+
+src_install() {
+	local i
+	local coredir="${ARCH_LIB}/CORE"
+
+	emake DESTDIR="${D}" install
+
+	rm -f "${ED}/usr/bin/perl${MY_PV}"
+	ln -s perl "${ED}"/usr/bin/perl${MY_PV} || die
+
+	if ! tc-is-static-only ; then
+		dolib.so "${ED}"${coredir}/${LIBPERL}
+		rm -f "${ED}"${coredir}/${LIBPERL}
+		ln -sf ${LIBPERL} "${ED}"/usr/$(get_libdir)/libperl$(get_libname ${SHORT_PV}) || die
+		ln -sf ${LIBPERL} "${ED}"/usr/$(get_libdir)/libperl$(get_libname) || die
+
+		ln -sf ../../../../${LIBPERL} "${ED}"${coredir}/${LIBPERL} || die
+		ln -sf ../../../../${LIBPERL} "${ED}"${coredir}/libperl$(get_libname ${SHORT_PV}) || die
+		ln -sf ../../../../${LIBPERL} "${ED}"${coredir}/libperl$(get_libname) || die
+	fi
+
+	rm -rf "${ED}"/usr/share/man/man3 || die "Unable to remove module man pages"
+
+	# This removes ${D} from Config.pm
+	for i in $(find "${D}" -iname "Config.pm" ) ; do
+		einfo "Removing ${D} from ${i}..."
+		sed -i -e "s:${D}::" "${i}" || die "Sed failed"
+	done
+
+	dodoc Changes* README AUTHORS
+
+	if use doc ; then
+		# HTML Documentation
+		# We expect errors, warnings, and such with the following.
+
+		dodir /usr/share/doc/${PF}/html
+		LD_LIBRARY_PATH=. ./perl installhtml \
+			--podroot='.' \
+			--podpath='lib:ext:pod:vms' \
+			--recurse \
+			--htmldir="${ED}/usr/share/doc/${PF}/html"
+	fi
+
+	[[ -d ${ED}/usr/local ]] && rm -r "${ED}"/usr/local
+
+	dual_scripts
+}
+
+pkg_preinst() {
+	check_rebuild
+}
+
+pkg_postinst() {
+	dual_scripts
+
+	if [[ -z "${ROOT}" ]] ; then
+		local INC DIR file
+		INC=$(perl -e 'for $line (@INC) { next if $line eq "."; next if $line =~ m/'${SHORT_PV}'|etc|local|perl$/; print "$line\n" }')
+		einfo "Removing old .ph files"
+		for DIR in ${INC} ; do
+			if [[ -d "${DIR}" ]] ; then
+				for file in $(find "${DIR}" -name "*.ph" -type f ) ; do
+					rm -f "${file}"
+					einfo "<< ${file}"
+				done
+			fi
+		done
+		# Silently remove the now empty dirs
+		for DIR in ${INC} ; do
+			if [[ -d "${DIR}" ]] ; then
+				find "${DIR}" -depth -type d -print0 | xargs -0 -r rmdir &> /dev/null
+			fi
+		done
+
+	fi
+}
+
+pkg_postrm() {
+	dual_scripts
+}


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-lang/perl/files/, dev-lang/perl/
@ 2023-05-01 21:56 Andreas K. Hüttel
  0 siblings, 0 replies; 12+ messages in thread
From: Andreas K. Hüttel @ 2023-05-01 21:56 UTC (permalink / raw
  To: gentoo-commits

commit:     587d4dee588525f616e38657ec601cc9447c942e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon May  1 21:54:19 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon May  1 21:56:16 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=587d4dee

dev-lang/perl: Enable verify_SSL by default in HTTP::Tiny

Trivial patch from alpine

Bug: https://bugs.gentoo.org/905296
See-also: https://github.com/chansen/p5-http-tiny/pull/151
See-also: https://github.com/chansen/p5-http-tiny/issues/152
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 dev-lang/perl/files/perl-5.36.1-http-tiny.patch |  25 +
 dev-lang/perl/perl-5.36.1-r1.ebuild             | 826 ++++++++++++++++++++++++
 2 files changed, 851 insertions(+)

diff --git a/dev-lang/perl/files/perl-5.36.1-http-tiny.patch b/dev-lang/perl/files/perl-5.36.1-http-tiny.patch
new file mode 100644
index 000000000000..34907cc6d9fd
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.36.1-http-tiny.patch
@@ -0,0 +1,25 @@
+in current year, we should verify tls certs by default.
+not doing so is as good as not using tls
+https://www.openwall.com/lists/oss-security/2023/04/18/14
+
+Source:
+https://git.alpinelinux.org/aports/plain/main/perl/default-https-perl-http-tiny.patch?id=fc21c0f7930ae3a9e2f50bacc305fb167a456ded
+
+Bug: https://bugs.gentoo.org/905296
+See-also: https://github.com/chansen/p5-http-tiny/pull/151
+See-also: https://github.com/chansen/p5-http-tiny/issues/152
+
+--
+diff --git a/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm b/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
+index 83ca06d..dc6217a 100644
+--- a/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
++++ b/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
+@@ -1055,7 +1055,7 @@ sub new {
+         timeout          => 60,
+         max_line_size    => 16384,
+         max_header_lines => 64,
+-        verify_SSL       => 0,
++        verify_SSL       => 1,
+         SSL_options      => {},
+         %args
+     }, $class;

diff --git a/dev-lang/perl/perl-5.36.1-r1.ebuild b/dev-lang/perl/perl-5.36.1-r1.ebuild
new file mode 100644
index 000000000000..a70fd75507d4
--- /dev/null
+++ b/dev-lang/perl/perl-5.36.1-r1.ebuild
@@ -0,0 +1,826 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit alternatives flag-o-matic toolchain-funcs multilib multiprocessing
+
+PATCH_VER=1
+CROSS_VER=1.4
+PATCH_BASE="perl-5.36.0-patches-${PATCH_VER}"
+PATCH_DEV=dilfridge
+
+DIST_AUTHOR=RJBS
+
+# Greatest first, don't include yourself
+# Devel point-releases are not ABI-intercompatible, but stable point releases are
+# BIN_OLDVERSEN contains only C-ABI-intercompatible versions
+PERL_BIN_OLDVERSEN=""
+
+if [[ "${PV##*.}" == "9999" ]]; then
+	DIST_VERSION=5.30.0
+else
+	DIST_VERSION="${PV/_rc/-RC}"
+fi
+SHORT_PV="${DIST_VERSION%.*}"
+
+# Even numbered major versions are ABI intercompatible
+# Odd numbered major versions are not
+if [[ $(( ${SHORT_PV#*.} % 2 )) == 1 ]]; then
+	SUBSLOT="${DIST_VERSION%-RC*}"
+else
+	SUBSLOT="${DIST_VERSION%.*}"
+fi
+
+# Used only in tar paths
+MY_P="perl-${DIST_VERSION}"
+# Used in library paths
+MY_PV="${DIST_VERSION%-RC*}"
+
+DESCRIPTION="Larry Wall's Practical Extraction and Report Language"
+
+SRC_URI="
+	mirror://cpan/src/5.0/${MY_P}.tar.xz
+	mirror://cpan/authors/id/${DIST_AUTHOR:0:1}/${DIST_AUTHOR:0:2}/${DIST_AUTHOR}/${MY_P}.tar.xz
+	https://github.com/gentoo-perl/perl-patchset/releases/download/${PATCH_BASE}/${PATCH_BASE}.tar.xz
+	https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${PATCH_BASE}.tar.xz
+	https://github.com/arsv/perl-cross/releases/download/${CROSS_VER}/perl-cross-${CROSS_VER}.tar.gz
+"
+
+HOMEPAGE="https://www.perl.org/"
+
+LICENSE="|| ( Artistic GPL-1+ )"
+SLOT="0/${SUBSLOT}"
+
+if [[ "${PV##*.}" != "9999" ]] && [[ "${PV/rc//}" == "${PV}" ]] ; then
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+
+IUSE="berkdb debug doc gdbm ithreads minimal quadmath"
+
+RDEPEND="
+	berkdb? ( sys-libs/db:= )
+	gdbm? ( >=sys-libs/gdbm-1.8.3:= )
+	app-arch/bzip2
+	>=sys-libs/zlib-1.2.12
+	virtual/libcrypt:=
+"
+DEPEND="${RDEPEND}"
+BDEPEND="${RDEPEND}"
+
+PDEPEND="
+	!minimal? (
+		>=app-admin/perl-cleaner-2.5
+		>=virtual/perl-CPAN-2.290.0
+		>=virtual/perl-Encode-3.120.0
+		>=virtual/perl-File-Temp-0.230.400-r2
+		>=virtual/perl-Data-Dumper-2.154.0
+		virtual/perl-Test-Harness
+	)
+"
+# bug 390719, bug 523624
+# virtual/perl-Test-Harness is here for the bundled ExtUtils::MakeMaker
+
+S="${WORKDIR}/${MY_P}"
+
+dual_scripts() {
+	src_remove_dual      perl-core/Archive-Tar        2.400.0       ptar ptardiff ptargrep
+	src_remove_dual      perl-core/CPAN               2.330.0       cpan
+	src_remove_dual      perl-core/Digest-SHA         6.20.0        shasum
+	src_remove_dual      perl-core/Encode             3.170.0       enc2xs piconv
+	src_remove_dual      perl-core/ExtUtils-MakeMaker 7.640.0       instmodsh
+	src_remove_dual      perl-core/ExtUtils-ParseXS   3.450.0       xsubpp
+	src_remove_dual      perl-core/IO-Compress        2.106.0       zipdetails
+	src_remove_dual      perl-core/JSON-PP            4.70.0        json_pp
+	src_remove_dual      perl-core/Module-CoreList    5.202.304.230 corelist
+	src_remove_dual      perl-core/Pod-Checker        1.740.0       podchecker
+	src_remove_dual      perl-core/Pod-Perldoc        3.280.100     perldoc
+	src_remove_dual      perl-core/Pod-Usage          2.10.0       pod2usage
+	src_remove_dual      perl-core/Test-Harness       3.440.0       prove
+	src_remove_dual      perl-core/podlators          4.140.0       pod2man pod2text
+	src_remove_dual_man  perl-core/podlators          4.140.0       /usr/share/man/man1/perlpodstyle.1
+}
+
+check_rebuild() {
+	# Fresh install
+	if [[ -z "${REPLACING_VERSIONS}" ]]; then
+		return 0;
+	# Major Upgrade
+	# doesn't matter if there's multiple copies, it still needs a rebuild
+	# if the string is anything other than "5.CURRENTMAJOR"
+	elif [[ "${REPLACING_VERSIONS%.*}" != "${PV%.*}" ]]; then
+		echo ""
+		ewarn "UPDATE THE PERL MODULES:"
+		ewarn "After updating dev-lang/perl the installed Perl modules"
+		ewarn "have to be re-installed. In most cases, this is done automatically"
+		ewarn "by the package manager, but subsequent steps are still recommended"
+		ewarn "to ensure system consistency."
+		ewarn
+		ewarn "You should start with a depclean to remove any unused perl dependencies"
+		ewarn "that may confuse portage in future. Regular depcleans are also encouraged"
+		ewarn "as part of your regular update cycle, as that will keep perl upgrades working."
+		ewarn "Recommended: emerge --depclean -va"
+		ewarn
+		ewarn "You should then call perl-cleaner to clean up any old files and trigger any"
+		ewarn "remaining rebuilds portage may have missed."
+		ewarn "Use: perl-cleaner --all"
+		return 0;
+
+	# Reinstall w/ USE Change
+	elif
+		 (   use ithreads && ! has_version dev-lang/perl[ithreads] ) || \
+		 ( ! use ithreads &&   has_version dev-lang/perl[ithreads] ) || \
+		 (   use quadmath && ! has_version dev-lang/perl[quadmath] ) || \
+		 ( ! use quadmath &&   has_version dev-lang/perl[quadmath] ) || \
+		 (   use debug    && ! has_version dev-lang/perl[debug]    ) || \
+		 ( ! use debug    &&   has_version dev-lang/perl[debug]    ) ; then
+		echo ""
+		ewarn "TOGGLED USE-FLAGS WARNING:"
+		ewarn "You changed one of the use-flags ithreads, quadmath, or debug."
+		ewarn "You must rebuild all perl-modules installed."
+		ewarn "Use: perl-cleaner --modules ; perl-cleaner --force --libperl"
+	fi
+}
+
+pkg_setup() {
+	case ${CHOST} in
+		*-freebsd*)   osname="freebsd" ;;
+		*-dragonfly*) osname="dragonfly" ;;
+		*-netbsd*)    osname="netbsd" ;;
+		*-openbsd*)   osname="openbsd" ;;
+		*-darwin*)    osname="darwin" ;;
+		*-solaris*)   osname="solaris" ;;
+		*-cygwin*)    osname="cygwin" ;;
+		*)            osname="linux" ;;
+	esac
+
+	myarch="${CHOST%%-*}-${osname}"
+	if use debug ; then
+		myarch+="-debug"
+	fi
+	if use quadmath ; then
+		myarch+="-quadmath"
+	fi
+	if use ithreads ; then
+		mythreading="-multi"
+		myarch+="-thread"
+	fi
+
+	PRIV_BASE="/usr/$(get_libdir)/perl5"
+	SITE_BASE="/usr/local/$(get_libdir)/perl5"
+	VENDOR_BASE="/usr/$(get_libdir)/perl5/vendor_perl"
+
+	LIBPERL="libperl$(get_libname ${MY_PV} )"
+
+	PRIV_LIB="${PRIV_BASE}/${SUBSLOT}"
+	ARCH_LIB="${PRIV_BASE}/${SUBSLOT}/${myarch}${mythreading}"
+	SITE_LIB="${SITE_BASE}/${SUBSLOT}"
+	SITE_ARCH="${SITE_BASE}/${SUBSLOT}/${myarch}${mythreading}"
+	VENDOR_LIB="${VENDOR_BASE}/${SUBSLOT}"
+	VENDOR_ARCH="${VENDOR_BASE}/${SUBSLOT}/${myarch}${mythreading}"
+
+	dual_scripts
+}
+
+src_remove_dual_file() {
+	local i pkg ver
+	pkg="$1"
+	ver="$2"
+	shift 2
+	case "${EBUILD_PHASE:-none}" in
+		postinst|postrm)
+			for i in "$@" ; do
+				alternatives_auto_makesym "${i}" "${i}-[0-9]*"
+			done
+			;;
+		setup)
+			for i in "$@" ; do
+				if [[ -f ${EROOT}${i} && ! -h ${EROOT}${i} ]] ; then
+					has_version ${pkg} && ewarn "You must reinstall ${pkg} !"
+					break
+				fi
+			done
+			;;
+		install)
+			for i in "$@" ; do
+				if ! [[ -f "${ED}"${i} ]] ; then
+					ewarn "${i} does not exist!"
+					continue
+				fi
+				mv "${ED}"${i}{,-${ver}-${P}} || die
+			done
+			;;
+	esac
+}
+
+src_remove_dual_man() {
+	local i pkg ver ff
+	pkg="$1"
+	ver="$2"
+	shift 2
+	case "${EBUILD_PHASE:-none}" in
+		postinst|postrm)
+			for i in "$@" ; do
+				ff=`echo "${EROOT}${i%.[0-9]}-${ver}-${P}${i#${i%.[0-9]}}"*`
+				ff=${ff##*${i#${i%.[0-9]}}}
+				alternatives_auto_makesym "${i}${ff}" "${i%.[0-9]}-[0-9]*"
+			done
+			;;
+		install)
+			for i in "$@" ; do
+				if ! [[ -f "${ED}"${i} ]] ; then
+					ewarn "${i} does not exist!"
+					continue
+				fi
+				mv "${ED}"${i} "${ED}"${i%.[0-9]}-${ver}-${P}${i#${i%.[0-9]}} || die
+			done
+			;;
+	esac
+}
+
+src_remove_dual() {
+	local i pkg ver
+	pkg="$1"
+	ver="$2"
+	shift 2
+	for i in "$@" ; do
+		src_remove_dual_file  "${pkg}" "${ver}" "/usr/bin/${i}"
+		src_remove_dual_man   "${pkg}" "${ver}" "/usr/share/man/man1/${i}.1"
+	done
+}
+
+src_prepare_perlcross() {
+	cp -a ../perl-cross-${CROSS_VER}/* . || die
+
+	# bug 794463, needs further analysis what is exactly wrong here
+	eapply "${FILESDIR}/perl-5.34.0-crossfit.patch"
+
+	# bug 604072
+	MAKEOPTS+=" -j1"
+	export MAKEOPTS
+}
+
+src_prepare_dynamic() {
+	ln -s ${LIBPERL} libperl$(get_libname ${SHORT_PV}) || die
+	ln -s ${LIBPERL} libperl$(get_libname ) || die
+}
+
+# Copy a patch into the patch series
+# add_patch SRC_PATH DEST_NAME ['description'] ['bug'] ['bug']
+# - description is optional, but recommended
+# - all arguments after descriptions are bug URLs
+add_patch() {
+	local patchdir="${WORKDIR}/patches"
+	local infodir="${WORKDIR}/patch-info"
+	local src_name dest_name desc
+	src_name="$1"
+	dest_name="$2"
+	desc="$3"
+	shift; shift; shift;
+	einfo "Adding ${dest_name} to patch bundle"
+	cp "${src_name}" "${patchdir}/${dest_name}" || die "Couldn't copy ${src_name} to ${dest_name}"
+	if [[ -n "${desc}" ]]; then
+		printf "%s" "${desc}" > "${infodir}/${dest_name}.desc" || die "Couldn't write ${dest_name}.desc"
+	fi
+	if [[ $# -gt 0 ]]; then
+		# Note: when $@ is more than one element, this emits a
+		# line for each element
+		printf "%s\n" "$@" > "${infodir}/${dest_name}.bugs" || die "Couldn't write ${dest_name}.bugs"
+	fi
+}
+
+# Remove a patch using a glob expr
+# eg:
+#	 rm_patch *-darwin-Use-CC*
+#
+rm_patch() {
+	local patchdir="${WORKDIR}/patches"
+	local expr="$1"
+	local patch="$( cd "${patchdir}"; echo $expr )"
+	einfo "Removing $patch ($expr) from patch bundle"
+	if [[ -e "${patchdir}/${patch}" ]]; then
+		rm -f "${patchdir}/${patch}" || die "Can't remove ${patch} ( $expr )"
+	else
+		ewarn "No ${expr} found in ${patchdir} to remove"
+	fi
+}
+
+# Yes, this is a reasonable amount of code for something seemingly simple
+# but this is far easier to debug when things go wrong, and things went wrong
+# multiple times while I was getting the exact number of slashes right, which
+# requires circumnavigating both bash and sed escape mechanisms.
+c_escape_string() {
+	local slash dquote
+	slash='\'
+	dquote='"'
+	re_slash="${slash}${slash}"
+	re_dquote="${slash}${dquote}"
+
+	# Convert \ to \\,
+	#         " to \"
+	echo "$1" |\
+		sed "s|${re_slash}|${re_slash}${re_slash}|g" |\
+		sed "s|${re_dquote}|${re_slash}${re_dquote}|g"
+}
+c_escape_file() {
+	c_escape_string "$(cat "$1")"
+}
+
+apply_patchdir() {
+	local patchdir="${WORKDIR}/patches"
+	local infodir="${WORKDIR}/patch-info"
+	local patchoutput="patchlevel-gentoo.h"
+
+	# Inject Patch-Level info into description for patchlevel.h patch
+	# to show in -V
+	local patch_expr="*List-packaged-patches*"
+	local patch="$( cd "${patchdir}"; echo $patch_expr )";
+	einfo "Injecting patch-level info into ${patch}.desc ( $patch_expr )"
+
+	if [[ -e "${patchdir}/${patch}" ]]; then
+		printf "List packaged patches for %s(%s) in patchlevel.h" "${PF}" "${PATCH_BASE}"\
+			>"${infodir}/${patch}.desc" || die "Can't rewrite ${patch}.desc"
+	else
+		eerror "No $patch_expr found in ${patchdir}"
+	fi
+
+	# Compute patch list to apply
+	# different name other than PATCHES to stop default
+	# reapplying it
+	# Single depth is currently only supported, as artifacts can reside
+	# from the old layout being multiple-directories, as well as it grossly
+	# simplifying the patchlevel_gentoo.h generation.
+	local PERL_PATCHES=($(
+		find "${patchdir}" -maxdepth 1 -mindepth 1 -type f -printf "%f\n" |\
+			grep -E '[.](diff|patch)$' |\
+			sort -n
+	))
+
+	for patch in "${PERL_PATCHES[@]}"; do
+		eapply "${WORKDIR}"/patches/${patch}
+	done
+
+	einfo "Generating $patchoutput"
+
+	# This code creates a header file, each iteration
+	# creates one-or-more-lines for each entry found in PERL_PATCHES
+	# and STDOUT is redirected to the .h file
+	for patch in "${PERL_PATCHES[@]}"; do
+		local desc_f="${infodir}/${patch}.desc"
+		local bugs_f="${infodir}/${patch}.bugs"
+
+		printf ',"%s"\n' "${patch}"
+		if [[ ! -e "${desc_f}" ]]; then
+			ewarn "No description provided for ${patch} (expected: ${desc_f} )"
+		else
+			local desc="$(c_escape_file "${desc_f}")"
+			printf ',"- %s"\n' "${desc}"
+		fi
+		if [[ -e "${bugs_f}" ]]; then
+			while read -d $'\n' -r line; do
+				local esc_line="$(c_escape_string "${line}")"
+				printf ',"- Bug: %s"\n' "${esc_line}"
+			done <"${bugs_f}"
+		fi
+	done > "${S}/${patchoutput}"
+	printf "%s\n" "${patchoutput}" >> "${S}/MANIFEST"
+
+}
+
+src_prepare() {
+	local patchdir="${WORKDIR}/patches"
+
+	# Prepare Patch dir with additional patches / remove unwanted patches
+	# Inject bug/desc entries for perl -V
+	# Old example:
+	# add_patch "${FILESDIR}/${PN}-5.26.2-hppa.patch" "100-5.26.2-hppa.patch"\
+	#		"Fix broken miniperl on hppa"\
+	#		"https://bugs.debian.org/869122" "https://bugs.gentoo.org/634162"
+
+	add_patch "${FILESDIR}/${PN}-5.36.1-http-tiny.patch" "0111-5.36.1-http-tiny.patch"\
+			"Enable certificate checking in HTTP::Tiny by default"\
+			"https://bugs.gentoo.org/905296" "https://bugs.debian.org/954089"
+
+	if [[ ${CHOST} == *-solaris* ]] ; then
+		# do NOT mess with nsl, on Solaris this is always necessary,
+		# when -lsocket is used e.g. to get h_errno
+		rm_patch "*-nsl-and-cl*"
+	fi
+
+	apply_patchdir
+
+	tc-is-cross-compiler && src_prepare_perlcross
+
+	tc-is-static-only || src_prepare_dynamic
+
+	if use gdbm; then
+		sed -i "s:INC => .*:INC => \"-I${EROOT}/usr/include/gdbm\":g" \
+			ext/NDBM_File/Makefile.PL || die
+	fi
+
+	# Use errno.h from prefix rather than from host system, bug #645804
+	if use prefix && [[ -e "${EPREFIX}"/usr/include/errno.h ]] ; then
+		sed -i "/my..sysroot/s:'':'${EPREFIX}':" ext/Errno/Errno_pm.PL || die
+	fi
+
+	if [[ ${CHOST} == *-solaris* ]] ; then
+		# set a soname, fix linking against just built libperl
+		sed -i -e 's/netbsd\*/netbsd*|solaris*/' Makefile.SH || die
+	fi
+
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		# fix install_name (soname) not to reference $D
+		sed -i -e '/install_name `pwd/s/`pwd`/\\$(shrpdir)/' Makefile.SH || die
+
+		# fix environ linkage absence (only a real issue on Darwin9)
+		if [[ ${CHOST##*-darwin} -le 9 ]] ; then
+			sed -i -e '/^PLDLFLAGS =/s/=/= -include crt_externs.h -Denviron="(*_NSGetEnviron())"/' \
+				Makefile.SH || die
+		fi
+	fi
+
+	default
+}
+
+myconf() {
+	# the myconf array is declared in src_configure
+	myconf=( "${myconf[@]}" "$@" )
+}
+
+# Outputs a list of versions which have been seen in any of the
+# primary perl @INC prefix paths, such as:
+#  /usr/lib64/perl5/<NUMBER>
+#  /usr/local/lib64/perl5/<NUMBER>
+#  /usr/lib64/perl5/vendor_perl/<NUMBER>
+#
+# All values of NUMBER must be like "5.x.y" or like "5.x"
+#
+find_candidate_inc_versions() {
+	local regex='.*/5[.][0-9]+\([.][0-9]+\|\)$'
+	local dirs=(
+		"${EROOT}${PRIV_BASE}"
+		"${EROOT}${SITE_BASE}"
+		"${EROOT}${VENDOR_BASE}"
+	)
+	for dir in "${dirs[@]}"; do
+		if [[ ! -e "${dir}" ]]; then
+			continue
+		fi
+		# Without access to readdir() on these dirs, find will not be able
+		# to reveal any @INC directories inside them, and will subsequently prune
+		# them from the built perl's @INC support, breaking our compatiblity options
+		# entirely.
+		if [[ ! -r "${dir}" || ! -x "${dir}" ]]; then
+			eerror "Bad permissions on ${dir}, this will probably break things"
+			eerror "Ensure ${dir} is +rx for at least uid=$EUID"
+			eerror "Recommended permission is +rx for all"
+			eerror "> chmod o+rx ${dir}"
+		fi
+	done
+	einfo "Scanning for old @INC dirs matching '$regex' in: ${dirs[*]}"
+	find "${dirs[@]}" -maxdepth 1 -mindepth 1 -type d -regex "${regex}" -printf "%f "  2>/dev/null
+}
+
+# Sort versions passed versiony-ly, remove self-version if present
+# dedup. Takes each version as an argument
+sanitize_inc_versions() {
+	local vexclude="${SUBSLOT}"
+	einfo "Normalizing/Sorting candidate list: $*"
+	einfo " to remove '${vexclude}'"
+	# Note, general numeric sort has to be used
+	# for the last component, or unique will convert
+	#  5.30.0 + 5.30 into just 5.30
+	printf "%s\n" "$@" |\
+		grep -vxF "${vexclude}" |\
+		sort -u -nr -t'.' -k1,1rn -k2,2rn -k3,3rg
+}
+
+versions_to_inclist() {
+	local oldv="${DIST_VERSION%-RC} ${PERL_BIN_OLDVERSEN}"
+
+	for v;	do
+			has "${v}" ${oldv} && echo -n "${v}/${myarch}${mythreading}/ ";
+			echo -n "${v}/ ";
+	done
+}
+
+versions_to_gentoolibdirs() {
+	local oldv="${DIST_VERSION%-RC} ${PERL_BIN_OLDVERSEN}"
+	local root
+	local v
+	for v;	do
+		for root in "${PRIV_BASE}" "${VENDOR_BASE}" "${SITE_BASE}"; do
+			local fullpath="${EROOT}${root}/${v}"
+			if [[ -e "${fullpath}" ]]; then
+				has "${v}" ${oldv} && printf "%s:" "${fullpath}/${myarch}${mythreading}";
+				printf "%s:" "${fullpath}"
+			fi
+		done
+	done
+}
+
+src_configure() {
+	declare -a myconf
+
+	export LC_ALL="C"
+	[[ ${COLUMNS:-1} -ge 1 ]] || unset COLUMNS # bug #394091
+
+	# Perl has problems compiling with -Os in your flags with glibc
+	replace-flags "-Os" "-O2"
+
+	# xlocale.h is going away in glibc-2.26, so it's counterproductive
+	# if we use it and include it in CORE/perl.h ... Perl builds just
+	# fine with glibc and locale.h only.
+	# However, the darwin prefix people have no locale.h ...
+	use elibc_glibc && myconf -Ui_xlocale
+
+	# This flag makes compiling crash in interesting ways
+	filter-flags "-malign-double"
+
+	# Generic LTO broken since 5.28, triggers EUMM failures
+	filter-flags "-flto"
+
+	use sparc && myconf -Ud_longdbl
+
+	export BUILD_BZIP2=0
+	export BZIP2_INCLUDE=${EROOT}/usr/include
+	export BZIP2_LIB=${EROOT}/usr/$(get_libdir)
+
+	export BUILD_ZLIB=False
+	export ZLIB_INCLUDE=${EROOT}/usr/include
+	export ZLIB_LIB=${EROOT}/usr/$(get_libdir)
+
+	# allow either gdbm to provide ndbm (in <gdbm/ndbm.h>) or db1
+	myndbm='U'
+	mygdbm='U'
+	mydb='U'
+	if use gdbm ; then
+		mygdbm='D'
+		if use berkdb ; then
+			myndbm='D'
+		fi
+	fi
+	if use berkdb ; then
+		mydb='D'
+		has_version '=sys-libs/db-1*' && myndbm='D'
+	fi
+
+	myconf "-${myndbm}i_ndbm" "-${mygdbm}i_gdbm" "-${mydb}i_db"
+
+	if use alpha && [[ "$(tc-getCC)" = "ccc" ]] ; then
+		ewarn "Perl will not be built with berkdb support, use gcc if you needed it..."
+		myconf -Ui_db -Ui_ndbm
+	fi
+
+	use ithreads && myconf -Dusethreads
+
+	use quadmath && myconf -Dusequadmath
+
+	if use debug ; then
+		append-cflags "-g"
+		myconf -DDEBUGGING
+	elif [[ ${CFLAGS} == *-g* ]] ; then
+		myconf -DDEBUGGING=-g
+	else
+		myconf -DDEBUGGING=none
+	fi
+
+	# modifying 'optimize' prevents cross configure script from appending required flags
+	if tc-is-cross-compiler; then
+		append-cflags "-fwrapv"
+	fi
+
+	# bug #877659, bug #821577
+	append-cflags -fno-strict-aliasing
+
+	# Autodiscover all old version directories, some of them will even be newer
+	# if you downgrade
+	if [[ -z ${PERL_OLDVERSEN} ]]; then
+		PERL_OLDVERSEN="$( find_candidate_inc_versions )"
+	fi
+
+	# Fixup versions, removing self match, fixing order and dupes
+	PERL_OLDVERSEN="$( sanitize_inc_versions ${PERL_OLDVERSEN} )"
+
+	# Experts who want a "Pure" install can set PERL_OLDVERSEN to an empty string
+	if [[ -n "${PERL_OLDVERSEN// }" ]]; then
+		local inclist="$( versions_to_inclist ${PERL_OLDVERSEN} )"
+		einfo "This version of perl may partially support modules previously"
+		einfo "installed in any of the following paths:"
+		for incpath in ${inclist}; do
+			[[ -e "${EROOT}${VENDOR_BASE}/${incpath}" ]] && einfo " ${EROOT}${VENDOR_BASE}/${incpath}"
+			[[ -e "${EROOT}${PRIV_BASE}/${incpath}"   ]] && einfo " ${EROOT}${PRIV_BASE}/${incpath}"
+			[[ -e "${EROOT}${SITE_BASE}/${incpath}"   ]] && einfo " ${EROOT}${SITE_BASE}/${incpath}"
+		done
+		einfo "This is a temporary measure and you should aim to cleanup these paths"
+		einfo "via world updates and perl-cleaner"
+		# myconf -Dinc_version_list="${inclist}"
+		myconf -Dgentoolibdirs="$( versions_to_gentoolibdirs ${PERL_OLDVERSEN} )"
+	fi
+
+	[[ ${ELIBC} == "FreeBSD" ]] && myconf "-Dlibc=/usr/$(get_libdir)/libc.a"
+
+	# Make sure we can do the final link #523730, need to set deployment
+	# target to override hardcoded 10.3 which breaks on modern OSX
+	[[ ${CHOST} == *-darwin* ]] && \
+		myconf "-Dld=env MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} $(tc-getCC)"
+
+	# Older macOS with non-Apple GCC chokes on inline in system headers
+	# using c89 mode as injected by cflags.SH, in addition, we override
+	# cflags, so we loose PERL_DARWIN which enables compat code that
+	# apparently on more recent macOS releases is no longer necessary
+	[[ ${CHOST} == *-darwin* && ${CHOST##*darwin} -le 9 ]] && tc-is-gcc && \
+		append-cflags -Dinline=__inline__ -DPERL_DARWIN
+
+	# flock on 32-bit sparc Solaris is broken, fall back to fcntl
+	[[ ${CHOST} == sparc-*-solaris* ]] && \
+		myconf -Ud_flock
+
+	# Prefix: the host system needs not to follow Gentoo multilib stuff, and in
+	# Prefix itself we don't do multilib either, so make sure perl can find
+	# something compatible.
+	if use prefix ; then
+		# Set a hook to check for each detected library whether it actually works.
+		export libscheck="
+			( echo 'main(){}' > '${T}'/conftest.c &&
+				$(tc-getCC) -o '${T}'/conftest '${T}'/conftest.c -l\$thislib >/dev/null 2>/dev/null
+			) || xxx=/dev/null"
+
+		# Use all host paths that might contain useful stuff, the hook above will filter out bad choices.
+		local paths="/lib/*-linux-gnu /usr/lib/*-linux-gnu /lib64 /lib/64 /usr/lib64 /usr/lib/64 /lib32 /usr/lib32 /lib /usr/lib"
+		myconf "-Dlibpth=${EPREFIX}/$(get_libdir) ${EPREFIX}/usr/$(get_libdir) ${paths}"
+	elif [[ $(get_libdir) != "lib" ]] ; then
+		# We need to use " and not ', as the written config.sh use ' ...
+		myconf "-Dlibpth=/usr/local/$(get_libdir) /$(get_libdir) /usr/$(get_libdir)"
+	fi
+
+	# don't try building ODBM, bug #354453
+	disabled_extensions="ODBM_File"
+
+	if ! use gdbm ; then
+		# workaround for bug #157774: don't try building GDBM related stuff with USE="-gdbm"
+		disabled_extensions="${disabled_extensions} GDBM_File NDBM_File"
+	fi
+
+	myconf -Dnoextensions="${disabled_extensions}"
+
+	[[ "${PV##*.}" == "9999" ]] && myconf -Dusedevel -Uversiononly
+
+	[[ -n "${EXTRA_ECONF}" ]] && ewarn During Perl build, EXTRA_ECONF=${EXTRA_ECONF}
+	# allow fiddling via EXTRA_ECONF, bug 558070
+	eval "local -a EXTRA_ECONF=(${EXTRA_ECONF})"
+
+	# setting -Dld= to tc-getLD breaks perl and all perl things
+	# https://github.com/Perl/perl5/issues/17791#issuecomment-630145202
+	myconf \
+		-Duseshrplib \
+		-Darchname="${myarch}" \
+		-Dcc="$(tc-getCC)" \
+		-Dar="$(tc-getAR)" \
+		-Dnm="$(tc-getNM)" \
+		-Dcpp="$(tc-getCPP)" \
+		-Dranlib="$(tc-getRANLIB)" \
+		-Accflags="${CFLAGS}" \
+		-Doptimize="${CFLAGS}" \
+		-Dldflags="${LDFLAGS}" \
+		-Dprefix="${EPREFIX}"'/usr' \
+		-Dsiteprefix="${EPREFIX}"'/usr/local' \
+		-Dvendorprefix="${EPREFIX}"'/usr' \
+		-Dscriptdir="${EPREFIX}"'/usr/bin' \
+		-Dprivlib="${EPREFIX}${PRIV_LIB}" \
+		-Darchlib="${EPREFIX}${ARCH_LIB}" \
+		-Dsitelib="${EPREFIX}${SITE_LIB}" \
+		-Dsitearch="${EPREFIX}${SITE_ARCH}" \
+		-Dvendorlib="${EPREFIX}${VENDOR_LIB}" \
+		-Dvendorarch="${EPREFIX}${VENDOR_ARCH}" \
+		-Dman1dir="${EPREFIX}"/usr/share/man/man1 \
+		-Dman3dir="${EPREFIX}"/usr/share/man/man3 \
+		-Dsiteman1dir="${EPREFIX}"/usr/local/man/man1 \
+		-Dsiteman3dir="${EPREFIX}"/usr/local/man/man3 \
+		-Dvendorman1dir="${EPREFIX}"/usr/share/man/man1 \
+		-Dvendorman3dir="${EPREFIX}"/usr/share/man/man3 \
+		-Dman1ext='1' \
+		-Dman3ext='3pm' \
+		-Dlibperl="${LIBPERL}" \
+		-Dlocincpth="${EPREFIX}"'/usr/include ' \
+		-Dglibpth="${EPREFIX}/$(get_libdir) ${EPREFIX}/usr/$(get_libdir)"' ' \
+		-Duselargefiles \
+		-Dd_semctl_semun \
+		-Dcf_by='Gentoo' \
+		-Dmyhostname='localhost' \
+		-Dperladmin='root@localhost' \
+		-Ud_csh \
+		-Dsh="${EPREFIX}"/bin/sh \
+		-Dtargetsh="${EPREFIX}"/bin/sh \
+		-Uusenm \
+		"${EXTRA_ECONF[@]}"
+
+	if tc-is-cross-compiler; then
+		./configure \
+			--target="${CHOST}" \
+			--build="${CBUILD}" \
+			-Dinstallprefix='' \
+			-Dinstallusrbinperl='undef' \
+			-Dusevendorprefix='define' \
+			"${myconf[@]}" \
+			|| die "Unable to configure"
+	else
+		sh Configure \
+			-des \
+			-Dinstallprefix="${EPREFIX}"'/usr' \
+			-Dinstallusrbinperl='n' \
+			"${myconf[@]}" \
+			|| die "Unable to configure"
+	fi
+}
+
+src_test() {
+	export NO_GENTOO_NETWORK_TESTS=1;
+	export GENTOO_ASSUME_SANDBOXED="${GENTOO_ASSUME_SANDBOXED:-1}"
+	export GENTOO_NO_PORTING_TESTS="${GENTOO_NO_PORTING_TESTS:-1}"
+	if [[ ${EUID} == 0 ]] ; then
+		ewarn "Test fails with a sandbox error (#328793) if run as root. Skipping tests..."
+		return 0
+	fi
+	TEST_JOBS="$(makeopts_jobs)" make test_harness || die "test failed"
+}
+
+src_install() {
+	local i
+	local coredir="${ARCH_LIB}/CORE"
+
+	emake DESTDIR="${D}" install
+
+	rm -f "${ED}/usr/bin/perl${MY_PV}"
+	ln -s perl "${ED}"/usr/bin/perl${MY_PV} || die
+
+	if ! tc-is-static-only ; then
+		dolib.so "${ED}"${coredir}/${LIBPERL}
+		rm -f "${ED}"${coredir}/${LIBPERL}
+		ln -sf ${LIBPERL} "${ED}"/usr/$(get_libdir)/libperl$(get_libname ${SHORT_PV}) || die
+		ln -sf ${LIBPERL} "${ED}"/usr/$(get_libdir)/libperl$(get_libname) || die
+
+		ln -sf ../../../../${LIBPERL} "${ED}"${coredir}/${LIBPERL} || die
+		ln -sf ../../../../${LIBPERL} "${ED}"${coredir}/libperl$(get_libname ${SHORT_PV}) || die
+		ln -sf ../../../../${LIBPERL} "${ED}"${coredir}/libperl$(get_libname) || die
+	fi
+
+	rm -rf "${ED}"/usr/share/man/man3 || die "Unable to remove module man pages"
+
+	# This removes ${D} from Config.pm
+	for i in $(find "${D}" -iname "Config.pm" ) ; do
+		einfo "Removing ${D} from ${i}..."
+		sed -i -e "s:${D}::" "${i}" || die "Sed failed"
+	done
+
+	dodoc Changes* README AUTHORS
+
+	if use doc ; then
+		# HTML Documentation
+		# We expect errors, warnings, and such with the following.
+
+		dodir /usr/share/doc/${PF}/html
+		LD_LIBRARY_PATH=. ./perl installhtml \
+			--podroot='.' \
+			--podpath='lib:ext:pod:vms' \
+			--recurse \
+			--htmldir="${ED}/usr/share/doc/${PF}/html"
+	fi
+
+	[[ -d ${ED}/usr/local ]] && rm -r "${ED}"/usr/local
+
+	dual_scripts
+}
+
+pkg_preinst() {
+	check_rebuild
+}
+
+pkg_postinst() {
+	dual_scripts
+
+	if [[ -z "${ROOT}" ]] ; then
+		local INC DIR file
+		INC=$(perl -e 'for $line (@INC) { next if $line eq "."; next if $line =~ m/'${SHORT_PV}'|etc|local|perl$/; print "$line\n" }')
+		einfo "Removing old .ph files"
+		for DIR in ${INC} ; do
+			if [[ -d "${DIR}" ]] ; then
+				for file in $(find "${DIR}" -name "*.ph" -type f ) ; do
+					rm -f "${file}"
+					einfo "<< ${file}"
+				done
+			fi
+		done
+		# Silently remove the now empty dirs
+		for DIR in ${INC} ; do
+			if [[ -d "${DIR}" ]] ; then
+				find "${DIR}" -depth -type d -print0 | xargs -0 -r rmdir &> /dev/null
+			fi
+		done
+
+	fi
+}
+
+pkg_postrm() {
+	dual_scripts
+}


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-lang/perl/files/, dev-lang/perl/
@ 2023-12-28  3:53 Sam James
  0 siblings, 0 replies; 12+ messages in thread
From: Sam James @ 2023-12-28  3:53 UTC (permalink / raw
  To: gentoo-commits

commit:     ebea30ffef8da0929e15dc5f81591f98fc3b7ab9
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 28 03:53:09 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Dec 28 03:53:09 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ebea30ff

Revert "dev-lang/perl: drop 5.36.0-r2"

This reverts commit 8cfcc4743fe176a415756588782175c2cf7dbeae.

This breaks a bunch of the virtuals.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-lang/perl/Manifest                        |   2 +
 dev-lang/perl/files/perl-5.36.0-clang16.patch | 129 ++++
 dev-lang/perl/perl-5.36.0-r2.ebuild           | 816 ++++++++++++++++++++++++++
 3 files changed, 947 insertions(+)

diff --git a/dev-lang/perl/Manifest b/dev-lang/perl/Manifest
index ab3461a85c05..50a9b3f4c1fa 100644
--- a/dev-lang/perl/Manifest
+++ b/dev-lang/perl/Manifest
@@ -1,8 +1,10 @@
 DIST perl-5.36.0-patches-1.tar.xz 20352 BLAKE2B f5413c75c5bbced230ad7fa692998caef8e4041f3394ae5212dc2aaee465de619b56cf07551be1bb36f2e06b9ed7d0ddda31ad4a7ec81d5c0c64b698ddd80379 SHA512 ab24577b6d71a13d9ccf272efa0881b29933b6a39532ca0d71d4c9a134f451bbe5f3d87c6c851f26114702ac3f92af5c5a72129a458ebee31e372106955eb157
+DIST perl-5.36.0.tar.xz 13051500 BLAKE2B e4864a4c21e5242df4164c73db8af10f7b9c36b075e0c05777abec79716db7778ccbf2c0c9e7e749518ad310019d2a6b32bd8b5ab2af5a8b16b5d920f83d034f SHA512 6dd6ac2a77566c173c5ab9c238cf555f2c3e592e89abb5600bc23ce1cbd0c349e0233f6417cbbf1f6d0aefc6a734ba491285af0d3dc68a605b658b65c89f1dab
 DIST perl-5.36.1.tar.xz 13053604 BLAKE2B baab610d16e444338ad7d529bad6a88e12010786bd25f2ab117ab4dd636859ff862cb925700095434f05a802bea5b89a9d41769f26bdbae439443020950882bd SHA512 8d1ec654c59d078bfc477f11c9526233199a85e4d4f6f5a55bf9eb7802cd355189c669cc6785d2d5e741c1de4d740b7a0cfd3c0198122586a07ac7f527fb14af
 DIST perl-5.38.0-patches-1.tar.gz 26047 BLAKE2B 809dd5242f9868e54525ae8056598d3252c889afc72ed6f122174f828947223399a5ba4dbc16dd43501f7138205991f8c102cbe0ed94175ae3353040c53a0162 SHA512 c66160e20095555aa21d3be70050dce934d62e55e01dcf0f716129b2faa390923958a48bc448b4fab6f55e5b097eb378f7a6409a92c024fe68c8b34fddcfc5e4
 DIST perl-5.38.0.tar.xz 13565448 BLAKE2B 22fd334d911e8ebe16ad2a96522110ad2c14d09dcd04d5e64391c7ffffbb8ec92dd80d3a0f8eb105fb45aef8a2f78457174133503f7aeac4d90f762a44631478 SHA512 71beff7f6daa22a967972f5805daf2d4ff837a17e5ab808780f815d5914a67acf4f2e92acac0f2d8b24bdde4ceec0c2f7cb3029b5eadeeb30191f757e1bf0f9d
 DIST perl-5.38.2.tar.xz 13679524 BLAKE2B 74250e30dde76911902a787134808dae69113c07029cdf09ab4777e7bb4e6c389cdefb9cb08be87e106a4bcd40dacaf188907d7a62c5aca22c1e374741855b39 SHA512 0ca51e447c7a18639627c281a1c7ae6662c773745ea3c86bede46336d5514ecc97ded2c61166e1ac15635581489dc596368907aa3a775b34db225b76d7402d10
 DIST perl-cross-1.4.1.tar.gz 117688 BLAKE2B e01103fb92764213dafb1ab92954fdc4bdcf1bd71a0064279ee75fed55a1c71850eaabdf667d6ab1c15eadccf7497668e5bb5ab13de33fef707fba14bfd52912 SHA512 5f403d3a52f724383d25c23b08e8001954300fa8f07a5b49df440ef4d06ef756404a6e448093c4f4d4f9a470b1c3f2b1b8b27d3d227ac1823552f6a377edd06a
+DIST perl-cross-1.4.tar.gz 113861 BLAKE2B 7c7783afccc6a04ab122a7c60b1cff7f0a2725655b2b63325ca25d7b8acb0cf993b496e2a590db943054336337ad215550b6b2a565f1d91a5aa9cfe3a4c36db4 SHA512 bde73cac13c0b42c4c6783d7e30dea491d70b65131e1c8434ef75db1f39a8e15ef5857568b706e8456faa3822402676dd247a1f20f4bed983597fdd5a6b4faad
 DIST perl-cross-1.5.2.tar.gz 120097 BLAKE2B 8703816363b41ea5fe528b192ed28b169cf0bfc3c61a9332682240bdc02f6ef0208fc0202517ba03e7c177bfbb52783c833aacaf2d16583e0f90bd58805a03ff SHA512 fb16316add0a7458f087295077518402eddaa1c759da6e268742e9ba5439cb3f1db7adcd7ef769c4a613b7518ff9e48849f60b24bd2a6daaaf6e96b59bbf0ac8
 DIST perl-cross-1.5.tar.gz 115073 BLAKE2B ecc2764beef5dd188e56c2e499297e09e03a48fe4cb3b1582005e5899d7a3e9f28b9e600a18e16560a9a1955fef6d0a543a601574991a3853c8c9cdee7acc5df SHA512 b358d79e10777118b97568329e11b6b72cfe4960f2f3c0e857de31b515bd588448ad224d182b083f4075b47fd3877decbb037e7d26d4ba090011e6e41946370f

diff --git a/dev-lang/perl/files/perl-5.36.0-clang16.patch b/dev-lang/perl/files/perl-5.36.0-clang16.patch
new file mode 100644
index 000000000000..dc7305a3acf1
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.36.0-clang16.patch
@@ -0,0 +1,129 @@
+https://bugs.gentoo.org/879857
+https://github.com/Perl/perl5/commit/e1ca9a418fa6b7d26fbb1931c9164141035262c3
+https://github.com/Perl/perl5/commit/fc35cee89c1a42558f50a37a6b4d5186b77f058b
+
+From e1ca9a418fa6b7d26fbb1931c9164141035262c3 Mon Sep 17 00:00:00 2001
+From: Peter Levine <plevine457@gmail.com>
+Date: Tue, 17 Jan 2023 02:47:12 -0500
+Subject: [PATCH] Add parameter types to declarations for clang-16
+
+ANSI C style function declarations without parameter types are errors with clang-16.
+--- a/Configure
++++ b/Configure
+@@ -7927,10 +7927,10 @@ $cat >malloc.c <<END
+ #include <stdlib.h>
+ #endif
+ #ifdef TRY_MALLOC
+-void *malloc();
++void *malloc(size_t);
+ #endif
+ #ifdef TRY_FREE
+-void free();
++void free(void *);
+ #endif
+ END
+ case "$malloctype" in
+
+From fc35cee89c1a42558f50a37a6b4d5186b77f058b Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer@redhat.com>
+Date: Tue, 17 Jan 2023 19:07:54 +0100
+Subject: [PATCH] Configure: Add various C99 compatibility improvements
+
+Two C99 compatibility issues are fixed by these changes: Return
+types are made explicit where they previously defaulted to int,
+and all called functions are now declared explicitly (either by
+including additional headers, or by adding prototypes manually).
+
+This avoids implict ints and implicit function declarations,
+both legacy C language features removed in the 1999 revision
+of the language.
+
+Verified with an instrumented GCC compiler on GNU/Linux.
+--- a/Configure
++++ b/Configure
+@@ -4655,7 +4655,7 @@ esac
+ # so we will take those off from locincpth.
+ case "$gccversion" in
+ 3.*)
+-    echo "main(){}">try.c
++    echo "int main(){}">try.c
+     for incdir in $locincpth; do
+        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
+ 	     grep '^c[cp]p*[01]: warning: changing search order '`
+@@ -5798,6 +5798,7 @@ case "$intsize" in
+ #ifdef I_STDLIB
+ #include <stdlib.h>
+ #endif
++#include <stdio.h>
+ int main()
+ {
+ 	printf("intsize=%d;\n", (int)sizeof(int));
+@@ -6871,6 +6872,7 @@ case "$doublesize" in
+ #ifdef I_STDLIB
+ #include <stdlib.h>
+ #endif
++#include <stdio.h>
+ int main()
+ {
+     printf("%d\n", (int)sizeof(double));
+@@ -12660,7 +12662,7 @@ case "$dlsrc" in
+ dl_dlopen.xs)
+ 	echo "Checking whether your dlsym() needs a leading underscore ..." >&4
+ 	$cat >dyna.c <<'EOM'
+-fred () { }
++void fred (void) { }
+ EOM
+ 
+ $cat >fred.c<<EOM
+@@ -12679,7 +12681,7 @@ $cat >fred.c<<EOM
+ #include <link.h>
+ #endif
+ 
+-extern int fred() ;
++extern void fred(void) ;
+ 
+ int main()
+ {
+@@ -13713,6 +13715,7 @@ $cat >try.c <<EOP
+ #ifdef I_STDLIB
+ #include <stdlib.h>
+ #endif
++#include <string.h>
+ #define FILE_ptr(fp)	$stdio_ptr
+ #define FILE_cnt(fp)	$stdio_cnt
+ int main() {
+@@ -16220,6 +16223,7 @@ echo "Checking to see if your libm supports _LIB_VERSION..." >&4
+ $cat >try.c <<EOCP
+ #include <unistd.h>
+ #include <math.h>
++#include <stdio.h>
+ int main (int argc, char *argv[])
+ {
+     printf ("%d\n", _LIB_VERSION);
+@@ -22168,13 +22172,15 @@ pager="$ans"
+ : see if ar generates random libraries by itself
+ echo " "
+ echo "Checking how to generate random libraries on your machine..." >&4
+-echo 'int bar1() { return bar2(); }' > bar1.c
++echo 'extern int bar2(); int bar1() { return bar2(); }' > bar1.c
+ echo 'int bar2() { return 2; }' > bar2.c
+ $cat > foo.c <<EOP
+ #$i_stdlib I_STDLIB
+ #ifdef I_STDLIB
+ #include <stdlib.h>
+ #endif
++#include <stdio.h>
++extern int bar1();
+ int main() { printf("%d\n", bar1()); exit(0); }
+ EOP
+ $cc $ccflags -c bar1.c >/dev/null 2>&1
+@@ -22400,7 +22406,7 @@ EOM
+ 			for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
+ 				for tmo in 'struct timeval *' 'const struct timeval *'; do
+ 					case "$val" in
+-					'')	try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
++					'')	try="$extern_C int select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
+ 						if ./protochk "$try" $hdrs; then
+ 							echo "Your system accepts $xxx."
+ 							val="$xxx"
+

diff --git a/dev-lang/perl/perl-5.36.0-r2.ebuild b/dev-lang/perl/perl-5.36.0-r2.ebuild
new file mode 100644
index 000000000000..faa2f998b616
--- /dev/null
+++ b/dev-lang/perl/perl-5.36.0-r2.ebuild
@@ -0,0 +1,816 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit alternatives flag-o-matic toolchain-funcs multilib multiprocessing
+
+PATCH_VER=1
+CROSS_VER=1.4
+PATCH_BASE="perl-5.36.0-patches-${PATCH_VER}"
+PATCH_DEV=dilfridge
+
+DIST_AUTHOR=RJBS
+
+# Greatest first, don't include yourself
+# Devel point-releases are not ABI-intercompatible, but stable point releases are
+# BIN_OLDVERSEN contains only C-ABI-intercompatible versions
+PERL_BIN_OLDVERSEN=""
+
+if [[ "${PV##*.}" == "9999" ]]; then
+	DIST_VERSION=5.30.0
+else
+	DIST_VERSION="${PV/_rc/-RC}"
+fi
+SHORT_PV="${DIST_VERSION%.*}"
+
+# Even numbered major versions are ABI intercompatible
+# Odd numbered major versions are not
+if [[ $(( ${SHORT_PV#*.} % 2 )) == 1 ]]; then
+	SUBSLOT="${DIST_VERSION%-RC*}"
+else
+	SUBSLOT="${DIST_VERSION%.*}"
+fi
+
+# Used only in tar paths
+MY_P="perl-${DIST_VERSION}"
+# Used in library paths
+MY_PV="${DIST_VERSION%-RC*}"
+
+DESCRIPTION="Larry Wall's Practical Extraction and Report Language"
+
+SRC_URI="
+	mirror://cpan/src/5.0/${MY_P}.tar.xz
+	mirror://cpan/authors/id/${DIST_AUTHOR:0:1}/${DIST_AUTHOR:0:2}/${DIST_AUTHOR}/${MY_P}.tar.xz
+	https://github.com/gentoo-perl/perl-patchset/releases/download/${PATCH_BASE}/${PATCH_BASE}.tar.xz
+	https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${PATCH_BASE}.tar.xz
+	https://github.com/arsv/perl-cross/releases/download/${CROSS_VER}/perl-cross-${CROSS_VER}.tar.gz
+"
+
+HOMEPAGE="https://www.perl.org/"
+
+LICENSE="|| ( Artistic GPL-1+ )"
+SLOT="0/${SUBSLOT}"
+
+if [[ "${PV##*.}" != "9999" ]] && [[ "${PV/rc//}" == "${PV}" ]] ; then
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+fi
+
+IUSE="berkdb debug doc gdbm ithreads minimal quadmath"
+
+RDEPEND="
+	berkdb? ( sys-libs/db:= )
+	gdbm? ( >=sys-libs/gdbm-1.8.3:= )
+	app-arch/bzip2
+	>=sys-libs/zlib-1.2.12
+	virtual/libcrypt:=
+"
+DEPEND="${RDEPEND}"
+BDEPEND="${RDEPEND}"
+
+PDEPEND="
+	!minimal? (
+		>=app-admin/perl-cleaner-2.5
+		>=virtual/perl-CPAN-2.290.0
+		>=virtual/perl-Encode-3.120.0
+		>=virtual/perl-File-Temp-0.230.400-r2
+		>=virtual/perl-Data-Dumper-2.154.0
+		virtual/perl-Test-Harness
+	)
+"
+# bug 390719, bug 523624
+# virtual/perl-Test-Harness is here for the bundled ExtUtils::MakeMaker
+
+S="${WORKDIR}/${MY_P}"
+
+dual_scripts() {
+	src_remove_dual      perl-core/Archive-Tar        2.400.0       ptar ptardiff ptargrep
+	src_remove_dual      perl-core/CPAN               2.330.0       cpan
+	src_remove_dual      perl-core/Digest-SHA         6.20.0        shasum
+	src_remove_dual      perl-core/Encode             3.170.0       enc2xs piconv
+	src_remove_dual      perl-core/ExtUtils-MakeMaker 7.640.0       instmodsh
+	src_remove_dual      perl-core/ExtUtils-ParseXS   3.450.0       xsubpp
+	src_remove_dual      perl-core/IO-Compress        2.106.0       zipdetails
+	src_remove_dual      perl-core/JSON-PP            4.70.0        json_pp
+	src_remove_dual      perl-core/Module-CoreList    5.202.205.200 corelist
+	src_remove_dual      perl-core/Pod-Checker        1.740.0       podchecker
+	src_remove_dual      perl-core/Pod-Perldoc        3.280.100     perldoc
+	src_remove_dual      perl-core/Pod-Usage          2.10.0       pod2usage
+	src_remove_dual      perl-core/Test-Harness       3.440.0       prove
+	src_remove_dual      perl-core/podlators          4.140.0       pod2man pod2text
+	src_remove_dual_man  perl-core/podlators          4.140.0       /usr/share/man/man1/perlpodstyle.1
+}
+
+check_rebuild() {
+	# Fresh install
+	if [[ -z "${REPLACING_VERSIONS}" ]]; then
+		return 0;
+	# Major Upgrade
+	# doesn't matter if there's multiple copies, it still needs a rebuild
+	# if the string is anything other than "5.CURRENTMAJOR"
+	elif [[ "${REPLACING_VERSIONS%.*}" != "${PV%.*}" ]]; then
+		echo ""
+		ewarn "UPDATE THE PERL MODULES:"
+		ewarn "After updating dev-lang/perl the installed Perl modules"
+		ewarn "have to be re-installed. In most cases, this is done automatically"
+		ewarn "by the package manager, but subsequent steps are still recommended"
+		ewarn "to ensure system consistency."
+		ewarn
+		ewarn "You should start with a depclean to remove any unused perl dependencies"
+		ewarn "that may confuse portage in future. Regular depcleans are also encouraged"
+		ewarn "as part of your regular update cycle, as that will keep perl upgrades working."
+		ewarn "Recommended: emerge --depclean -va"
+		ewarn
+		ewarn "You should then call perl-cleaner to clean up any old files and trigger any"
+		ewarn "remaining rebuilds portage may have missed."
+		ewarn "Use: perl-cleaner --all"
+		return 0;
+
+	# Reinstall w/ USE Change
+	elif
+		 (   use ithreads && ! has_version dev-lang/perl[ithreads] ) || \
+		 ( ! use ithreads &&   has_version dev-lang/perl[ithreads] ) || \
+		 (   use quadmath && ! has_version dev-lang/perl[quadmath] ) || \
+		 ( ! use quadmath &&   has_version dev-lang/perl[quadmath] ) || \
+		 (   use debug    && ! has_version dev-lang/perl[debug]    ) || \
+		 ( ! use debug    &&   has_version dev-lang/perl[debug]    ) ; then
+		echo ""
+		ewarn "TOGGLED USE-FLAGS WARNING:"
+		ewarn "You changed one of the use-flags ithreads, quadmath, or debug."
+		ewarn "You must rebuild all perl-modules installed."
+		ewarn "Use: perl-cleaner --modules ; perl-cleaner --force --libperl"
+	fi
+}
+
+pkg_setup() {
+	case ${CHOST} in
+		*-darwin*)    osname="darwin" ;;
+		*-solaris*)   osname="solaris" ;;
+		*)            osname="linux" ;;
+	esac
+
+	myarch="${CHOST%%-*}-${osname}"
+	if use debug ; then
+		myarch+="-debug"
+	fi
+	if use quadmath ; then
+		myarch+="-quadmath"
+	fi
+	if use ithreads ; then
+		mythreading="-multi"
+		myarch+="-thread"
+	fi
+
+	PRIV_BASE="/usr/$(get_libdir)/perl5"
+	SITE_BASE="/usr/local/$(get_libdir)/perl5"
+	VENDOR_BASE="/usr/$(get_libdir)/perl5/vendor_perl"
+
+	LIBPERL="libperl$(get_libname ${MY_PV} )"
+
+	PRIV_LIB="${PRIV_BASE}/${SUBSLOT}"
+	ARCH_LIB="${PRIV_BASE}/${SUBSLOT}/${myarch}${mythreading}"
+	SITE_LIB="${SITE_BASE}/${SUBSLOT}"
+	SITE_ARCH="${SITE_BASE}/${SUBSLOT}/${myarch}${mythreading}"
+	VENDOR_LIB="${VENDOR_BASE}/${SUBSLOT}"
+	VENDOR_ARCH="${VENDOR_BASE}/${SUBSLOT}/${myarch}${mythreading}"
+
+	dual_scripts
+}
+
+src_remove_dual_file() {
+	local i pkg ver
+	pkg="$1"
+	ver="$2"
+	shift 2
+	case "${EBUILD_PHASE:-none}" in
+		postinst|postrm)
+			for i in "$@" ; do
+				alternatives_auto_makesym "${i}" "${i}-[0-9]*"
+			done
+			;;
+		setup)
+			for i in "$@" ; do
+				if [[ -f ${EROOT}${i} && ! -h ${EROOT}${i} ]] ; then
+					has_version ${pkg} && ewarn "You must reinstall ${pkg} !"
+					break
+				fi
+			done
+			;;
+		install)
+			for i in "$@" ; do
+				if ! [[ -f "${ED}"${i} ]] ; then
+					ewarn "${i} does not exist!"
+					continue
+				fi
+				mv "${ED}"${i}{,-${ver}-${P}} || die
+			done
+			;;
+	esac
+}
+
+src_remove_dual_man() {
+	local i pkg ver ff
+	pkg="$1"
+	ver="$2"
+	shift 2
+	case "${EBUILD_PHASE:-none}" in
+		postinst|postrm)
+			for i in "$@" ; do
+				ff=`echo "${EROOT}${i%.[0-9]}-${ver}-${P}${i#${i%.[0-9]}}"*`
+				ff=${ff##*${i#${i%.[0-9]}}}
+				alternatives_auto_makesym "${i}${ff}" "${i%.[0-9]}-[0-9]*"
+			done
+			;;
+		install)
+			for i in "$@" ; do
+				if ! [[ -f "${ED}"${i} ]] ; then
+					ewarn "${i} does not exist!"
+					continue
+				fi
+				mv "${ED}"${i} "${ED}"${i%.[0-9]}-${ver}-${P}${i#${i%.[0-9]}} || die
+			done
+			;;
+	esac
+}
+
+src_remove_dual() {
+	local i pkg ver
+	pkg="$1"
+	ver="$2"
+	shift 2
+	for i in "$@" ; do
+		src_remove_dual_file  "${pkg}" "${ver}" "/usr/bin/${i}"
+		src_remove_dual_man   "${pkg}" "${ver}" "/usr/share/man/man1/${i}.1"
+	done
+}
+
+src_prepare_perlcross() {
+	cp -a ../perl-cross-${CROSS_VER}/* . || die
+
+	# bug 794463, needs further analysis what is exactly wrong here
+	eapply "${FILESDIR}/perl-5.34.0-crossfit.patch"
+
+	# bug 604072
+	MAKEOPTS+=" -j1"
+	export MAKEOPTS
+}
+
+src_prepare_dynamic() {
+	ln -s ${LIBPERL} libperl$(get_libname ${SHORT_PV}) || die
+	ln -s ${LIBPERL} libperl$(get_libname ) || die
+}
+
+# Copy a patch into the patch series
+# add_patch SRC_PATH DEST_NAME ['description'] ['bug'] ['bug']
+# - description is optional, but recommended
+# - all arguments after descriptions are bug URLs
+add_patch() {
+	local patchdir="${WORKDIR}/patches"
+	local infodir="${WORKDIR}/patch-info"
+	local src_name dest_name desc
+	src_name="$1"
+	dest_name="$2"
+	desc="$3"
+	shift; shift; shift;
+	einfo "Adding ${dest_name} to patch bundle"
+	cp "${src_name}" "${patchdir}/${dest_name}" || die "Couldn't copy ${src_name} to ${dest_name}"
+	if [[ -n "${desc}" ]]; then
+		printf "%s" "${desc}" > "${infodir}/${dest_name}.desc" || die "Couldn't write ${dest_name}.desc"
+	fi
+	if [[ $# -gt 0 ]]; then
+		# Note: when $@ is more than one element, this emits a
+		# line for each element
+		printf "%s\n" "$@" > "${infodir}/${dest_name}.bugs" || die "Couldn't write ${dest_name}.bugs"
+	fi
+}
+
+# Remove a patch using a glob expr
+# eg:
+#	 rm_patch *-darwin-Use-CC*
+#
+rm_patch() {
+	local patchdir="${WORKDIR}/patches"
+	local expr="$1"
+	local patch="$( cd "${patchdir}"; echo $expr )"
+	einfo "Removing $patch ($expr) from patch bundle"
+	if [[ -e "${patchdir}/${patch}" ]]; then
+		rm -f "${patchdir}/${patch}" || die "Can't remove ${patch} ( $expr )"
+	else
+		ewarn "No ${expr} found in ${patchdir} to remove"
+	fi
+}
+
+# Yes, this is a reasonable amount of code for something seemingly simple
+# but this is far easier to debug when things go wrong, and things went wrong
+# multiple times while I was getting the exact number of slashes right, which
+# requires circumnavigating both bash and sed escape mechanisms.
+c_escape_string() {
+	local slash dquote
+	slash='\'
+	dquote='"'
+	re_slash="${slash}${slash}"
+	re_dquote="${slash}${dquote}"
+
+	# Convert \ to \\,
+	#         " to \"
+	echo "$1" |\
+		sed "s|${re_slash}|${re_slash}${re_slash}|g" |\
+		sed "s|${re_dquote}|${re_slash}${re_dquote}|g"
+}
+c_escape_file() {
+	c_escape_string "$(cat "$1")"
+}
+
+apply_patchdir() {
+	local patchdir="${WORKDIR}/patches"
+	local infodir="${WORKDIR}/patch-info"
+	local patchoutput="patchlevel-gentoo.h"
+
+	# Inject Patch-Level info into description for patchlevel.h patch
+	# to show in -V
+	local patch_expr="*List-packaged-patches*"
+	local patch="$( cd "${patchdir}"; echo $patch_expr )";
+	einfo "Injecting patch-level info into ${patch}.desc ( $patch_expr )"
+
+	if [[ -e "${patchdir}/${patch}" ]]; then
+		printf "List packaged patches for %s(%s) in patchlevel.h" "${PF}" "${PATCH_BASE}"\
+			>"${infodir}/${patch}.desc" || die "Can't rewrite ${patch}.desc"
+	else
+		eerror "No $patch_expr found in ${patchdir}"
+	fi
+
+	# Compute patch list to apply
+	# different name other than PATCHES to stop default
+	# reapplying it
+	# Single depth is currently only supported, as artifacts can reside
+	# from the old layout being multiple-directories, as well as it grossly
+	# simplifying the patchlevel_gentoo.h generation.
+	local PERL_PATCHES=($(
+		find "${patchdir}" -maxdepth 1 -mindepth 1 -type f -printf "%f\n" |\
+			grep -E '[.](diff|patch)$' |\
+			sort -n
+	))
+
+	for patch in "${PERL_PATCHES[@]}"; do
+		eapply "${WORKDIR}"/patches/${patch}
+	done
+
+	einfo "Generating $patchoutput"
+
+	# This code creates a header file, each iteration
+	# creates one-or-more-lines for each entry found in PERL_PATCHES
+	# and STDOUT is redirected to the .h file
+	for patch in "${PERL_PATCHES[@]}"; do
+		local desc_f="${infodir}/${patch}.desc"
+		local bugs_f="${infodir}/${patch}.bugs"
+
+		printf ',"%s"\n' "${patch}"
+		if [[ ! -e "${desc_f}" ]]; then
+			ewarn "No description provided for ${patch} (expected: ${desc_f} )"
+		else
+			local desc="$(c_escape_file "${desc_f}")"
+			printf ',"- %s"\n' "${desc}"
+		fi
+		if [[ -e "${bugs_f}" ]]; then
+			while read -d $'\n' -r line; do
+				local esc_line="$(c_escape_string "${line}")"
+				printf ',"- Bug: %s"\n' "${esc_line}"
+			done <"${bugs_f}"
+		fi
+	done > "${S}/${patchoutput}"
+	printf "%s\n" "${patchoutput}" >> "${S}/MANIFEST"
+
+}
+
+src_prepare() {
+	local patchdir="${WORKDIR}/patches"
+
+	# Prepare Patch dir with additional patches / remove unwanted patches
+	# Inject bug/desc entries for perl -V
+	# Old example:
+	# add_patch "${FILESDIR}/${PN}-5.26.2-hppa.patch" "100-5.26.2-hppa.patch"\
+	#		"Fix broken miniperl on hppa"\
+	#		"https://bugs.debian.org/869122" "https://bugs.gentoo.org/634162"
+	add_patch "${FILESDIR}/${PN}-5.36.0-clang16.patch" "100-5.36.0-clang16.patch" \
+			"Fix Clang 16 / modern C issues in configure" \
+			"https://bugs.gentoo.org/879857" "https://github.com/Perl/perl5/issues/20715"
+
+	if [[ ${CHOST} == *-solaris* ]] ; then
+		# do NOT mess with nsl, on Solaris this is always necessary,
+		# when -lsocket is used e.g. to get h_errno
+		rm_patch "*-nsl-and-cl*"
+	fi
+
+	apply_patchdir
+
+	tc-is-cross-compiler && src_prepare_perlcross
+
+	tc-is-static-only || src_prepare_dynamic
+
+	if use gdbm; then
+		sed -i "s:INC => .*:INC => \"-I${EROOT}/usr/include/gdbm\":g" \
+			ext/NDBM_File/Makefile.PL || die
+	fi
+
+	# Use errno.h from prefix rather than from host system, bug #645804
+	if use prefix && [[ -e "${EPREFIX}"/usr/include/errno.h ]] ; then
+		sed -i "/my..sysroot/s:'':'${EPREFIX}':" ext/Errno/Errno_pm.PL || die
+	fi
+
+	if [[ ${CHOST} == *-solaris* ]] ; then
+		# set a soname, fix linking against just built libperl
+		sed -i -e 's/netbsd\*/netbsd*|solaris*/' Makefile.SH || die
+	fi
+
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		# fix install_name (soname) not to reference $D
+		sed -i -e '/install_name `pwd/s/`pwd`/\\$(shrpdir)/' Makefile.SH || die
+
+		# fix environ linkage absence (only a real issue on Darwin9)
+		if [[ ${CHOST##*-darwin} -le 9 ]] ; then
+			sed -i -e '/^PLDLFLAGS =/s/=/= -include crt_externs.h -Denviron="(*_NSGetEnviron())"/' \
+				Makefile.SH || die
+		fi
+	fi
+
+	default
+}
+
+myconf() {
+	# the myconf array is declared in src_configure
+	myconf=( "${myconf[@]}" "$@" )
+}
+
+# Outputs a list of versions which have been seen in any of the
+# primary perl @INC prefix paths, such as:
+#  /usr/lib64/perl5/<NUMBER>
+#  /usr/local/lib64/perl5/<NUMBER>
+#  /usr/lib64/perl5/vendor_perl/<NUMBER>
+#
+# All values of NUMBER must be like "5.x.y" or like "5.x"
+#
+find_candidate_inc_versions() {
+	local regex='.*/5[.][0-9]+\([.][0-9]+\|\)$'
+	local dirs=(
+		"${EROOT}${PRIV_BASE}"
+		"${EROOT}${SITE_BASE}"
+		"${EROOT}${VENDOR_BASE}"
+	)
+	for dir in "${dirs[@]}"; do
+		if [[ ! -e "${dir}" ]]; then
+			continue
+		fi
+		# Without access to readdir() on these dirs, find will not be able
+		# to reveal any @INC directories inside them, and will subsequently prune
+		# them from the built perl's @INC support, breaking our compatiblity options
+		# entirely.
+		if [[ ! -r "${dir}" || ! -x "${dir}" ]]; then
+			eerror "Bad permissions on ${dir}, this will probably break things"
+			eerror "Ensure ${dir} is +rx for at least uid=$EUID"
+			eerror "Recommended permission is +rx for all"
+			eerror "> chmod o+rx ${dir}"
+		fi
+	done
+	einfo "Scanning for old @INC dirs matching '$regex' in: ${dirs[*]}"
+	find "${dirs[@]}" -maxdepth 1 -mindepth 1 -type d -regex "${regex}" -printf "%f "  2>/dev/null
+}
+
+# Sort versions passed versiony-ly, remove self-version if present
+# dedup. Takes each version as an argument
+sanitize_inc_versions() {
+	local vexclude="${SUBSLOT}"
+	einfo "Normalizing/Sorting candidate list: $*"
+	einfo " to remove '${vexclude}'"
+	# Note, general numeric sort has to be used
+	# for the last component, or unique will convert
+	#  5.30.0 + 5.30 into just 5.30
+	printf "%s\n" "$@" |\
+		grep -vxF "${vexclude}" |\
+		sort -u -nr -t'.' -k1,1rn -k2,2rn -k3,3rg
+}
+
+versions_to_inclist() {
+	local oldv="${DIST_VERSION%-RC} ${PERL_BIN_OLDVERSEN}"
+
+	for v;	do
+			has "${v}" ${oldv} && echo -n "${v}/${myarch}${mythreading}/ ";
+			echo -n "${v}/ ";
+	done
+}
+
+versions_to_gentoolibdirs() {
+	local oldv="${DIST_VERSION%-RC} ${PERL_BIN_OLDVERSEN}"
+	local root
+	local v
+	for v;	do
+		for root in "${PRIV_BASE}" "${VENDOR_BASE}" "${SITE_BASE}"; do
+			local fullpath="${EROOT}${root}/${v}"
+			if [[ -e "${fullpath}" ]]; then
+				has "${v}" ${oldv} && printf "%s:" "${fullpath}/${myarch}${mythreading}";
+				printf "%s:" "${fullpath}"
+			fi
+		done
+	done
+}
+
+src_configure() {
+	declare -a myconf
+
+	export LC_ALL="C"
+	[[ ${COLUMNS:-1} -ge 1 ]] || unset COLUMNS # bug #394091
+
+	# Perl has problems compiling with -Os in your flags with glibc
+	replace-flags "-Os" "-O2"
+
+	# xlocale.h is going away in glibc-2.26, so it's counterproductive
+	# if we use it and include it in CORE/perl.h ... Perl builds just
+	# fine with glibc and locale.h only.
+	# However, the darwin prefix people have no locale.h ...
+	use elibc_glibc && myconf -Ui_xlocale
+
+	# This flag makes compiling crash in interesting ways
+	filter-flags "-malign-double"
+
+	# Generic LTO broken since 5.28, triggers EUMM failures
+	filter-flags "-flto"
+
+	use sparc && myconf -Ud_longdbl
+
+	export BUILD_BZIP2=0
+	export BZIP2_INCLUDE=${EROOT}/usr/include
+	export BZIP2_LIB=${EROOT}/usr/$(get_libdir)
+
+	export BUILD_ZLIB=False
+	export ZLIB_INCLUDE=${EROOT}/usr/include
+	export ZLIB_LIB=${EROOT}/usr/$(get_libdir)
+
+	# allow either gdbm to provide ndbm (in <gdbm/ndbm.h>) or db1
+	myndbm='U'
+	mygdbm='U'
+	mydb='U'
+	if use gdbm ; then
+		mygdbm='D'
+		if use berkdb ; then
+			myndbm='D'
+		fi
+	fi
+	if use berkdb ; then
+		mydb='D'
+		has_version '=sys-libs/db-1*' && myndbm='D'
+	fi
+
+	myconf "-${myndbm}i_ndbm" "-${mygdbm}i_gdbm" "-${mydb}i_db"
+
+	if use alpha && [[ "$(tc-getCC)" = "ccc" ]] ; then
+		ewarn "Perl will not be built with berkdb support, use gcc if you needed it..."
+		myconf -Ui_db -Ui_ndbm
+	fi
+
+	use ithreads && myconf -Dusethreads
+
+	use quadmath && myconf -Dusequadmath
+
+	if use debug ; then
+		append-cflags "-g"
+		myconf -DDEBUGGING
+	elif [[ ${CFLAGS} == *-g* ]] ; then
+		myconf -DDEBUGGING=-g
+	else
+		myconf -DDEBUGGING=none
+	fi
+
+	# modifying 'optimize' prevents cross configure script from appending required flags
+	if tc-is-cross-compiler; then
+		append-cflags "-fwrapv"
+	fi
+
+	# bug #877659, bug #821577
+	append-cflags -fno-strict-aliasing
+
+	# Autodiscover all old version directories, some of them will even be newer
+	# if you downgrade
+	if [[ -z ${PERL_OLDVERSEN} ]]; then
+		PERL_OLDVERSEN="$( find_candidate_inc_versions )"
+	fi
+
+	# Fixup versions, removing self match, fixing order and dupes
+	PERL_OLDVERSEN="$( sanitize_inc_versions ${PERL_OLDVERSEN} )"
+
+	# Experts who want a "Pure" install can set PERL_OLDVERSEN to an empty string
+	if [[ -n "${PERL_OLDVERSEN// }" ]]; then
+		local inclist="$( versions_to_inclist ${PERL_OLDVERSEN} )"
+		einfo "This version of perl may partially support modules previously"
+		einfo "installed in any of the following paths:"
+		for incpath in ${inclist}; do
+			[[ -e "${EROOT}${VENDOR_BASE}/${incpath}" ]] && einfo " ${EROOT}${VENDOR_BASE}/${incpath}"
+			[[ -e "${EROOT}${PRIV_BASE}/${incpath}"   ]] && einfo " ${EROOT}${PRIV_BASE}/${incpath}"
+			[[ -e "${EROOT}${SITE_BASE}/${incpath}"   ]] && einfo " ${EROOT}${SITE_BASE}/${incpath}"
+		done
+		einfo "This is a temporary measure and you should aim to cleanup these paths"
+		einfo "via world updates and perl-cleaner"
+		# myconf -Dinc_version_list="${inclist}"
+		myconf -Dgentoolibdirs="$( versions_to_gentoolibdirs ${PERL_OLDVERSEN} )"
+	fi
+
+	[[ ${ELIBC} == "FreeBSD" ]] && myconf "-Dlibc=/usr/$(get_libdir)/libc.a"
+
+	# Make sure we can do the final link #523730, need to set deployment
+	# target to override hardcoded 10.3 which breaks on modern OSX
+	[[ ${CHOST} == *-darwin* ]] && \
+		myconf "-Dld=env MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} $(tc-getCC)"
+
+	# Older macOS with non-Apple GCC chokes on inline in system headers
+	# using c89 mode as injected by cflags.SH, in addition, we override
+	# cflags, so we loose PERL_DARWIN which enables compat code that
+	# apparently on more recent macOS releases is no longer necessary
+	[[ ${CHOST} == *-darwin* && ${CHOST##*darwin} -le 9 ]] && tc-is-gcc && \
+		append-cflags -Dinline=__inline__ -DPERL_DARWIN
+
+	# Prefix: the host system needs not to follow Gentoo multilib stuff, and in
+	# Prefix itself we don't do multilib either, so make sure perl can find
+	# something compatible.
+	if use prefix ; then
+		# Set a hook to check for each detected library whether it actually works.
+		export libscheck="
+			( echo 'main(){}' > '${T}'/conftest.c &&
+				$(tc-getCC) -o '${T}'/conftest '${T}'/conftest.c -l\$thislib >/dev/null 2>/dev/null
+			) || xxx=/dev/null"
+
+		# Use all host paths that might contain useful stuff, the hook above will filter out bad choices.
+		local paths="/lib/*-linux-gnu /usr/lib/*-linux-gnu /lib64 /lib/64 /usr/lib64 /usr/lib/64 /lib32 /usr/lib32 /lib /usr/lib"
+		myconf "-Dlibpth=${EPREFIX}/$(get_libdir) ${EPREFIX}/usr/$(get_libdir) ${paths}"
+	elif [[ $(get_libdir) != "lib" ]] ; then
+		# We need to use " and not ', as the written config.sh use ' ...
+		myconf "-Dlibpth=/usr/local/$(get_libdir) /$(get_libdir) /usr/$(get_libdir)"
+	fi
+
+	# don't try building ODBM, bug #354453
+	disabled_extensions="ODBM_File"
+
+	if ! use gdbm ; then
+		# workaround for bug #157774: don't try building GDBM related stuff with USE="-gdbm"
+		disabled_extensions="${disabled_extensions} GDBM_File NDBM_File"
+	fi
+
+	myconf -Dnoextensions="${disabled_extensions}"
+
+	[[ "${PV##*.}" == "9999" ]] && myconf -Dusedevel -Uversiononly
+
+	[[ -n "${EXTRA_ECONF}" ]] && ewarn During Perl build, EXTRA_ECONF=${EXTRA_ECONF}
+	# allow fiddling via EXTRA_ECONF, bug 558070
+	eval "local -a EXTRA_ECONF=(${EXTRA_ECONF})"
+
+	# setting -Dld= to tc-getLD breaks perl and all perl things
+	# https://github.com/Perl/perl5/issues/17791#issuecomment-630145202
+	myconf \
+		-Duseshrplib \
+		-Darchname="${myarch}" \
+		-Dcc="$(tc-getCC)" \
+		-Dar="$(tc-getAR)" \
+		-Dnm="$(tc-getNM)" \
+		-Dcpp="$(tc-getCPP)" \
+		-Dranlib="$(tc-getRANLIB)" \
+		-Accflags="${CFLAGS}" \
+		-Doptimize="${CFLAGS}" \
+		-Dldflags="${LDFLAGS}" \
+		-Dprefix="${EPREFIX}"'/usr' \
+		-Dsiteprefix="${EPREFIX}"'/usr/local' \
+		-Dvendorprefix="${EPREFIX}"'/usr' \
+		-Dscriptdir="${EPREFIX}"'/usr/bin' \
+		-Dprivlib="${EPREFIX}${PRIV_LIB}" \
+		-Darchlib="${EPREFIX}${ARCH_LIB}" \
+		-Dsitelib="${EPREFIX}${SITE_LIB}" \
+		-Dsitearch="${EPREFIX}${SITE_ARCH}" \
+		-Dvendorlib="${EPREFIX}${VENDOR_LIB}" \
+		-Dvendorarch="${EPREFIX}${VENDOR_ARCH}" \
+		-Dman1dir="${EPREFIX}"/usr/share/man/man1 \
+		-Dman3dir="${EPREFIX}"/usr/share/man/man3 \
+		-Dsiteman1dir="${EPREFIX}"/usr/local/man/man1 \
+		-Dsiteman3dir="${EPREFIX}"/usr/local/man/man3 \
+		-Dvendorman1dir="${EPREFIX}"/usr/share/man/man1 \
+		-Dvendorman3dir="${EPREFIX}"/usr/share/man/man3 \
+		-Dman1ext='1' \
+		-Dman3ext='3pm' \
+		-Dlibperl="${LIBPERL}" \
+		-Dlocincpth="${EPREFIX}"'/usr/include ' \
+		-Dglibpth="${EPREFIX}/$(get_libdir) ${EPREFIX}/usr/$(get_libdir)"' ' \
+		-Duselargefiles \
+		-Dd_semctl_semun \
+		-Dcf_by='Gentoo' \
+		-Dmyhostname='localhost' \
+		-Dperladmin='root@localhost' \
+		-Ud_csh \
+		-Dsh="${EPREFIX}"/bin/sh \
+		-Dtargetsh="${EPREFIX}"/bin/sh \
+		-Uusenm \
+		"${EXTRA_ECONF[@]}"
+
+	if tc-is-cross-compiler; then
+		./configure \
+			--target="${CHOST}" \
+			--build="${CBUILD}" \
+			-Dinstallprefix='' \
+			-Dinstallusrbinperl='undef' \
+			-Dusevendorprefix='define' \
+			"${myconf[@]}" \
+			|| die "Unable to configure"
+	else
+		sh Configure \
+			-des \
+			-Dinstallprefix="${EPREFIX}"'/usr' \
+			-Dinstallusrbinperl='n' \
+			"${myconf[@]}" \
+			|| die "Unable to configure"
+	fi
+}
+
+src_test() {
+	export NO_GENTOO_NETWORK_TESTS=1;
+	export GENTOO_ASSUME_SANDBOXED="${GENTOO_ASSUME_SANDBOXED:-1}"
+	export GENTOO_NO_PORTING_TESTS="${GENTOO_NO_PORTING_TESTS:-1}"
+	if [[ ${EUID} == 0 ]] ; then
+		ewarn "Test fails with a sandbox error (#328793) if run as root. Skipping tests..."
+		return 0
+	fi
+	TEST_JOBS="$(makeopts_jobs)" make test_harness || die "test failed"
+}
+
+src_install() {
+	local i
+	local coredir="${ARCH_LIB}/CORE"
+
+	emake DESTDIR="${D}" install
+
+	rm -f "${ED}/usr/bin/perl${MY_PV}"
+	ln -s perl "${ED}"/usr/bin/perl${MY_PV} || die
+
+	if ! tc-is-static-only ; then
+		dolib.so "${ED}"${coredir}/${LIBPERL}
+		rm -f "${ED}"${coredir}/${LIBPERL}
+		ln -sf ${LIBPERL} "${ED}"/usr/$(get_libdir)/libperl$(get_libname ${SHORT_PV}) || die
+		ln -sf ${LIBPERL} "${ED}"/usr/$(get_libdir)/libperl$(get_libname) || die
+
+		ln -sf ../../../../${LIBPERL} "${ED}"${coredir}/${LIBPERL} || die
+		ln -sf ../../../../${LIBPERL} "${ED}"${coredir}/libperl$(get_libname ${SHORT_PV}) || die
+		ln -sf ../../../../${LIBPERL} "${ED}"${coredir}/libperl$(get_libname) || die
+	fi
+
+	rm -rf "${ED}"/usr/share/man/man3 || die "Unable to remove module man pages"
+
+	# This removes ${D} from Config.pm
+	for i in $(find "${D}" -iname "Config.pm" ) ; do
+		einfo "Removing ${D} from ${i}..."
+		sed -i -e "s:${D}::" "${i}" || die "Sed failed"
+	done
+
+	dodoc Changes* README AUTHORS
+
+	if use doc ; then
+		# HTML Documentation
+		# We expect errors, warnings, and such with the following.
+
+		dodir /usr/share/doc/${PF}/html
+		LD_LIBRARY_PATH=. ./perl installhtml \
+			--podroot='.' \
+			--podpath='lib:ext:pod:vms' \
+			--recurse \
+			--htmldir="${ED}/usr/share/doc/${PF}/html"
+	fi
+
+	[[ -d ${ED}/usr/local ]] && rm -r "${ED}"/usr/local
+
+	dual_scripts
+}
+
+pkg_preinst() {
+	check_rebuild
+}
+
+pkg_postinst() {
+	dual_scripts
+
+	if [[ -z "${ROOT}" ]] ; then
+		local INC DIR file
+		INC=$(perl -e 'for $line (@INC) { next if $line eq "."; next if $line =~ m/'${SHORT_PV}'|etc|local|perl$/; print "$line\n" }')
+		einfo "Removing old .ph files"
+		for DIR in ${INC} ; do
+			if [[ -d "${DIR}" ]] ; then
+				for file in $(find "${DIR}" -name "*.ph" -type f ) ; do
+					rm -f "${file}"
+					einfo "<< ${file}"
+				done
+			fi
+		done
+		# Silently remove the now empty dirs
+		for DIR in ${INC} ; do
+			if [[ -d "${DIR}" ]] ; then
+				find "${DIR}" -depth -type d -print0 | xargs -0 -r rmdir &> /dev/null
+			fi
+		done
+
+	fi
+}
+
+pkg_postrm() {
+	dual_scripts
+}


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-lang/perl/files/, dev-lang/perl/
@ 2024-01-20 12:04 Sam James
  0 siblings, 0 replies; 12+ messages in thread
From: Sam James @ 2024-01-20 12:04 UTC (permalink / raw
  To: gentoo-commits

commit:     842c2e9bff302de882b067103e3abf20568e2ee8
Author:     Raul E Rangel <rrangel <AT> chromium <DOT> org>
AuthorDate: Thu May 18 18:32:34 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jan 20 12:00:21 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=842c2e9b

dev-lang/perl: Fix clang check in configure

The check was a bit too strict. `clang` actually appears in the middle
of the version string. This change will allow perl to build correctly
when `gcc` isn't present on the system.

See: https://github.com/Perl/perl5/issues/21099
Signed-off-by: Raul E Rangel <rrangel <AT> chromium.org>
Closes: https://github.com/gentoo/gentoo/pull/32677
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../perl-5.36.0-fix-configure-for-clang.patch      | 41 ++++++++++++++++++++++
 dev-lang/perl/perl-5.36.1-r3.ebuild                |  4 +++
 dev-lang/perl/perl-5.38.0-r1.ebuild                |  4 +++
 dev-lang/perl/perl-5.38.2-r1.ebuild                |  4 +++
 4 files changed, 53 insertions(+)

diff --git a/dev-lang/perl/files/perl-5.36.0-fix-configure-for-clang.patch b/dev-lang/perl/files/perl-5.36.0-fix-configure-for-clang.patch
new file mode 100644
index 000000000000..3ad508c95f7e
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.36.0-fix-configure-for-clang.patch
@@ -0,0 +1,41 @@
+From 40db21129c0ba08ea457b6e40e7357e86ea1404b Mon Sep 17 00:00:00 2001
+From: Raul E Rangel <rrangel@chromium.org>
+Date: Fri, 28 Jul 2023 15:50:49 -0600
+Subject: [PATCH] hints/linux: Add additional expression when matching clang
+
+Newer versions of clang actually print the distro before `clang` when
+calling `$CC --version`. This changes fixes the regex so it can match
+this new pattern.
+
+i.e.,
+
+	$ clang --version
+	Debian clang version 14.0.6
+
+	$ x86_64-pc-linux-gnu-clang --version
+	Chromium OS 17.0_pre496208_p20230501-r1 clang version 17.0.0
+
+Fixes #21099
+
+BUG=b:283275881
+See: https://github.com/Perl/perl5/issues/21099
+---
+ hints/linux.sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/hints/linux.sh b/hints/linux.sh
+index e1508c7509..5202b28b09 100644
+--- a/hints/linux.sh
++++ b/hints/linux.sh
+@@ -166,7 +166,7 @@ esac
+ if [ -x /usr/bin/gcc ] ; then
+     gcc=/usr/bin/gcc
+ # clang also provides -print-search-dirs
+-elif ${cc:-cc} --version 2>/dev/null | grep -q '^clang ' ; then
++elif ${cc:-cc} --version 2>/dev/null | grep -q -e '^clang version' -e ' clang version'; then
+     gcc=${cc:-cc}
+ else
+     gcc=gcc
+-- 
+2.41.0.585.gd2178a4bd4-goog
+

diff --git a/dev-lang/perl/perl-5.36.1-r3.ebuild b/dev-lang/perl/perl-5.36.1-r3.ebuild
index 553ab9f76a38..277079bb9ef4 100644
--- a/dev-lang/perl/perl-5.36.1-r3.ebuild
+++ b/dev-lang/perl/perl-5.36.1-r3.ebuild
@@ -395,6 +395,10 @@ src_prepare() {
 	add_patch "${FILESDIR}/${PN}-5.36.1-http-tiny.patch" "0111-5.36.1-http-tiny.patch"\
 			"Enable certificate checking in HTTP::Tiny by default"\
 			"https://bugs.gentoo.org/905296" "https://bugs.debian.org/954089"
+	add_patch "${FILESDIR}/${PN}-5.36.0-fix-configure-for-clang.patch" \
+			"100-5.36.0-fix-configure-for-clang.patch" \
+			"Fix clang check in configure" \
+			"https://github.com/Perl/perl5/issues/21099"
 
 	if [[ ${CHOST} == *-solaris* ]] ; then
 		# do NOT mess with nsl, on Solaris this is always necessary,

diff --git a/dev-lang/perl/perl-5.38.0-r1.ebuild b/dev-lang/perl/perl-5.38.0-r1.ebuild
index 66a37abc47a9..c518862f3ed4 100644
--- a/dev-lang/perl/perl-5.38.0-r1.ebuild
+++ b/dev-lang/perl/perl-5.38.0-r1.ebuild
@@ -395,6 +395,10 @@ src_prepare() {
 	# add_patch "${FILESDIR}/${PN}-5.26.2-hppa.patch" "100-5.26.2-hppa.patch"\
 	#		"Fix broken miniperl on hppa"\
 	#		"https://bugs.debian.org/869122" "https://bugs.gentoo.org/634162"
+	add_patch "${FILESDIR}/${PN}-5.36.0-fix-configure-for-clang.patch" \
+			"100-5.36.0-fix-configure-for-clang.patch" \
+			"Fix clang check in configure" \
+			"https://github.com/Perl/perl5/issues/21099"
 
 	if [[ ${CHOST} == *-solaris* ]] ; then
 		# do NOT mess with nsl, on Solaris this is always necessary,

diff --git a/dev-lang/perl/perl-5.38.2-r1.ebuild b/dev-lang/perl/perl-5.38.2-r1.ebuild
index 8edc3aca52ba..d0575868dfe2 100644
--- a/dev-lang/perl/perl-5.38.2-r1.ebuild
+++ b/dev-lang/perl/perl-5.38.2-r1.ebuild
@@ -396,6 +396,10 @@ src_prepare() {
 	# add_patch "${FILESDIR}/${PN}-5.26.2-hppa.patch" "100-5.26.2-hppa.patch"\
 	#		"Fix broken miniperl on hppa"\
 	#		"https://bugs.debian.org/869122" "https://bugs.gentoo.org/634162"
+	add_patch "${FILESDIR}/${PN}-5.36.0-fix-configure-for-clang.patch" \
+			"100-5.36.0-fix-configure-for-clang.patch" \
+			"Fix clang check in configure" \
+			"https://github.com/Perl/perl5/issues/21099"
 
 	if [[ ${CHOST} == *-solaris* ]] ; then
 		# do NOT mess with nsl, on Solaris this is always necessary,


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-01-20 12:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-07 14:10 [gentoo-commits] repo/gentoo:master commit in: dev-lang/perl/files/, dev-lang/perl/ Andreas K. Hüttel
  -- strict thread matches above, loose matches on Subject: below --
2024-01-20 12:04 Sam James
2023-12-28  3:53 Sam James
2023-05-01 21:56 Andreas K. Hüttel
2023-01-19  2:27 Sam James
2021-10-09 14:26 Andreas K. Hüttel
2020-08-07 21:05 Kent Fredric
2020-03-21 22:59 Sergei Trofimovich
2018-12-30 21:26 Andreas K. Hüttel
2018-02-22 23:48 Andreas Hüttel
2017-01-05  9:43 Andreas Hüttel
2016-12-29 16:53 Andreas Hüttel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox