Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/ncurses/
Date: Tue, 02 Jan 2018 11:08:36
Message-Id: 1514890304.961bf0f53a7ac66bd84021d8e5e093f54cf5d972.vapier@gentoo
1 commit: 961bf0f53a7ac66bd84021d8e5e093f54cf5d972
2 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 2 10:37:16 2018 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 2 10:51:44 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=961bf0f5
7
8 sys-libs/ncurses: modernize the fallback terminal list
9
10 We drop "sun" and "xterm-xfree86" as it's unlikely anyone uses those
11 anymore in fallback scenarios. We add {screen,xterm}-256color as those
12 are fairly common defaults. The size delta is negligible.
13
14 sys-libs/ncurses/ncurses-6.0-r2.ebuild | 287 +++++++++++++++++++++++++++++++++
15 1 file changed, 287 insertions(+)
16
17 diff --git a/sys-libs/ncurses/ncurses-6.0-r2.ebuild b/sys-libs/ncurses/ncurses-6.0-r2.ebuild
18 new file mode 100644
19 index 00000000000..9051223ca37
20 --- /dev/null
21 +++ b/sys-libs/ncurses/ncurses-6.0-r2.ebuild
22 @@ -0,0 +1,287 @@
23 +# Copyright 1999-2017 Gentoo Foundation
24 +# Distributed under the terms of the GNU General Public License v2
25 +
26 +EAPI="5"
27 +
28 +inherit eutils flag-o-matic toolchain-funcs multilib-minimal
29 +
30 +MY_PV=${PV:0:3}
31 +PV_SNAP=${PV:4}
32 +MY_P=${PN}-${MY_PV}
33 +DESCRIPTION="console display library"
34 +HOMEPAGE="https://www.gnu.org/software/ncurses/ http://dickey.his.com/ncurses/"
35 +SRC_URI="mirror://gnu/ncurses/${MY_P}.tar.gz"
36 +
37 +LICENSE="MIT"
38 +# The subslot reflects the SONAME.
39 +SLOT="0/6"
40 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
41 +IUSE="ada +cxx debug doc gpm minimal profile static-libs test threads tinfo trace unicode"
42 +
43 +DEPEND="gpm? ( sys-libs/gpm[${MULTILIB_USEDEP}] )"
44 +# berkdb? ( sys-libs/db )"
45 +# Block the older ncurses that installed all files w/SLOT=5. #557472
46 +RDEPEND="${DEPEND}
47 + !<=sys-libs/ncurses-5.9-r4:5
48 + !<x11-terms/rxvt-unicode-9.06-r3
49 + !<x11-terms/st-0.6-r1
50 + !app-emulation/emul-linux-x86-baselibs"
51 +
52 +S=${WORKDIR}/${MY_P}
53 +
54 +PATCHES=(
55 + "${FILESDIR}/${PN}-6.0-gfbsd.patch"
56 + "${FILESDIR}/${PN}-5.7-nongnu.patch"
57 + "${FILESDIR}/${PN}-6.0-rxvt-unicode-9.15.patch" #192083 #383871
58 + "${FILESDIR}/${PN}-6.0-pkg-config.patch"
59 + "${FILESDIR}/${PN}-5.9-gcc-5.patch" #545114
60 + "${FILESDIR}/${PN}-6.0-ticlib.patch" #557360
61 + "${FILESDIR}/${PN}-6.0-cppflags-cross.patch" #601426
62 +)
63 +
64 +src_prepare() {
65 + [[ -n ${PV_SNAP} ]] && epatch "${WORKDIR}"/${MY_P}-${PV_SNAP}-patch.sh
66 + epatch "${PATCHES[@]}"
67 +}
68 +
69 +src_configure() {
70 + unset TERMINFO #115036
71 + tc-export_build_env BUILD_{CC,CPP}
72 + BUILD_CPPFLAGS+=" -D_GNU_SOURCE" #214642
73 +
74 + # Build the various variants of ncurses -- narrow, wide, and threaded. #510440
75 + # Order matters here -- we want unicode/thread versions to come last so that the
76 + # binaries in /usr/bin support both wide and narrow.
77 + # The naming is also important as we use these directly with filenames and when
78 + # checking configure flags.
79 + NCURSES_TARGETS=(
80 + ncurses
81 + $(usex unicode 'ncursesw' '')
82 + $(usex threads 'ncursest' '')
83 + $(use unicode && usex threads 'ncursestw' '')
84 + )
85 +
86 + # When installing ncurses, we have to use a compatible version of tic.
87 + # This comes up when cross-compiling, doing multilib builds, upgrading,
88 + # or installing for the first time. Build a local copy of tic whenever
89 + # the host version isn't available. #249363 #557598
90 + if ! ROOT=/ has_version "~sys-libs/${P}:0" ; then
91 + local lbuildflags="-static"
92 +
93 + # some toolchains don't quite support static linking
94 + local dbuildflags="-Wl,-rpath,${WORKDIR}/lib"
95 + case ${CHOST} in
96 + *-darwin*) dbuildflags= ;;
97 + *-aix*) dbuildflags= ;;
98 + esac
99 + echo "int main() {}" | \
100 + $(tc-getCC) -o x -x c - ${lbuildflags} -pipe >& /dev/null \
101 + || lbuildflags="${dbuildflags}"
102 +
103 + # We can't re-use the multilib BUILD_DIR because we run outside of it.
104 + BUILD_DIR="${WORKDIR}" \
105 + CHOST=${CBUILD} \
106 + CFLAGS=${BUILD_CFLAGS} \
107 + CXXFLAGS=${BUILD_CXXFLAGS} \
108 + CPPFLAGS=${BUILD_CPPFLAGS} \
109 + LDFLAGS="${BUILD_LDFLAGS} ${lbuildflags}" \
110 + do_configure cross --without-shared --with-normal
111 + fi
112 + multilib-minimal_src_configure
113 +}
114 +
115 +multilib_src_configure() {
116 + local t
117 + for t in "${NCURSES_TARGETS[@]}" ; do
118 + do_configure "${t}"
119 + done
120 +}
121 +
122 +do_configure() {
123 + local target=$1
124 + shift
125 +
126 + mkdir "${BUILD_DIR}/${target}"
127 + cd "${BUILD_DIR}/${target}" || die
128 +
129 + local conf=(
130 + # We need the basic terminfo files in /etc, bug #37026. We will
131 + # add '--with-terminfo-dirs' and then populate /etc/terminfo in
132 + # src_install() ...
133 + --with-terminfo-dirs="${EPREFIX}/etc/terminfo:${EPREFIX}/usr/share/terminfo"
134 +
135 + # Disabled until #245417 is sorted out.
136 + #$(use_with berkdb hashed-db)
137 +
138 + # ncurses is dumb and doesn't install .pc files unless pkg-config
139 + # is also installed. Force the tests to go our way. Note that it
140 + # doesn't actually use pkg-config ... it just looks for set vars.
141 + --enable-pc-files
142 + --with-pkg-config="$(tc-getPKG_CONFIG)"
143 + # This path is used to control where the .pc files are installed.
144 + --with-pkg-config-libdir="${EPREFIX}/usr/$(get_libdir)/pkgconfig"
145 +
146 + # Now the rest of the various standard flags.
147 + --with-shared
148 + --without-hashed-db
149 + $(use_with ada)
150 + $(use_with cxx)
151 + $(use_with cxx cxx-binding)
152 + --with-cxx-shared
153 + $(use_with debug)
154 + $(use_with profile)
155 + # The configure script uses ldd to parse the linked output which
156 + # is flaky for cross-compiling/multilib/ldd versions/etc...
157 + $(use_with gpm gpm libgpm.so.1)
158 + --disable-termcap
159 + --enable-symlinks
160 + --with-rcs-ids
161 + --with-manpage-format=normal
162 + --enable-const
163 + --enable-colorfgbg
164 + --enable-hard-tabs
165 + --enable-echo
166 + $(use_enable !ada warnings)
167 + $(use_with debug assertions)
168 + $(use_enable !debug leaks)
169 + $(use_with debug expanded)
170 + $(use_with !debug macros)
171 + $(multilib_native_with progs)
172 + $(use_with test tests)
173 + $(use_with trace)
174 + $(use_with tinfo termlib)
175 + )
176 +
177 + if [[ ${target} == ncurses*w ]] ; then
178 + conf+=( --enable-widec )
179 + else
180 + conf+=( --disable-widec )
181 + fi
182 + if [[ ${target} == ncursest* ]] ; then
183 + conf+=( --with-{pthread,reentrant} )
184 + else
185 + conf+=( --without-{pthread,reentrant} )
186 + fi
187 + # Make sure each variant goes in a unique location.
188 + if [[ ${target} == "ncurses" ]] ; then
189 + # "ncurses" variant goes into "${EPREFIX}"/usr/include
190 + # It is needed on Prefix because the configure script appends
191 + # "ncurses" to "${prefix}/include" if "${prefix}" is not /usr.
192 + conf+=( --enable-overwrite )
193 + else
194 + conf+=( --includedir="${EPREFIX}"/usr/include/${target} )
195 + fi
196 + # See comments in src_configure.
197 + if [[ ${target} != "cross" ]] ; then
198 + local cross_path="${WORKDIR}/cross"
199 + [[ -d ${cross_path} ]] && export TIC_PATH="${cross_path}/progs/tic"
200 + fi
201 +
202 + # Force bash until upstream rebuilds the configure script with a newer
203 + # version of autotools. #545532
204 + CONFIG_SHELL=${EPREFIX}/bin/bash \
205 + ECONF_SOURCE=${S} \
206 + econf "${conf[@]}" "$@"
207 +}
208 +
209 +src_compile() {
210 + # See comments in src_configure.
211 + if ! ROOT=/ has_version "~sys-libs/${P}:0" ; then
212 + BUILD_DIR="${WORKDIR}" \
213 + do_compile cross -C progs tic
214 + fi
215 +
216 + multilib-minimal_src_compile
217 +}
218 +
219 +multilib_src_compile() {
220 + local t
221 + for t in "${NCURSES_TARGETS[@]}" ; do
222 + do_compile "${t}"
223 + done
224 +}
225 +
226 +do_compile() {
227 + local target=$1
228 + shift
229 +
230 + cd "${BUILD_DIR}/${target}" || die
231 +
232 + # A little hack to fix parallel builds ... they break when
233 + # generating sources so if we generate the sources first (in
234 + # non-parallel), we can then build the rest of the package
235 + # in parallel. This is not really a perf hit since the source
236 + # generation is quite small.
237 + emake -j1 sources
238 + # For some reason, sources depends on pc-files which depends on
239 + # compiled libraries which depends on sources which ...
240 + # Manually delete the pc-files file so the install step will
241 + # create the .pc files we want.
242 + rm -f misc/pc-files
243 + emake "$@"
244 +}
245 +
246 +multilib_src_install() {
247 + local target
248 + for target in "${NCURSES_TARGETS[@]}" ; do
249 + emake -C "${BUILD_DIR}/${target}" DESTDIR="${D}" install
250 + done
251 +
252 + # Move main libraries into /.
253 + if multilib_is_native_abi ; then
254 + gen_usr_ldscript -a \
255 + "${NCURSES_TARGETS[@]}" \
256 + $(use tinfo && usex unicode 'tinfow' '') \
257 + $(usev tinfo)
258 + fi
259 + if ! tc-is-static-only ; then
260 + # Provide a link for -lcurses.
261 + ln -sf libncurses$(get_libname) "${ED}"/usr/$(get_libdir)/libcurses$(get_libname) || die
262 + fi
263 + use static-libs || find "${ED}"/usr/ -name '*.a' -delete
264 +
265 + # Build fails to create this ...
266 + dosym ../share/terminfo /usr/$(get_libdir)/terminfo
267 +}
268 +
269 +multilib_src_install_all() {
270 +# if ! use berkdb ; then
271 + # We need the basic terminfo files in /etc, bug #37026
272 + einfo "Installing basic terminfo files in /etc..."
273 + local x
274 + for x in ansi console dumb linux rxvt rxvt-unicode screen{,-256color} vt{52,100,102,200,220} \
275 + xterm xterm-{,256}color
276 + do
277 + local termfile=$(find "${ED}"/usr/share/terminfo/ -name "${x}" 2>/dev/null)
278 + local basedir=$(basename $(dirname "${termfile}"))
279 +
280 + if [[ -n ${termfile} ]] ; then
281 + dodir /etc/terminfo/${basedir}
282 + mv ${termfile} "${ED}"/etc/terminfo/${basedir}/
283 + dosym ../../../../etc/terminfo/${basedir}/${x} \
284 + /usr/share/terminfo/${basedir}/${x}
285 + fi
286 + done
287 +# fi
288 +
289 + echo "CONFIG_PROTECT_MASK=\"/etc/terminfo\"" > "${T}"/50ncurses
290 + doenvd "${T}"/50ncurses
291 +
292 + use minimal && rm -r "${ED}"/usr/share/terminfo*
293 + # Because ncurses5-config --terminfo returns the directory we keep it
294 + keepdir /usr/share/terminfo #245374
295 +
296 + cd "${S}"
297 + dodoc ANNOUNCE MANIFEST NEWS README* TO-DO doc/*.doc
298 + use doc && dohtml -r doc/html/
299 +}
300 +
301 +pkg_preinst() {
302 + preserve_old_lib /$(get_libdir)/libncurses.so.5
303 + use unicode && preserve_old_lib /$(get_libdir)/libncursesw.so.5
304 +}
305 +
306 +pkg_postinst() {
307 + preserve_old_lib_notify /$(get_libdir)/libncurses.so.5
308 + use unicode && preserve_old_lib_notify /$(get_libdir)/libncursesw.so.5
309 +}