sys-libs/ncurses: Sync with Gentoo

It's from Gentoo commit 018deb254e510a7278510990e920126b263f3f39.
This commit is contained in:
Flatcar Buildbot 2025-01-27 07:11:12 +00:00 committed by Krzesimir Nowak
parent 96aa879f70
commit 1df80b82b3
3 changed files with 966 additions and 0 deletions

View File

@ -191,6 +191,27 @@ DIST ncurses-6.5-20241102.patch.gz 3571 BLAKE2B 265fabae05675a01039569dab957e8ca
DIST ncurses-6.5-20241102.patch.gz.asc 729 BLAKE2B a35bc58064361f8e7527d3af3ef08dcaf8b3e70442d280797b6260458dd8d258d42214c25cb5f329851a88ea8cb32a293a3abd93f64d971a0d3b0ade7e04228d SHA512 9695c1a4cdb66cd8f64880b937dbbe7caa5746b754056359e48118b75deb9d6338f270bb5f252b9e52d6de14278a8435e2d4799e0fbda9ef5b76d5569ea8c6bd
DIST ncurses-6.5-20241109.patch.gz 121789 BLAKE2B 3626c3fb1332d12558e53545bb0aec0ad315ffbfb0f64514f30fb15ce21b80b73228feec4569a9545c6115ca59db70f85d99830733ede3958f220627416cfebf SHA512 a15b6ee70ea10bb8a10a70ab9c74f437eceb60a7313a688ad04e0c3a9e097824b642f259c728fc7831d60322b1a0957d19a5fe73cbf68fd21a623ddf9d9c0ef4
DIST ncurses-6.5-20241109.patch.gz.asc 729 BLAKE2B af2c1bd38031bff8e5465340fbd5dbff875939ff62fa4e805d2fdd869a15a25e135aaaca98510ddb308e532f3b58209b4ad0d8e75bc792149972470809a42df4 SHA512 8946e1e84baf9c48129460a83a5ef679b427c0147ca7fd4701aca3fa23b260c8ed8fb08fd2996676f149ffeec4ca960358d7df6a0b7774c4b49b2bb66800237f
DIST ncurses-6.5-20241123.patch.gz 17657 BLAKE2B dac07cc85c7ce3637e20c6a81d7f69943ffb62313080fe607a9e7a972c0c0fc557ec99b3c6a47ce053e6e814e6340c3ee0d8f598b7c33ab3c64fa745470cadac SHA512 aee0de1d2d9216fec03a78260b5c0a973a8191777db383b6a09dfad20a4f8ecf735e14d4129f59b0a9da0bcfb59691ff6c395a55edf3303e2af57f80a1901232
DIST ncurses-6.5-20241123.patch.gz.asc 729 BLAKE2B 367529435f5e0efc24e34818d59e75a8c41cb10c52d8b8d0679b49e7070bb63ed096076f0f0a951f4f58cf57a6cdb41874991f4913aea1583de9a385a3d8fb5d SHA512 4d751650011e648aea4a1a0c5ab6984021ff8ee305f0beaffc452804b4de8722954069cab08f5f6e46a3164e3b863226d7e745528f742a874b3b086b83251f85
DIST ncurses-6.5-20241130.patch.gz 142324 BLAKE2B e7f7ba18550db745c9252c8a3b74f77ee0eb93d3bd509f18a5833a4e8b544abb3067558a1c815d12384505c62435c9cbba8e1128ae09587ec91256932fb0b965 SHA512 6a5ce47d47ff5fbed9612c3127056e9302ed340583d23a90b5fb5ca905d98a7d48d61d29698396a66cb5b120423d3bf5ace40c68d029f5ffd24d33ade39f2402
DIST ncurses-6.5-20241130.patch.gz.asc 729 BLAKE2B 0bbc5c9e6bc6eb37c7c1bcde44abbf7e45d16f287599c2b7dffad37cd751572d3adbd50413c0568942ceb0fb874237fa179c4e2df170f73512f43e598e4bd711 SHA512 ba2c08cd08839c8e5754293165343a7fed537770dd5a7e1712e371d8495c83573ea9e016589c886e080405ac999460abf83c8fa1bd91194a585afb7739c7d8a6
DIST ncurses-6.5-20241207.patch.gz 115869 BLAKE2B c9016f627ae48e44afcc449308d4abd288067a9bda4a5bcf1d847cf91be9a0f22c376fef964ff5e69291bd46b90f32201d05127d1d7c150f62e75a244a5ee1dc SHA512 f37dcdb95a2698d32e25c840d98c2dae3fd5b734717f753be4ae7ab325b3263b7b84dccf8423a4338b8fed7071fb083f4a74afb68616dde390c37fe8b6251552
DIST ncurses-6.5-20241207.patch.gz.asc 729 BLAKE2B 3f9345290997bbe68764017651d50493e7cb1d64a33b7ea4d335b7f95ae33586b841496f01746e19fced605ec3cf129dc8b02a20a7e89dc9447296ad0804d6a0 SHA512 c090a8369f12421894c99bd1d72bab1abd18f86c58acfc5341ac1aa6ccc07f9c83425696f54c32bec3d6ec17a2ab2df932fb12dd6c6a5fce4820d3ecd1c71aef
DIST ncurses-6.5-20241214.patch.gz 79375 BLAKE2B 96114d3d195209aa630a61ab6f3e3c071ee4bd04c929f072937c9d7c377974a01c5c45be1540e4f9f37035b8fd68c3c554416513969474ecb5f3d60abc14bdf7 SHA512 bfb873e081ca1aefe5b02d259d679afcb14299dd633c5933a53d3e6e4102dff388209a5d2a09d5d390df08fcfdac79b1eb32d03c3aec461fa78c1f6d0a743243
DIST ncurses-6.5-20241214.patch.gz.asc 729 BLAKE2B af6a83a690c31b18e3b8a89bfd8adc620397ce5026d8573430a69538ff38e341e82f5f34fd639668f3651e9b0229a2b3af246dd025ca2be85621b9015dbf69e6 SHA512 ceff0eae372a792cbce83151b915fddc4f82c979eddad9dd88df28c87f5ebd6e4bbef6c6e32924dac38e58a3a12da86521f72bd438132c5cb4a9dc157c686787
DIST ncurses-6.5-20241221.patch.gz 7787 BLAKE2B 7dce1a2770ba3dd7b9f5bc5eb49ad0009cf57db9107b9d19300d532d35dc42894c7952c72ca7a21a31be6378b201d16cbcd2668ce0cbb07c073da9bcf04061b9 SHA512 26d8bdcd4d1d496b3a90668660ddda118ba0ec3571bcadffce65bc6097a9663338f3b026a390d9420c1d844f0b8cef43c717a1542cb1bf91f3e5eb4e332a2edb
DIST ncurses-6.5-20241221.patch.gz.asc 729 BLAKE2B 8bca0aa7b6b6f78518d33602b13b2e0dc83e151c62891abbfbc00aa324b82e9981d2f1d4ebcf2cca7cd7a2c474e33d7cbdc749e5a6e0b8005dac15086547203b SHA512 3ca0cb7f799fa2c9efc9f1ed2c350904a99e085e3d250e55d5198cb40eb2ae58640ba6226a6263996289d3122204a83e681f38e7195de2203cafb68f66a12272
DIST ncurses-6.5-20241228.patch.gz 129948 BLAKE2B 9366438db329bfef3db29c572171abea3fb5b56a430c9ff09c51b0738429b437fee760be3812e0f93120ae9896bba61f28fdbe29b5cd2d30f2cca19ad29b287f SHA512 292eeaa4ee41eebb2c64129d77b1baf3e64e5c5960008093c9b11a33295bd5ef04bea7b11bd02d38f5f819e7ac8ca5d69a6a114213c849a0e5f0bb94852cce9e
DIST ncurses-6.5-20241228.patch.gz.asc 729 BLAKE2B a32ed7189f0557da6fcdcf4b8cab88f0462906166b71db82cfb14ae137cad9c86a85cf3cb5fb9e6bc1b7d7ecbb24a34d96527b76a466fbea96e4be458a72add4 SHA512 015fee99356fb2bdadb546e67d3773196a442a53ee2abd7dc839b0e6afd569438031249ed4c33920e716b14d928c2198969199eb0270a18cae66411658934bfb
DIST ncurses-6.5-20250104.patch.gz 22099 BLAKE2B 176b9ed65414b55cc2f2bcdcc68c7bbe84dbbe6dd5dbd3071e6a69187932f973e45cfb2aa5714752a1cc66b1317807548fd3d8075ab97d7a648e6527381bdbe7 SHA512 9667b9995eefeb6d6d59b11ca37fa57b5407a36a5e29dade672787645e851f5e0f30f7838ecb368b247e50ab54b1f2ed1fe70ef6df86609fc72e27d259907733
DIST ncurses-6.5-20250104.patch.gz.asc 729 BLAKE2B a224636d20cddeb11e1c8dfd6fe0908cd53b1d045e9bbeccf9fe29cb59092fbc3f25b7d80106a8a7c8a21d71175f8e01431d04ede5dd10a0a42a13cf58ec6e4a SHA512 aad743612aff3720bcf210539c69d41e7c5a196af79b3129957ddf5eb1201941bd6e1efe41a9a5a0e75c92fe89c12cf43ab78cf5748313b8ed41ba62317c57d5
DIST ncurses-6.5-20250111.patch.gz 11034 BLAKE2B b9b9b39035e6f5730a39e358faf7b53bf0728e5a6de5e5f9285d72239c0b3e9dc029d5aa6528b60f729aa30d4d76959fc091570382d5e43bdb4738e6b906e29b SHA512 d6c90512348a7b5e5d5d82acef95973539bcf49203481087454cd9cc75f08051697ef2011f96a902f97d5f6eb3f69cee2802bc5dcec8cb58ec97f56b510fdf0c
DIST ncurses-6.5-20250111.patch.gz.asc 729 BLAKE2B d1fdefb370d3f1a0d698e1bc8f4d6d4b2f333f8f4440e61a3d32a5d4dd1667729776330f178399ecb726013cbfa71f8b1fd78ceaf61942c0b97f41f4196146c4 SHA512 ea5d82e01cc95a7141da52400e00da37b36762acb113258151a179d70b08cc58342e9d23cb0fe057fba88bf110f18c500f4b5c769684c57c2be7c5c83d6b01f5
DIST ncurses-6.5-20250118.patch.gz 405753 BLAKE2B 6aa666a85bf7d1526984ac46cbbeb6103635c4f0fb93426ae06a05a4fa12e345dd052030ec639e23d377fe0a78e0e411d2343755a378ba4b18a3af9e42e5c438 SHA512 e82630a447fb759f1ee1f9b698094e1b18d83f235c970d1c910419de873cf7643b3f58fc279c42b17c2fd34c8ac090b703f735700fcce33c3ec68fee9544f99a
DIST ncurses-6.5-20250118.patch.gz.asc 729 BLAKE2B 22cea1147c6b30e24b2eab79e0f00b9901b45193f391a270799661eb4f45a943d2e0afba4f94f69b6a21a5ed7155636d9f775d29bac7aa4b0248fc2ba90d19d9 SHA512 fba7ea75945879f97294e75bee34e58ff4dbb0d10bf549a8928dbf308fdbdb978b377231a618be444e3a4426acc63a6d5f0f588fca82fda7585ef6af78b602e1
DIST ncurses-6.5-20250125.patch.gz 11864 BLAKE2B f4fa5b4a9a0c87b11f5d3cc84961a19d3948658481255b65eba1041d3ff9952c4941e6879bdd9b3237087353800398eacf47fd44de114f9c57046a0a3b200da8 SHA512 7e8571cf264dad27136a00d7601b2bbe90c497f2caa8e7379b72547c9c1cf07c4b32e54773c22695c183d4444d2816ec020bafc3cec55ff3fb5d191e956a77c8
DIST ncurses-6.5-20250125.patch.gz.asc 729 BLAKE2B 53fde87fdfa46107addc6ee523bfbc7db0b12d288882ae9bf85c1e5ffbcb26562809faa3f284cfe1c68665cf666ab50c52abffd42b03d9f82ca98c7fd8e2895e SHA512 6e3b6c009b0b429238dee41639fd2f1535374c7f84c9b432756fe5e22eba38171f2ced867bc28b924ac2d338938bfa840a560ace54d4ffd329e986a0080749b8
DIST ncurses-6.5.tar.gz 3688489 BLAKE2B d0a05c218b5f320ba9abe2f322787baef1d15d764e503c81d49772b54b2927d28ecbeb500c8e514996226b41f69445b4de44ff423cec25b61847307fe61682ec SHA512 fc5a13409d2a530a1325776dcce3a99127ddc2c03999cfeb0065d0eee2d68456274fb1c7b3cc99c1937bc657d0e7fca97016e147f93c7821b5a4a6837db821e8
DIST ncurses-6.5.tar.gz.sig 438 BLAKE2B 5789b47932ec97d3863c7a65306369f0a36cb5b1a35c1e009b5174f50941edceafc22e6f07db3843a096773663a0ca602c0ecb9465e6042d9a78d76ae5008215 SHA512 96ce61a3d529e48e249acecbf4bb9eae2d9f2f67506e92ffa3182f5e98040c38babf0c2c15d92fc5d96e1181e72be1b29fdbff7bee859dfe2ae387f9b8883092
DIST ncurses-6.5_p20241109-patches.tar.xz 63676 BLAKE2B 9981b740fcec18cc794074ccc93ae1dbe175e52449af2bddfd10a6fb1d5dfe9b545bd19fce5e601d2d85008425fd5cd6fc33042d7bcc854363b0642b9c880efe SHA512 076d2d39c46cf9236e5e65472e10182da2dffffa936c7567b11e23323d64f9739bb3818d4fdbdd75a14fd3f5b202dcdb7aaa6813afb5e303f81c094339824162
DIST ncurses-6.5_p20250118-patches.tar.xz 64188 BLAKE2B 46ac7c8bcfb0ec4fb032ccff4ba0c57d15f925910eb4d108c626aba8fdecefd21660a05cf54a88a4668b50e489ce0a08526f978a0084c66b2105fc4d929fdfe5 SHA512 12ff29d5ec76487f8b368d481fc19d841e8ce6bc216ff614b6d6d543a1fa36020b403432c802665d99b7fb4f08ae863d7ac331e6e2d95ff86c719fdca383c3e2

