Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/ncurses/, sys-libs/ncurses/files/
Date: Mon, 01 Feb 2021 21:15:29
Message-Id: 1612214123.6ffebcc7ca7f3168014d612f017ba02473108d85.polynomial-c@gentoo
1 commit: 6ffebcc7ca7f3168014d612f017ba02473108d85
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Mon Feb 1 21:15:12 2021 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 1 21:15:23 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6ffebcc7
7
8 sys-libs/ncurses: Bump to version 6.2_p20210123
9
10 Package-Manager: Portage-3.0.14, Repoman-3.0.2
11 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
12
13 sys-libs/ncurses/Manifest | 1 +
14 .../ncurses-6.2_p20210123-cppflags-cross.patch | 35 +++
15 ...ses-6.2_p20210123-no_user_ldflags_in_libs.patch | 40 +++
16 sys-libs/ncurses/ncurses-6.2_p20210123.ebuild | 327 +++++++++++++++++++++
17 4 files changed, 403 insertions(+)
18
19 diff --git a/sys-libs/ncurses/Manifest b/sys-libs/ncurses/Manifest
20 index 61cb703f5fe..401a4ce6c09 100644
21 --- a/sys-libs/ncurses/Manifest
22 +++ b/sys-libs/ncurses/Manifest
23 @@ -1 +1,2 @@
24 DIST ncurses-6.2.tar.gz 3425862 BLAKE2B 6680cd7a369a4cb8234442a70869c283f0db6db9d7da1da2a7a5c519eb862a2c9b9411957d99f9ebb5089cad00b42e1ca6bc0784327461113df2eeaec695913c SHA512 4c1333dcc30e858e8a9525d4b9aefb60000cfc727bc4a1062bace06ffc4639ad9f6e54f6bdda0e3a0e5ea14de995f96b52b3327d9ec633608792c99a1e8d840d
25 +DIST ncurses-6.2_p20210123.patch.xz 519076 BLAKE2B 790ca80f0b7cdba2e75e3ace91e7f40a740594bdcb19930f64a5aaad8ba041f9ee6057e0a856050e5ef54f79ffe21f23897477dd186790fce9f8192d6149e8fc SHA512 f0d4ef317157472400f183e9ba65102e342e996c4f1d99924ece72305064c3d8616668bb2c81c6113b4bd145b1589844f8c948e6424d4372939752364bed6141
26
27 diff --git a/sys-libs/ncurses/files/ncurses-6.2_p20210123-cppflags-cross.patch b/sys-libs/ncurses/files/ncurses-6.2_p20210123-cppflags-cross.patch
28 new file mode 100644
29 index 00000000000..1087bf5c9cb
30 --- /dev/null
31 +++ b/sys-libs/ncurses/files/ncurses-6.2_p20210123-cppflags-cross.patch
32 @@ -0,0 +1,35 @@
33 +https://bugs.gentoo.org/601426
34 +https://lists.gnu.org/archive/html/bug-ncurses/2015-02/msg00012.html
35 +
36 +From: John Vogel
37 +Subject: [PATCH] c++ binding missed when cross compiling
38 +Date: Mon, 16 Feb 2015 01:01:48 -0500
39 +
40 +The configure script hard codes the include dir to the prefix'ed include dir,
41 +when checking if c++ compiler works. This breaks the compiler's built-in search
42 +path. I've included two patches. The first works on the configure.in file, which
43 +requires your autoconf stuff to test and I'm not ready to meddle with at the
44 +moment. The other works directly on the configure file. I've tested the second
45 +one; it should mirror what the first patch tries to achieve and works for me.
46 +
47 +--- a/configure
48 ++++ b/configure
49 +@@ -3459,10 +3459,6 @@
50 + echo "$as_me:3459: checking if $CXX works" >&5
51 + echo $ECHO_N "checking if $CXX works... $ECHO_C" >&6
52 +
53 +- save_CPPFLAGS="$CPPFLAGS"
54 +- eval cf_includedir=${includedir}
55 +- CPPFLAGS="$CPPFLAGS -I${cf_includedir}"
56 +-
57 + cat >"conftest.$ac_ext" <<_ACEOF
58 + #line 3467 "configure"
59 + #include "confdefs.h"
60 +@@ -3499,7 +3495,6 @@
61 + cf_cxx_works=no
62 + fi
63 + rm -f "conftest.$ac_objext" "conftest.$ac_ext"
64 +- CPPFLAGS="$save_CPPFLAGS"
65 +
66 + echo "$as_me:3504: result: $cf_cxx_works" >&5
67 + echo "${ECHO_T}$cf_cxx_works" >&6
68
69 diff --git a/sys-libs/ncurses/files/ncurses-6.2_p20210123-no_user_ldflags_in_libs.patch b/sys-libs/ncurses/files/ncurses-6.2_p20210123-no_user_ldflags_in_libs.patch
70 new file mode 100644
71 index 00000000000..fde03f1d56f
72 --- /dev/null
73 +++ b/sys-libs/ncurses/files/ncurses-6.2_p20210123-no_user_ldflags_in_libs.patch
74 @@ -0,0 +1,40 @@
75 +From 6af3253a91d8844f16924a77349f162060e038fa Mon Sep 17 00:00:00 2001
76 +From: Lars Wendler <polynomial-c@g.o>
77 +Date: Thu, 13 Feb 2020 11:51:09 +0100
78 +Subject: [PATCH] Don't bleed user LDFLAGS into Libs
79 +
80 +Signed-off-by: Lars Wendler <polynomial-c@g.o>
81 +---
82 + misc/gen-pkgconfig.in | 2 +-
83 + misc/ncurses-config.in | 2 +-
84 + 2 files changed, 2 insertions(+), 2 deletions(-)
85 +
86 +diff --git a/misc/gen-pkgconfig.in b/misc/gen-pkgconfig.in
87 +index 5a71ab02..9fa2e0a1 100644
88 +--- a/misc/gen-pkgconfig.in
89 ++++ b/misc/gen-pkgconfig.in
90 +@@ -83,7 +83,7 @@ if [ "$includedir" != "/usr/include" ]; then
91 + fi
92 +
93 + lib_flags=
94 +-for opt in -L$libdir @LDFLAGS@ @EXTRA_PKG_LDFLAGS@ @LIBS@
95 ++for opt in -L$libdir @LIBS@
96 + do
97 + case $opt in
98 + -l*) # LIBS is handled specially below
99 +diff --git a/misc/ncurses-config.in b/misc/ncurses-config.in
100 +index eae39a51..a25e2787 100644
101 +--- a/misc/ncurses-config.in
102 ++++ b/misc/ncurses-config.in
103 +@@ -101,7 +101,7 @@ fi
104 + # There is no portable way to find the list of standard library directories.
105 + # Require a POSIX shell anyway, to keep this simple.
106 + lib_flags=
107 +-for opt in -L$libdir @LDFLAGS@ @EXTRA_PKG_LDFLAGS@ $LIBS
108 ++for opt in -L$libdir $LIBS
109 + do
110 + case $opt in
111 + -specs*) # ignore linker specs-files which were used to build library
112 +--
113 +2.30.0
114 +
115
116 diff --git a/sys-libs/ncurses/ncurses-6.2_p20210123.ebuild b/sys-libs/ncurses/ncurses-6.2_p20210123.ebuild
117 new file mode 100644
118 index 00000000000..df45a2a66cd
119 --- /dev/null
120 +++ b/sys-libs/ncurses/ncurses-6.2_p20210123.ebuild
121 @@ -0,0 +1,327 @@
122 +# Copyright 1999-2021 Gentoo Authors
123 +# Distributed under the terms of the GNU General Public License v2
124 +
125 +EAPI=7
126 +
127 +inherit flag-o-matic toolchain-funcs multilib-minimal preserve-libs usr-ldscript
128 +
129 +MY_PV="${PV:0:3}"
130 +MY_P="${PN}-${MY_PV}"
131 +DESCRIPTION="console display library"
132 +HOMEPAGE="https://www.gnu.org/software/ncurses/ https://invisible-island.net/ncurses/"
133 +SRC_URI="mirror://gnu/ncurses/${MY_P}.tar.gz"
134 +
135 +if [[ "${PV}" == *_p* ]] ; then
136 + #SRC_URI+=" ftp://ftp.invisible-island.net/${PN}/${PV/_p*}/${P/_p/-}-patch.sh.bz2
137 + # https://invisible-mirror.net/archives/${PN}/${PV/_p*}/${P/_p/-}-patch.sh.bz2"
138 + SRC_URI+=" https://dev.gentoo.org/~polynomial-c/dist/${P}.patch.xz"
139 +fi
140 +
141 +LICENSE="MIT"
142 +# The subslot reflects the SONAME.
143 +SLOT="0/6"
144 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~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"
145 +IUSE="ada +cxx debug doc gpm minimal profile static-libs test threads tinfo trace unicode"
146 +RESTRICT="!test? ( test )"
147 +
148 +DEPEND="gpm? ( sys-libs/gpm[${MULTILIB_USEDEP}] )"
149 +# berkdb? ( sys-libs/db )"
150 +# Block the older ncurses that installed all files w/SLOT=5. #557472
151 +RDEPEND="${DEPEND}
152 + !<=sys-libs/ncurses-5.9-r4:5
153 + !<sys-libs/slang-2.3.2_pre23
154 + !<x11-terms/rxvt-unicode-9.06-r3
155 + !<x11-terms/st-0.6-r1"
156 +
157 +S="${WORKDIR}/${MY_P}"
158 +
159 +PATCHES=(
160 + "${FILESDIR}/${PN}-5.7-nongnu.patch"
161 + "${FILESDIR}/${PN}-6.0-rxvt-unicode-9.15.patch" #192083 #383871
162 + "${FILESDIR}/${PN}-6.0-pkg-config.patch"
163 + "${FILESDIR}/${PN}-6.0-ticlib.patch" #557360
164 + "${FILESDIR}/${PN}-6.2_p20210123-cppflags-cross.patch" #601426
165 + "${FILESDIR}/${PN}-6.2_p20210123-no_user_ldflags_in_libs.patch"
166 +)
167 +
168 +src_prepare() {
169 + if [[ "${PV}" == *_p* ]] ; then
170 + #eapply "${WORKDIR}"/${P/_p/-}-patch.sh
171 + eapply "${WORKDIR}/${P}.patch"
172 + fi
173 + default
174 +}
175 +
176 +src_configure() {
177 + unset TERMINFO #115036
178 + tc-export_build_env BUILD_{CC,CPP}
179 + BUILD_CPPFLAGS+=" -D_GNU_SOURCE" #214642
180 +
181 + # Build the various variants of ncurses -- narrow, wide, and threaded. #510440
182 + # Order matters here -- we want unicode/thread versions to come last so that the
183 + # binaries in /usr/bin support both wide and narrow.
184 + # The naming is also important as we use these directly with filenames and when
185 + # checking configure flags.
186 + NCURSES_TARGETS=(
187 + ncurses
188 + $(usex unicode 'ncursesw' '')
189 + $(usex threads 'ncursest' '')
190 + $(use unicode && usex threads 'ncursestw' '')
191 + )
192 +
193 + # When installing ncurses, we have to use a compatible version of tic.
194 + # This comes up when cross-compiling, doing multilib builds, upgrading,
195 + # or installing for the first time. Build a local copy of tic whenever
196 + # the host version isn't available. #249363 #557598
197 + if ! has_version -b "~sys-libs/${P}:0" ; then
198 + local lbuildflags="-static"
199 +
200 + # some toolchains don't quite support static linking
201 + local dbuildflags="-Wl,-rpath,${WORKDIR}/lib"
202 + case ${CHOST} in
203 + *-darwin*) dbuildflags= ;;
204 + *-solaris*) dbuildflags="-Wl,-R,${WORKDIR}/lib" ;;
205 + esac
206 + echo "int main() {}" | \
207 + $(tc-getCC) -o x -x c - ${lbuildflags} -pipe >& /dev/null \
208 + || lbuildflags="${dbuildflags}"
209 +
210 + # We can't re-use the multilib BUILD_DIR because we run outside of it.
211 + BUILD_DIR="${WORKDIR}" \
212 + CHOST=${CBUILD} \
213 + CFLAGS=${BUILD_CFLAGS} \
214 + CXXFLAGS=${BUILD_CXXFLAGS} \
215 + CPPFLAGS=${BUILD_CPPFLAGS} \
216 + LDFLAGS="${BUILD_LDFLAGS} ${lbuildflags}" \
217 + do_configure cross --without-shared --with-normal
218 + fi
219 + multilib-minimal_src_configure
220 +}
221 +
222 +multilib_src_configure() {
223 + local t
224 + for t in "${NCURSES_TARGETS[@]}" ; do
225 + do_configure "${t}"
226 + done
227 +}
228 +
229 +do_configure() {
230 + local target=$1
231 + shift
232 +
233 + mkdir "${BUILD_DIR}/${target}" || die
234 + cd "${BUILD_DIR}/${target}" || die
235 +
236 + local conf=(
237 + # We need the basic terminfo files in /etc, bug #37026. We will
238 + # add '--with-terminfo-dirs' and then populate /etc/terminfo in
239 + # src_install() ...
240 + --with-terminfo-dirs="${EPREFIX}/etc/terminfo:${EPREFIX}/usr/share/terminfo"
241 +
242 + # Disabled until #245417 is sorted out.
243 + #$(use_with berkdb hashed-db)
244 +
245 + # Enable installation of .pc files.
246 + --enable-pc-files
247 + # This path is used to control where the .pc files are installed.
248 + --with-pkg-config-libdir="${EPREFIX}/usr/$(get_libdir)/pkgconfig"
249 +
250 + # Now the rest of the various standard flags.
251 + --with-shared
252 + --without-hashed-db
253 + $(use_with ada)
254 + $(use_with cxx)
255 + $(use_with cxx cxx-binding)
256 + --with-cxx-shared
257 + $(use_with debug)
258 + $(use_with profile)
259 + # The configure script uses ldd to parse the linked output which
260 + # is flaky for cross-compiling/multilib/ldd versions/etc...
261 + $(use_with gpm gpm libgpm.so.1)
262 + # Required for building on mingw-w64, and possibly other windows
263 + # platforms, bug #639670
264 + $(use_enable kernel_Winnt term-driver)
265 + --disable-termcap
266 + --enable-symlinks
267 + --with-rcs-ids
268 + --with-manpage-format=normal
269 + --enable-const
270 + --enable-colorfgbg
271 + --enable-hard-tabs
272 + --enable-echo
273 + $(use_enable !ada warnings)
274 + $(use_with debug assertions)
275 + $(use_enable !debug leaks)
276 + $(use_with debug expanded)
277 + $(use_with !debug macros)
278 + $(multilib_native_with progs)
279 + $(use_with test tests)
280 + $(use_with trace)
281 + $(use_with tinfo termlib)
282 + --disable-stripping
283 + --disable-pkg-ldflags
284 + )
285 +
286 + if [[ ${target} == ncurses*w ]] ; then
287 + conf+=( --enable-widec )
288 + else
289 + conf+=( --disable-widec )
290 + fi
291 + if [[ ${target} == ncursest* ]] ; then
292 + conf+=( --with-{pthread,reentrant} )
293 + else
294 + conf+=( --without-{pthread,reentrant} )
295 + fi
296 + # Make sure each variant goes in a unique location.
297 + if [[ ${target} == "ncurses" ]] ; then
298 + # "ncurses" variant goes into "${EPREFIX}"/usr/include
299 + # It is needed on Prefix because the configure script appends
300 + # "ncurses" to "${prefix}/include" if "${prefix}" is not /usr.
301 + conf+=( --enable-overwrite )
302 + else
303 + conf+=( --includedir="${EPREFIX}"/usr/include/${target} )
304 + fi
305 + # See comments in src_configure.
306 + if [[ ${target} != "cross" ]] ; then
307 + local cross_path="${WORKDIR}/cross"
308 + [[ -d ${cross_path} ]] && export TIC_PATH="${cross_path}/progs/tic"
309 + fi
310 +
311 + # Force bash until upstream rebuilds the configure script with a newer
312 + # version of autotools. #545532
313 + #CONFIG_SHELL=${EPREFIX}/bin/bash \
314 + ECONF_SOURCE="${S}" \
315 + econf "${conf[@]}" "$@"
316 +}
317 +
318 +src_compile() {
319 + # See comments in src_configure.
320 + if ! has_version -b "~sys-libs/${P}:0" ; then
321 + # We could possibly merge these two branches but opting to be
322 + # conservative when merging some of the Prefix changes.
323 +
324 + if [[ ${CHOST} == *-cygwin* ]] && ! multilib_is_native_abi ; then
325 + # We make 'tic$(x)' here, for Cygwin having x=".exe".
326 + BUILD_DIR="${WORKDIR}" \
327 + do_compile cross -C progs all PROGS='tic$(x)'
328 + else
329 + BUILD_DIR="${WORKDIR}" \
330 + do_compile cross -C progs tic
331 + fi
332 + fi
333 +
334 + multilib-minimal_src_compile
335 +}
336 +
337 +multilib_src_compile() {
338 + local t
339 + for t in "${NCURSES_TARGETS[@]}" ; do
340 + do_compile "${t}"
341 + done
342 +}
343 +
344 +do_compile() {
345 + local target=$1
346 + shift
347 +
348 + cd "${BUILD_DIR}/${target}" || die
349 +
350 + # A little hack to fix parallel builds ... they break when
351 + # generating sources so if we generate the sources first (in
352 + # non-parallel), we can then build the rest of the package
353 + # in parallel. This is not really a perf hit since the source
354 + # generation is quite small.
355 + emake -j1 sources
356 + # For some reason, sources depends on pc-files which depends on
357 + # compiled libraries which depends on sources which ...
358 + # Manually delete the pc-files file so the install step will
359 + # create the .pc files we want.
360 + rm -f misc/pc-files || die
361 + emake "$@"
362 +}
363 +
364 +multilib_src_install() {
365 + local target
366 + for target in "${NCURSES_TARGETS[@]}" ; do
367 + emake -C "${BUILD_DIR}/${target}" DESTDIR="${D}" install
368 + done
369 +
370 + # Move main libraries into /.
371 + if multilib_is_native_abi ; then
372 + gen_usr_ldscript -a \
373 + "${NCURSES_TARGETS[@]}" \
374 + $(use tinfo && usex unicode 'tinfow' '') \
375 + $(usev tinfo)
376 + fi
377 + if ! tc-is-static-only ; then
378 + # Provide a link for -lcurses.
379 + ln -sf libncurses$(get_libname) "${ED}"/usr/$(get_libdir)/libcurses$(get_libname) || die
380 + fi
381 + # don't delete '*.dll.a', needed for linking #631468
382 + if ! use static-libs; then
383 + find "${ED}"/usr/ -name '*.a' ! -name '*.dll.a' -delete || die
384 + fi
385 +
386 + # Build fails to create this ...
387 + # -FIXME-
388 + # Ugly hackaround for riscv having two parts libdir (#689240)
389 + # Replace this hack with an official solution once we have one...
390 + # -FIXME-
391 + dosym $(sed 's@[^/]\+@..@g' <<< $(get_libdir))/share/terminfo \
392 + /usr/$(get_libdir)/terminfo
393 +}
394 +
395 +multilib_src_install_all() {
396 +# if ! use berkdb ; then
397 + # We need the basic terminfo files in /etc for embedded/recovery. #37026
398 + einfo "Installing basic terminfo files in /etc..."
399 + local terms=(
400 + # Dumb/simple values that show up when using the in-kernel VT.
401 + ansi console dumb linux
402 + vt{52,100,102,200,220}
403 + # [u]rxvt users used to be pretty common. Probably should drop this
404 + # since upstream is dead and people are moving away from it.
405 + rxvt{,-unicode}{,-256color}
406 + # xterm users are common, as is terminals re-using/spoofing it.
407 + xterm xterm-{,256}color
408 + # screen is common (and reused by tmux).
409 + screen{,-256color}
410 + screen.xterm-256color
411 + )
412 + local x
413 + for x in "${terms[@]}"; do
414 + local termfile=$(find "${ED}"/usr/share/terminfo/ -name "${x}" 2>/dev/null)
415 + local basedir=$(basename "$(dirname "${termfile}")")
416 +
417 + if [[ -n ${termfile} ]] ; then
418 + dodir "/etc/terminfo/${basedir}"
419 + mv "${termfile}" "${ED}/etc/terminfo/${basedir}/" || die
420 + dosym "../../../../etc/terminfo/${basedir}/${x}" \
421 + "/usr/share/terminfo/${basedir}/${x}"
422 + fi
423 + done
424 +# fi
425 +
426 + echo "CONFIG_PROTECT_MASK=\"/etc/terminfo\"" | newenvd - 50ncurses
427 +
428 + use minimal && rm -r "${ED}"/usr/share/terminfo*
429 + # Because ncurses5-config --terminfo returns the directory we keep it
430 + keepdir /usr/share/terminfo #245374
431 +
432 + cd "${S}" || die
433 + dodoc ANNOUNCE MANIFEST NEWS README* TO-DO doc/*.doc
434 + if use doc ; then
435 + docinto html
436 + dodoc -r doc/html/
437 + fi
438 +}
439 +
440 +pkg_preinst() {
441 + preserve_old_lib /$(get_libdir)/libncurses.so.5
442 + use unicode && preserve_old_lib /$(get_libdir)/libncursesw.so.5
443 +}
444 +
445 +pkg_postinst() {
446 + preserve_old_lib_notify /$(get_libdir)/libncurses.so.5
447 + use unicode && preserve_old_lib_notify /$(get_libdir)/libncursesw.so.5
448 +}