sys-libs/readline: Sync with Gentoo

It's from Gentoo commit e702138165d331f7b26a7e027b468471ec3f3ed2.
This commit is contained in:
Flatcar Buildbot 2024-08-12 07:20:58 +00:00 committed by Krzesimir Nowak
parent bb206151b9
commit 263d1687d5
2 changed files with 269 additions and 0 deletions

View File

@ -29,3 +29,9 @@ DIST readline82-009 2270 BLAKE2B ecfa4f3f445b0c90d4ba1cf4116c9a773a3e5ee737966d9
DIST readline82-009.sig 95 BLAKE2B 5484f3df25e550a717915ecf70e8410f747ff6d192a873e5449a4fb664bd3557d21a3cf40c5c9e0097dfaf2cee205243cd1cf6af34200f89e79f9d73626c49c1 SHA512 383cc954f8324588c699968d7cdf9a4f3c0e461917c8a16f5599cd0ffb59ff9539207478195a7d77c1842c11bd912cc17d3b3b56e6a9463db1991fb5c24d5409
DIST readline82-010 2653 BLAKE2B 44ebbf93b6449d848b2dda49716b494596d207bef08cdea0d01808b5291d68714e01ef914e97652bb73e81808a91fff829c8035a097db5b3649be1e0735e3eab SHA512 b611b42e31601ea5fcd7de59e6c1cdd3fece7cc8287e0e495ddfc4d5e8f765b3c6567b728fe0a317d6cb00240b772fa4c26f374c8bf361355a9d262bc5133874
DIST readline82-010.sig 95 BLAKE2B a5a6ccaace88a79c4e28f3c9d3a9ffad186ab772ada7668653b729190d5a598cbe46c769861a72acd08b5fb36f84537bd2018a98fbd0602565660411810447f7 SHA512 0c781417f0cf63daa8532f54b71c9fda69bb2206ca41f7f75fceb7f44781ec949f932881d82fd55d69038208aed45692e30a1e6013d698c7d13f8c9984e331bc
DIST readline82-011 1865 BLAKE2B c0c083021ef8d3b482013846719ddbbee8e0d0dcdb694e138d193937ec1ccbf26b10cf55c84646db1b63c1ba9f6e7e47b815ab11a49a2466fa1907389e61ba4f SHA512 13694129f388364bea8009e1d2156c2a27e4b63bf780be2bc18129134e9f0454cad82106b6aeed03fab5ffe1f1fa630b80b77d1bc8b824a3d2280a71bf5d2ea6
DIST readline82-011.sig 95 BLAKE2B f391e3f83b8f574a6ccb28e1064e5b2451e4342b8b64d09f19e61ec6b380fc2d6a1ae7d384ef43c4291c1cd4cbe370de30f436abaedd0437c997fa2bbbb77ce6 SHA512 5c013a02edca92963bd2bc08b8b897cdf92c4e27d763bc3702f0f405d8409bb30a1d096a84e61c35c3bd1a7678a34f815939a0fd12d30103996ac544d8a325a4
DIST readline82-012 2824 BLAKE2B 02f5351cdeaf818d809a3d40596ef7c7d83ab397e28486aa3ec1f25b1efe8c6ca1569d0c7e7a85170d38a37a5681cf53eb8a3b435b7c010e70ebd3d346bc25ca SHA512 8921328ed899702a4e0f5c924efee7955d70909cc6ccd2722c87127891e0639376ef5a642ca4b27f92e0ee06d4fad7297fe5f2d2db425e1b6a9b1eaf5c1e4b63
DIST readline82-012.sig 95 BLAKE2B c9d69070ebff6b1996cfb5d1559dfdaa56d2e34770f142f9771cf8b99a68dfd55933cbcbadf589f490db4c7bdc57e43cd657d43ce72c185a46b802e61175470e SHA512 d9c0cedd012fe5a1e2236f072aefca3b1c9c66c6eedef1842f22d80c860d1e48a4f0a10711f52316e6c57d221ee32e00172002f53a3931574a03891873c0ed1e
DIST readline82-013 5757 BLAKE2B 5af309dc331cdc2fc9c47f8a53c78731885cf70ba22c135929a30c3ab0c6c0a786d1a58b607a7aca9a6522e70aa0e9dc182ad21854d87299e48bf207ee9b02e2 SHA512 9a768946c91e4af31e872fb856b017662cdd5a12ed432d84ba13013fbac327673b655a034dbcfab52da2ff9e45eb1fdb562c3e26c224a5f4e86bff23df25175e
DIST readline82-013.sig 95 BLAKE2B 388b707e863c6047fdc92bb29e2c172292b497f53926f6e2534016e5cdb621fd7feb9418c6edd4a693869ea61c16cb64815bf2159d6af0bb3eec5d5dc666e525 SHA512 85bd30dc816d62a2e339c95bf9f243a60a960264e14bc396b34f586afdded2cc43ecc307a7f1a2c03c7eba2d11d2f3a0028107a59c4b2bc8d6dbe77fe9fb81cd

