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