22
|
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=7
|
|
7 |
|
|
8 |
inherit flag-o-matic toolchain-funcs multilib-minimal preserve-libs usr-ldscript
|
|
9 |
|
|
10 |
MY_PV="${PV:0:3}"
|
|
11 |
MY_P="${PN/-compat}-${MY_PV}"
|
|
12 |
MY_PN="${PN/-compat}"
|
|
13 |
|
|
14 |
DESCRIPTION="console display library (ABI version 5)"
|
|
15 |
HOMEPAGE="https://www.gnu.org/software/ncurses/ https://invisible-island.net/ncurses/"
|
|
16 |
SRC_URI="mirror://gnu/ncurses/${MY_P}.tar.gz"
|
|
17 |
|
|
18 |
if [[ "${PV}" == *_p* ]] ; then
|
|
19 |
SRC_URI+=" ftp://ftp.invisible-island.net/ncurses/${PV/_p*}/${MY_PN}-${PV/_p/-}-patch.sh.bz2
|
|
20 |
https://invisible-mirror.net/archives/ncurses/${PV/_p*}/${MY_PN}-${PV/_p/-}-patch.sh.bz2"
|
|
21 |
fi
|
|
22 |
|
|
23 |
LICENSE="MIT"
|
|
24 |
# The subslot reflects the SONAME.
|
|
25 |
SLOT="5/5"
|
|
26 |
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
|
|
27 |
IUSE="gpm tinfo unicode -versyms"
|
|
28 |
|
|
29 |
DEPEND="gpm? ( sys-libs/gpm[${MULTILIB_USEDEP}] )"
|
|
30 |
# Block the ncurses-5 that installs the same lib. #557472
|
|
31 |
RDEPEND="${DEPEND}
|
|
32 |
!<sys-libs/ncurses-6:0
|
|
33 |
!sys-libs/ncurses:5"
|
|
34 |
|
|
35 |
S="${WORKDIR}/${MY_P}"
|
|
36 |
|
|
37 |
PATCHES=(
|
|
38 |
"${FILESDIR}/ncurses-5.7-nongnu.patch"
|
|
39 |
"${FILESDIR}/ncurses-6.0-rxvt-unicode-9.15.patch" #192083 #383871
|
|
40 |
"${FILESDIR}/ncurses-6.0-pkg-config.patch"
|
|
41 |
"${FILESDIR}/ncurses-5.9-gcc-5.patch" #545114
|
|
42 |
"${FILESDIR}/ncurses-6.0-ticlib.patch" #557360
|
|
43 |
"${FILESDIR}/ncurses-6.0-cppflags-cross.patch" #601426
|
|
44 |
)
|
|
45 |
|
|
46 |
src_prepare() {
|
|
47 |
if [[ "${PV}" == *_p* ]] ; then
|
|
48 |
eapply "${WORKDIR}/${MY_PN}-${PV/_p/-}-patch.sh"
|
|
49 |
fi
|
|
50 |
default
|
|
51 |
}
|
|
52 |
|
|
53 |
src_configure() {
|
|
54 |
unset TERMINFO #115036
|
|
55 |
tc-export_build_env BUILD_{CC,CPP}
|
|
56 |
BUILD_CPPFLAGS+=" -D_GNU_SOURCE" #214642
|
|
57 |
|
|
58 |
# Build the various variants of ncurses -- narrow, wide, and threaded. #510440
|
|
59 |
# Order matters here -- we want unicode/thread versions to come last so that the
|
|
60 |
# binaries in /usr/bin support both wide and narrow.
|
|
61 |
# The naming is also important as we use these directly with filenames and when
|
|
62 |
# checking configure flags.
|
|
63 |
NCURSES_TARGETS=(
|
|
64 |
ncurses
|
|
65 |
$(usex unicode 'ncursesw' '')
|
|
66 |
)
|
|
67 |
|
|
68 |
# When installing ncurses, we have to use a compatible version of tic.
|
|
69 |
# This comes up when cross-compiling, doing multilib builds, upgrading,
|
|
70 |
# or installing for the first time. Build a local copy of tic whenever
|
|
71 |
# the host version isn't available. #249363 #557598
|
|
72 |
if ! ROOT=/ has_version -b "~sys-libs/${P}:0" ; then
|
|
73 |
local lbuildflags="-static"
|
|
74 |
|
|
75 |
# some toolchains don't quite support static linking
|
|
76 |
local dbuildflags="-Wl,-rpath,${WORKDIR}/lib"
|
|
77 |
case ${CHOST} in
|
|
78 |
*-darwin*) dbuildflags= ;;
|
|
79 |
*-aix*) dbuildflags= ;;
|
|
80 |
esac
|
|
81 |
echo "int main() {}" | \
|
|
82 |
$(tc-getCC) -o x -x c - ${lbuildflags} -pipe >& /dev/null \
|
|
83 |
|| lbuildflags="${dbuildflags}"
|
|
84 |
|
|
85 |
# We can't re-use the multilib BUILD_DIR because we run outside of it.
|
|
86 |
BUILD_DIR="${WORKDIR}" \
|
|
87 |
CHOST=${CBUILD} \
|
|
88 |
CFLAGS=${BUILD_CFLAGS} \
|
|
89 |
CXXFLAGS=${BUILD_CXXFLAGS} \
|
|
90 |
CPPFLAGS=${BUILD_CPPFLAGS} \
|
|
91 |
LDFLAGS="${BUILD_LDFLAGS} ${lbuildflags}" \
|
|
92 |
do_configure cross --without-shared --with-normal
|
|
93 |
fi
|
|
94 |
multilib-minimal_src_configure
|
|
95 |
}
|
|
96 |
|
|
97 |
multilib_src_configure() {
|
|
98 |
local t
|
|
99 |
for t in "${NCURSES_TARGETS[@]}" ; do
|
|
100 |
do_configure "${t}"
|
|
101 |
done
|
|
102 |
}
|
|
103 |
|
|
104 |
do_configure() {
|
|
105 |
local target=$1
|
|
106 |
shift
|
|
107 |
|
|
108 |
mkdir "${BUILD_DIR}/${target}" || die
|
|
109 |
cd "${BUILD_DIR}/${target}" || die
|
|
110 |
|
|
111 |
local conf=(
|
|
112 |
# We need the basic terminfo files in /etc, bug #37026. We will
|
|
113 |
# add '--with-terminfo-dirs' and then populate /etc/terminfo in
|
|
114 |
# src_install() ...
|
|
115 |
##--with-rel-version=5.9 ??
|
|
116 |
--with-abi-version=5
|
|
117 |
--with-terminfo-dirs="${EPREFIX}/etc/terminfo:${EPREFIX}/usr/share/terminfo"
|
|
118 |
|
|
119 |
# Now the rest of the various standard flags.
|
|
120 |
--without-hashed-db
|
|
121 |
--disable-pc-files
|
|
122 |
--with-shared
|
|
123 |
--without-hashed-db
|
|
124 |
--without-ada
|
|
125 |
--without-cxx
|
|
126 |
--without-cxx-binding
|
|
127 |
--without-debug
|
|
128 |
--without-profile
|
|
129 |
# The configure script uses ldd to parse the linked output which
|
|
130 |
# is flaky for cross-compiling/multilib/ldd versions/etc...
|
|
131 |
$(use_with gpm gpm libgpm.so.1)
|
|
132 |
--disable-termcap
|
|
133 |
--enable-symlinks
|
|
134 |
--with-rcs-ids
|
|
135 |
--with-manpage-format=normal
|
|
136 |
--enable-const
|
|
137 |
--enable-colorfgbg
|
|
138 |
--enable-echo
|
|
139 |
--disable-warnings
|
|
140 |
--without-assertions
|
|
141 |
--enable-leaks
|
|
142 |
--without-expanded
|
|
143 |
--with-macros
|
|
144 |
--without-progs
|
|
145 |
--without-tests
|
|
146 |
--without-trace
|
|
147 |
$(use_with tinfo termlib)
|
|
148 |
|
|
149 |
# The chtype/mmask-t settings below are to retain ABI compat
|
|
150 |
# with ncurses-5.4 so dont change em !
|
|
151 |
--with-chtype=long
|
|
152 |
--with-mmask-t=long
|
|
153 |
--disable-ext-colors
|
|
154 |
--disable-ext-mouse
|
|
155 |
--without-{pthread,reentrant}
|
|
156 |
|
|
157 |
# Buidl versioned symbols, some binaries may want this
|
|
158 |
$(use_with versysm versioned-syms)
|
|
159 |
)
|
|
160 |
|
|
161 |
if [[ ${target} == ncurses*w ]] ; then
|
|
162 |
conf+=( --enable-widec )
|
|
163 |
else
|
|
164 |
conf+=( --disable-widec )
|
|
165 |
fi
|
|
166 |
# Make sure each variant goes in a unique location.
|
|
167 |
if [[ ${target} != "ncurses" ]] ; then
|
|
168 |
conf+=( --includedir="${EPREFIX}"/usr/include/${target} )
|
|
169 |
fi
|
|
170 |
# See comments in src_configure.
|
|
171 |
if [[ ${target} != "cross" ]] ; then
|
|
172 |
local cross_path="${WORKDIR}/cross"
|
|
173 |
[[ -d ${cross_path} ]] && export TIC_PATH="${cross_path}/progs/tic"
|
|
174 |
else
|
|
175 |
conf+=( --with-progs )
|
|
176 |
fi
|
|
177 |
|
|
178 |
# Force bash until upstream rebuilds the configure script with a newer
|
|
179 |
# version of autotools. #545532
|
|
180 |
CONFIG_SHELL="${EPREFIX}"/bin/bash \
|
|
181 |
ECONF_SOURCE="${S}" \
|
|
182 |
econf "${conf[@]}" "$@"
|
|
183 |
}
|
|
184 |
|
|
185 |
src_compile() {
|
|
186 |
# See comments in src_configure.
|
|
187 |
if ! ROOT=/ has_version -b "~sys-libs/${P}:0" ; then
|
|
188 |
BUILD_DIR="${WORKDIR}" \
|
|
189 |
do_compile cross -C progs tic
|
|
190 |
fi
|
|
191 |
|
|
192 |
multilib-minimal_src_compile
|
|
193 |
}
|
|
194 |
|
|
195 |
multilib_src_compile() {
|
|
196 |
local t
|
|
197 |
for t in "${NCURSES_TARGETS[@]}" ; do
|
|
198 |
do_compile "${t}"
|
|
199 |
done
|
|
200 |
}
|
|
201 |
|
|
202 |
do_compile() {
|
|
203 |
local target=$1
|
|
204 |
shift
|
|
205 |
|
|
206 |
cd "${BUILD_DIR}/${target}" || die
|
|
207 |
|
|
208 |
# A little hack to fix parallel builds ... they break when
|
|
209 |
# generating sources so if we generate the sources first (in
|
|
210 |
# non-parallel), we can then build the rest of the package
|
|
211 |
# in parallel. This is not really a perf hit since the source
|
|
212 |
# generation is quite small.
|
|
213 |
emake -j1 sources
|
|
214 |
# For some reason, sources depends on pc-files which depends on
|
|
215 |
# compiled libraries which depends on sources which ...
|
|
216 |
# Manually delete the pc-files file so the install step will
|
|
217 |
# create the .pc files we want.
|
|
218 |
rm -f misc/pc-files || die
|
|
219 |
emake "$@"
|
|
220 |
}
|
|
221 |
|
|
222 |
multilib_src_install() {
|
|
223 |
local target lib
|
|
224 |
for target in "${NCURSES_TARGETS[@]}" ; do
|
|
225 |
cd "${BUILD_DIR}/${target}/lib" || die
|
|
226 |
for lib in *5.9 ; do
|
|
227 |
newlib.so "${lib}" "${lib%%.9}"
|
|
228 |
done
|
|
229 |
done
|
|
230 |
}
|