View File

@ -0,0 +1,263 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
# There's no standard way of versioning the point releases upstream
# make anyway, so while this was added for RC versions, it's fine
# in general.
QA_PKGCONFIG_VERSION=$(ver_cut 1-2)
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/chetramey.asc
inherit flag-o-matic multilib multilib-minimal preserve-libs toolchain-funcs verify-sig
# Official patches
# See ftp://ftp.cwru.edu/pub/bash/readline-8.1-patches/
PLEVEL="${PV##*_p}"
MY_PV="${PV/_p*}"
MY_PV="${MY_PV/_/-}"
MY_P="${PN}-${MY_PV}"
MY_PATCHES=()
is_release() {
case ${PV} in
9999|*_alpha*|*_beta*|*_rc*)
return 1
;;
*)
return 0
;;
esac
}
[[ ${PV} != *_p* ]] && PLEVEL=0
DESCRIPTION="Another cute console display library"
HOMEPAGE="https://tiswww.case.edu/php/chet/readline/rltop.html https://git.savannah.gnu.org/cgit/readline.git"
if [[ ${PV} == 9999 ]] ; then
EGIT_REPO_URI="https://git.savannah.gnu.org/git/readline.git"
EGIT_BRANCH=devel
inherit git-r3
elif is_release ; then
SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz"
SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/readline-8.1-rlfe-c99.patch.xz"
SRC_URI+=" verify-sig? ( mirror://gnu/${PN}/${MY_P}.tar.gz.sig )"
if [[ ${PLEVEL} -gt 0 ]] ; then
# bash-5.1 -> bash51
my_p=${PN}$(ver_rs 1-2 '' $(ver_cut 1-2))
patch_url=
my_patch_index=
upstream_url_base="mirror://gnu/readline"
mirror_url_base="ftp://ftp.cwru.edu/pub/readline"
for ((my_patch_index=1; my_patch_index <= ${PLEVEL} ; my_patch_index++)) ; do
printf -v mangled_patch_ver ${my_p}-%03d ${my_patch_index}
patch_url="${upstream_url_base}/${MY_P}-patches/${mangled_patch_ver}"
SRC_URI+=" ${patch_url}"
SRC_URI+=" verify-sig? ( ${patch_url}.sig )"
# Add in the mirror URL too.
SRC_URI+=" ${patch_url/${upstream_url_base}/${mirror_url_base}}"
SRC_URI+=" verify-sig? ( ${patch_url/${upstream_url_base}/${mirror_url_base}}.sig )"
MY_PATCHES+=( "${DISTDIR}"/${mangled_patch_ver} )
done
unset my_p patch_url my_patch_index upstream_url_base mirror_url_base
fi
else
SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz ftp://ftp.cwru.edu/pub/readline/${MY_P}.tar.gz"
SRC_URI+=" verify-sig? ( mirror://gnu/${PN}/${MY_P}.tar.gz.sig ftp://ftp.cwru.edu/pub/readline/${MY_P}.tar.gz.sig )"
fi
S="${WORKDIR}/${MY_P}"
if ! is_release ; then
inherit autotools
fi
LICENSE="GPL-3+"
SLOT="0/8" # subslot matches SONAME major
if is_release ; then
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
fi
IUSE="static-libs +unicode utils"
RDEPEND=">=sys-libs/ncurses-5.9-r3:=[static-libs?,unicode(+)?,${MULTILIB_USEDEP}]"
DEPEND="${RDEPEND}"
BDEPEND="virtual/pkgconfig
verify-sig? ( sec-keys/openpgp-keys-chetramey )"
PATCHES=(
"${FILESDIR}"/${PN}-5.0-no_rpath.patch
"${FILESDIR}"/${PN}-7.0-headers.patch
"${FILESDIR}"/${PN}-8.0-headers.patch
"${WORKDIR}"/${PN}-8.1-rlfe-c99.patch
# TODO: rebase
#"${FILESDIR}"/${PN}-8.0-darwin-shlib-versioning.patch
)
src_unpack() {
local patch
if [[ ${PV} == 9999 ]]; then
git-r3_src_unpack
else
if use verify-sig; then
verify-sig_verify_detached "${DISTDIR}/${MY_P}.tar.gz"{,.sig}
for patch in "${MY_PATCHES[@]}"; do
verify-sig_verify_detached "${patch}"{,.sig}
done
fi
unpack "${MY_P}.tar.gz"
unpack readline-8.1-rlfe-c99.patch.xz
#if [[ ${GENTOO_PATCH_VER} ]]; then
# unpack "${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
#fi
fi
}
src_prepare() {
[[ ${PLEVEL} -gt 0 ]] && eapply -p0 "${MY_PATCHES[@]}"
default
is_release || eautoreconf
if use prefix && [[ ! -x "${BROOT}"/usr/bin/pkg-config ]] ; then
# If we're bootstrapping, make a guess. We don't have pkg-config
# around yet. bug #818103.
# Incorrectly populating this leads to underlinked libreadline.
local ncurses_libs
local ncurses_libs_suffix=$(usex unicode w '')
ncurses_libs="-lncurses${ncurses_libs_suffix}"
if has_version "sys-libs/ncurses[tinfo(+)]" ; then
ncurses_libs+=" -ltinfo${ncurses_libs_suffix}"
fi
else
# Force ncurses linking, bug #71420.
# Use pkg-config to get the right values, bug #457558.
local ncurses_libs=$($(tc-getPKG_CONFIG) ncurses$(usex unicode w '') --libs)
fi
sed -i \
-e "/^SHLIB_LIBS=/s:=.*:='${ncurses_libs}':" \
support/shobj-conf || die
sed -i \
-e "/^[[:space:]]*LIBS=.-lncurses/s:-lncurses:${ncurses_libs}:" \
examples/rlfe/configure || die
# Fix building under Gentoo/FreeBSD; upstream FreeBSD deprecated
# objformat for years, so we don't want to rely on that.
sed -i -e '/objformat/s:if .*; then:if true; then:' support/shobj-conf || die
# For local readline headers
ln -s ../.. examples/rlfe/readline || die
}
src_configure() {
# Fix implicit decls with widechar funcs
append-cppflags -D_GNU_SOURCE
# https://lists.gnu.org/archive/html/bug-readline/2010-07/msg00013.html
append-cppflags -Dxrealloc=_rl_realloc -Dxmalloc=_rl_malloc -Dxfree=_rl_free
# Make sure configure picks a better ar than `ar`, bug #484866
export ac_cv_prog_AR="$(tc-getAR)"
# Force the test since we used sed above to force it.
export bash_cv_termcap_lib=ncurses
# Control cross-compiling cases when we know the right answer.
# In cases where the C library doesn't support wide characters, readline
# itself won't work correctly, so forcing the answer below should be OK.
if tc-is-cross-compiler ; then
export bash_cv_func_sigsetjmp="present"
export bash_cv_func_ctype_nonascii="yes"
# bug #503312
export bash_cv_wcwidth_broken="no"
fi
# This is for rlfe, but we need to make sure LDFLAGS doesn't change
# so we can re-use the config cache file between the two.
append-ldflags -L.
multilib-minimal_src_configure
}
multilib_src_configure() {
local myeconfargs=(
--cache-file="${BUILD_DIR}"/config.cache
--with-curses
$(use_enable static-libs static)
)
ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
if use utils && multilib_is_native_abi && ! tc-is-cross-compiler ; then
# Code is full of AC_TRY_RUN()
mkdir -p examples/rlfe || die
cd examples/rlfe || die
ECONF_SOURCE="${S}"/examples/rlfe econf --cache-file="${BUILD_DIR}"/config.cache
fi
}
multilib_src_compile() {
emake
if use utils && multilib_is_native_abi && ! tc-is-cross-compiler ; then
# Code is full of AC_TRY_RUN()
cd examples/rlfe || die
local l
for l in readline history ; do
ln -s ../../shlib/lib${l}$(get_libname)* lib${l}$(get_libname) || die
ln -s ../../lib${l}.a lib${l}.a || die
done
emake
fi
}
multilib_src_install() {
default
if multilib_is_native_abi ; then
if use utils && ! tc-is-cross-compiler; then
dobin examples/rlfe/rlfe
fi
fi
}
multilib_src_install_all() {
HTML_DOCS="doc/history.html doc/readline.html doc/rluserman.html" einstalldocs
dodoc USAGE
docinto ps
dodoc doc/*.ps
}
pkg_preinst() {
# bug #29865
# Reappeared in bug #595324 with paludis so keeping this for now...
preserve_old_lib \
/$(get_libdir)/lib{history,readline}$(get_libname 4) \
/$(get_libdir)/lib{history,readline}$(get_libname 5) \
/$(get_libdir)/lib{history,readline}$(get_libname 6) \
/$(get_libdir)/lib{history,readline}$(get_libname 7)
}
pkg_postinst() {
preserve_old_lib_notify \
/$(get_libdir)/lib{history,readline}$(get_libname 4) \
/$(get_libdir)/lib{history,readline}$(get_libname 5) \
/$(get_libdir)/lib{history,readline}$(get_libname 6) \
/$(get_libdir)/lib{history,readline}$(get_libname 7)
}