Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/ncurses/
Date: Sun, 25 Sep 2022 01:15:05
Message-Id: 1664068494.b6c4ac1ae4228b4b865da7f9f3ad3c3a1c5a2b00.sam@gentoo
1 commit: b6c4ac1ae4228b4b865da7f9f3ad3c3a1c5a2b00
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Sun Sep 25 01:14:49 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sun Sep 25 01:14:54 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b6c4ac1a
7
8 sys-libs/ncurses: add 6.3_p20220924
9
10 Wasn't necessarily planning on doing more of these snapshots but
11 a (Gentoo) user reported [0] a bug upstream that's fixed in this version,
12 so why not?
13
14 [0] https://lists.gnu.org/archive/html/bug-ncurses/2022-09/msg00020.html
15 Signed-off-by: Sam James <sam <AT> gentoo.org>
16
17 sys-libs/ncurses/Manifest | 3 +
18 sys-libs/ncurses/ncurses-6.3_p20220924-r1.ebuild | 465 +++++++++++++++++++++++
19 sys-libs/ncurses/ncurses-6.3_p20220924.ebuild | 463 ++++++++++++++++++++++
20 3 files changed, 931 insertions(+)
21
22 diff --git a/sys-libs/ncurses/Manifest b/sys-libs/ncurses/Manifest
23 index 0c5441853c5a..46fc616af217 100644
24 --- a/sys-libs/ncurses/Manifest
25 +++ b/sys-libs/ncurses/Manifest
26 @@ -96,6 +96,9 @@ DIST ncurses-6.3-20220910.patch.gz 120984 BLAKE2B 69ad11c6d31d4bb97737e6ede506ba
27 DIST ncurses-6.3-20220910.patch.gz.asc 729 BLAKE2B 55c87ac9edd67abf2c39823acc37a9c8dce6852344d38b442bc2e4693a44412383c2ea710d3030b079607824877f6a1f5efc50970ccd51086c62ebed23e7ee05 SHA512 887031e5248665c79abbc35f4c1e63cffa3b271359188e266372c624b1ac2ce6bb269823c16ea0f6662e4e4acf592179db8f0030fdd9b03ed531d37d5fb7b44e
28 DIST ncurses-6.3-20220917.patch.gz 7833 BLAKE2B 338ddfc2b660cff6248bcb2fc39ef13baf3d622c9f68b47c2da4d94e21a12dec7f6d98f7125a154f1e4dbe612cde9172de9d78851bba1fe4e9106dc1cd9e0a26 SHA512 5b2de00087211b9e599aecbe94870504c4bd312d9f0ab4959e706f784700e6e3095beeb8283ed8df9911f5e841f1004a2ef5184ee2c04762a63d84c47c2f4cfe
29 DIST ncurses-6.3-20220917.patch.gz.asc 729 BLAKE2B c952f018cee490635809fa3a4ead27964a639289db16db42768c545e85b56033b01ea45b9251cd14f4d0cff97673566a4c8d04f93a1539392b676baeecc0307c SHA512 57de37e7c0fe70b0c1abdabe77b36a95b2845b423f167dd4d5acf5999a7152d69193f707c41f88d6e4210934c120d8c72a93830c6f2f9cb49832266e02314588
30 +DIST ncurses-6.3-20220924.patch.gz 112587 BLAKE2B 77711d12d8b38d72c8f218eae8f1452fe5d6f65e00937b663ee99e399f0b2a53d450391b12900470b1670cd83dfaac3c10ecc2e4358617866edc317c6daeb3fd SHA512 99057a0e28fa03aae415761928a4fd158eca7de1fee34531a102901846a94893de9dce2f1ad08885201ec0f54d379c3b4886725e766c27239ac957108c89dcb4
31 +DIST ncurses-6.3-20220924.patch.gz.asc 729 BLAKE2B 64103419d56b0e3b9ab7d7c0b2c650db18b472f2c656b6939b865f7a93e4f6ef5adbed9e438c21a488c204c0dffc818a9c787558ce04a50c7d1c6384f84889aa SHA512 f4bda8c09b6b701c99ffd3153dd8754496991b7f83c36ee7f49c4c701d081d32adfc9c04fa83e639df7f024479c7ee5b3921f45db9f72e896c48637073eca38b
32 DIST ncurses-6.3.tar.gz 3583550 BLAKE2B b2c174ac48d587b4d3aa054f04e4ec8bffd8a657a4aff5f090104965c741901e600712c8f8e5e98f3b8a26bc558996a1e14a746f113854832853b855e9d406c3 SHA512 5373f228cba6b7869210384a607a2d7faecfcbfef6dbfcd7c513f4e84fbd8bcad53ac7db2e7e84b95582248c1039dcfc7c4db205a618f7da22a166db482f0105
33 DIST ncurses-6.3.tar.gz.sig 438 BLAKE2B d7f9852292110fe7a048a9e38611ea06564b5142cb4cbeb8d99bba752d5df8eeffa3b57e5ca315c14024520bc008b30650e99669c995dca05a798399a0c85d39 SHA512 b9a2a25e0b1854c272bf89c610c81fc0ba061f0296eca5c0079a79cfe310e44eb16c46eb5a0dd018f1ca9114d569c9d5087a2b8e60b0344f1eb97f7c5addafc6
34 DIST ncurses-6.3_p20220910-patches.tar.xz 62776 BLAKE2B a65260559ca4f69d724fdaec5ebade7f213144ff77485f6a8b6a55632736caae350ab478550d7ad3a3b723c4804397e8c5dfbed172f77f4f91a444a545b85f16 SHA512 21a51325ab649213e09ea67bc22045e91e67766211766f2d19477e740d36cb235b292576230d087532ba0b44947938d29fd2d28199084fb91e3f8cd3cd6cf00a
35 +DIST ncurses-6.3_p20220924-patches.tar.xz 63272 BLAKE2B 94b617ba8e949bd7b78047bb1a99acb9f5e0e456d4aebfe3d81b405c491071be7aaeb90df68d144c80a7da6a02a916ba3b2c553ecaf7a8a74214860743b7b783 SHA512 7e55e96b94184a84a752a2b482d13c3aaccb41ade79d14569aad00534c03a80f2dbafc5460838b8d51271089c02c5f0da1a73e5a70bc0619217124ae1c647e20
36
37 diff --git a/sys-libs/ncurses/ncurses-6.3_p20220924-r1.ebuild b/sys-libs/ncurses/ncurses-6.3_p20220924-r1.ebuild
38 new file mode 100644
39 index 000000000000..3f93d46bd575
40 --- /dev/null
41 +++ b/sys-libs/ncurses/ncurses-6.3_p20220924-r1.ebuild
42 @@ -0,0 +1,465 @@
43 +# Copyright 1999-2022 Gentoo Authors
44 +# Distributed under the terms of the GNU General Public License v2
45 +
46 +EAPI=7
47 +
48 +VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/thomasdickey.asc
49 +inherit flag-o-matic toolchain-funcs multilib multilib-minimal preserve-libs usr-ldscript verify-sig
50 +
51 +MY_PV="${PV:0:3}"
52 +MY_P="${PN}-${MY_PV}"
53 +DESCRIPTION="Console display library"
54 +HOMEPAGE="https://www.gnu.org/software/ncurses/ https://invisible-island.net/ncurses/"
55 +# Keep invisible-mirror.net here as some users reported 403 forbidden with invisible-island.net
56 +SRC_URI="
57 + mirror://gnu/ncurses/${MY_P}.tar.gz
58 + https://invisible-island.net/archives/${PN}/${MY_P}.tar.gz
59 + https://invisible-mirror.net/archives/${PN}/${MY_P}.tar.gz
60 + verify-sig? ( mirror://gnu/ncurses/${MY_P}.tar.gz.sig )
61 +"
62 +
63 +GENTOO_PATCH_DEV=sam
64 +GENTOO_PATCH_PV=6.3_p20220924
65 +GENTOO_PATCH_NAME=${PN}-${GENTOO_PATCH_PV}-patches
66 +
67 +# Populated below in a loop. Do not add patches manually here.
68 +UPSTREAM_PATCHES=()
69 +
70 +if [[ ${PV} == *_p* ]] ; then
71 + # Sometimes, after releases, there's no megapatch available yet.
72 + #
73 + # From upstream README at e.g. https://invisible-island.net/archives/ncurses/6.3/:
74 + #
75 + # "At times (generally to mark a relatively stable point), I create a rollup
76 + # patch, which consists of all changes from the release through the current date."
77 + #
78 + # Also, from https://lists.gnu.org/archive/html/bug-ncurses/2019-08/msg00039.html,
79 + # the patches are considered to be acceptable to use after some testing. They
80 + # are both for development but also bug fixes.
81 + #
82 + # This array should contain a list of all the snapshots since the last
83 + # release if there's no megapatch available yet.
84 + PATCH_DATES=(
85 + 20211026
86 + 20211030
87 + 20211106
88 + 20211113
89 + 20211115
90 + 20211120
91 + 20211127
92 + 20211204
93 + 20211211
94 + 20211219
95 + 20211225
96 + 20220101
97 + 20220115
98 + 20220122
99 + 20220129
100 + 20220205
101 + 20220212
102 + 20220219
103 + 20220226
104 + 20220305
105 + 20220312
106 + 20220319
107 + 20220326
108 + 20220402
109 + 20220409
110 + 20220416
111 + 20220423
112 + 20220430
113 + 20220501
114 + 20220507
115 + 20220514
116 + 20220521
117 + 20220529
118 + 20220604
119 + 20220612
120 + 20220618
121 + 20220625
122 + 20220703
123 + 20220709
124 + 20220716
125 + 20220724
126 + 20220729
127 + 20220806
128 + 20220813
129 + 20220820
130 + 20220827
131 + 20220903
132 + 20220910
133 + 20220917
134 +
135 + # Latest patch is just _pN = $(ver_cut 4)
136 + $(ver_cut 4)
137 + )
138 +
139 + if [[ -z ${PATCH_DATES[@]} ]] ; then
140 + SRC_URI+=" https://invisible-island.net/archives/${PN}/${PV/_p*}/${P/_p/-}.patch.sh.gz"
141 + SRC_URI+=" verify-sig? ( https://invisible-island.net/archives/${PN}/${PV/_p*}/${P/_p/-}.patch.sh.gz.asc"
142 +
143 + # If we have a rollup patch, use that instead of the individual ones.
144 + UPSTREAM_PATCHES+=( "${WORKDIR}"/${P/_p/-}-patch.sh )
145 + else
146 + patch_url=
147 + my_patch_index=
148 +
149 + # We keep a bunch of mirrors here as we've had reports of invisible*.net
150 + # being 403 forbidden for some users.
151 + urls=(
152 + "https://invisible-island.net/archives/${PN}/${PV/_p*}/${MY_P}-%s"
153 + "https://invisible-mirror.net/archives/${PN}/${PV/_p*}/${MY_P}-%s"
154 + "https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${MY_P}-%s"
155 + )
156 +
157 + for ((my_patch_index=0; my_patch_index < "${#PATCH_DATES[@]}"; my_patch_index++)); do
158 + for url in "${urls[@]}" ; do
159 + patch_url="$(printf ${urls} ${PATCH_DATES[${my_patch_index}]}.patch.gz)"
160 + SRC_URI+=" ${patch_url}"
161 + SRC_URI+=" verify-sig? ( ${patch_url}.asc )"
162 + done
163 +
164 + UPSTREAM_PATCHES+=( "${WORKDIR}"/${MY_P}-${PATCH_DATES[${my_patch_index}]}.patch )
165 + done
166 +
167 + unset patch_url
168 + unset my_patch_index
169 + unset urls
170 + fi
171 +
172 + SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${GENTOO_PATCH_NAME}.tar.xz"
173 +fi
174 +
175 +LICENSE="MIT"
176 +# The subslot reflects the SONAME.
177 +SLOT="0/6"
178 +#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"
179 +IUSE="ada +cxx debug doc gpm minimal profile +stack-realign static-libs test tinfo trace"
180 +RESTRICT="!test? ( test )"
181 +
182 +DEPEND="gpm? ( sys-libs/gpm[${MULTILIB_USEDEP}] )"
183 +# Block the older ncurses that installed all files w/SLOT=5, bug #557472
184 +RDEPEND="${DEPEND}
185 + !<=sys-libs/ncurses-5.9-r4:5
186 + !<sys-libs/slang-2.3.2_pre23
187 + !<x11-terms/rxvt-unicode-9.06-r3
188 + !<x11-terms/st-0.6-r1"
189 +BDEPEND="verify-sig? ( sec-keys/openpgp-keys-thomasdickey )"
190 +
191 +S="${WORKDIR}/${MY_P}"
192 +
193 +PATCHES=(
194 + "${UPSTREAM_PATCHES[@]}"
195 +
196 + # When rebasing Gentoo's patchset, please use git from a clean
197 + # src_unpack with upstream patches already applied. git am --reject
198 + # the existing patchset and rebase as required. This makes it easier
199 + # to manage future rebasing & adding new patches.
200 + #
201 + # For the same reasons, please include the original configure.in changes,
202 + # NOT just the generated results!
203 + "${WORKDIR}"/${GENTOO_PATCH_NAME}
204 +)
205 +
206 +src_unpack() {
207 + # Avoid trying to verify our own patchset tarball, there's no point
208 + if use verify-sig ; then
209 + local file
210 + for file in ${A} ; do
211 + if [[ ${file} == ${MY_P}.tar.gz ]] ; then
212 + verify-sig_verify_detached "${DISTDIR}"/${file} "${DISTDIR}"/${file}.sig
213 + else
214 + [[ ${file} == @(*${GENTOO_PATCH_NAME}.tar.xz|*.asc|*.sig) ]] && continue
215 +
216 + verify-sig_verify_detached "${DISTDIR}"/${file} "${DISTDIR}"/${file}.asc
217 + fi
218 + done
219 + fi
220 +
221 + default
222 +}
223 +
224 +src_configure() {
225 + # bug #115036
226 + unset TERMINFO
227 +
228 + tc-export_build_env BUILD_{CC,CPP}
229 +
230 + # bug #214642
231 + BUILD_CPPFLAGS+=" -D_GNU_SOURCE"
232 +
233 + # Build the various variants of ncurses -- narrow, wide, and threaded. #510440
234 + # Order matters here -- we want unicode/thread versions to come last so that the
235 + # binaries in /usr/bin support both wide and narrow.
236 + # The naming is also important as we use these directly with filenames and when
237 + # checking configure flags.
238 + NCURSES_TARGETS=(
239 + ncurses
240 + ncursesw
241 + ncursest
242 + ncursestw
243 + )
244 +
245 + # When installing ncurses, we have to use a compatible version of tic.
246 + # This comes up when cross-compiling, doing multilib builds, upgrading,
247 + # or installing for the first time. Build a local copy of tic whenever
248 + # the host version isn't available. bug #249363, bug #557598
249 + if ! has_version -b "~sys-libs/${P}:0" ; then
250 + local lbuildflags="-static"
251 +
252 + # some toolchains don't quite support static linking
253 + local dbuildflags="-Wl,-rpath,${WORKDIR}/lib"
254 + case ${CHOST} in
255 + *-darwin*) dbuildflags= ;;
256 + *-solaris*) dbuildflags="-Wl,-R,${WORKDIR}/lib" ;;
257 + esac
258 + echo "int main() {}" | \
259 + $(tc-getCC) -o x -x c - ${lbuildflags} -pipe >& /dev/null \
260 + || lbuildflags="${dbuildflags}"
261 +
262 + # We can't re-use the multilib BUILD_DIR because we run outside of it.
263 + BUILD_DIR="${WORKDIR}" \
264 + CC=${BUILD_CC} \
265 + CHOST=${CBUILD} \
266 + CFLAGS=${BUILD_CFLAGS} \
267 + CXXFLAGS=${BUILD_CXXFLAGS} \
268 + CPPFLAGS=${BUILD_CPPFLAGS} \
269 + LDFLAGS="${BUILD_LDFLAGS} ${lbuildflags}" \
270 + do_configure cross --without-shared --with-normal --with-progs
271 + fi
272 + multilib-minimal_src_configure
273 +}
274 +
275 +multilib_src_configure() {
276 + if [[ ${ABI} == x86 ]] ; then
277 + # For compatibility with older binaries at slight performance cost.
278 + # bug #616402
279 + use stack-realign && append-flags -mstackrealign
280 + fi
281 +
282 + local t
283 + for t in "${NCURSES_TARGETS[@]}" ; do
284 + do_configure "${t}"
285 + done
286 +}
287 +
288 +do_configure() {
289 + local target=$1
290 + shift
291 +
292 + mkdir "${BUILD_DIR}/${target}" || die
293 + cd "${BUILD_DIR}/${target}" || die
294 +
295 + local conf=(
296 + # We need the basic terminfo files in /etc, bug #37026. We will
297 + # add '--with-terminfo-dirs' and then populate /etc/terminfo in
298 + # src_install() ...
299 + --with-terminfo-dirs="${EPREFIX}/etc/terminfo:${EPREFIX}/usr/share/terminfo"
300 +
301 + # Enable installation of .pc files.
302 + --enable-pc-files
303 + # This path is used to control where the .pc files are installed.
304 + --with-pkg-config-libdir="${EPREFIX}/usr/$(get_libdir)/pkgconfig"
305 +
306 + # Now the rest of the various standard flags.
307 + --with-shared
308 + # (Originally disabled until bug #245417 is sorted out, but now
309 + # just keeping it off for good, given nobody needed it until now
310 + # (2022) and we're trying to phase out bdb.)
311 + --without-hashed-db
312 + $(use_with ada)
313 + $(use_with cxx)
314 + $(use_with cxx cxx-binding)
315 + --with-cxx-shared
316 + $(use_with debug)
317 + $(use_with profile)
318 + # The configure script uses ldd to parse the linked output which
319 + # is flaky for cross-compiling/multilib/ldd versions/etc...
320 + $(use_with gpm gpm libgpm.so.1)
321 + # Required for building on mingw-w64, and possibly other windows
322 + # platforms, bug #639670
323 + $(use_enable kernel_Winnt term-driver)
324 + --disable-termcap
325 + --enable-symlinks
326 + --with-rcs-ids
327 + --with-manpage-format=normal
328 + --enable-const
329 + --enable-colorfgbg
330 + --enable-hard-tabs
331 + --enable-echo
332 + $(use_enable !ada warnings)
333 + $(use_with debug assertions)
334 + $(use_enable !debug leaks)
335 + $(use_with debug expanded)
336 + $(use_with !debug macros)
337 + $(multilib_native_with progs)
338 + $(use_with test tests)
339 + $(use_with trace)
340 + $(use_with tinfo termlib)
341 + --disable-stripping
342 + --disable-pkg-ldflags
343 + )
344 +
345 + if [[ ${target} == ncurses*w ]] ; then
346 + conf+=( --enable-widec )
347 + else
348 + conf+=( --disable-widec )
349 + fi
350 + if [[ ${target} == ncursest* ]] ; then
351 + conf+=( --with-{pthread,reentrant} )
352 + else
353 + conf+=( --without-{pthread,reentrant} )
354 + fi
355 +
356 + # Make sure each variant goes in a unique location.
357 + if [[ ${target} == "ncurses" ]] ; then
358 + # "ncurses" variant goes into "${EPREFIX}"/usr/include
359 + # It is needed on Prefix because the configure script appends
360 + # "ncurses" to "${prefix}/include" if "${prefix}" is not /usr.
361 + conf+=( --enable-overwrite )
362 + else
363 + conf+=( --includedir="${EPREFIX}"/usr/include/${target} )
364 + fi
365 + # See comments in src_configure.
366 + if [[ ${target} != "cross" ]] ; then
367 + local cross_path="${WORKDIR}/cross"
368 + [[ -d ${cross_path} ]] && export TIC_PATH="${cross_path}/progs/tic"
369 + fi
370 +
371 + ECONF_SOURCE="${S}" econf "${conf[@]}" "$@"
372 +}
373 +
374 +src_compile() {
375 + # See comments in src_configure.
376 + if ! has_version -b "~sys-libs/${P}:0" ; then
377 + # We could possibly merge these two branches but opting to be
378 + # conservative when merging some of the Prefix changes.
379 +
380 + if [[ ${CHOST} == *-cygwin* ]] && ! multilib_is_native_abi ; then
381 + # We make 'tic$(x)' here, for Cygwin having x=".exe".
382 + BUILD_DIR="${WORKDIR}" \
383 + do_compile cross -C progs all PROGS='tic$(x)'
384 + else
385 + BUILD_DIR="${WORKDIR}" \
386 + do_compile cross -C progs tic
387 + fi
388 + fi
389 +
390 + multilib-minimal_src_compile
391 +}
392 +
393 +multilib_src_compile() {
394 + local t
395 + for t in "${NCURSES_TARGETS[@]}" ; do
396 + do_compile "${t}"
397 + done
398 +}
399 +
400 +do_compile() {
401 + local target=$1
402 + shift
403 +
404 + cd "${BUILD_DIR}/${target}" || die
405 +
406 + # A little hack to fix parallel builds ... they break when
407 + # generating sources so if we generate the sources first (in
408 + # non-parallel), we can then build the rest of the package
409 + # in parallel. This is not really a perf hit since the source
410 + # generation is quite small.
411 + emake -j1 sources
412 +
413 + # For some reason, sources depends on pc-files which depends on
414 + # compiled libraries which depends on sources which ...
415 + # Manually delete the pc-files file so the install step will
416 + # create the .pc files we want.
417 + rm -f misc/pc-files || die
418 + emake "$@"
419 +}
420 +
421 +multilib_src_install() {
422 + local target
423 + for target in "${NCURSES_TARGETS[@]}" ; do
424 + emake -C "${BUILD_DIR}/${target}" DESTDIR="${D}" install
425 + done
426 +
427 + # Move main libraries into /.
428 + if multilib_is_native_abi ; then
429 + gen_usr_ldscript -a \
430 + "${NCURSES_TARGETS[@]}" \
431 + $(usex tinfo 'tinfow tinfo' '')
432 + fi
433 +
434 + # Don't delete '*.dll.a', needed for linking, bug #631468
435 + if ! use static-libs; then
436 + find "${ED}"/usr/ -name '*.a' ! -name '*.dll.a' -delete || die
437 + fi
438 +
439 + # Build fails to create this ...
440 + # -FIXME-
441 + # Ugly hackaround for riscv having two parts libdir (bug #689240)
442 + # Replace this hack with an official solution once we have one...
443 + # -FIXME-
444 + dosym $(sed 's@[^/]\+@..@g' <<< $(get_libdir))/share/terminfo \
445 + /usr/$(get_libdir)/terminfo
446 +
447 + # Remove obsolete libcurses symlink that is created by the build
448 + # system. Technically, this could be also achieved
449 + # via --disable-overwrite but it also moves headers implicitly,
450 + # and we do not want to do this yet.
451 + # bug #836696
452 + rm "${ED}"/usr/$(get_libdir)/libcurses* || die
453 +}
454 +
455 +multilib_src_install_all() {
456 + # We need the basic terminfo files in /etc for embedded/recovery, bug #37026
457 + einfo "Installing basic terminfo files in /etc..."
458 + local terms=(
459 + # Dumb/simple values that show up when using the in-kernel VT.
460 + ansi console dumb linux
461 + vt{52,100,102,200,220}
462 + # [u]rxvt users used to be pretty common. Probably should drop this
463 + # since upstream is dead and people are moving away from it.
464 + rxvt{,-unicode}{,-256color}
465 + # xterm users are common, as is terminals re-using/spoofing it.
466 + xterm xterm-{,256}color
467 + # screen is common (and reused by tmux).
468 + screen{,-256color}
469 + screen.xterm-256color
470 + )
471 + local x
472 + for x in "${terms[@]}"; do
473 + local termfile=$(find "${ED}"/usr/share/terminfo/ -name "${x}" 2>/dev/null)
474 + local basedir=$(basename "$(dirname "${termfile}")")
475 +
476 + if [[ -n ${termfile} ]] ; then
477 + dodir "/etc/terminfo/${basedir}"
478 + mv "${termfile}" "${ED}/etc/terminfo/${basedir}/" || die
479 + dosym "../../../../etc/terminfo/${basedir}/${x}" \
480 + "/usr/share/terminfo/${basedir}/${x}"
481 + fi
482 + done
483 +
484 + echo "CONFIG_PROTECT_MASK=\"/etc/terminfo\"" | newenvd - 50ncurses
485 +
486 + use minimal && rm -r "${ED}"/usr/share/terminfo*
487 + # Because ncurses5-config --terminfo returns the directory we keep it
488 + # bug #245374
489 + keepdir /usr/share/terminfo
490 +
491 + cd "${S}" || die
492 + dodoc ANNOUNCE MANIFEST NEWS README* TO-DO doc/*.doc
493 + if use doc ; then
494 + docinto html
495 + dodoc -r doc/html/
496 + fi
497 +}
498 +
499 +pkg_preinst() {
500 + preserve_old_lib /$(get_libdir)/libncurses.so.5
501 + preserve_old_lib /$(get_libdir)/libncursesw.so.5
502 +}
503 +
504 +pkg_postinst() {
505 + preserve_old_lib_notify /$(get_libdir)/libncurses.so.5
506 + preserve_old_lib_notify /$(get_libdir)/libncursesw.so.5
507 +}
508
509 diff --git a/sys-libs/ncurses/ncurses-6.3_p20220924.ebuild b/sys-libs/ncurses/ncurses-6.3_p20220924.ebuild
510 new file mode 100644
511 index 000000000000..4fcb647e26d7
512 --- /dev/null
513 +++ b/sys-libs/ncurses/ncurses-6.3_p20220924.ebuild
514 @@ -0,0 +1,463 @@
515 +# Copyright 1999-2022 Gentoo Authors
516 +# Distributed under the terms of the GNU General Public License v2
517 +
518 +EAPI=7
519 +
520 +VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/thomasdickey.asc
521 +inherit flag-o-matic toolchain-funcs multilib multilib-minimal preserve-libs usr-ldscript verify-sig
522 +
523 +MY_PV="${PV:0:3}"
524 +MY_P="${PN}-${MY_PV}"
525 +DESCRIPTION="Console display library"
526 +HOMEPAGE="https://www.gnu.org/software/ncurses/ https://invisible-island.net/ncurses/"
527 +# Keep invisible-mirror.net here as some users reported 403 forbidden with invisible-island.net
528 +SRC_URI="
529 + mirror://gnu/ncurses/${MY_P}.tar.gz
530 + https://invisible-island.net/archives/${PN}/${MY_P}.tar.gz
531 + https://invisible-mirror.net/archives/${PN}/${MY_P}.tar.gz
532 + verify-sig? ( mirror://gnu/ncurses/${MY_P}.tar.gz.sig )
533 +"
534 +
535 +GENTOO_PATCH_DEV=sam
536 +GENTOO_PATCH_PV=6.3_p20220924
537 +GENTOO_PATCH_NAME=${PN}-${GENTOO_PATCH_PV}-patches
538 +
539 +# Populated below in a loop. Do not add patches manually here.
540 +UPSTREAM_PATCHES=()
541 +
542 +if [[ ${PV} == *_p* ]] ; then
543 + # Sometimes, after releases, there's no megapatch available yet.
544 + #
545 + # From upstream README at e.g. https://invisible-island.net/archives/ncurses/6.3/:
546 + #
547 + # "At times (generally to mark a relatively stable point), I create a rollup
548 + # patch, which consists of all changes from the release through the current date."
549 + #
550 + # Also, from https://lists.gnu.org/archive/html/bug-ncurses/2019-08/msg00039.html,
551 + # the patches are considered to be acceptable to use after some testing. They
552 + # are both for development but also bug fixes.
553 + #
554 + # This array should contain a list of all the snapshots since the last
555 + # release if there's no megapatch available yet.
556 + PATCH_DATES=(
557 + 20211026
558 + 20211030
559 + 20211106
560 + 20211113
561 + 20211115
562 + 20211120
563 + 20211127
564 + 20211204
565 + 20211211
566 + 20211219
567 + 20211225
568 + 20220101
569 + 20220115
570 + 20220122
571 + 20220129
572 + 20220205
573 + 20220212
574 + 20220219
575 + 20220226
576 + 20220305
577 + 20220312
578 + 20220319
579 + 20220326
580 + 20220402
581 + 20220409
582 + 20220416
583 + 20220423
584 + 20220430
585 + 20220501
586 + 20220507
587 + 20220514
588 + 20220521
589 + 20220529
590 + 20220604
591 + 20220612
592 + 20220618
593 + 20220625
594 + 20220703
595 + 20220709
596 + 20220716
597 + 20220724
598 + 20220729
599 + 20220806
600 + 20220813
601 + 20220820
602 + 20220827
603 + 20220903
604 + 20220910
605 + 20220917
606 +
607 + # Latest patch is just _pN = $(ver_cut 4)
608 + $(ver_cut 4)
609 + )
610 +
611 + if [[ -z ${PATCH_DATES[@]} ]] ; then
612 + SRC_URI+=" https://invisible-island.net/archives/${PN}/${PV/_p*}/${P/_p/-}.patch.sh.gz"
613 + SRC_URI+=" verify-sig? ( https://invisible-island.net/archives/${PN}/${PV/_p*}/${P/_p/-}.patch.sh.gz.asc"
614 +
615 + # If we have a rollup patch, use that instead of the individual ones.
616 + UPSTREAM_PATCHES+=( "${WORKDIR}"/${P/_p/-}-patch.sh )
617 + else
618 + patch_url=
619 + my_patch_index=
620 +
621 + # We keep a bunch of mirrors here as we've had reports of invisible*.net
622 + # being 403 forbidden for some users.
623 + urls=(
624 + "https://invisible-island.net/archives/${PN}/${PV/_p*}/${MY_P}-%s"
625 + "https://invisible-mirror.net/archives/${PN}/${PV/_p*}/${MY_P}-%s"
626 + "https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${MY_P}-%s"
627 + )
628 +
629 + for ((my_patch_index=0; my_patch_index < "${#PATCH_DATES[@]}"; my_patch_index++)); do
630 + for url in "${urls[@]}" ; do
631 + patch_url="$(printf ${urls} ${PATCH_DATES[${my_patch_index}]}.patch.gz)"
632 + SRC_URI+=" ${patch_url}"
633 + SRC_URI+=" verify-sig? ( ${patch_url}.asc )"
634 + done
635 +
636 + UPSTREAM_PATCHES+=( "${WORKDIR}"/${MY_P}-${PATCH_DATES[${my_patch_index}]}.patch )
637 + done
638 +
639 + unset patch_url
640 + unset my_patch_index
641 + unset urls
642 + fi
643 +
644 + SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${GENTOO_PATCH_NAME}.tar.xz"
645 +fi
646 +
647 +LICENSE="MIT"
648 +# The subslot reflects the SONAME.
649 +SLOT="0/6"
650 +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"
651 +IUSE="ada +cxx debug doc gpm minimal profile +stack-realign static-libs test tinfo trace"
652 +RESTRICT="!test? ( test )"
653 +
654 +DEPEND="gpm? ( sys-libs/gpm[${MULTILIB_USEDEP}] )"
655 +# Block the older ncurses that installed all files w/SLOT=5, bug #557472
656 +RDEPEND="${DEPEND}
657 + !<=sys-libs/ncurses-5.9-r4:5
658 + !<sys-libs/slang-2.3.2_pre23
659 + !<x11-terms/rxvt-unicode-9.06-r3
660 + !<x11-terms/st-0.6-r1"
661 +BDEPEND="verify-sig? ( sec-keys/openpgp-keys-thomasdickey )"
662 +
663 +S="${WORKDIR}/${MY_P}"
664 +
665 +PATCHES=(
666 + "${UPSTREAM_PATCHES[@]}"
667 +
668 + # When rebasing Gentoo's patchset, please use git from a clean
669 + # src_unpack with upstream patches already applied. git am --reject
670 + # the existing patchset and rebase as required. This makes it easier
671 + # to manage future rebasing & adding new patches.
672 + #
673 + # For the same reasons, please include the original configure.in changes,
674 + # NOT just the generated results!
675 + "${WORKDIR}"/${GENTOO_PATCH_NAME}
676 +)
677 +
678 +src_unpack() {
679 + # Avoid trying to verify our own patchset tarball, there's no point
680 + if use verify-sig ; then
681 + local file
682 + for file in ${A} ; do
683 + if [[ ${file} == ${MY_P}.tar.gz ]] ; then
684 + verify-sig_verify_detached "${DISTDIR}"/${file} "${DISTDIR}"/${file}.sig
685 + else
686 + [[ ${file} == @(*${GENTOO_PATCH_NAME}.tar.xz|*.asc|*.sig) ]] && continue
687 +
688 + verify-sig_verify_detached "${DISTDIR}"/${file} "${DISTDIR}"/${file}.asc
689 + fi
690 + done
691 + fi
692 +
693 + default
694 +}
695 +
696 +src_configure() {
697 + # bug #115036
698 + unset TERMINFO
699 +
700 + tc-export_build_env BUILD_{CC,CPP}
701 +
702 + # bug #214642
703 + BUILD_CPPFLAGS+=" -D_GNU_SOURCE"
704 +
705 + # Build the various variants of ncurses -- narrow, wide, and threaded. #510440
706 + # Order matters here -- we want unicode/thread versions to come last so that the
707 + # binaries in /usr/bin support both wide and narrow.
708 + # The naming is also important as we use these directly with filenames and when
709 + # checking configure flags.
710 + NCURSES_TARGETS=(
711 + ncurses
712 + ncursesw
713 + ncursest
714 + ncursestw
715 + )
716 +
717 + # When installing ncurses, we have to use a compatible version of tic.
718 + # This comes up when cross-compiling, doing multilib builds, upgrading,
719 + # or installing for the first time. Build a local copy of tic whenever
720 + # the host version isn't available. bug #249363, bug #557598
721 + if ! has_version -b "~sys-libs/${P}:0" ; then
722 + local lbuildflags="-static"
723 +
724 + # some toolchains don't quite support static linking
725 + local dbuildflags="-Wl,-rpath,${WORKDIR}/lib"
726 + case ${CHOST} in
727 + *-darwin*) dbuildflags= ;;
728 + *-solaris*) dbuildflags="-Wl,-R,${WORKDIR}/lib" ;;
729 + esac
730 + echo "int main() {}" | \
731 + $(tc-getCC) -o x -x c - ${lbuildflags} -pipe >& /dev/null \
732 + || lbuildflags="${dbuildflags}"
733 +
734 + # We can't re-use the multilib BUILD_DIR because we run outside of it.
735 + BUILD_DIR="${WORKDIR}" \
736 + CC=${BUILD_CC} \
737 + CHOST=${CBUILD} \
738 + CFLAGS=${BUILD_CFLAGS} \
739 + CXXFLAGS=${BUILD_CXXFLAGS} \
740 + CPPFLAGS=${BUILD_CPPFLAGS} \
741 + LDFLAGS="${BUILD_LDFLAGS} ${lbuildflags}" \
742 + do_configure cross --without-shared --with-normal --with-progs
743 + fi
744 + multilib-minimal_src_configure
745 +}
746 +
747 +multilib_src_configure() {
748 + if [[ ${ABI} == x86 ]] ; then
749 + # For compatibility with older binaries at slight performance cost.
750 + # bug #616402
751 + use stack-realign && append-flags -mstackrealign
752 + fi
753 +
754 + local t
755 + for t in "${NCURSES_TARGETS[@]}" ; do
756 + do_configure "${t}"
757 + done
758 +}
759 +
760 +do_configure() {
761 + local target=$1
762 + shift
763 +
764 + mkdir "${BUILD_DIR}/${target}" || die
765 + cd "${BUILD_DIR}/${target}" || die
766 +
767 + local conf=(
768 + # We need the basic terminfo files in /etc, bug #37026. We will
769 + # add '--with-terminfo-dirs' and then populate /etc/terminfo in
770 + # src_install() ...
771 + --with-terminfo-dirs="${EPREFIX}/etc/terminfo:${EPREFIX}/usr/share/terminfo"
772 +
773 + # Enable installation of .pc files.
774 + --enable-pc-files
775 + # This path is used to control where the .pc files are installed.
776 + --with-pkg-config-libdir="${EPREFIX}/usr/$(get_libdir)/pkgconfig"
777 +
778 + # Now the rest of the various standard flags.
779 + --with-shared
780 + # (Originally disabled until bug #245417 is sorted out, but now
781 + # just keeping it off for good, given nobody needed it until now
782 + # (2022) and we're trying to phase out bdb.)
783 + --without-hashed-db
784 + $(use_with ada)
785 + $(use_with cxx)
786 + $(use_with cxx cxx-binding)
787 + --with-cxx-shared
788 + $(use_with debug)
789 + $(use_with profile)
790 + # The configure script uses ldd to parse the linked output which
791 + # is flaky for cross-compiling/multilib/ldd versions/etc...
792 + $(use_with gpm gpm libgpm.so.1)
793 + # Required for building on mingw-w64, and possibly other windows
794 + # platforms, bug #639670
795 + $(use_enable kernel_Winnt term-driver)
796 + --disable-termcap
797 + --enable-symlinks
798 + --with-rcs-ids
799 + --with-manpage-format=normal
800 + --enable-const
801 + --enable-colorfgbg
802 + --enable-hard-tabs
803 + --enable-echo
804 + $(use_enable !ada warnings)
805 + $(use_with debug assertions)
806 + $(use_enable !debug leaks)
807 + $(use_with debug expanded)
808 + $(use_with !debug macros)
809 + $(multilib_native_with progs)
810 + $(use_with test tests)
811 + $(use_with trace)
812 + $(use_with tinfo termlib)
813 + --disable-stripping
814 + --disable-pkg-ldflags
815 + )
816 +
817 + if [[ ${target} == ncurses*w ]] ; then
818 + conf+=( --enable-widec )
819 + else
820 + conf+=( --disable-widec )
821 + fi
822 + if [[ ${target} == ncursest* ]] ; then
823 + conf+=( --with-{pthread,reentrant} )
824 + else
825 + conf+=( --without-{pthread,reentrant} )
826 + fi
827 +
828 + # Make sure each variant goes in a unique location.
829 + if [[ ${target} == "ncurses" ]] ; then
830 + # "ncurses" variant goes into "${EPREFIX}"/usr/include
831 + # It is needed on Prefix because the configure script appends
832 + # "ncurses" to "${prefix}/include" if "${prefix}" is not /usr.
833 + conf+=( --enable-overwrite )
834 + else
835 + conf+=( --includedir="${EPREFIX}"/usr/include/${target} )
836 + fi
837 + # See comments in src_configure.
838 + if [[ ${target} != "cross" ]] ; then
839 + local cross_path="${WORKDIR}/cross"
840 + [[ -d ${cross_path} ]] && export TIC_PATH="${cross_path}/progs/tic"
841 + fi
842 +
843 + ECONF_SOURCE="${S}" econf "${conf[@]}" "$@"
844 +}
845 +
846 +src_compile() {
847 + # See comments in src_configure.
848 + if ! has_version -b "~sys-libs/${P}:0" ; then
849 + # We could possibly merge these two branches but opting to be
850 + # conservative when merging some of the Prefix changes.
851 +
852 + if [[ ${CHOST} == *-cygwin* ]] && ! multilib_is_native_abi ; then
853 + # We make 'tic$(x)' here, for Cygwin having x=".exe".
854 + BUILD_DIR="${WORKDIR}" \
855 + do_compile cross -C progs all PROGS='tic$(x)'
856 + else
857 + BUILD_DIR="${WORKDIR}" \
858 + do_compile cross -C progs tic
859 + fi
860 + fi
861 +
862 + multilib-minimal_src_compile
863 +}
864 +
865 +multilib_src_compile() {
866 + local t
867 + for t in "${NCURSES_TARGETS[@]}" ; do
868 + do_compile "${t}"
869 + done
870 +}
871 +
872 +do_compile() {
873 + local target=$1
874 + shift
875 +
876 + cd "${BUILD_DIR}/${target}" || die
877 +
878 + # A little hack to fix parallel builds ... they break when
879 + # generating sources so if we generate the sources first (in
880 + # non-parallel), we can then build the rest of the package
881 + # in parallel. This is not really a perf hit since the source
882 + # generation is quite small.
883 + emake -j1 sources
884 +
885 + # For some reason, sources depends on pc-files which depends on
886 + # compiled libraries which depends on sources which ...
887 + # Manually delete the pc-files file so the install step will
888 + # create the .pc files we want.
889 + rm -f misc/pc-files || die
890 + emake "$@"
891 +}
892 +
893 +multilib_src_install() {
894 + local target
895 + for target in "${NCURSES_TARGETS[@]}" ; do
896 + emake -C "${BUILD_DIR}/${target}" DESTDIR="${D}" install
897 + done
898 +
899 + # Move main libraries into /.
900 + if multilib_is_native_abi ; then
901 + gen_usr_ldscript -a \
902 + "${NCURSES_TARGETS[@]}" \
903 + $(usex tinfo 'tinfow tinfo' '')
904 + fi
905 +
906 + if ! tc-is-static-only ; then
907 + # Provide a link for -lcurses.
908 + ln -sf libncurses$(get_libname) "${ED}"/usr/$(get_libdir)/libcurses$(get_libname) || die
909 + fi
910 +
911 + # Don't delete '*.dll.a', needed for linking, bug #631468
912 + if ! use static-libs; then
913 + find "${ED}"/usr/ -name '*.a' ! -name '*.dll.a' -delete || die
914 + fi
915 +
916 + # Build fails to create this ...
917 + # -FIXME-
918 + # Ugly hackaround for riscv having two parts libdir (bug #689240)
919 + # Replace this hack with an official solution once we have one...
920 + # -FIXME-
921 + dosym $(sed 's@[^/]\+@..@g' <<< $(get_libdir))/share/terminfo \
922 + /usr/$(get_libdir)/terminfo
923 +}
924 +
925 +multilib_src_install_all() {
926 + # We need the basic terminfo files in /etc for embedded/recovery, bug #37026
927 + einfo "Installing basic terminfo files in /etc..."
928 + local terms=(
929 + # Dumb/simple values that show up when using the in-kernel VT.
930 + ansi console dumb linux
931 + vt{52,100,102,200,220}
932 + # [u]rxvt users used to be pretty common. Probably should drop this
933 + # since upstream is dead and people are moving away from it.
934 + rxvt{,-unicode}{,-256color}
935 + # xterm users are common, as is terminals re-using/spoofing it.
936 + xterm xterm-{,256}color
937 + # screen is common (and reused by tmux).
938 + screen{,-256color}
939 + screen.xterm-256color
940 + )
941 + local x
942 + for x in "${terms[@]}"; do
943 + local termfile=$(find "${ED}"/usr/share/terminfo/ -name "${x}" 2>/dev/null)
944 + local basedir=$(basename "$(dirname "${termfile}")")
945 +
946 + if [[ -n ${termfile} ]] ; then
947 + dodir "/etc/terminfo/${basedir}"
948 + mv "${termfile}" "${ED}/etc/terminfo/${basedir}/" || die
949 + dosym "../../../../etc/terminfo/${basedir}/${x}" \
950 + "/usr/share/terminfo/${basedir}/${x}"
951 + fi
952 + done
953 +
954 + echo "CONFIG_PROTECT_MASK=\"/etc/terminfo\"" | newenvd - 50ncurses
955 +
956 + use minimal && rm -r "${ED}"/usr/share/terminfo*
957 + # Because ncurses5-config --terminfo returns the directory we keep it
958 + # bug #245374
959 + keepdir /usr/share/terminfo
960 +
961 + cd "${S}" || die
962 + dodoc ANNOUNCE MANIFEST NEWS README* TO-DO doc/*.doc
963 + if use doc ; then
964 + docinto html
965 + dodoc -r doc/html/
966 + fi
967 +}
968 +
969 +pkg_preinst() {
970 + preserve_old_lib /$(get_libdir)/libncurses.so.5
971 + preserve_old_lib /$(get_libdir)/libncursesw.so.5
972 +}
973 +
974 +pkg_postinst() {
975 + preserve_old_lib_notify /$(get_libdir)/libncurses.so.5
976 + preserve_old_lib_notify /$(get_libdir)/libncursesw.so.5
977 +}