View File

@ -0,0 +1,472 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
# sys-libs/ncurses-compat can be bumped with sys-libs/ncurses as upstream
# provide a configure option for the ABI version.
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/thomasdickey.asc
inherit flag-o-matic toolchain-funcs multilib multilib-minimal preserve-libs usr-ldscript verify-sig
MY_PV="${PV:0:3}"
MY_P="${PN}-${MY_PV}"
DESCRIPTION="Console display library"
HOMEPAGE="https://www.gnu.org/software/ncurses/ https://invisible-island.net/ncurses/"
# Keep invisible-mirror.net here as some users reported 403 forbidden with invisible-island.net
SRC_URI="
mirror://gnu/ncurses/${MY_P}.tar.gz
https://invisible-island.net/archives/${PN}/${MY_P}.tar.gz
https://invisible-mirror.net/archives/${PN}/${MY_P}.tar.gz
verify-sig? ( mirror://gnu/ncurses/${MY_P}.tar.gz.sig )
"
GENTOO_PATCH_DEV=sam
GENTOO_PATCH_PV=6.5_p20250118
GENTOO_PATCH_NAME=${PN}-${GENTOO_PATCH_PV}-patches
# Populated below in a loop. Do not add patches manually here.
UPSTREAM_PATCHES=()
if [[ ${PV} == *_p* ]] ; then
# Sometimes, after releases, there's no megapatch available yet.
#
# From upstream README at e.g. https://invisible-island.net/archives/ncurses/6.3/:
#
# "At times (generally to mark a relatively stable point), I create a rollup
# patch, which consists of all changes from the release through the current date."
#
# Also, from https://lists.gnu.org/archive/html/bug-ncurses/2019-08/msg00039.html,
# the patches are considered to be acceptable to use after some testing. They
# are both for development but also bug fixes.
#
# This array should contain a list of all the snapshots since the last
# release if there's no megapatch available yet.
PATCH_DATES=(
20240504
20240511
20240518
20240519
20240525
20240601
20240608
20240615
20240622
20240629
20240706
20240713
20240720
20240727
20240810
20240817
20240824
20240831
20240914
20240922
20240928
20241006
20241019
20241026
20241102
20241109
20241123
20241130
20241207
20241214
20241221
20241228
20250104
20250111
# Latest patch is just _pN = $(ver_cut 4)
$(ver_cut 4)
)
if [[ -z ${PATCH_DATES[@]} ]] ; then
SRC_URI+=" https://invisible-island.net/archives/${PN}/${PV/_p*}/${MY_P/_p/-}.patch.sh.gz"
SRC_URI+=" verify-sig? ( https://invisible-island.net/archives/${PN}/${PV/_p*}/${MY_P/_p/-}.patch.sh.gz.asc"
# If we have a rollup patch, use that instead of the individual ones.
UPSTREAM_PATCHES+=( patch.sh )
else
# We use a mirror as well because we've had reports of 403 forbidden for some users.
upstream_url_base="https://invisible-island.net/archives/${PN}/${PV/_p*}/${MY_P}-"
upstream_m_url_base="https://invisible-mirror.net/archives/${PN}/${PV/_p*}/${MY_P}-"
# Prefix each date with the upstream location (https://invisible-island.net/archives/${PN}/${PV/_p*}/${MY_P})
mangled_patches=( "${PATCH_DATES[@]/#/${upstream_url_base}}" )
# Suffix each with .patch.gz
mangled_patches=( "${mangled_patches[@]/%/.patch.gz}" )
mangled_patches_sig=( "${mangled_patches[@]/%/.asc}" )
# Repeat for .patch.gz.asc for verify-sig
SRC_URI+=" ${mangled_patches[@]}"
SRC_URI+=" verify-sig? ( ${mangled_patches_sig[@]} )"
# For all of the URLs, chuck in invisible-island.net too:
SRC_URI+=" ${mangled_patches[@]/${upstream_url_base}/${upstream_m_url_base}}"
SRC_URI+=" verify-sig? ( ${mangled_patches_sig[@]/${upstream_url_base}/${upstream_m_url_base}} )"
UPSTREAM_PATCHES=( "${PATCH_DATES[@]/%/.patch}" )
unset upstream_url_base upstream_m_url_base mangled_patches mangled_patches_sig
fi
fi
SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${GENTOO_PATCH_NAME}.tar.xz"
S="${WORKDIR}/${MY_P}"
LICENSE="MIT"
# The subslot reflects the SONAME.
SLOT="0/6"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
IUSE="ada +cxx debug doc gpm minimal profile split-usr +stack-realign static-libs test tinfo trace"
# In 6.5_p20250118, the C++ examples fail to link, but there's no automated
# testsuite anyway. Controlling building examples isn't really what USE=test
# is for. Just restrict them.
RESTRICT="!test? ( test ) test"
# TODO: ncurses allows (and we take advantage of this, even) passing
# the SONAME for dlopen() use, so only the header is needed at build time.
# Maybe we should bundle a copy of gpm.h so we can move gpm to PDEPEND
# which would be far nicer UX-wise.
DEPEND="gpm? ( sys-libs/gpm[${MULTILIB_USEDEP}] )"
# Block the older ncurses that installed all files w/SLOT=5, bug #557472
RDEPEND="
${DEPEND}
!<=sys-libs/ncurses-5.9-r4:5
!<sys-libs/slang-2.3.2_pre23
!<x11-terms/rxvt-unicode-9.06-r3
!<x11-terms/st-0.6-r1
"
BDEPEND="verify-sig? ( sec-keys/openpgp-keys-thomasdickey )"
PATCHES=(
"${UPSTREAM_PATCHES[@]/#/${WORKDIR}/${MY_P}-}"
# When rebasing Gentoo's patchset, please use git from a clean
# src_prepare with upstream patches already applied. git am --reject
# the existing patchset and rebase as required. This makes it easier
# to manage future rebasing & adding new patches.
#
# For the same reasons, please include the original configure.in changes,
# NOT just the generated results!
"${WORKDIR}"/${GENTOO_PATCH_NAME}
)
src_unpack() {
# Avoid trying to verify our own patchset tarball, there's no point
if use verify-sig ; then
local file
for file in ${A} ; do
if [[ ${file} == ${MY_P}.tar.gz ]] ; then
verify-sig_verify_detached "${DISTDIR}"/${file} "${DISTDIR}"/${file}.sig
else
[[ ${file} == @(*${GENTOO_PATCH_NAME}.tar.xz|*.asc|*.sig) ]] && continue
verify-sig_verify_detached "${DISTDIR}"/${file} "${DISTDIR}"/${file}.asc
fi
done
fi
default
}
src_configure() {
# bug #115036
unset TERMINFO
tc-export_build_env BUILD_{CC,CXX,CPP}
# bug #214642
BUILD_CPPFLAGS+=" -D_GNU_SOURCE"
# NCURSES_BOOL confusion, see https://lists.gnu.org/archive/html/bug-ncurses/2024-11/msg00010.html
append-cflags $(test-flags-CC -std=gnu17)
# Build the various variants of ncurses -- narrow, wide, and threaded. #510440
# Order matters here -- we want unicode/thread versions to come last so that the
# binaries in /usr/bin support both wide and narrow.
# The naming is also important as we use these directly with filenames and when
# checking configure flags.
NCURSES_TARGETS=(
ncurses
ncursesw
ncursest
ncursestw
)
# When installing ncurses, we have to use a compatible version of tic.
# This comes up when cross-compiling, doing multilib builds, upgrading,
# or installing for the first time. Build a local copy of tic whenever
# the host version isn't available. bug #249363, bug #557598
if ! has_version -b "~sys-libs/${P}:0" ; then
local lbuildflags="-static"
# some toolchains don't quite support static linking
local dbuildflags="-Wl,-rpath,${WORKDIR}/lib"
case ${CHOST} in
*-darwin*) dbuildflags= ;;
*-solaris*) dbuildflags="-Wl,-R,${WORKDIR}/lib" ;;
esac
echo "int main() {}" | \
$(tc-getCC) -o x -x c - ${lbuildflags} -pipe >& /dev/null \
|| lbuildflags="${dbuildflags}"
# We can't re-use the multilib BUILD_DIR because we run outside of it.
BUILD_DIR="${WORKDIR}" \
CC=${BUILD_CC} \
CXX=${BUILD_CXX} \
CPP=${BUILD_CPP} \
CHOST=${CBUILD} \
CFLAGS=${BUILD_CFLAGS} \
CXXFLAGS=${BUILD_CXXFLAGS} \
CPPFLAGS=${BUILD_CPPFLAGS} \
LDFLAGS="${BUILD_LDFLAGS} ${lbuildflags}" \
do_configure cross --without-shared --with-normal --with-progs --without-ada
fi
multilib-minimal_src_configure
}
multilib_src_configure() {
if [[ ${ABI} == x86 ]] ; then
# For compatibility with older binaries at slight performance cost.
# bug #616402
use stack-realign && append-flags -mstackrealign
fi
local t
for t in "${NCURSES_TARGETS[@]}" ; do
do_configure "${t}"
done
}
do_configure() {
local target=$1
shift
mkdir "${BUILD_DIR}/${target}" || die
cd "${BUILD_DIR}/${target}" || die
local conf=(
# We need the basic terminfo files in /etc, bug #37026. We will
# add '--with-terminfo-dirs' and then populate /etc/terminfo in
# src_install() ...
--with-terminfo-dirs="${EPREFIX}/etc/terminfo:${EPREFIX}/usr/share/terminfo"
# Enable installation of .pc files.
--enable-pc-files
# This path is used to control where the .pc files are installed.
--with-pkg-config-libdir="${EPREFIX}/usr/$(get_libdir)/pkgconfig"
# Now the rest of the various standard flags.
--with-shared
--enable-fvisibility
# (Originally disabled until bug #245417 is sorted out, but now
# just keeping it off for good, given nobody needed it until now
# (2022) and we're trying to phase out bdb.)
--without-hashed-db
$(use_with ada)
$(use_with cxx)
$(use_with cxx cxx-binding)
--with-cxx-shared
$(use_with debug)
$(use_with profile)
# The configure script uses ldd to parse the linked output which
# is flaky for cross-compiling/multilib/ldd versions/etc...
$(use_with gpm gpm libgpm.so.1)
# bug #930806
--disable-setuid-environ
# TODO: Maybe do these for USE=hardened
#--disable-root-access
#--disable-root-environ
--disable-termcap
--enable-symlinks
--with-manpage-format=normal
--enable-const
--enable-colorfgbg
--enable-hard-tabs
--enable-echo
$(use_enable !ada warnings)
$(use_with debug assertions)
$(use_enable !debug leaks)
$(use_with debug expanded)
$(use_with !debug macros)
$(multilib_native_with progs)
$(use_with test tests)
$(use_with trace)
$(use_with tinfo termlib)
--disable-stripping
--disable-pkg-ldflags
)
case ${CHOST} in
*-mingw32*)
conf+=( --enable-term-driver )
;;
*)
conf+=( --disable-term-driver )
;;
esac
if [[ ${target} == ncurses*w ]] ; then
conf+=( --enable-widec )
else
conf+=( --disable-widec )
fi
if [[ ${target} == ncursest* ]] ; then
conf+=( --with-{pthread,reentrant} )
else
conf+=( --without-{pthread,reentrant} )
fi
# Make sure each variant goes in a unique location.
if [[ ${target} == "ncurses" ]] ; then
# "ncurses" variant goes into "${EPREFIX}"/usr/include
# It is needed on Prefix because the configure script appends
# "ncurses" to "${prefix}/include" if "${prefix}" is not /usr.
conf+=( --enable-overwrite )
else
conf+=( --includedir="${EPREFIX}"/usr/include/${target} )
fi
# See comments in src_configure.
if [[ ${target} != "cross" ]] ; then
local cross_path="${WORKDIR}/cross"
[[ -d ${cross_path} ]] && export TIC_PATH="${cross_path}/progs/tic"
fi
ECONF_SOURCE="${S}" econf "${conf[@]}" "$@"
}
src_compile() {
# See comments in src_configure.
if ! has_version -b "~sys-libs/${P}:0" ; then
BUILD_DIR="${WORKDIR}" do_compile cross -C progs tic$(get_exeext)
fi
multilib-minimal_src_compile
}
multilib_src_compile() {
local t
for t in "${NCURSES_TARGETS[@]}" ; do
do_compile "${t}"
done
}
do_compile() {
local target=$1
shift
cd "${BUILD_DIR}/${target}" || die
# A little hack to fix parallel builds ... they break when
# generating sources so if we generate the sources first (in
# non-parallel), we can then build the rest of the package
# in parallel. This is not really a perf hit since the source
# generation is quite small.
emake -j1 sources
# For some reason, sources depends on pc-files which depends on
# compiled libraries which depends on sources which ...
# Manually delete the pc-files file so the install step will
# create the .pc files we want.
rm -f misc/pc-files || die
emake "$@"
}
multilib_src_install() {
local target
for target in "${NCURSES_TARGETS[@]}" ; do
emake -C "${BUILD_DIR}/${target}" DESTDIR="${D}" install
done
# Move main libraries into /.
if multilib_is_native_abi ; then
gen_usr_ldscript -a \
"${NCURSES_TARGETS[@]}" \
$(usex tinfo 'tinfow tinfo' '')
fi
# Don't delete '*.dll.a', needed for linking, bug #631468
if ! use static-libs; then
find "${ED}"/usr/ -name '*.a' ! -name '*.dll.a' -delete || die
fi
# Build fails to create this ...
# -FIXME-
# Ugly hackaround for riscv having two parts libdir (bug #689240)
# Replace this hack with an official solution once we have one...
# -FIXME-
dosym $(sed 's@[^/]\+@..@g' <<< $(get_libdir))/share/terminfo \
/usr/$(get_libdir)/terminfo
# Remove obsolete libcurses symlink that is created by the build
# system. Technically, this could be also achieved
# via --disable-overwrite but it also moves headers implicitly,
# and we do not want to do this yet.
# bug #836696
rm "${ED}"/usr/$(get_libdir)/libcurses* || die
}
multilib_src_install_all() {
local terms=(
# Dumb/simple values that show up when using the in-kernel VT.
ansi console dumb linux
vt{52,100,102,200,220}
# [u]rxvt users used to be pretty common. Probably should drop this
# since upstream is dead and people are moving away from it.
rxvt{,-unicode}{,-256color}
# xterm users are common, as is terminals re-using/spoofing it.
xterm xterm-{,256}color
# screen is common (and reused by tmux).
screen{,-256color}
screen.xterm-256color
)
if use split-usr ; then
local x
# We need the basic terminfo files in /etc for embedded/recovery, bug #37026
einfo "Installing basic terminfo files in /etc..."
for x in "${terms[@]}"; do
local termfile=$(find "${ED}"/usr/share/terminfo/ -name "${x}" 2>/dev/null)
local basedir=$(basename "$(dirname "${termfile}")")
if [[ -n ${termfile} ]] ; then
dodir "/etc/terminfo/${basedir}"
mv "${termfile}" "${ED}/etc/terminfo/${basedir}/" || die
dosym "../../../../etc/terminfo/${basedir}/${x}" \
"/usr/share/terminfo/${basedir}/${x}"
fi
done
echo "CONFIG_PROTECT_MASK=\"/etc/terminfo\"" | newenvd - 50ncurses
use minimal && rm -r "${ED}"/usr/share/terminfo*
# Because ncurses5-config --terminfo returns the directory we keep it
# bug #245374
keepdir /usr/share/terminfo
elif use minimal ; then
# Keep only the basic terminfo files
find "${ED}"/usr/share/terminfo/ \
\( -type f -o -type l \) ${terms[*]/#/! -name } -delete , \
-type d -empty -delete || die
fi
cd "${S}" || die
dodoc ANNOUNCE MANIFEST NEWS README* TO-DO doc/*.doc
if use doc ; then
docinto html
dodoc -r doc/html/
fi
}
pkg_preinst() {
preserve_old_lib /$(get_libdir)/libncurses.so.5
preserve_old_lib /$(get_libdir)/libncursesw.so.5
}
pkg_postinst() {
preserve_old_lib_notify /$(get_libdir)/libncurses.so.5
preserve_old_lib_notify /$(get_libdir)/libncursesw.so.5
}

View File

@ -0,0 +1,473 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
# sys-libs/ncurses-compat can be bumped with sys-libs/ncurses as upstream
# provide a configure option for the ABI version.
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/thomasdickey.asc
inherit flag-o-matic toolchain-funcs multilib multilib-minimal preserve-libs usr-ldscript verify-sig
MY_PV="${PV:0:3}"
MY_P="${PN}-${MY_PV}"
DESCRIPTION="Console display library"
HOMEPAGE="https://www.gnu.org/software/ncurses/ https://invisible-island.net/ncurses/"
# Keep invisible-mirror.net here as some users reported 403 forbidden with invisible-island.net
SRC_URI="
mirror://gnu/ncurses/${MY_P}.tar.gz
https://invisible-island.net/archives/${PN}/${MY_P}.tar.gz
https://invisible-mirror.net/archives/${PN}/${MY_P}.tar.gz
verify-sig? ( mirror://gnu/ncurses/${MY_P}.tar.gz.sig )
"
GENTOO_PATCH_DEV=sam
GENTOO_PATCH_PV=6.5_p20250118
GENTOO_PATCH_NAME=${PN}-${GENTOO_PATCH_PV}-patches
# Populated below in a loop. Do not add patches manually here.
UPSTREAM_PATCHES=()
if [[ ${PV} == *_p* ]] ; then
# Sometimes, after releases, there's no megapatch available yet.
#
# From upstream README at e.g. https://invisible-island.net/archives/ncurses/6.3/:
#
# "At times (generally to mark a relatively stable point), I create a rollup
# patch, which consists of all changes from the release through the current date."
#
# Also, from https://lists.gnu.org/archive/html/bug-ncurses/2019-08/msg00039.html,
# the patches are considered to be acceptable to use after some testing. They
# are both for development but also bug fixes.
#
# This array should contain a list of all the snapshots since the last
# release if there's no megapatch available yet.
PATCH_DATES=(
20240504
20240511
20240518
20240519
20240525
20240601
20240608
20240615
20240622
20240629
20240706
20240713
20240720
20240727
20240810
20240817
20240824
20240831
20240914
20240922
20240928
20241006
20241019
20241026
20241102
20241109
20241123
20241130
20241207
20241214
20241221
20241228
20250104
20250111
20250118
# Latest patch is just _pN = $(ver_cut 4)
$(ver_cut 4)
)
if [[ -z ${PATCH_DATES[@]} ]] ; then
SRC_URI+=" https://invisible-island.net/archives/${PN}/${PV/_p*}/${MY_P/_p/-}.patch.sh.gz"
SRC_URI+=" verify-sig? ( https://invisible-island.net/archives/${PN}/${PV/_p*}/${MY_P/_p/-}.patch.sh.gz.asc"
# If we have a rollup patch, use that instead of the individual ones.
UPSTREAM_PATCHES+=( patch.sh )
else
# We use a mirror as well because we've had reports of 403 forbidden for some users.
upstream_url_base="https://invisible-island.net/archives/${PN}/${PV/_p*}/${MY_P}-"
upstream_m_url_base="https://invisible-mirror.net/archives/${PN}/${PV/_p*}/${MY_P}-"
# Prefix each date with the upstream location (https://invisible-island.net/archives/${PN}/${PV/_p*}/${MY_P})
mangled_patches=( "${PATCH_DATES[@]/#/${upstream_url_base}}" )
# Suffix each with .patch.gz
mangled_patches=( "${mangled_patches[@]/%/.patch.gz}" )
mangled_patches_sig=( "${mangled_patches[@]/%/.asc}" )
# Repeat for .patch.gz.asc for verify-sig
SRC_URI+=" ${mangled_patches[@]}"
SRC_URI+=" verify-sig? ( ${mangled_patches_sig[@]} )"
# For all of the URLs, chuck in invisible-island.net too:
SRC_URI+=" ${mangled_patches[@]/${upstream_url_base}/${upstream_m_url_base}}"
SRC_URI+=" verify-sig? ( ${mangled_patches_sig[@]/${upstream_url_base}/${upstream_m_url_base}} )"
UPSTREAM_PATCHES=( "${PATCH_DATES[@]/%/.patch}" )
unset upstream_url_base upstream_m_url_base mangled_patches mangled_patches_sig
fi
fi
SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${GENTOO_PATCH_NAME}.tar.xz"
S="${WORKDIR}/${MY_P}"
LICENSE="MIT"
# The subslot reflects the SONAME.
SLOT="0/6"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
IUSE="ada +cxx debug doc gpm minimal profile split-usr +stack-realign static-libs test tinfo trace"
# In 6.5_p20250118, the C++ examples fail to link, but there's no automated
# testsuite anyway. Controlling building examples isn't really what USE=test
# is for. Just restrict them.
RESTRICT="!test? ( test ) test"
# TODO: ncurses allows (and we take advantage of this, even) passing
# the SONAME for dlopen() use, so only the header is needed at build time.
# Maybe we should bundle a copy of gpm.h so we can move gpm to PDEPEND
# which would be far nicer UX-wise.
DEPEND="gpm? ( sys-libs/gpm[${MULTILIB_USEDEP}] )"
# Block the older ncurses that installed all files w/SLOT=5, bug #557472
RDEPEND="
${DEPEND}
!<=sys-libs/ncurses-5.9-r4:5
!<sys-libs/slang-2.3.2_pre23
!<x11-terms/rxvt-unicode-9.06-r3
!<x11-terms/st-0.6-r1
"
BDEPEND="verify-sig? ( sec-keys/openpgp-keys-thomasdickey )"
PATCHES=(
"${UPSTREAM_PATCHES[@]/#/${WORKDIR}/${MY_P}-}"
# When rebasing Gentoo's patchset, please use git from a clean
# src_prepare with upstream patches already applied. git am --reject
# the existing patchset and rebase as required. This makes it easier
# to manage future rebasing & adding new patches.
#
# For the same reasons, please include the original configure.in changes,
# NOT just the generated results!
"${WORKDIR}"/${GENTOO_PATCH_NAME}
)
src_unpack() {
# Avoid trying to verify our own patchset tarball, there's no point
if use verify-sig ; then
local file
for file in ${A} ; do
if [[ ${file} == ${MY_P}.tar.gz ]] ; then
verify-sig_verify_detached "${DISTDIR}"/${file} "${DISTDIR}"/${file}.sig
else
[[ ${file} == @(*${GENTOO_PATCH_NAME}.tar.xz|*.asc|*.sig) ]] && continue
verify-sig_verify_detached "${DISTDIR}"/${file} "${DISTDIR}"/${file}.asc
fi
done
fi
default
}
src_configure() {
# bug #115036
unset TERMINFO
tc-export_build_env BUILD_{CC,CXX,CPP}
# bug #214642
BUILD_CPPFLAGS+=" -D_GNU_SOURCE"
# NCURSES_BOOL confusion, see https://lists.gnu.org/archive/html/bug-ncurses/2024-11/msg00010.html
append-cflags $(test-flags-CC -std=gnu17)
# Build the various variants of ncurses -- narrow, wide, and threaded. #510440
# Order matters here -- we want unicode/thread versions to come last so that the
# binaries in /usr/bin support both wide and narrow.
# The naming is also important as we use these directly with filenames and when
# checking configure flags.
NCURSES_TARGETS=(
ncurses
ncursesw
ncursest
ncursestw
)
# When installing ncurses, we have to use a compatible version of tic.
# This comes up when cross-compiling, doing multilib builds, upgrading,
# or installing for the first time. Build a local copy of tic whenever
# the host version isn't available. bug #249363, bug #557598
if ! has_version -b "~sys-libs/${P}:0" ; then
local lbuildflags="-static"
# some toolchains don't quite support static linking
local dbuildflags="-Wl,-rpath,${WORKDIR}/lib"
case ${CHOST} in
*-darwin*) dbuildflags= ;;
*-solaris*) dbuildflags="-Wl,-R,${WORKDIR}/lib" ;;
esac
echo "int main() {}" | \
$(tc-getCC) -o x -x c - ${lbuildflags} -pipe >& /dev/null \
|| lbuildflags="${dbuildflags}"
# We can't re-use the multilib BUILD_DIR because we run outside of it.
BUILD_DIR="${WORKDIR}" \
CC=${BUILD_CC} \
CXX=${BUILD_CXX} \
CPP=${BUILD_CPP} \
CHOST=${CBUILD} \
CFLAGS=${BUILD_CFLAGS} \
CXXFLAGS=${BUILD_CXXFLAGS} \
CPPFLAGS=${BUILD_CPPFLAGS} \
LDFLAGS="${BUILD_LDFLAGS} ${lbuildflags}" \
do_configure cross --without-shared --with-normal --with-progs --without-ada
fi
multilib-minimal_src_configure
}
multilib_src_configure() {
if [[ ${ABI} == x86 ]] ; then
# For compatibility with older binaries at slight performance cost.
# bug #616402
use stack-realign && append-flags -mstackrealign
fi
local t
for t in "${NCURSES_TARGETS[@]}" ; do
do_configure "${t}"
done
}
do_configure() {
local target=$1
shift
mkdir "${BUILD_DIR}/${target}" || die
cd "${BUILD_DIR}/${target}" || die
local conf=(
# We need the basic terminfo files in /etc, bug #37026. We will
# add '--with-terminfo-dirs' and then populate /etc/terminfo in
# src_install() ...
--with-terminfo-dirs="${EPREFIX}/etc/terminfo:${EPREFIX}/usr/share/terminfo"
# Enable installation of .pc files.
--enable-pc-files
# This path is used to control where the .pc files are installed.
--with-pkg-config-libdir="${EPREFIX}/usr/$(get_libdir)/pkgconfig"
# Now the rest of the various standard flags.
--with-shared
--enable-fvisibility
# (Originally disabled until bug #245417 is sorted out, but now
# just keeping it off for good, given nobody needed it until now
# (2022) and we're trying to phase out bdb.)
--without-hashed-db
$(use_with ada)
$(use_with cxx)
$(use_with cxx cxx-binding)
--with-cxx-shared
$(use_with debug)
$(use_with profile)
# The configure script uses ldd to parse the linked output which
# is flaky for cross-compiling/multilib/ldd versions/etc...
$(use_with gpm gpm libgpm.so.1)
# bug #930806
--disable-setuid-environ
# TODO: Maybe do these for USE=hardened
#--disable-root-access
#--disable-root-environ
--disable-termcap
--enable-symlinks
--with-manpage-format=normal
--enable-const
--enable-colorfgbg
--enable-hard-tabs
--enable-echo
$(use_enable !ada warnings)
$(use_with debug assertions)
$(use_enable !debug leaks)
$(use_with debug expanded)
$(use_with !debug macros)
$(multilib_native_with progs)
$(use_with test tests)
$(use_with trace)
$(use_with tinfo termlib)
--disable-stripping
--disable-pkg-ldflags
)
case ${CHOST} in
*-mingw32*)
conf+=( --enable-term-driver )
;;
*)
conf+=( --disable-term-driver )
;;
esac
if [[ ${target} == ncurses*w ]] ; then
conf+=( --enable-widec )
else
conf+=( --disable-widec )
fi
if [[ ${target} == ncursest* ]] ; then
conf+=( --with-{pthread,reentrant} )
else
conf+=( --without-{pthread,reentrant} )
fi
# Make sure each variant goes in a unique location.
if [[ ${target} == "ncurses" ]] ; then
# "ncurses" variant goes into "${EPREFIX}"/usr/include
# It is needed on Prefix because the configure script appends
# "ncurses" to "${prefix}/include" if "${prefix}" is not /usr.
conf+=( --enable-overwrite )
else
conf+=( --includedir="${EPREFIX}"/usr/include/${target} )
fi
# See comments in src_configure.
if [[ ${target} != "cross" ]] ; then
local cross_path="${WORKDIR}/cross"
[[ -d ${cross_path} ]] && export TIC_PATH="${cross_path}/progs/tic"
fi
ECONF_SOURCE="${S}" econf "${conf[@]}" "$@"
}
src_compile() {
# See comments in src_configure.
if ! has_version -b "~sys-libs/${P}:0" ; then
BUILD_DIR="${WORKDIR}" do_compile cross -C progs tic$(get_exeext)
fi
multilib-minimal_src_compile
}
multilib_src_compile() {
local t
for t in "${NCURSES_TARGETS[@]}" ; do
do_compile "${t}"
done
}
do_compile() {
local target=$1
shift
cd "${BUILD_DIR}/${target}" || die
# A little hack to fix parallel builds ... they break when
# generating sources so if we generate the sources first (in
# non-parallel), we can then build the rest of the package
# in parallel. This is not really a perf hit since the source
# generation is quite small.
emake -j1 sources
# For some reason, sources depends on pc-files which depends on
# compiled libraries which depends on sources which ...
# Manually delete the pc-files file so the install step will
# create the .pc files we want.
rm -f misc/pc-files || die
emake "$@"
}
multilib_src_install() {
local target
for target in "${NCURSES_TARGETS[@]}" ; do
emake -C "${BUILD_DIR}/${target}" DESTDIR="${D}" install
done
# Move main libraries into /.
if multilib_is_native_abi ; then
gen_usr_ldscript -a \
"${NCURSES_TARGETS[@]}" \
$(usex tinfo 'tinfow tinfo' '')
fi
# Don't delete '*.dll.a', needed for linking, bug #631468
if ! use static-libs; then
find "${ED}"/usr/ -name '*.a' ! -name '*.dll.a' -delete || die
fi
# Build fails to create this ...
# -FIXME-
# Ugly hackaround for riscv having two parts libdir (bug #689240)
# Replace this hack with an official solution once we have one...
# -FIXME-
dosym $(sed 's@[^/]\+@..@g' <<< $(get_libdir))/share/terminfo \
/usr/$(get_libdir)/terminfo
# Remove obsolete libcurses symlink that is created by the build
# system. Technically, this could be also achieved
# via --disable-overwrite but it also moves headers implicitly,
# and we do not want to do this yet.
# bug #836696
rm "${ED}"/usr/$(get_libdir)/libcurses* || die
}
multilib_src_install_all() {
local terms=(
# Dumb/simple values that show up when using the in-kernel VT.
ansi console dumb linux
vt{52,100,102,200,220}
# [u]rxvt users used to be pretty common. Probably should drop this
# since upstream is dead and people are moving away from it.
rxvt{,-unicode}{,-256color}
# xterm users are common, as is terminals re-using/spoofing it.
xterm xterm-{,256}color
# screen is common (and reused by tmux).
screen{,-256color}
screen.xterm-256color
)
if use split-usr ; then
local x
# We need the basic terminfo files in /etc for embedded/recovery, bug #37026
einfo "Installing basic terminfo files in /etc..."
for x in "${terms[@]}"; do
local termfile=$(find "${ED}"/usr/share/terminfo/ -name "${x}" 2>/dev/null)
local basedir=$(basename "$(dirname "${termfile}")")
if [[ -n ${termfile} ]] ; then
dodir "/etc/terminfo/${basedir}"
mv "${termfile}" "${ED}/etc/terminfo/${basedir}/" || die
dosym "../../../../etc/terminfo/${basedir}/${x}" \
"/usr/share/terminfo/${basedir}/${x}"
fi
done
echo "CONFIG_PROTECT_MASK=\"/etc/terminfo\"" | newenvd - 50ncurses
use minimal && rm -r "${ED}"/usr/share/terminfo*
# Because ncurses5-config --terminfo returns the directory we keep it
# bug #245374
keepdir /usr/share/terminfo
elif use minimal ; then
# Keep only the basic terminfo files
find "${ED}"/usr/share/terminfo/ \
\( -type f -o -type l \) ${terms[*]/#/! -name } -delete , \
-type d -empty -delete || die
fi
cd "${S}" || die
dodoc ANNOUNCE MANIFEST NEWS README* TO-DO doc/*.doc
if use doc ; then
docinto html
dodoc -r doc/html/
fi
}
pkg_preinst() {
preserve_old_lib /$(get_libdir)/libncurses.so.5
preserve_old_lib /$(get_libdir)/libncursesw.so.5
}
pkg_postinst() {
preserve_old_lib_notify /$(get_libdir)/libncurses.so.5
preserve_old_lib_notify /$(get_libdir)/libncursesw.so.5
}