1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit eutils multilib toolchain-funcs flag-o-matic multilib-minimal
9 # See ftp://ftp.cwru.edu/pub/bash/readline-7.0-patches/
14 [[ ${PV} != *_p* ]] && PLEVEL=0
16 [[ ${PLEVEL} -eq 0 ]] && return 1
18 eval set -- {1..${PLEVEL}}
19 set -- $(printf "${PN}${MY_PV/\.}-%03d " "$@")
20 if [[ ${opt} == -s ]] ; then
21 echo "${@/#/${DISTDIR}/}"
24 for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${PN} ; do
25 printf "${u}/${PN}-${MY_PV}-patches/%s " "$@"
30 DESCRIPTION="Another cute console display library"
31 HOMEPAGE="http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html"
33 *_alpha*|*_beta*|*_rc*) SRC_URI+=" ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz" ;;
34 *) SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz $(patches)" ;;
38 SLOT="0/7" # subslot matches SONAME major
39 KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
40 IUSE="static-libs utils"
42 RDEPEND=">=sys-libs/ncurses-5.9-r3:0=[static-libs?,${MULTILIB_USEDEP}]"
53 [[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
54 epatch "${FILESDIR}"/${PN}-5.0-no_rpath.patch
55 epatch "${FILESDIR}"/${PN}-6.2-rlfe-tgoto.patch #385091
56 epatch "${FILESDIR}"/${PN}-7.0-headers.patch
57 epatch "${FILESDIR}"/${PN}-7.0-missing-echo-proto.patch
59 # Force ncurses linking. #71420
60 # Use pkg-config to get the right values. #457558
61 local ncurses_libs=$($(tc-getPKG_CONFIG) ncurses --libs)
63 -e "/^SHLIB_LIBS=/s:=.*:='${ncurses_libs}':" \
64 support/shobj-conf || die
66 -e "/^[[:space:]]*LIBS=.-lncurses/s:-lncurses:${ncurses_libs}:" \
67 examples/rlfe/configure || die
69 # fix building under Gentoo/FreeBSD; upstream FreeBSD deprecated
70 # objformat for years, so we don't want to rely on that.
71 sed -i -e '/objformat/s:if .*; then:if true; then:' support/shobj-conf || die
73 ln -s ../.. examples/rlfe/readline # for local readline headers
77 # fix implicit decls with widechar funcs
78 append-cppflags -D_GNU_SOURCE
79 # https://lists.gnu.org/archive/html/bug-readline/2010-07/msg00013.html
80 append-cppflags -Dxrealloc=_rl_realloc -Dxmalloc=_rl_malloc -Dxfree=_rl_free
82 # Make sure configure picks a better ar than `ar`. #484866
83 export ac_cv_prog_AR=$(tc-getAR)
85 # Force the test since we used sed above to force it.
86 export bash_cv_termcap_lib=ncurses
88 # Control cross-compiling cases when we know the right answer.
89 # In cases where the C library doesn't support wide characters, readline
90 # itself won't work correctly, so forcing the answer below should be OK.
91 if tc-is-cross-compiler ; then
92 export bash_cv_func_sigsetjmp='present'
93 export bash_cv_func_ctype_nonascii='yes'
94 export bash_cv_wcwidth_broken='no' #503312
97 # This is for rlfe, but we need to make sure LDFLAGS doesn't change
98 # so we can re-use the config cache file between the two.
101 multilib-minimal_src_configure
104 multilib_src_configure() {
107 --cache-file="${BUILD_DIR}"/config.cache \
108 --docdir='$(datarootdir)'/doc/${PF} \
110 $(use_enable static-libs static)
112 if use utils && multilib_is_native_abi && ! tc-is-cross-compiler ; then
113 # code is full of AC_TRY_RUN()
114 mkdir -p examples/rlfe || die
115 cd examples/rlfe || die
116 ECONF_SOURCE=${S}/examples/rlfe \
117 econf --cache-file="${BUILD_DIR}"/config.cache
121 multilib_src_compile() {
124 if use utils && multilib_is_native_abi && ! tc-is-cross-compiler ; then
125 # code is full of AC_TRY_RUN()
126 cd examples/rlfe || die
128 for l in readline history ; do
129 ln -s ../../shlib/lib${l}$(get_libname)* lib${l}$(get_libname)
130 ln -sf ../../lib${l}.a lib${l}.a
136 multilib_src_install() {
139 if multilib_is_native_abi ; then
140 gen_usr_ldscript -a readline history #4411
142 if use utils && ! tc-is-cross-compiler; then
143 dobin examples/rlfe/rlfe
148 multilib_src_install_all() {
157 # Reappeared in #595324 with paludis so keeping this for now...
158 preserve_old_lib /$(get_libdir)/lib{history,readline}.so.{4,5,6}
162 preserve_old_lib_notify /$(get_libdir)/lib{history,readline}.so.{4,5,6}