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: Fri, 05 Jun 2020 11:15:28
Message-Id: 1591355702.e248fc47ab1dc43a759dbcff3039bef1874990de.dilfridge@gentoo
1 commit: e248fc47ab1dc43a759dbcff3039bef1874990de
2 Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 5 11:15:02 2020 +0000
4 Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 5 11:15:02 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e248fc47
7
8 dev-lang/perl: Re-add toolchain improvements
9
10 Package-Manager: Portage-2.3.99, Repoman-2.3.22
11 Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
12
13 dev-lang/perl/perl-5.30.3-r1.ebuild | 659 ++++++++++++++++++++++++++++++++++++
14 1 file changed, 659 insertions(+)
15
16 diff --git a/dev-lang/perl/perl-5.30.3-r1.ebuild b/dev-lang/perl/perl-5.30.3-r1.ebuild
17 new file mode 100644
18 index 00000000000..94fa953355b
19 --- /dev/null
20 +++ b/dev-lang/perl/perl-5.30.3-r1.ebuild
21 @@ -0,0 +1,659 @@
22 +# Copyright 1999-2020 Gentoo Authors
23 +# Distributed under the terms of the GNU General Public License v2
24 +
25 +EAPI=6
26 +
27 +inherit eutils alternatives flag-o-matic toolchain-funcs multilib multiprocessing
28 +
29 +PATCH_VER=1
30 +CROSS_VER=1.3.2
31 +PATCH_BASE="perl-5.30.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="5.30.0 5.30.1 5.30.2"
40 +
41 +if [[ "${PV##*.}" == "9999" ]]; then
42 + DIST_VERSION=5.30.0
43 +else
44 + DIST_VERSION="${PV/_rc/-RC}"
45 +fi
46 +SHORT_PV="${DIST_VERSION%.*}"
47 +# Even numbered major versions are ABI intercompatible
48 +# Odd numbered major versions are not
49 +if [[ $(( ${SHORT_PV#*.} % 2 )) == 1 ]]; then
50 + SUBSLOT="${DIST_VERSION%-RC*}"
51 +else
52 + SUBSLOT="${DIST_VERSION%.*}"
53 +fi
54 +# Used only in tar paths
55 +MY_P="perl-${DIST_VERSION}"
56 +# Used in library paths
57 +MY_PV="${DIST_VERSION%-RC*}"
58 +
59 +DESCRIPTION="Larry Wall's Practical Extraction and Report Language"
60 +
61 +SRC_URI="
62 + mirror://cpan/src/5.0/${MY_P}.tar.xz
63 + mirror://cpan/authors/id/${DIST_AUTHOR:0:1}/${DIST_AUTHOR:0:2}/${DIST_AUTHOR}/${MY_P}.tar.xz
64 + https://github.com/gentoo-perl/perl-patchset/releases/download/${PATCH_BASE}/${PATCH_BASE}.tar.xz
65 + mirror://gentoo/${PATCH_BASE}.tar.xz
66 + https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${PATCH_BASE}.tar.xz
67 + https://github.com/arsv/perl-cross/releases/download/${CROSS_VER}/perl-cross-${CROSS_VER}.tar.gz
68 +"
69 +HOMEPAGE="https://www.perl.org/"
70 +
71 +LICENSE="|| ( Artistic GPL-1+ )"
72 +SLOT="0/${SUBSLOT}"
73 +
74 +if [[ "${PV##*.}" != "9999" ]] && [[ "${PV/rc//}" == "${PV}" ]] ; then
75 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
76 +fi
77 +
78 +IUSE="berkdb debug doc gdbm ithreads"
79 +
80 +RDEPEND="
81 + berkdb? ( sys-libs/db:= )
82 + gdbm? ( >=sys-libs/gdbm-1.8.3:= )
83 + app-arch/bzip2
84 + sys-libs/zlib
85 +"
86 +DEPEND="${RDEPEND}"
87 +PDEPEND="
88 + >=app-admin/perl-cleaner-2.5
89 + >=virtual/perl-File-Temp-0.230.400-r2
90 + >=virtual/perl-Data-Dumper-2.154.0
91 + virtual/perl-Test-Harness
92 +"
93 +# bug 390719, bug 523624
94 +# virtual/perl-Test-Harness is here for the bundled ExtUtils::MakeMaker
95 +
96 +S="${WORKDIR}/${MY_P}"
97 +
98 +dual_scripts() {
99 + src_remove_dual perl-core/Archive-Tar 2.320.0 ptar ptardiff ptargrep
100 + src_remove_dual perl-core/CPAN 2.220.0 cpan
101 + src_remove_dual perl-core/Digest-SHA 6.20.0 shasum
102 + src_remove_dual perl-core/Encode 3.10.0 enc2xs piconv
103 + src_remove_dual perl-core/ExtUtils-MakeMaker 7.340.0 instmodsh
104 + src_remove_dual perl-core/ExtUtils-ParseXS 3.400.0 xsubpp
105 + src_remove_dual perl-core/IO-Compress 2.84.0 zipdetails
106 + src_remove_dual perl-core/JSON-PP 4.20.0 json_pp
107 + src_remove_dual perl-core/Module-CoreList 5.202.6.13.0_rc corelist
108 + src_remove_dual perl-core/Pod-Parser 1.630.0 pod2usage podchecker podselect
109 + src_remove_dual perl-core/Pod-Perldoc 3.280.100 perldoc
110 + src_remove_dual perl-core/Test-Harness 3.420.0 prove
111 + src_remove_dual perl-core/podlators 4.110.0 pod2man pod2text
112 + src_remove_dual_man perl-core/podlators 4.110.0 /usr/share/man/man1/perlpodstyle.1
113 +}
114 +
115 +check_rebuild() {
116 + # Fresh install
117 + if [[ -z "${REPLACING_VERSIONS}" ]]; then
118 + return 0;
119 + # Major Upgrade
120 + # doesn't matter if there's multiple copies, it still needs a rebuild
121 + # if the string is anything other than "5.CURRENTMAJOR"
122 + elif [[ "${REPLACING_VERSIONS%.*}" != "${PV%.*}" ]]; then
123 + echo ""
124 + ewarn "UPDATE THE PERL MODULES:"
125 + ewarn "After updating dev-lang/perl the installed Perl modules"
126 + ewarn "have to be re-installed. In most cases, this is done automatically"
127 + ewarn "by the package manager, but subsequent steps are still recommended"
128 + ewarn "to ensure system consistency."
129 + ewarn
130 + ewarn "You should start with a depclean to remove any unused perl dependencies"
131 + ewarn "that may confuse portage in future. Regular depcleans are also encouraged"
132 + ewarn "as part of your regular update cycle, as that will keep perl upgrades working."
133 + ewarn "Recommended: emerge --depclean -va"
134 + ewarn
135 + ewarn "You should then call perl-cleaner to clean up any old files and trigger any"
136 + ewarn "remaining rebuilds portage may have missed."
137 + ewarn "Use: perl-cleaner --all"
138 + return 0;
139 +
140 + # Reinstall w/ USE Change
141 + elif ( use ithreads && ! has_version dev-lang/perl[ithreads] ) || \
142 + ( ! use ithreads && has_version dev-lang/perl[ithreads] ) || \
143 + ( use debug && ! has_version dev-lang/perl[debug] ) || \
144 + ( ! use debug && has_version dev-lang/perl[debug] ) ; then
145 + echo ""
146 + ewarn "TOGGLED USE-FLAGS WARNING:"
147 + ewarn "You changed one of the use-flags ithreads or debug."
148 + ewarn "You must rebuild all perl-modules installed."
149 + ewarn "Use: perl-cleaner --modules ; perl-cleaner --force --libperl"
150 + fi
151 +}
152 +
153 +pkg_setup() {
154 + case ${CHOST} in
155 + *-freebsd*) osname="freebsd" ;;
156 + *-dragonfly*) osname="dragonfly" ;;
157 + *-netbsd*) osname="netbsd" ;;
158 + *-openbsd*) osname="openbsd" ;;
159 + *-darwin*) osname="darwin" ;;
160 + *-solaris*) osname="solaris" ;;
161 + *-interix*) osname="interix" ;;
162 + *-aix*) osname="aix" ;;
163 + *-cygwin*) osname="cygwin" ;;
164 + *) osname="linux" ;;
165 + esac
166 +
167 + myarch="${CHOST%%-*}-${osname}"
168 + if use debug ; then
169 + myarch+="-debug"
170 + fi
171 + if use ithreads ; then
172 + mythreading="-multi"
173 + myarch+="-thread"
174 + fi
175 +
176 + PRIV_BASE="/usr/$(get_libdir)/perl5"
177 + SITE_BASE="/usr/local/$(get_libdir)/perl5"
178 + VENDOR_BASE="/usr/$(get_libdir)/perl5/vendor_perl"
179 +
180 + LIBPERL="libperl$(get_libname ${MY_PV} )"
181 + PRIV_LIB="${PRIV_BASE}/${MY_PV}"
182 + ARCH_LIB="${PRIV_BASE}/${MY_PV}/${myarch}${mythreading}"
183 + SITE_LIB="${SITE_BASE}/${MY_PV}"
184 + SITE_ARCH="${SITE_BASE}/${MY_PV}/${myarch}${mythreading}"
185 + VENDOR_LIB="${VENDOR_BASE}/${MY_PV}"
186 + VENDOR_ARCH="${VENDOR_BASE}/${MY_PV}/${myarch}${mythreading}"
187 +
188 + dual_scripts
189 +}
190 +
191 +src_remove_dual_file() {
192 + local i pkg ver
193 + pkg="$1"
194 + ver="$2"
195 + shift 2
196 + case "${EBUILD_PHASE:-none}" in
197 + postinst|postrm)
198 + for i in "$@" ; do
199 + alternatives_auto_makesym "${i}" "${i}-[0-9]*"
200 + done
201 + ;;
202 + setup)
203 + for i in "$@" ; do
204 + if [[ -f ${EROOT}${i} && ! -h ${EROOT}${i} ]] ; then
205 + has_version ${pkg} && ewarn "You must reinstall ${pkg} !"
206 + break
207 + fi
208 + done
209 + ;;
210 + install)
211 + for i in "$@" ; do
212 + if ! [[ -f "${ED}"${i} ]] ; then
213 + ewarn "${i} does not exist!"
214 + continue
215 + fi
216 + mv "${ED}"${i}{,-${ver}-${P}} || die
217 + done
218 + ;;
219 + esac
220 +}
221 +
222 +src_remove_dual_man() {
223 + local i pkg ver ff
224 + pkg="$1"
225 + ver="$2"
226 + shift 2
227 + case "${EBUILD_PHASE:-none}" in
228 + postinst|postrm)
229 + for i in "$@" ; do
230 + ff=`echo "${EROOT}${i%.[0-9]}-${ver}-${P}${i#${i%.[0-9]}}"*`
231 + ff=${ff##*${i#${i%.[0-9]}}}
232 + alternatives_auto_makesym "${i}${ff}" "${i%.[0-9]}-[0-9]*"
233 + done
234 + ;;
235 + install)
236 + for i in "$@" ; do
237 + if ! [[ -f "${ED}"${i} ]] ; then
238 + ewarn "${i} does not exist!"
239 + continue
240 + fi
241 + mv "${ED}"${i} "${ED}"${i%.[0-9]}-${ver}-${P}${i#${i%.[0-9]}} || die
242 + done
243 + ;;
244 + esac
245 +}
246 +
247 +src_remove_dual() {
248 + local i pkg ver
249 + pkg="$1"
250 + ver="$2"
251 + shift 2
252 + for i in "$@" ; do
253 + src_remove_dual_file "${pkg}" "${ver}" "/usr/bin/${i}"
254 + src_remove_dual_man "${pkg}" "${ver}" "/usr/share/man/man1/${i}.1"
255 + done
256 +}
257 +
258 +src_prepare_update_patchlevel_h() {
259 + # Copied and modified from debian:
260 + # Copyright 2011 Niko Tyni
261 + # This program is free software; you can redistribute it and/or modify
262 + # it under the same terms as Perl itself.
263 + local patchdir="${WORKDIR}/patches"
264 + local prefix
265 + local patchoutput="patchlevel-gentoo.h"
266 +
267 + [[ -f ${patchdir}/series ]] || return 0
268 +
269 +while read patch
270 +do
271 + patchname=$(echo $patch | sed 's/\.diff$//')
272 + < $patchdir/$patch sed -e '/^Subject:/ { N; s/\n / / }' | sed -n -e '
273 +
274 + # massage the patch headers
275 + s|^Bug: .*https\?://rt\.perl\.org/.*id=\(.*\).*|[perl #\1]|; tprepend;
276 + s|^Bug: .*https\?://rt\.cpan\.org/.*id=\(.*\).*|[rt.cpan.org #\1]|; tprepend;
277 + s|^Bug-Gentoo: ||; tprepend;
278 + s/^\(Subject\|Description\): //; tappend;
279 + s|^Origin: .*http://perl5\.git\.perl\.org/perl\.git/commit\(diff\)\?/\(.......\).*|[\2]|; tprepend;
280 +
281 + # post-process at the end of input
282 + $ { x;
283 + # include the version number in the patchlevel.h description (if available)
284 + s/List packaged patches/&'" for ${PF}(#${PATCH_VER})"'/;
285 +
286 + # escape any backslashes and double quotes
287 + s|\\|\\\\|g; s|"|\\"|g;
288 +
289 + # add a prefix
290 + s|^|\t,"'"$prefix$patchname"' - |;
291 + # newlines away
292 + s/\n/ /g; s/ */ /g;
293 + # add a suffix
294 + s/ *$/"/; p
295 + };
296 + # stop all processing
297 + d;
298 + # label: append to the hold space
299 + :append H; d;
300 + # label: prepend to the hold space
301 + :prepend x; H; d;
302 + '
303 +done < "${WORKDIR}"/patches/series > "${S}/${patchoutput}"
304 +echo "${patchoutput}" >> "${S}/MANIFEST"
305 +}
306 +
307 +src_prepare_perlcross() {
308 + cp -a ../perl-cross-${CROSS_VER}/* . || die
309 +
310 + # bug 604072
311 + MAKEOPTS+=" -j1"
312 + export MAKEOPTS
313 +}
314 +src_prepare_dynamic() {
315 + ln -s ${LIBPERL} libperl$(get_libname ${SHORT_PV}) || die
316 + ln -s ${LIBPERL} libperl$(get_libname ) || die
317 +}
318 +
319 +src_prepare() {
320 + local patch
321 + EPATCH_OPTS+=" -p1"
322 +
323 + if use hppa ; then
324 + epatch "${FILESDIR}/${PN}-5.26.2-hppa.patch" # bug 634162
325 + fi
326 +
327 + if [[ ${CHOST} == *-solaris* ]] ; then
328 + # do NOT mess with nsl, on Solaris this is always necessary,
329 + # when -lsocket is used e.g. to get h_errno
330 + sed -i '/gentoo\/no-nsl-cl\.patch/d' "${WORKDIR}/patches/series" || die
331 + fi
332 +
333 + einfo "Applying patches from ${PATCH_BASE} ..."
334 + while read patch ; do
335 + EPATCH_SINGLE_MSG=" ${patch} ..."
336 + epatch "${WORKDIR}"/patches/${patch}
337 + done < "${WORKDIR}"/patches/series
338 +
339 + src_prepare_update_patchlevel_h
340 +
341 + tc-is-cross-compiler && src_prepare_perlcross
342 +
343 + tc-is-static-only || src_prepare_dynamic
344 +
345 + if use gdbm; then
346 + sed -i "s:INC => .*:INC => \"-I${EROOT}usr/include/gdbm\":g" \
347 + ext/NDBM_File/Makefile.PL || die
348 + fi
349 +
350 + # Use errno.h from prefix rather than from host system, bug #645804
351 + if use prefix && [[ -e "${EPREFIX}"/usr/include/errno.h ]] ; then
352 + sed -i "/my..sysroot/s:'':'${EPREFIX}':" ext/Errno/Errno_pm.PL || die
353 + fi
354 +
355 + if [[ ${CHOST} == *-solaris* ]] ; then
356 + # set a soname, fix linking against just built libperl
357 + sed -i -e 's/netbsd\*/netbsd*|solaris*/' Makefile.SH || die
358 + fi
359 +
360 + if [[ ${CHOST} == *-darwin* ]] ; then
361 + # fix install_name (soname) not to reference $D
362 + sed -i -e '/install_name `pwd/s/`pwd`/\\$(shrpdir)/' Makefile.SH || die
363 + fi
364 +
365 + default
366 +}
367 +
368 +myconf() {
369 + # the myconf array is declared in src_configure
370 + myconf=( "${myconf[@]}" "$@" )
371 +}
372 +
373 +src_configure() {
374 + declare -a myconf
375 +
376 + export LC_ALL="C"
377 + [[ ${COLUMNS:-1} -ge 1 ]] || unset COLUMNS # bug #394091
378 +
379 + # Perl has problems compiling with -Os in your flags with glibc
380 + use elibc_uclibc || replace-flags "-Os" "-O2"
381 +
382 + # xlocale.h is going away in glibc-2.26, so it's counterproductive
383 + # if we use it and include it in CORE/perl.h ... Perl builds just
384 + # fine with glibc and locale.h only.
385 + # However, the darwin prefix people have no locale.h ...
386 + use elibc_glibc && myconf -Ui_xlocale
387 +
388 + # This flag makes compiling crash in interesting ways
389 + filter-flags "-malign-double"
390 +
391 + # Generic LTO broken since 5.28, triggers EUMM failures
392 + filter-flags "-flto"
393 +
394 + use sparc && myconf -Ud_longdbl
395 +
396 + export BUILD_BZIP2=0
397 + export BZIP2_INCLUDE=${EROOT}/usr/include
398 + export BZIP2_LIB=${EROOT}/usr/$(get_libdir)
399 +
400 + export BUILD_ZLIB=False
401 + export ZLIB_INCLUDE=${EROOT}/usr/include
402 + export ZLIB_LIB=${EROOT}/usr/$(get_libdir)
403 +
404 + # allow either gdbm to provide ndbm (in <gdbm/ndbm.h>) or db1
405 + myndbm='U'
406 + mygdbm='U'
407 + mydb='U'
408 + if use gdbm ; then
409 + mygdbm='D'
410 + if use berkdb ; then
411 + myndbm='D'
412 + fi
413 + fi
414 + if use berkdb ; then
415 + mydb='D'
416 + has_version '=sys-libs/db-1*' && myndbm='D'
417 + fi
418 +
419 + myconf "-${myndbm}i_ndbm" "-${mygdbm}i_gdbm" "-${mydb}i_db"
420 +
421 + if use alpha && [[ "$(tc-getCC)" = "ccc" ]] ; then
422 + ewarn "Perl will not be built with berkdb support, use gcc if you needed it..."
423 + myconf -Ui_db -Ui_ndbm
424 + fi
425 +
426 + use ithreads && myconf -Dusethreads
427 +
428 + if use debug ; then
429 + append-cflags "-g"
430 + myconf -DDEBUGGING
431 + elif [[ ${CFLAGS} == *-g* ]] ; then
432 + myconf -DDEBUGGING=-g
433 + else
434 + myconf -DDEBUGGING=none
435 + fi
436 +
437 + # Autodiscover all old version directories, some of them will even be newer
438 + # if you downgrade
439 + if [[ -z ${PERL_OLDVERSEN} ]]; then
440 + PERL_OLDVERSEN="$(
441 + find "${EROOT%/}${PRIV_BASE}" "${EROOT%/}${SITE_BASE}" "${EROOT%/}${VENDOR_BASE}" \
442 + -maxdepth 1 -mindepth 1 -type d -regex '.*/5[.][0-9]+[.][0-9]+$' \
443 + -printf "%f " 2>/dev/null )"
444 + fi
445 + # Fixup versions, removing self match, fixing order and dupes
446 + PERL_OLDVERSEN="$(
447 + echo "${PERL_OLDVERSEN}" |\
448 + tr " " "\n" |\
449 + grep -vF "${DIST_VERSION%-RC}" |\
450 + sort -u -nr -t'.' -k1,1 -k2,2 -k3,3
451 + )"
452 +
453 + # Experts who want a "Pure" install can set PERL_OLDVERSEN to an empty string
454 + if [[ -n "${PERL_OLDVERSEN// }" ]]; then
455 + local inclist="$(
456 + for v in ${PERL_OLDVERSEN}; do
457 + has "${v}" ${PERL_BIN_OLDVERSEN} && echo -n "${v}/${myarch}${mythreading} ";
458 + echo -n "${v} ";
459 + done )"
460 + einfo "This version of perl may partially support modules previously"
461 + einfo "installed in any of the following paths:"
462 + for incpath in ${inclist}; do
463 + [[ -e "${EROOT%/}${VENDOR_BASE}/${incpath}" ]] && einfo " ${EROOT%/}${VENDOR_BASE}/${incpath}"
464 + [[ -e "${EROOT%/}${PRIV_BASE}/${incpath}" ]] && einfo " ${EROO%/T}${PRIV_BASE}/${incpath}"
465 + [[ -e "${EROOT%/}${SITE_BASE}/${incpath}" ]] && einfo " ${EROOT%/}${SITE_BASE}/${incpath}"
466 + done
467 + einfo "This is a temporary measure and you should aim to cleanup these paths"
468 + einfo "via world updates and perl-cleaner"
469 + myconf -Dinc_version_list="${inclist}"
470 + fi
471 +
472 + [[ ${ELIBC} == "FreeBSD" ]] && myconf "-Dlibc=/usr/$(get_libdir)/libc.a"
473 +
474 + # Make sure we can do the final link #523730, need to set deployment
475 + # target to override hardcoded 10.3 which breaks on modern OSX
476 + [[ ${CHOST} == *-darwin* ]] && \
477 + myconf "-Dld=env MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} $(tc-getCC)"
478 +
479 + # Older macOS with non-Apple GCC chokes on inline in system headers
480 + # using c89 mode as injected by cflags.SH
481 + [[ ${CHOST} == *-darwin* && ${CHOST##*darwin} -le 9 ]] && tc-is-gcc && \
482 + append-cflags -Dinline=__inline__
483 +
484 + # fix unaligned access misdetection
485 + # https://rt.perl.org/Public/Bug/Display.html?id=133495
486 + # https://rt.perl.org/Public/Bug/Display.html?id=133803
487 + # bug #676062, bug #688432
488 + use hppa || use sparc || [[ ${CHOST} == sparc*-solaris* ]] || \
489 + [[ ${CHOST} == armv5tel* ]] \
490 + && myconf "-Dd_u32align='define'"
491 +
492 + # Prefix: the host system needs not to follow Gentoo multilib stuff, and in
493 + # Prefix itself we don't do multilib either, so make sure perl can find
494 + # something compatible.
495 + if use prefix ; then
496 + # Set a hook to check for each detected library whether it actually works.
497 + export libscheck="
498 + ( echo 'main(){}' > '${T}'/conftest.c &&
499 + $(tc-getCC) -o '${T}'/conftest '${T}'/conftest.c -l\$thislib >/dev/null 2>/dev/null
500 + ) || xxx=/dev/null"
501 +
502 + # Use all host paths that might contain useful stuff, the hook above will filter out bad choices.
503 + local paths="/lib/*-linux-gnu /usr/lib/*-linux-gnu /lib64 /lib/64 /usr/lib64 /usr/lib/64 /lib32 /usr/lib32 /lib /usr/lib"
504 + myconf "-Dlibpth=${EPREFIX}/$(get_libdir) ${EPREFIX}/usr/$(get_libdir) ${paths}"
505 + elif [[ $(get_libdir) != "lib" ]] ; then
506 + # We need to use " and not ', as the written config.sh use ' ...
507 + myconf "-Dlibpth=/usr/local/$(get_libdir) /$(get_libdir) /usr/$(get_libdir)"
508 + fi
509 +
510 + # don't try building ODBM, bug #354453
511 + disabled_extensions="ODBM_File"
512 +
513 + if ! use gdbm ; then
514 + # workaround for bug #157774: don't try building GDBM related stuff with USE="-gdbm"
515 + disabled_extensions="${disabled_extensions} GDBM_File NDBM_File"
516 + fi
517 +
518 + myconf -Dnoextensions="${disabled_extensions}"
519 +
520 + [[ "${PV##*.}" == "9999" ]] && myconf -Dusedevel -Uversiononly
521 +
522 + [[ -n "${EXTRA_ECONF}" ]] && ewarn During Perl build, EXTRA_ECONF=${EXTRA_ECONF}
523 + # allow fiddling via EXTRA_ECONF, bug 558070
524 + eval "local -a EXTRA_ECONF=(${EXTRA_ECONF})"
525 +
526 + # setting -Dld= to tc-getLD breaks perl and all perl things
527 + # https://github.com/Perl/perl5/issues/17791#issuecomment-630145202
528 + myconf \
529 + -Duseshrplib \
530 + -Darchname="${myarch}" \
531 + -Dcc="$(tc-getCC)" \
532 + -Dar="$(tc-getAR)" \
533 + -Dnm="$(tc-getNM)" \
534 + -Dcpp="$(tc-getCPP)" \
535 + -Dranlib="$(tc-getRANLIB)" \
536 + -Doptimize="${CFLAGS}" \
537 + -Dldflags="${LDFLAGS}" \
538 + -Dprefix="${EPREFIX}"'/usr' \
539 + -Dsiteprefix="${EPREFIX}"'/usr/local' \
540 + -Dvendorprefix="${EPREFIX}"'/usr' \
541 + -Dscriptdir="${EPREFIX}"'/usr/bin' \
542 + -Dprivlib="${EPREFIX}${PRIV_LIB}" \
543 + -Darchlib="${EPREFIX}${ARCH_LIB}" \
544 + -Dsitelib="${EPREFIX}${SITE_LIB}" \
545 + -Dsitearch="${EPREFIX}${SITE_ARCH}" \
546 + -Dvendorlib="${EPREFIX}${VENDOR_LIB}" \
547 + -Dvendorarch="${EPREFIX}${VENDOR_ARCH}" \
548 + -Dman1dir="${EPREFIX}"/usr/share/man/man1 \
549 + -Dman3dir="${EPREFIX}"/usr/share/man/man3 \
550 + -Dsiteman1dir="${EPREFIX}"/usr/local/man/man1 \
551 + -Dsiteman3dir="${EPREFIX}"/usr/local/man/man3 \
552 + -Dvendorman1dir="${EPREFIX}"/usr/share/man/man1 \
553 + -Dvendorman3dir="${EPREFIX}"/usr/share/man/man3 \
554 + -Dman1ext='1' \
555 + -Dman3ext='3pm' \
556 + -Dlibperl="${LIBPERL}" \
557 + -Dlocincpth="${EPREFIX}"'/usr/include ' \
558 + -Dglibpth="${EPREFIX}/$(get_libdir) ${EPREFIX}/usr/$(get_libdir)"' ' \
559 + -Duselargefiles \
560 + -Dd_semctl_semun \
561 + -Dcf_by='Gentoo' \
562 + -Dmyhostname='localhost' \
563 + -Dperladmin='root@localhost' \
564 + -Ud_csh \
565 + -Dsh="${EPREFIX}"/bin/sh \
566 + -Dtargetsh="${EPREFIX}"/bin/sh \
567 + -Uusenm \
568 + "${myconf[@]}" \
569 + "${EXTRA_ECONF[@]}"
570 +
571 + if tc-is-cross-compiler; then
572 + ./configure \
573 + --target="${CHOST}" \
574 + --build="${CBUILD}" \
575 + -Dinstallprefix='' \
576 + -Dinstallusrbinperl='undef' \
577 + -Dusevendorprefix='define' \
578 + "${myconf[@]}" \
579 + || die "Unable to configure"
580 + else
581 + sh Configure \
582 + -des \
583 + -Dinstallprefix="${EPREFIX}"'/usr' \
584 + -Dinstallusrbinperl='n' \
585 + "${myconf[@]}" \
586 + || die "Unable to configure"
587 + fi
588 +}
589 +
590 +src_test() {
591 + export NO_GENTOO_NETWORK_TESTS=1;
592 + export GENTOO_ASSUME_SANDBOXED="${GENTOO_ASSUME_SANDBOXED:-1}"
593 + export GENTOO_NO_PORTING_TESTS="${GENTOO_NO_PORTING_TESTS:-1}"
594 + if [[ ${EUID} == 0 ]] ; then
595 + ewarn "Test fails with a sandbox error (#328793) if run as root. Skipping tests..."
596 + return 0
597 + fi
598 + use elibc_uclibc && export MAKEOPTS+=" -j1"
599 + TEST_JOBS="$(makeopts_jobs)" make test_harness || die "test failed"
600 +}
601 +
602 +src_install() {
603 + local i
604 + local coredir="${ARCH_LIB}/CORE"
605 +
606 + emake DESTDIR="${D}" install
607 +
608 + rm -f "${ED}/usr/bin/perl${MY_PV}"
609 + ln -s perl "${ED}"/usr/bin/perl${MY_PV} || die
610 +
611 + if ! tc-is-static-only ; then
612 + dolib.so "${ED}"${coredir}/${LIBPERL}
613 + rm -f "${ED}"${coredir}/${LIBPERL}
614 + ln -sf ${LIBPERL} "${ED}"/usr/$(get_libdir)/libperl$(get_libname ${SHORT_PV}) || die
615 + ln -sf ${LIBPERL} "${ED}"/usr/$(get_libdir)/libperl$(get_libname) || die
616 +
617 + ln -sf ../../../../${LIBPERL} "${ED}"${coredir}/${LIBPERL} || die
618 + ln -sf ../../../../${LIBPERL} "${ED}"${coredir}/libperl$(get_libname ${SHORT_PV}) || die
619 + ln -sf ../../../../${LIBPERL} "${ED}"${coredir}/libperl$(get_libname) || die
620 + fi
621 +
622 + rm -rf "${ED}"/usr/share/man/man3 || die "Unable to remove module man pages"
623 +
624 + # This removes ${D} from Config.pm
625 + for i in $(find "${D}" -iname "Config.pm" ) ; do
626 + einfo "Removing ${D} from ${i}..."
627 + sed -i -e "s:${D}::" "${i}" || die "Sed failed"
628 + done
629 +
630 + dodoc Changes* README AUTHORS
631 +
632 + if use doc ; then
633 + # HTML Documentation
634 + # We expect errors, warnings, and such with the following.
635 +
636 + dodir /usr/share/doc/${PF}/html
637 + LD_LIBRARY_PATH=. ./perl installhtml \
638 + --podroot='.' \
639 + --podpath='lib:ext:pod:vms' \
640 + --recurse \
641 + --htmldir="${ED}/usr/share/doc/${PF}/html"
642 + fi
643 +
644 + [[ -d ${ED}/usr/local ]] && rm -r "${ED}"/usr/local
645 +
646 + dual_scripts
647 +}
648 +
649 +pkg_preinst() {
650 + check_rebuild
651 +}
652 +
653 +pkg_postinst() {
654 + dual_scripts
655 +
656 + if [[ "${ROOT}" = "/" ]] ; then
657 + local INC DIR file
658 + INC=$(perl -e 'for $line (@INC) { next if $line eq "."; next if $line =~ m/'${SHORT_PV}'|etc|local|perl$/; print "$line\n" }')
659 + einfo "Removing old .ph files"
660 + for DIR in ${INC} ; do
661 + if [[ -d "${DIR}" ]] ; then
662 + for file in $(find "${DIR}" -name "*.ph" -type f ) ; do
663 + rm -f "${file}"
664 + einfo "<< ${file}"
665 + done
666 + fi
667 + done
668 + # Silently remove the now empty dirs
669 + for DIR in ${INC} ; do
670 + if [[ -d "${DIR}" ]] ; then
671 + find "${DIR}" -depth -type d -print0 | xargs -0 -r rmdir &> /dev/null
672 + fi
673 + done
674 +
675 + fi
676 +}
677 +
678 +pkg_postrm() {
679 + dual_scripts
680 +}