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