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