--- /usr/portage/sys-libs/ncurses/ncurses-5.9-r3.ebuild 2014-07-13 13:31:36.000000000 -0600 +++ /usr/portage/sys-libs/ncurses/ncurses-5.9-r3.ebuild 2014-08-04 08:51:48.887942764 -0600 @@ -3,7 +3,7 @@ # $Header: /var/cvsroot/gentoo-x86/sys-libs/ncurses/ncurses-5.9-r3.ebuild,v 1.16 2014/07/13 19:30:57 zlogene Exp $ EAPI="4" -inherit eutils flag-o-matic toolchain-funcs multilib-minimal +inherit eutils flag-o-matic toolchain-funcs multilib-minimal libtool MY_PV=${PV:0:3} PV_SNAP=${PV:4} @@ -12,9 +12,17 @@ HOMEPAGE="http://www.gnu.org/software/ncurses/ http://dickey.his.com/ncurses/" SRC_URI="mirror://gnu/ncurses/${MY_P}.tar.gz" +HOSTLTV="0.1.0" +HOSTLT="host-libtool-${HOSTLTV}" +HOSTLT_URI="http://github.com/haubi/host-libtool/releases/download/v${HOSTLTV}/${HOSTLT}.tar.gz" +SRC_URI="${SRC_URI} + kernel_AIX? ( ${HOSTLT_URI} ) + kernel_HPUX? ( ${HOSTLT_URI} ) +" + LICENSE="MIT" SLOT="5" KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 s390 ~sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" IUSE="ada +cxx debug doc gpm minimal profile static-libs tinfo trace unicode" DEPEND="gpm? ( sys-libs/gpm )" @@ -33,6 +41,15 @@ S=${WORKDIR}/${MY_P} HOSTTIC_DIR=${WORKDIR}/${P}-host +need-libtool() { + # need libtool to build aix-style shared objects inside archive libs, but + # cannot depend on libtool, as this would create circular dependencies... + # And libtool-1.5.26 needs (a similar) patch for AIX (DESTDIR) as found in + # http://lists.gnu.org/archive/html/bug-libtool/2008-03/msg00124.html + # Use libtool on hpux too to get some soname. + [[ ${CHOST} == *'-aix'* || ${CHOST} == *'-hpux'* ]] +} + src_prepare() { [[ -n ${PV_SNAP} ]] && epatch "${WORKDIR}"/${MY_P}-${PV_SNAP}-patch.sh epatch "${FILESDIR}"/${PN}-5.8-gfbsd.patch @@ -40,9 +57,44 @@ epatch "${FILESDIR}"/${PN}-5.9-rxvt-unicode-9.15.patch #192083 #383871 epatch "${FILESDIR}"/${PN}-5.9-fix-clang-build.patch #417763 epatch "${FILESDIR}"/${PN}-5.9-pkg-config.patch + + # /bin/sh is not always good enough + find . -name "*.sh" | xargs sed -i -e '1c\#!/usr/bin/env sh' + + if need-libtool; then + S="${WORKDIR}"/${HOSTLT} elibtoolize + + # Don't need local libraries (-L../lib) for libncurses, + # ends up as insecure runpath in libncurses.so[shr.o] on AIX + sed -i -e '/^SHLIB_LIST[ \t]*=/s/\$(SHLIB_DIRS)//' ncurses/Makefile.in || die + fi + + # Don't mess with _XOPEN_SOURCE for C++ on (Open)Solaris. The compiler + # defines a value for it, and depending on version, a different definition + # is used. Defining this variable on these systems is dangerous any time, + # since the system headers do strict checks on compatability of flags and + # standards. + # Defining _XOPEN_SOURCE_EXTENDED together with _XOPEN_SOURCE leads to + # pre-_XOPEN_SOURCE=500 stuff, so only do it for non-C++ code. + # See also bug #431352 + if [[ ${CHOST} == *-solaris* ]] ; then + sed -i \ + -e '/-D__EXTENSIONS__/ s/-D_XOPEN_SOURCE=\$cf_XOPEN_SOURCE//' \ + -e '/CPPFLAGS="$CPPFLAGS/s/ -D_XOPEN_SOURCE_EXTENDED//' \ + configure || die + # ONLY in C-mode, NOT C++ + append-cflags -D_XOPEN_SOURCE_EXTENDED + fi } src_configure() { + if need-libtool; then + cd "${WORKDIR}"/${HOSTLT} || die + econf + export PATH="${WORKDIR}"/${HOSTLT}:${PATH} + cd "${S}" || die + fi + unset TERMINFO #115036 tc-export_build_env BUILD_{CC,CPP} BUILD_CPPFLAGS+=" -D_GNU_SOURCE" #214642 @@ -63,7 +115,7 @@ multilib_src_configure() { do_configure narrowc - use unicode && do_configure widec --enable-widec --includedir=/usr/include/ncursesw + use unicode && do_configure widec --enable-widec --includedir="${EPREFIX}"/usr/include/ncursesw } do_configure() { @@ -77,7 +129,7 @@ # 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="/etc/terminfo:/usr/share/terminfo" + --with-terminfo-dirs="${EPREFIX}/etc/terminfo:${EPREFIX}/usr/share/terminfo" # Disabled until #245417 is sorted out. #$(use_with berkdb hashed-db) @@ -88,10 +140,19 @@ --enable-pc-files --with-pkg-config="$(tc-getPKG_CONFIG)" # This path is used to control where the .pc files are installed. - PKG_CONFIG_LIBDIR="/usr/$(get_libdir)/pkgconfig" + PKG_CONFIG_LIBDIR="${EPREFIX}/usr/$(get_libdir)/pkgconfig" # Now the rest of the various standard flags. - --with-shared + --$( + if need-libtool ; then + echo with-libtool + elif [[ ${CHOST} == *-mint* ]] ; then + echo without-shared + else + echo with-shared + fi + ) + --enable-overwrite --without-hashed-db $(use_with ada) $(use_with cxx) @@ -183,7 +244,9 @@ $(usex unicode 'ncursesw' '') \ $(use tinfo && usex unicode 'tinfow' '') \ $(usev tinfo) - ln -sf libncurses.so "${D}"/usr/$(get_libdir)/libcurses.so || die + if ! tc-is-static-only ; then + ln -sf libncurses$(get_libname) "${ED}"/usr/$(get_libdir)/libcurses$(get_libname) || die + fi use static-libs || find "${D}"/usr/ -name '*.a' -a '!' -name '*curses++*.a' -delete # Build fails to create this ... @@ -197,12 +260,12 @@ for x in ansi console dumb linux rxvt rxvt-unicode screen sun vt{52,100,102,200,220} \ xterm xterm-color xterm-xfree86 do - local termfile=$(find "${D}"/usr/share/terminfo/ -name "${x}" 2>/dev/null) + 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} "${D}"/etc/terminfo/${basedir}/ + mv ${termfile} "${ED}"/etc/terminfo/${basedir}/ dosym ../../../../etc/terminfo/${basedir}/${x} \ /usr/share/terminfo/${basedir}/${x} fi @@ -212,7 +275,7 @@ echo "CONFIG_PROTECT_MASK=\"/etc/terminfo\"" > "${T}"/50ncurses doenvd "${T}"/50ncurses - use minimal && rm -r "${D}"/usr/share/terminfo* + use minimal && rm -r "${ED}"/usr/share/terminfo* # Because ncurses5-config --terminfo returns the directory we keep it keepdir /usr/share/terminfo #245374