1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 # This version is just for the ABI .5 library
8 inherit eutils toolchain-funcs multilib-minimal
12 DESCRIPTION="console display library"
13 HOMEPAGE="https://www.gnu.org/software/ncurses/ https://invisible-island.net/ncurses/"
14 SRC_URI="mirror://gnu/ncurses/${MY_P}.tar.gz"
17 # The subslot reflects the SONAME.
19 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 s390 sparc x86"
20 IUSE="gpm tinfo unicode"
22 DEPEND="gpm? ( sys-libs/gpm[${MULTILIB_USEDEP}] )"
23 # Block the ncurses-5 that installs the same lib. #557472
25 !<sys-libs/ncurses-6:0
31 "${FILESDIR}"/ncurses-5.8-gfbsd.patch
32 "${FILESDIR}"/ncurses-5.7-nongnu.patch
33 "${FILESDIR}"/ncurses-5.9-rxvt-unicode-9.15.patch #192083 #383871
34 "${FILESDIR}"/ncurses-5.9-fix-clang-build.patch #417763
35 "${FILESDIR}"/ncurses-5.9-pkg-config.patch
36 "${FILESDIR}"/ncurses-5.9-no-I-usr-include.patch #522586
37 "${FILESDIR}"/ncurses-5.9-gcc-5.patch #545114
41 epatch "${PATCHES[@]}"
45 unset TERMINFO #115036
46 tc-export_build_env BUILD_{CC,CPP}
47 BUILD_CPPFLAGS+=" -D_GNU_SOURCE" #214642
49 # Build the various variants of ncurses -- narrow, wide, and threaded. #510440
50 # Order matters here -- we want unicode/thread versions to come last so that the
51 # binaries in /usr/bin support both wide and narrow.
52 # The naming is also important as we use these directly with filenames and when
53 # checking configure flags.
56 $(usex unicode 'ncursesw' '')
59 # When installing ncurses, we have to use a compatible version of tic.
60 # This comes up when cross-compiling, doing multilib builds, upgrading,
61 # or installing for the first time. Build a local copy of tic whenever
62 # the host version isn't available. #249363 #557598
63 if ! ROOT=/ has_version "~sys-libs/${P}" ; then
64 # We can't re-use the multilib BUILD_DIR because we run outside of it.
65 BUILD_DIR="${WORKDIR}" \
67 CFLAGS=${BUILD_CFLAGS} \
68 CXXFLAGS=${BUILD_CXXFLAGS} \
69 CPPFLAGS=${BUILD_CPPFLAGS} \
70 LDFLAGS="${BUILD_LDFLAGS} -static" \
71 do_configure cross --without-shared --with-normal
73 multilib-minimal_src_configure
76 multilib_src_configure() {
78 for t in "${NCURSES_TARGETS[@]}" ; do
87 mkdir "${BUILD_DIR}/${target}"
88 cd "${BUILD_DIR}/${target}" || die
91 # We need the basic terminfo files in /etc, bug #37026. We will
92 # add '--with-terminfo-dirs' and then populate /etc/terminfo in
94 --with-terminfo-dirs="${EPREFIX}/etc/terminfo:${EPREFIX}/usr/share/terminfo"
96 # Now the rest of the various standard flags.
103 --without-cxx-binding
106 # The configure script uses ldd to parse the linked output which
107 # is flaky for cross-compiling/multilib/ldd versions/etc...
108 $(use_with gpm gpm libgpm.so.1)
112 --with-manpage-format=normal
124 $(use_with tinfo termlib)
126 # The chtype/mmask-t settings below are to retain ABI compat
127 # with ncurses-5.4 so dont change em !
132 --without-{pthread,reentrant}
135 if [[ ${target} == ncurses*w ]] ; then
136 conf+=( --enable-widec )
138 conf+=( --disable-widec )
140 # Make sure each variant goes in a unique location.
141 if [[ ${target} != "ncurses" ]] ; then
142 conf+=( --includedir="${EPREFIX}"/usr/include/${target} )
144 # See comments in src_configure.
145 if [[ ${target} != "cross" ]] ; then
146 local cross_path="${WORKDIR}/cross"
147 [[ -d ${cross_path} ]] && export TIC_PATH="${cross_path}/progs/tic"
149 conf+=( --with-progs )
152 # Force bash until upstream rebuilds the configure script with a newer
153 # version of autotools. #545532
154 CONFIG_SHELL=/bin/bash \
156 econf "${conf[@]}" "$@"
160 # See comments in src_configure.
161 if ! ROOT=/ has_version "~sys-libs/${P}" ; then
162 BUILD_DIR="${WORKDIR}" \
163 do_compile cross -C progs tic
166 multilib-minimal_src_compile
169 multilib_src_compile() {
171 for t in "${NCURSES_TARGETS[@]}" ; do
180 cd "${BUILD_DIR}/${target}" || die
182 # A little hack to fix parallel builds ... they break when
183 # generating sources so if we generate the sources first (in
184 # non-parallel), we can then build the rest of the package
185 # in parallel. This is not really a perf hit since the source
186 # generation is quite small.
191 multilib_src_install() {
193 for target in "${NCURSES_TARGETS[@]}" ; do
194 cd "${BUILD_DIR}/${target}/lib" || die
196 newlib.so "${lib}" "${lib%%.9}"