dev-qt/qtx11extras: stable 5.14.2 for ppc, bug #719732
[gentoo.git] / sys-libs / ncurses-compat / ncurses-compat-5.9.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 # This version is just for the ABI .5 library
5
6 EAPI="5"
7
8 inherit eutils toolchain-funcs multilib-minimal
9
10 MY_PV=${PV:0:3}
11 MY_P=ncurses-${MY_PV}
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"
15
16 LICENSE="MIT"
17 # The subslot reflects the SONAME.
18 SLOT="5/5"
19 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 s390 sparc x86"
20 IUSE="gpm tinfo unicode"
21
22 DEPEND="gpm? ( sys-libs/gpm[${MULTILIB_USEDEP}] )"
23 # Block the ncurses-5 that installs the same lib. #557472
24 RDEPEND="${DEPEND}
25         !<sys-libs/ncurses-6:0
26         !sys-libs/ncurses:5"
27
28 S=${WORKDIR}/${MY_P}
29
30 PATCHES=(
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
38 )
39
40 src_prepare() {
41         epatch "${PATCHES[@]}"
42 }
43
44 src_configure() {
45         unset TERMINFO #115036
46         tc-export_build_env BUILD_{CC,CPP}
47         BUILD_CPPFLAGS+=" -D_GNU_SOURCE" #214642
48
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.
54         NCURSES_TARGETS=(
55                 ncurses
56                 $(usex unicode 'ncursesw' '')
57         )
58
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}" \
66                 CHOST=${CBUILD} \
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
72         fi
73         multilib-minimal_src_configure
74 }
75
76 multilib_src_configure() {
77         local t
78         for t in "${NCURSES_TARGETS[@]}" ; do
79                 do_configure "${t}"
80         done
81 }
82
83 do_configure() {
84         local target=$1
85         shift
86
87         mkdir "${BUILD_DIR}/${target}"
88         cd "${BUILD_DIR}/${target}" || die
89
90         local conf=(
91                 # We need the basic terminfo files in /etc, bug #37026.  We will
92                 # add '--with-terminfo-dirs' and then populate /etc/terminfo in
93                 # src_install() ...
94                 --with-terminfo-dirs="${EPREFIX}/etc/terminfo:${EPREFIX}/usr/share/terminfo"
95
96                 # Now the rest of the various standard flags.
97                 --without-hashed-db
98                 --disable-pc-files
99                 --with-shared
100                 --without-hashed-db
101                 --without-ada
102                 --without-cxx
103                 --without-cxx-binding
104                 --without-debug
105                 --without-profile
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)
109                 --disable-termcap
110                 --enable-symlinks
111                 --with-rcs-ids
112                 --with-manpage-format=normal
113                 --enable-const
114                 --enable-colorfgbg
115                 --enable-echo
116                 --disable-warnings
117                 --without-assertions
118                 --enable-leaks
119                 --without-expanded
120                 --with-macros
121                 --without-progs
122                 --without-tests
123                 --without-trace
124                 $(use_with tinfo termlib)
125
126                 # The chtype/mmask-t settings below are to retain ABI compat
127                 # with ncurses-5.4 so dont change em !
128                 --with-chtype=long
129                 --with-mmask-t=long
130                 --disable-ext-colors
131                 --disable-ext-mouse
132                 --without-{pthread,reentrant}
133         )
134
135         if [[ ${target} == ncurses*w ]] ; then
136                 conf+=( --enable-widec )
137         else
138                 conf+=( --disable-widec )
139         fi
140         # Make sure each variant goes in a unique location.
141         if [[ ${target} != "ncurses" ]] ; then
142                 conf+=( --includedir="${EPREFIX}"/usr/include/${target} )
143         fi
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"
148         else
149                 conf+=( --with-progs )
150         fi
151
152         # Force bash until upstream rebuilds the configure script with a newer
153         # version of autotools. #545532
154         CONFIG_SHELL=/bin/bash \
155         ECONF_SOURCE=${S} \
156         econf "${conf[@]}" "$@"
157 }
158
159 src_compile() {
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
164         fi
165
166         multilib-minimal_src_compile
167 }
168
169 multilib_src_compile() {
170         local t
171         for t in "${NCURSES_TARGETS[@]}" ; do
172                 do_compile "${t}"
173         done
174 }
175
176 do_compile() {
177         local target=$1
178         shift
179
180         cd "${BUILD_DIR}/${target}" || die
181
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.
187         emake -j1 sources
188         emake "$@"
189 }
190
191 multilib_src_install() {
192         local target lib
193         for target in "${NCURSES_TARGETS[@]}" ; do
194                 cd "${BUILD_DIR}/${target}/lib" || die
195                 for lib in *5.9 ; do
196                         newlib.so "${lib}" "${lib%%.9}"
197                 done
198         done
199 }