Gentoo Archives: gentoo-commits

From: "Andreas K. Hüttel" <dilfridge@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/perl/
Date: Sat, 23 Oct 2021 16:17:28
Message-Id: 1635005829.9ae40c4c5a16667076bc418fecf8c691dcdb2a58.dilfridge@gentoo
1 commit: 9ae40c4c5a16667076bc418fecf8c691dcdb2a58
2 Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
3 AuthorDate: Sat Oct 23 15:45:58 2021 +0000
4 Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
5 CommitDate: Sat Oct 23 16:17:09 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9ae40c4c
7
8 dev-lang/perl: Remove old
9
10 Package-Manager: Portage-3.0.28, Repoman-3.0.3
11 Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
12
13 dev-lang/perl/perl-5.34.0-r2.ebuild | 823 ------------------------------------
14 1 file changed, 823 deletions(-)
15
16 diff --git a/dev-lang/perl/perl-5.34.0-r2.ebuild b/dev-lang/perl/perl-5.34.0-r2.ebuild
17 deleted file mode 100644
18 index 4c2d1bce1ed..00000000000
19 --- a/dev-lang/perl/perl-5.34.0-r2.ebuild
20 +++ /dev/null
21 @@ -1,823 +0,0 @@
22 -# Copyright 1999-2021 Gentoo Authors
23 -# Distributed under the terms of the GNU General Public License v2
24 -
25 -EAPI=7
26 -
27 -inherit alternatives flag-o-matic toolchain-funcs multilib multiprocessing
28 -
29 -PATCH_VER=1
30 -CROSS_VER=1.3.6
31 -PATCH_BASE="perl-5.34.0-patches-${PATCH_VER}"
32 -PATCH_DEV=dilfridge
33 -
34 -DIST_AUTHOR=XSAWYERX
35 -
36 -# Greatest first, don't include yourself
37 -# Devel point-releases are not ABI-intercompatible, but stable point releases are
38 -# BIN_OLDVERSEN is contains only C-ABI-intercompatible versions
39 -PERL_BIN_OLDVERSEN=""
40 -
41 -# Yes we can.
42 -PERL_SINGLE_SLOT=y
43 -
44 -if [[ "${PV##*.}" == "9999" ]]; then
45 - DIST_VERSION=5.30.0
46 -else
47 - DIST_VERSION="${PV/_rc/-RC}"
48 -fi
49 -SHORT_PV="${DIST_VERSION%.*}"
50 -# Even numbered major versions are ABI intercompatible
51 -# Odd numbered major versions are not
52 -if [[ $(( ${SHORT_PV#*.} % 2 )) == 1 ]]; then
53 - SUBSLOT="${DIST_VERSION%-RC*}"
54 -else
55 - SUBSLOT="${DIST_VERSION%.*}"
56 -fi
57 -# Used only in tar paths
58 -MY_P="perl-${DIST_VERSION}"
59 -# Used in library paths
60 -MY_PV="${DIST_VERSION%-RC*}"
61 -
62 -DESCRIPTION="Larry Wall's Practical Extraction and Report Language"
63 -
64 -SRC_URI="
65 - mirror://cpan/src/5.0/${MY_P}.tar.xz
66 - mirror://cpan/authors/id/${DIST_AUTHOR:0:1}/${DIST_AUTHOR:0:2}/${DIST_AUTHOR}/${MY_P}.tar.xz
67 - https://github.com/gentoo-perl/perl-patchset/releases/download/${PATCH_BASE}/${PATCH_BASE}.tar.xz
68 - https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${PATCH_BASE}.tar.xz
69 - https://github.com/arsv/perl-cross/releases/download/${CROSS_VER}/perl-cross-${CROSS_VER}.tar.gz
70 -"
71 -HOMEPAGE="https://www.perl.org/"
72 -
73 -LICENSE="|| ( Artistic GPL-1+ )"
74 -SLOT="0/${SUBSLOT}"
75 -
76 -if [[ "${PV##*.}" != "9999" ]] && [[ "${PV/rc//}" == "${PV}" ]] ; then
77 -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"
78 -fi
79 -
80 -IUSE="berkdb debug doc gdbm ithreads minimal"
81 -
82 -RDEPEND="
83 - berkdb? ( sys-libs/db:= )
84 - gdbm? ( >=sys-libs/gdbm-1.8.3:= )
85 - app-arch/bzip2
86 - sys-libs/zlib
87 - virtual/libcrypt:=
88 -"
89 -DEPEND="${RDEPEND}"
90 -BDEPEND="${RDEPEND}"
91 -
92 -PDEPEND="
93 - !minimal? (
94 - >=app-admin/perl-cleaner-2.5
95 - >=virtual/perl-Encode-3.120.0
96 - >=virtual/perl-File-Temp-0.230.400-r2
97 - >=virtual/perl-Data-Dumper-2.154.0
98 - virtual/perl-Test-Harness
99 - )
100 -"
101 -# bug 390719, bug 523624
102 -# virtual/perl-Test-Harness is here for the bundled ExtUtils::MakeMaker
103 -
104 -S="${WORKDIR}/${MY_P}"
105 -
106 -dual_scripts() {
107 - src_remove_dual perl-core/Archive-Tar 2.380.0 ptar ptardiff ptargrep
108 - src_remove_dual perl-core/CPAN 2.280.0 cpan
109 - src_remove_dual perl-core/Digest-SHA 6.20.0 shasum
110 - src_remove_dual perl-core/Encode 3.80.0 enc2xs piconv
111 - src_remove_dual perl-core/ExtUtils-MakeMaker 7.620.0 instmodsh
112 - src_remove_dual perl-core/ExtUtils-ParseXS 3.430.0 xsubpp
113 - src_remove_dual perl-core/IO-Compress 2.102.0 zipdetails
114 - src_remove_dual perl-core/JSON-PP 4.60.0 json_pp
115 - src_remove_dual perl-core/Module-CoreList 5.202.105.200 corelist
116 - src_remove_dual perl-core/Pod-Checker 1.740.0 podchecker
117 - src_remove_dual perl-core/Pod-Perldoc 3.280.100 perldoc
118 - src_remove_dual perl-core/Pod-Usage 2.10.0 pod2usage
119 - src_remove_dual perl-core/Test-Harness 3.430.0 prove
120 - src_remove_dual perl-core/podlators 4.140.0 pod2man pod2text
121 - src_remove_dual_man perl-core/podlators 4.140.0 /usr/share/man/man1/perlpodstyle.1
122 -}
123 -
124 -check_rebuild() {
125 - # Fresh install
126 - if [[ -z "${REPLACING_VERSIONS}" ]]; then
127 - return 0;
128 - # Major Upgrade
129 - # doesn't matter if there's multiple copies, it still needs a rebuild
130 - # if the string is anything other than "5.CURRENTMAJOR"
131 - elif [[ "${REPLACING_VERSIONS%.*}" != "${PV%.*}" ]]; then
132 - echo ""
133 - ewarn "UPDATE THE PERL MODULES:"
134 - ewarn "After updating dev-lang/perl the installed Perl modules"
135 - ewarn "have to be re-installed. In most cases, this is done automatically"
136 - ewarn "by the package manager, but subsequent steps are still recommended"
137 - ewarn "to ensure system consistency."
138 - ewarn
139 - ewarn "You should start with a depclean to remove any unused perl dependencies"
140 - ewarn "that may confuse portage in future. Regular depcleans are also encouraged"
141 - ewarn "as part of your regular update cycle, as that will keep perl upgrades working."
142 - ewarn "Recommended: emerge --depclean -va"
143 - ewarn
144 - ewarn "You should then call perl-cleaner to clean up any old files and trigger any"
145 - ewarn "remaining rebuilds portage may have missed."
146 - ewarn "Use: perl-cleaner --all"
147 - return 0;
148 -
149 - # Reinstall w/ USE Change
150 - elif ( use ithreads && ! has_version dev-lang/perl[ithreads] ) || \
151 - ( ! use ithreads && has_version dev-lang/perl[ithreads] ) || \
152 - ( use debug && ! has_version dev-lang/perl[debug] ) || \
153 - ( ! use debug && has_version dev-lang/perl[debug] ) ; then
154 - echo ""
155 - ewarn "TOGGLED USE-FLAGS WARNING:"
156 - ewarn "You changed one of the use-flags ithreads or debug."
157 - ewarn "You must rebuild all perl-modules installed."
158 - ewarn "Use: perl-cleaner --modules ; perl-cleaner --force --libperl"
159 - fi
160 -}
161 -
162 -pkg_setup() {
163 - case ${CHOST} in
164 - *-freebsd*) osname="freebsd" ;;
165 - *-dragonfly*) osname="dragonfly" ;;
166 - *-netbsd*) osname="netbsd" ;;
167 - *-openbsd*) osname="openbsd" ;;
168 - *-darwin*) osname="darwin" ;;
169 - *-solaris*) osname="solaris" ;;
170 - *-cygwin*) osname="cygwin" ;;
171 - *) osname="linux" ;;
172 - esac
173 -
174 - myarch="${CHOST%%-*}-${osname}"
175 - if use debug ; then
176 - myarch+="-debug"
177 - fi
178 - if use ithreads ; then
179 - mythreading="-multi"
180 - myarch+="-thread"
181 - fi
182 -
183 - PRIV_BASE="/usr/$(get_libdir)/perl5"
184 - SITE_BASE="/usr/local/$(get_libdir)/perl5"
185 - VENDOR_BASE="/usr/$(get_libdir)/perl5/vendor_perl"
186 -
187 - LIBPERL="libperl$(get_libname ${MY_PV} )"
188 -
189 - # This ENV var tells perl to build with a directory like "5.30"
190 - # regardless of its patch version. This is for experts only
191 - # at this point.
192 - if [[ -z "${PERL_SINGLE_SLOT}" ]]; then
193 - PRIV_LIB="${PRIV_BASE}/${MY_PV}"
194 - ARCH_LIB="${PRIV_BASE}/${MY_PV}/${myarch}${mythreading}"
195 - SITE_LIB="${SITE_BASE}/${MY_PV}"
196 - SITE_ARCH="${SITE_BASE}/${MY_PV}/${myarch}${mythreading}"
197 - VENDOR_LIB="${VENDOR_BASE}/${MY_PV}"
198 - VENDOR_ARCH="${VENDOR_BASE}/${MY_PV}/${myarch}${mythreading}"
199 - else
200 - PRIV_LIB="${PRIV_BASE}/${SUBSLOT}"
201 - ARCH_LIB="${PRIV_BASE}/${SUBSLOT}/${myarch}${mythreading}"
202 - SITE_LIB="${SITE_BASE}/${SUBSLOT}"
203 - SITE_ARCH="${SITE_BASE}/${SUBSLOT}/${myarch}${mythreading}"
204 - VENDOR_LIB="${VENDOR_BASE}/${SUBSLOT}"
205 - VENDOR_ARCH="${VENDOR_BASE}/${SUBSLOT}/${myarch}${mythreading}"
206 - fi
207 -
208 - dual_scripts
209 -}
210 -
211 -src_remove_dual_file() {
212 - local i pkg ver
213 - pkg="$1"
214 - ver="$2"
215 - shift 2
216 - case "${EBUILD_PHASE:-none}" in
217 - postinst|postrm)
218 - for i in "$@" ; do
219 - alternatives_auto_makesym "${i}" "${i}-[0-9]*"
220 - done
221 - ;;
222 - setup)
223 - for i in "$@" ; do
224 - if [[ -f ${EROOT}${i} && ! -h ${EROOT}${i} ]] ; then
225 - has_version ${pkg} && ewarn "You must reinstall ${pkg} !"
226 - break
227 - fi
228 - done
229 - ;;
230 - install)
231 - for i in "$@" ; do
232 - if ! [[ -f "${ED}"${i} ]] ; then
233 - ewarn "${i} does not exist!"
234 - continue
235 - fi
236 - mv "${ED}"${i}{,-${ver}-${P}} || die
237 - done
238 - ;;
239 - esac
240 -}
241 -
242 -src_remove_dual_man() {
243 - local i pkg ver ff
244 - pkg="$1"
245 - ver="$2"
246 - shift 2
247 - case "${EBUILD_PHASE:-none}" in
248 - postinst|postrm)
249 - for i in "$@" ; do
250 - ff=`echo "${EROOT}${i%.[0-9]}-${ver}-${P}${i#${i%.[0-9]}}"*`
251 - ff=${ff##*${i#${i%.[0-9]}}}
252 - alternatives_auto_makesym "${i}${ff}" "${i%.[0-9]}-[0-9]*"
253 - done
254 - ;;
255 - install)
256 - for i in "$@" ; do
257 - if ! [[ -f "${ED}"${i} ]] ; then
258 - ewarn "${i} does not exist!"
259 - continue
260 - fi
261 - mv "${ED}"${i} "${ED}"${i%.[0-9]}-${ver}-${P}${i#${i%.[0-9]}} || die
262 - done
263 - ;;
264 - esac
265 -}
266 -
267 -src_remove_dual() {
268 - local i pkg ver
269 - pkg="$1"
270 - ver="$2"
271 - shift 2
272 - for i in "$@" ; do
273 - src_remove_dual_file "${pkg}" "${ver}" "/usr/bin/${i}"
274 - src_remove_dual_man "${pkg}" "${ver}" "/usr/share/man/man1/${i}.1"
275 - done
276 -}
277 -
278 -src_prepare_perlcross() {
279 - cp -a ../perl-cross-${CROSS_VER}/* . || die
280 -
281 - # bug 794463, needs further analysis what is exactly wrong here
282 - eapply "${FILESDIR}/perl-5.34.0-crossfit.patch"
283 -
284 - # bug 604072
285 - MAKEOPTS+=" -j1"
286 - export MAKEOPTS
287 -}
288 -src_prepare_dynamic() {
289 - ln -s ${LIBPERL} libperl$(get_libname ${SHORT_PV}) || die
290 - ln -s ${LIBPERL} libperl$(get_libname ) || die
291 -}
292 -
293 -# Copy a patch into the patch series
294 -# add_patch SRC_PATH DEST_NAME ['description'] ['bug'] ['bug']
295 -# - description is optional, but recommended
296 -# - all arguments after descriptions are bug URLs
297 -add_patch() {
298 - local patchdir="${WORKDIR}/patches"
299 - local infodir="${WORKDIR}/patch-info"
300 - local src_name dest_name desc
301 - src_name="$1"
302 - dest_name="$2"
303 - desc="$3"
304 - shift; shift; shift;
305 - einfo "Adding ${dest_name} to patch bundle"
306 - cp "${src_name}" "${patchdir}/${dest_name}" || die "Couldn't copy ${src_name} to ${dest_name}"
307 - if [[ -n "${desc}" ]]; then
308 - printf "%s" "${desc}" > "${infodir}/${dest_name}.desc" || die "Couldn't write ${dest_name}.desc"
309 - fi
310 - if [[ $# -gt 0 ]]; then
311 - # Note: when $@ is more than one element, this emits a
312 - # line for each element
313 - printf "%s\n" "$@" > "${infodir}/${dest_name}.bugs" || die "Couldn't write ${dest_name}.bugs"
314 - fi
315 -}
316 -# Remove a patch using a glob expr
317 -# eg:
318 -# rm_patch *-darin-Use-CC*
319 -#
320 -rm_patch() {
321 - local patchdir="${WORKDIR}/patches"
322 - local expr="$1"
323 - local patch="$( cd "${patchdir}"; echo $expr )"
324 - einfo "Removing $patch ($expr) from patch bundle"
325 - if [[ -e "${patchdir}/${patch}" ]]; then
326 - rm -f "${patchdir}/${patch}" || die "Can't remove ${patch} ( $expr )"
327 - else
328 - ewarn "No ${expr} found in ${patchdir} to remove"
329 - fi
330 -}
331 -# Yes, this is a reasonable amount of code for something seemingly simple
332 -# but this is far easier to debug when things go wrong, and things went wrong
333 -# multiple times while I was getting the exact number of slashes right, which
334 -# requires circumnavigating both bash and sed escape mechanisms.
335 -c_escape_string() {
336 - local slash dquote
337 - slash='\'
338 - dquote='"'
339 - re_slash="${slash}${slash}"
340 - re_dquote="${slash}${dquote}"
341 -
342 - # Convert \ to \\,
343 - # " to \"
344 - echo "$1" |\
345 - sed "s|${re_slash}|${re_slash}${re_slash}|g" |\
346 - sed "s|${re_dquote}|${re_slash}${re_dquote}|g"
347 -}
348 -c_escape_file() {
349 - c_escape_string "$(cat "$1")"
350 -}
351 -
352 -apply_patchdir() {
353 - local patchdir="${WORKDIR}/patches"
354 - local infodir="${WORKDIR}/patch-info"
355 - local patchoutput="patchlevel-gentoo.h"
356 -
357 - # Inject Patch-Level info into description for patchlevel.h patch
358 - # to show in -V
359 - local patch_expr="*List-packaged-patches*"
360 - local patch="$( cd "${patchdir}"; echo $patch_expr )";
361 - einfo "Injecting patch-level info into ${patch}.desc ( $patch_expr )"
362 -
363 - if [[ -e "${patchdir}/${patch}" ]]; then
364 - printf "List packaged patches for %s(%s) in patchlevel.h" "${PF}" "${PATCH_BASE}"\
365 - >"${infodir}/${patch}.desc" || die "Can't rewrite ${patch}.desc"
366 - else
367 - eerror "No $patch_expr found in ${patchdir}"
368 - fi
369 -
370 - # Compute patch list to apply
371 - # different name other than PATCHES to stop default
372 - # reapplying it
373 - # Single depth is currently only supported, as artifacts can reside
374 - # from the old layout being multiple-directories, as well as it grossly
375 - # simplifying the patchlevel_gentoo.h generation.
376 - local PERL_PATCHES=($(
377 - find "${patchdir}" -maxdepth 1 -mindepth 1 -type f -printf "%f\n" |\
378 - grep -E '[.](diff|patch)$' |\
379 - sort -n
380 - ))
381 -
382 - for patch in "${PERL_PATCHES[@]}"; do
383 - eapply "${WORKDIR}"/patches/${patch}
384 - done
385 -
386 - einfo "Generating $patchoutput"
387 -
388 - # This code creates a header file, each iteration
389 - # creates one-or-more-lines for each entry found in PERL_PATCHES
390 - # and STDOUT is redirected to the .h file
391 - for patch in "${PERL_PATCHES[@]}"; do
392 - local desc_f="${infodir}/${patch}.desc"
393 - local bugs_f="${infodir}/${patch}.bugs"
394 -
395 - printf ',"%s"\n' "${patch}"
396 - if [[ ! -e "${desc_f}" ]]; then
397 - ewarn "No description provided for ${patch} (expected: ${desc_f} )"
398 - else
399 - local desc="$(c_escape_file "${desc_f}")"
400 - printf ',"- %s"\n' "${desc}"
401 - fi
402 - if [[ -e "${bugs_f}" ]]; then
403 - while read -d $'\n' -r line; do
404 - local esc_line="$(c_escape_string "${line}")"
405 - printf ',"- Bug: %s"\n' "${esc_line}"
406 - done <"${bugs_f}"
407 - fi
408 - done > "${S}/${patchoutput}"
409 - printf "%s\n" "${patchoutput}" >> "${S}/MANIFEST"
410 -
411 -}
412 -src_prepare() {
413 - local patchdir="${WORKDIR}/patches"
414 -
415 - # Prepare Patch dir with additional patches / remove unwanted patches
416 - # Inject bug/desc entries for perl -V
417 - # Old example:
418 - # add_patch "${FILESDIR}/${PN}-5.26.2-hppa.patch" "100-5.26.2-hppa.patch"\
419 - # "Fix broken miniperl on hppa"\
420 - # "https://bugs.debian.org/869122" "https://bugs.gentoo.org/634162"
421 -
422 - if [[ ${CHOST} == *-solaris* ]] ; then
423 - # do NOT mess with nsl, on Solaris this is always necessary,
424 - # when -lsocket is used e.g. to get h_errno
425 - rm_patch "*-nsl-and-cl*"
426 - fi
427 -
428 - apply_patchdir
429 -
430 - tc-is-cross-compiler && src_prepare_perlcross
431 -
432 - tc-is-static-only || src_prepare_dynamic
433 -
434 - if use gdbm; then
435 - sed -i "s:INC => .*:INC => \"-I${EROOT}/usr/include/gdbm\":g" \
436 - ext/NDBM_File/Makefile.PL || die
437 - fi
438 -
439 - # Use errno.h from prefix rather than from host system, bug #645804
440 - if use prefix && [[ -e "${EPREFIX}"/usr/include/errno.h ]] ; then
441 - sed -i "/my..sysroot/s:'':'${EPREFIX}':" ext/Errno/Errno_pm.PL || die
442 - fi
443 -
444 - if [[ ${CHOST} == *-solaris* ]] ; then
445 - # set a soname, fix linking against just built libperl
446 - sed -i -e 's/netbsd\*/netbsd*|solaris*/' Makefile.SH || die
447 - fi
448 -
449 - if [[ ${CHOST} == *-darwin* ]] ; then
450 - # fix install_name (soname) not to reference $D
451 - sed -i -e '/install_name `pwd/s/`pwd`/\\$(shrpdir)/' Makefile.SH || die
452 - fi
453 -
454 - default
455 -}
456 -
457 -myconf() {
458 - # the myconf array is declared in src_configure
459 - myconf=( "${myconf[@]}" "$@" )
460 -}
461 -
462 -# Outputs a list of versions which have been seen in any of the
463 -# primary perl @INC prefix paths, such as:
464 -# /usr/lib64/perl5/<NUMBER>
465 -# /usr/local/lib64/perl5/<NUMBER>
466 -# /usr/lib64/perl5/vendor_perl/<NUMBER>
467 -#
468 -# All values of NUMBER must be like "5.x.y", unless PERL_SUPPORT_SINGLE_SLOT
469 -# is enabled, where it will also allow numbers like "5.x"
470 -#
471 -# PERL_SUPPORT_SINGLE_SLOT should only be used to transition *away* from PERL_SINGLE_SLOT
472 -# if you used that.
473 -find_candidate_inc_versions() {
474 - local regex='.*/5[.][0-9]+[.][0-9]+$';
475 - if [[ ! -z "${PERL_SUPPORT_SINGLE_SLOT}" || ! -z "${PERL_SINGLE_SLOT}" ]]; then
476 - regex='.*/5[.][0-9]+\([.][0-9]+\|\)$'
477 - fi
478 - local dirs=(
479 - "${EROOT}${PRIV_BASE}"
480 - "${EROOT}${SITE_BASE}"
481 - "${EROOT}${VENDOR_BASE}"
482 - )
483 - for dir in "${dirs[@]}"; do
484 - if [[ ! -e "${dir}" ]]; then
485 - continue
486 - fi
487 - # Without access to readdir() on these dirs, find will not be able
488 - # to reveal any @INC directories inside them, and will subsequently prune
489 - # them from the built perl's @INC support, breaking our compatiblity options
490 - # entirely.
491 - if [[ ! -r "${dir}" || ! -x "${dir}" ]]; then
492 - eerror "Bad permissions on ${dir}, this will probably break things"
493 - eerror "Ensure ${dir} is +rx for at least uid=$EUID"
494 - eerror "Recommended permission is +rx for all"
495 - eerror "> chmod o+rx ${dir}"
496 - fi
497 - done
498 - einfo "Scanning for old @INC dirs matching '$regex' in: ${dirs[*]}"
499 - find "${dirs[@]}" -maxdepth 1 -mindepth 1 -type d -regex "${regex}" -printf "%f " 2>/dev/null
500 -}
501 -# Sort versions passed versiony-ly, remove self-version if present
502 -# dedup. Takes each version as an argument
503 -sanitize_inc_versions() {
504 - local vexclude="${DIST_VERSION%-RC}"
505 - if [[ ! -z "${PERL_SINGLE_SLOT}" ]]; then
506 - vexclude="${SUBSLOT}"
507 - fi
508 - einfo "Normalizing/Sorting candidate list: $*"
509 - einfo " to remove '${vexclude}'"
510 - # Note, general numeric sort has to be used
511 - # for the last component, or unique will convert
512 - # 5.30.0 + 5.30 into just 5.30
513 - printf "%s\n" "$@" |\
514 - grep -vxF "${vexclude}" |\
515 - sort -u -nr -t'.' -k1,1rn -k2,2rn -k3,3rg
516 -}
517 -
518 -versions_to_inclist() {
519 - local oldv="${PERL_BIN_OLDVERSEN}"
520 - if [[ ! -z "${PERL_SINGLE_SLOT}" ]]; then
521 - oldv="${DIST_VERSION%-RC} ${PERL_BIN_OLDVERSEN}"
522 - fi
523 - for v; do
524 - has "${v}" ${oldv} && echo -n "${v}/${myarch}${mythreading}/ ";
525 - echo -n "${v}/ ";
526 - done
527 -}
528 -versions_to_gentoolibdirs() {
529 - local oldv="${PERL_BIN_OLDVERSEN}"
530 - local root
531 - local v
532 - if [[ ! -z "${PERL_SINGLE_SLOT}" ]]; then
533 - oldv="${DIST_VERSION%-RC} ${PERL_BIN_OLDVERSEN}"
534 - fi
535 - for v; do
536 - for root in "${PRIV_BASE}" "${VENDOR_BASE}" "${SITE_BASE}"; do
537 - local fullpath="${EROOT}${root}/${v}"
538 - if [[ -e "${fullpath}" ]]; then
539 - has "${v}" ${oldv} && printf "%s:" "${fullpath}/${myarch}${mythreading}";
540 - printf "%s:" "${fullpath}"
541 - fi
542 - done
543 - done
544 -}
545 -
546 -src_configure() {
547 - declare -a myconf
548 -
549 - export LC_ALL="C"
550 - [[ ${COLUMNS:-1} -ge 1 ]] || unset COLUMNS # bug #394091
551 -
552 - # Perl has problems compiling with -Os in your flags with glibc
553 - use elibc_uclibc || replace-flags "-Os" "-O2"
554 -
555 - # xlocale.h is going away in glibc-2.26, so it's counterproductive
556 - # if we use it and include it in CORE/perl.h ... Perl builds just
557 - # fine with glibc and locale.h only.
558 - # However, the darwin prefix people have no locale.h ...
559 - use elibc_glibc && myconf -Ui_xlocale
560 -
561 - # This flag makes compiling crash in interesting ways
562 - filter-flags "-malign-double"
563 -
564 - # Generic LTO broken since 5.28, triggers EUMM failures
565 - filter-flags "-flto"
566 -
567 - use sparc && myconf -Ud_longdbl
568 -
569 - export BUILD_BZIP2=0
570 - export BZIP2_INCLUDE=${EROOT}/usr/include
571 - export BZIP2_LIB=${EROOT}/usr/$(get_libdir)
572 -
573 - export BUILD_ZLIB=False
574 - export ZLIB_INCLUDE=${EROOT}/usr/include
575 - export ZLIB_LIB=${EROOT}/usr/$(get_libdir)
576 -
577 - # allow either gdbm to provide ndbm (in <gdbm/ndbm.h>) or db1
578 - myndbm='U'
579 - mygdbm='U'
580 - mydb='U'
581 - if use gdbm ; then
582 - mygdbm='D'
583 - if use berkdb ; then
584 - myndbm='D'
585 - fi
586 - fi
587 - if use berkdb ; then
588 - mydb='D'
589 - has_version '=sys-libs/db-1*' && myndbm='D'
590 - fi
591 -
592 - myconf "-${myndbm}i_ndbm" "-${mygdbm}i_gdbm" "-${mydb}i_db"
593 -
594 - if use alpha && [[ "$(tc-getCC)" = "ccc" ]] ; then
595 - ewarn "Perl will not be built with berkdb support, use gcc if you needed it..."
596 - myconf -Ui_db -Ui_ndbm
597 - fi
598 -
599 - use ithreads && myconf -Dusethreads
600 -
601 - if use debug ; then
602 - append-cflags "-g"
603 - myconf -DDEBUGGING
604 - elif [[ ${CFLAGS} == *-g* ]] ; then
605 - myconf -DDEBUGGING=-g
606 - else
607 - myconf -DDEBUGGING=none
608 - fi
609 -
610 - # modifying 'optimize' prevents cross configure script from appending required flags
611 - if tc-is-cross-compiler; then
612 - append-cflags "-fwrapv -fno-strict-aliasing"
613 - fi
614 -
615 - # Autodiscover all old version directories, some of them will even be newer
616 - # if you downgrade
617 - if [[ -z ${PERL_OLDVERSEN} ]]; then
618 - PERL_OLDVERSEN="$( find_candidate_inc_versions )"
619 - fi
620 -
621 - # Fixup versions, removing self match, fixing order and dupes
622 - PERL_OLDVERSEN="$( sanitize_inc_versions ${PERL_OLDVERSEN} )"
623 -
624 - # Experts who want a "Pure" install can set PERL_OLDVERSEN to an empty string
625 - if [[ -n "${PERL_OLDVERSEN// }" ]]; then
626 - local inclist="$( versions_to_inclist ${PERL_OLDVERSEN} )"
627 - einfo "This version of perl may partially support modules previously"
628 - einfo "installed in any of the following paths:"
629 - for incpath in ${inclist}; do
630 - [[ -e "${EROOT}${VENDOR_BASE}/${incpath}" ]] && einfo " ${EROOT}${VENDOR_BASE}/${incpath}"
631 - [[ -e "${EROOT}${PRIV_BASE}/${incpath}" ]] && einfo " ${EROOT}${PRIV_BASE}/${incpath}"
632 - [[ -e "${EROOT}${SITE_BASE}/${incpath}" ]] && einfo " ${EROOT}${SITE_BASE}/${incpath}"
633 - done
634 - einfo "This is a temporary measure and you should aim to cleanup these paths"
635 - einfo "via world updates and perl-cleaner"
636 - # myconf -Dinc_version_list="${inclist}"
637 - myconf -Dgentoolibdirs="$( versions_to_gentoolibdirs ${PERL_OLDVERSEN} )"
638 - fi
639 -
640 - [[ ${ELIBC} == "FreeBSD" ]] && myconf "-Dlibc=/usr/$(get_libdir)/libc.a"
641 -
642 - # Make sure we can do the final link #523730, need to set deployment
643 - # target to override hardcoded 10.3 which breaks on modern OSX
644 - [[ ${CHOST} == *-darwin* ]] && \
645 - myconf "-Dld=env MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} $(tc-getCC)"
646 -
647 - # Older macOS with non-Apple GCC chokes on inline in system headers
648 - # using c89 mode as injected by cflags.SH
649 - [[ ${CHOST} == *-darwin* && ${CHOST##*darwin} -le 9 ]] && tc-is-gcc && \
650 - append-cflags -Dinline=__inline__
651 -
652 - # flock on 32-bit sparc Solaris is broken, fall back to fcntl
653 - [[ ${CHOST} == sparc-*-solaris* ]] && \
654 - myconf -Ud_flock
655 -
656 - # Prefix: the host system needs not to follow Gentoo multilib stuff, and in
657 - # Prefix itself we don't do multilib either, so make sure perl can find
658 - # something compatible.
659 - if use prefix ; then
660 - # Set a hook to check for each detected library whether it actually works.
661 - export libscheck="
662 - ( echo 'main(){}' > '${T}'/conftest.c &&
663 - $(tc-getCC) -o '${T}'/conftest '${T}'/conftest.c -l\$thislib >/dev/null 2>/dev/null
664 - ) || xxx=/dev/null"
665 -
666 - # Use all host paths that might contain useful stuff, the hook above will filter out bad choices.
667 - local paths="/lib/*-linux-gnu /usr/lib/*-linux-gnu /lib64 /lib/64 /usr/lib64 /usr/lib/64 /lib32 /usr/lib32 /lib /usr/lib"
668 - myconf "-Dlibpth=${EPREFIX}/$(get_libdir) ${EPREFIX}/usr/$(get_libdir) ${paths}"
669 - elif [[ $(get_libdir) != "lib" ]] ; then
670 - # We need to use " and not ', as the written config.sh use ' ...
671 - myconf "-Dlibpth=/usr/local/$(get_libdir) /$(get_libdir) /usr/$(get_libdir)"
672 - fi
673 -
674 - # don't try building ODBM, bug #354453
675 - disabled_extensions="ODBM_File"
676 -
677 - if ! use gdbm ; then
678 - # workaround for bug #157774: don't try building GDBM related stuff with USE="-gdbm"
679 - disabled_extensions="${disabled_extensions} GDBM_File NDBM_File"
680 - fi
681 -
682 - myconf -Dnoextensions="${disabled_extensions}"
683 -
684 - [[ "${PV##*.}" == "9999" ]] && myconf -Dusedevel -Uversiononly
685 -
686 - [[ -n "${EXTRA_ECONF}" ]] && ewarn During Perl build, EXTRA_ECONF=${EXTRA_ECONF}
687 - # allow fiddling via EXTRA_ECONF, bug 558070
688 - eval "local -a EXTRA_ECONF=(${EXTRA_ECONF})"
689 -
690 - # setting -Dld= to tc-getLD breaks perl and all perl things
691 - # https://github.com/Perl/perl5/issues/17791#issuecomment-630145202
692 - myconf \
693 - -Duseshrplib \
694 - -Darchname="${myarch}" \
695 - -Dcc="$(tc-getCC)" \
696 - -Dar="$(tc-getAR)" \
697 - -Dnm="$(tc-getNM)" \
698 - -Dcpp="$(tc-getCPP)" \
699 - -Dranlib="$(tc-getRANLIB)" \
700 - -Doptimize="${CFLAGS}" \
701 - -Dldflags="${LDFLAGS}" \
702 - -Dprefix="${EPREFIX}"'/usr' \
703 - -Dsiteprefix="${EPREFIX}"'/usr/local' \
704 - -Dvendorprefix="${EPREFIX}"'/usr' \
705 - -Dscriptdir="${EPREFIX}"'/usr/bin' \
706 - -Dprivlib="${EPREFIX}${PRIV_LIB}" \
707 - -Darchlib="${EPREFIX}${ARCH_LIB}" \
708 - -Dsitelib="${EPREFIX}${SITE_LIB}" \
709 - -Dsitearch="${EPREFIX}${SITE_ARCH}" \
710 - -Dvendorlib="${EPREFIX}${VENDOR_LIB}" \
711 - -Dvendorarch="${EPREFIX}${VENDOR_ARCH}" \
712 - -Dman1dir="${EPREFIX}"/usr/share/man/man1 \
713 - -Dman3dir="${EPREFIX}"/usr/share/man/man3 \
714 - -Dsiteman1dir="${EPREFIX}"/usr/local/man/man1 \
715 - -Dsiteman3dir="${EPREFIX}"/usr/local/man/man3 \
716 - -Dvendorman1dir="${EPREFIX}"/usr/share/man/man1 \
717 - -Dvendorman3dir="${EPREFIX}"/usr/share/man/man3 \
718 - -Dman1ext='1' \
719 - -Dman3ext='3pm' \
720 - -Dlibperl="${LIBPERL}" \
721 - -Dlocincpth="${EPREFIX}"'/usr/include ' \
722 - -Dglibpth="${EPREFIX}/$(get_libdir) ${EPREFIX}/usr/$(get_libdir)"' ' \
723 - -Duselargefiles \
724 - -Dd_semctl_semun \
725 - -Dcf_by='Gentoo' \
726 - -Dmyhostname='localhost' \
727 - -Dperladmin='root@localhost' \
728 - -Ud_csh \
729 - -Dsh="${EPREFIX}"/bin/sh \
730 - -Dtargetsh="${EPREFIX}"/bin/sh \
731 - -Uusenm \
732 - "${myconf[@]}" \
733 - "${EXTRA_ECONF[@]}"
734 -
735 - if tc-is-cross-compiler; then
736 - ./configure \
737 - --target="${CHOST}" \
738 - --build="${CBUILD}" \
739 - -Dinstallprefix='' \
740 - -Dinstallusrbinperl='undef' \
741 - -Dusevendorprefix='define' \
742 - "${myconf[@]}" \
743 - || die "Unable to configure"
744 - else
745 - sh Configure \
746 - -des \
747 - -Dinstallprefix="${EPREFIX}"'/usr' \
748 - -Dinstallusrbinperl='n' \
749 - "${myconf[@]}" \
750 - || die "Unable to configure"
751 - fi
752 -}
753 -
754 -src_test() {
755 - export NO_GENTOO_NETWORK_TESTS=1;
756 - export GENTOO_ASSUME_SANDBOXED="${GENTOO_ASSUME_SANDBOXED:-1}"
757 - export GENTOO_NO_PORTING_TESTS="${GENTOO_NO_PORTING_TESTS:-1}"
758 - if [[ ${EUID} == 0 ]] ; then
759 - ewarn "Test fails with a sandbox error (#328793) if run as root. Skipping tests..."
760 - return 0
761 - fi
762 - use elibc_uclibc && export MAKEOPTS+=" -j1"
763 - TEST_JOBS="$(makeopts_jobs)" make test_harness || die "test failed"
764 -}
765 -
766 -src_install() {
767 - local i
768 - local coredir="${ARCH_LIB}/CORE"
769 -
770 - emake DESTDIR="${D}" install
771 -
772 - rm -f "${ED}/usr/bin/perl${MY_PV}"
773 - ln -s perl "${ED}"/usr/bin/perl${MY_PV} || die
774 -
775 - if ! tc-is-static-only ; then
776 - dolib.so "${ED}"${coredir}/${LIBPERL}
777 - rm -f "${ED}"${coredir}/${LIBPERL}
778 - ln -sf ${LIBPERL} "${ED}"/usr/$(get_libdir)/libperl$(get_libname ${SHORT_PV}) || die
779 - ln -sf ${LIBPERL} "${ED}"/usr/$(get_libdir)/libperl$(get_libname) || die
780 -
781 - ln -sf ../../../../${LIBPERL} "${ED}"${coredir}/${LIBPERL} || die
782 - ln -sf ../../../../${LIBPERL} "${ED}"${coredir}/libperl$(get_libname ${SHORT_PV}) || die
783 - ln -sf ../../../../${LIBPERL} "${ED}"${coredir}/libperl$(get_libname) || die
784 - fi
785 -
786 - rm -rf "${ED}"/usr/share/man/man3 || die "Unable to remove module man pages"
787 -
788 - # This removes ${D} from Config.pm
789 - for i in $(find "${D}" -iname "Config.pm" ) ; do
790 - einfo "Removing ${D} from ${i}..."
791 - sed -i -e "s:${D}::" "${i}" || die "Sed failed"
792 - done
793 -
794 - dodoc Changes* README AUTHORS
795 -
796 - if use doc ; then
797 - # HTML Documentation
798 - # We expect errors, warnings, and such with the following.
799 -
800 - dodir /usr/share/doc/${PF}/html
801 - LD_LIBRARY_PATH=. ./perl installhtml \
802 - --podroot='.' \
803 - --podpath='lib:ext:pod:vms' \
804 - --recurse \
805 - --htmldir="${ED}/usr/share/doc/${PF}/html"
806 - fi
807 -
808 - [[ -d ${ED}/usr/local ]] && rm -r "${ED}"/usr/local
809 -
810 - dual_scripts
811 -}
812 -
813 -pkg_preinst() {
814 - check_rebuild
815 -}
816 -
817 -pkg_postinst() {
818 - dual_scripts
819 -
820 - if [[ "${ROOT}" = "/" ]] ; then
821 - local INC DIR file
822 - INC=$(perl -e 'for $line (@INC) { next if $line eq "."; next if $line =~ m/'${SHORT_PV}'|etc|local|perl$/; print "$line\n" }')
823 - einfo "Removing old .ph files"
824 - for DIR in ${INC} ; do
825 - if [[ -d "${DIR}" ]] ; then
826 - for file in $(find "${DIR}" -name "*.ph" -type f ) ; do
827 - rm -f "${file}"
828 - einfo "<< ${file}"
829 - done
830 - fi
831 - done
832 - # Silently remove the now empty dirs
833 - for DIR in ${INC} ; do
834 - if [[ -d "${DIR}" ]] ; then
835 - find "${DIR}" -depth -type d -print0 | xargs -0 -r rmdir &> /dev/null
836 - fi
837 - done
838 -
839 - fi
840 -}
841 -
842 -pkg_postrm() {
843 - dual_scripts
844 -}