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