readline-6.3_p8-r3.ebuild 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit eutils multilib toolchain-funcs flag-o-matic multilib-minimal
  5. # Official patches
  6. # See ftp://ftp.cwru.edu/pub/bash/readline-6.3-patches/
  7. PLEVEL=${PV##*_p}
  8. MY_PV=${PV/_p*}
  9. MY_PV=${MY_PV/_/-}
  10. MY_P=${PN}-${MY_PV}
  11. [[ ${PV} != *_p* ]] && PLEVEL=0
  12. patches() {
  13. [[ ${PLEVEL} -eq 0 ]] && return 1
  14. local opt=$1
  15. eval set -- {1..${PLEVEL}}
  16. set -- $(printf "${PN}${MY_PV/\.}-%03d " "$@")
  17. if [[ ${opt} == -s ]] ; then
  18. echo "${@/#/${DISTDIR}/}"
  19. else
  20. local u
  21. for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${PN} ; do
  22. printf "${u}/${PN}-${MY_PV}-patches/%s " "$@"
  23. done
  24. fi
  25. }
  26. DESCRIPTION="Another cute console display library"
  27. HOMEPAGE="http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html"
  28. SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz $(patches)"
  29. LICENSE="GPL-3"
  30. SLOT="0"
  31. KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux"
  32. IUSE="static-libs utils"
  33. RDEPEND=">=sys-libs/ncurses-5.9-r3:0=[${MULTILIB_USEDEP}]
  34. abi_x86_32? (
  35. !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
  36. !<=app-emulation/emul-linux-x86-baselibs-20131008-r7
  37. )"
  38. DEPEND="${RDEPEND}
  39. virtual/pkgconfig"
  40. S=${WORKDIR}/${MY_P}
  41. PATCHES=(
  42. "${FILESDIR}"/${PN}-5.0-no_rpath.patch
  43. "${FILESDIR}"/${PN}-6.2-rlfe-tgoto.patch #385091
  44. "${FILESDIR}"/${PN}-6.3-fix-long-prompt-vi-search.patch
  45. "${FILESDIR}"/${PN}-6.3-read-eof.patch
  46. )
  47. src_unpack() {
  48. unpack ${MY_P}.tar.gz
  49. }
  50. src_prepare() {
  51. [[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
  52. epatch "${PATCHES[@]}"
  53. # Force ncurses linking. #71420
  54. # Use pkg-config to get the right values. #457558
  55. local ncurses_libs=$($(tc-getPKG_CONFIG) ncurses --libs)
  56. sed -i \
  57. -e "/^SHLIB_LIBS=/s:=.*:='${ncurses_libs}':" \
  58. support/shobj-conf || die
  59. sed -i \
  60. -e "/^[[:space:]]*LIBS=.-lncurses/s:-lncurses:${ncurses_libs}:" \
  61. examples/rlfe/configure || die
  62. # fix building under Gentoo/FreeBSD; upstream FreeBSD deprecated
  63. # objformat for years, so we don't want to rely on that.
  64. sed -i -e '/objformat/s:if .*; then:if true; then:' support/shobj-conf || die
  65. ln -s ../.. examples/rlfe/readline # for local readline headers
  66. }
  67. src_configure() {
  68. # fix implicit decls with widechar funcs
  69. append-cppflags -D_GNU_SOURCE
  70. # https://lists.gnu.org/archive/html/bug-readline/2010-07/msg00013.html
  71. append-cppflags -Dxrealloc=_rl_realloc -Dxmalloc=_rl_malloc -Dxfree=_rl_free
  72. # Make sure configure picks a better ar than `ar`. #484866
  73. export ac_cv_prog_AR=$(tc-getAR)
  74. # Force the test since we used sed above to force it.
  75. export bash_cv_termcap_lib=ncurses
  76. # Control cross-compiling cases when we know the right answer.
  77. # In cases where the C library doesn't support wide characters, readline
  78. # itself won't work correctly, so forcing the answer below should be OK.
  79. if tc-is-cross-compiler ; then
  80. export bash_cv_func_sigsetjmp='present'
  81. export bash_cv_func_ctype_nonascii='yes'
  82. export bash_cv_wcwidth_broken='no' #503312
  83. fi
  84. # This is for rlfe, but we need to make sure LDFLAGS doesn't change
  85. # so we can re-use the config cache file between the two.
  86. append-ldflags -L.
  87. multilib-minimal_src_configure
  88. }
  89. multilib_src_configure() {
  90. ECONF_SOURCE=${S} \
  91. econf \
  92. --cache-file="${BUILD_DIR}"/config.cache \
  93. --docdir='$(datarootdir)'/doc/${PF} \
  94. --with-curses \
  95. $(use_enable static-libs static)
  96. if use utils && multilib_is_native_abi && ! tc-is-cross-compiler ; then
  97. # code is full of AC_TRY_RUN()
  98. mkdir -p examples/rlfe || die
  99. cd examples/rlfe || die
  100. ECONF_SOURCE=${S}/examples/rlfe \
  101. econf --cache-file="${BUILD_DIR}"/config.cache
  102. fi
  103. }
  104. multilib_src_compile() {
  105. emake
  106. if use utils && multilib_is_native_abi && ! tc-is-cross-compiler ; then
  107. # code is full of AC_TRY_RUN()
  108. cd examples/rlfe || die
  109. local l
  110. for l in readline history ; do
  111. ln -s ../../shlib/lib${l}$(get_libname)* lib${l}$(get_libname)
  112. ln -sf ../../lib${l}.a lib${l}.a
  113. done
  114. emake
  115. fi
  116. }
  117. multilib_src_install() {
  118. default
  119. if multilib_is_native_abi ; then
  120. gen_usr_ldscript -a readline history #4411
  121. if use utils && ! tc-is-cross-compiler; then
  122. dobin examples/rlfe/rlfe
  123. fi
  124. fi
  125. }
  126. multilib_src_install_all() {
  127. einstalldocs
  128. dodoc USAGE
  129. dohtml -r doc/.
  130. docinto ps
  131. dodoc doc/*.ps
  132. }
  133. pkg_preinst() {
  134. preserve_old_lib /$(get_libdir)/lib{history,readline}.so.{4,5} #29865
  135. }
  136. pkg_postinst() {
  137. preserve_old_lib_notify /$(get_libdir)/lib{history,readline}.so.{4,5}
  138. }