summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/ncurses/ncurses.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/ncurses/ncurses.inc')
-rw-r--r--meta/recipes-core/ncurses/ncurses.inc292
1 files changed, 292 insertions, 0 deletions
diff --git a/meta/recipes-core/ncurses/ncurses.inc b/meta/recipes-core/ncurses/ncurses.inc
new file mode 100644
index 0000000000..f0a4044345
--- /dev/null
+++ b/meta/recipes-core/ncurses/ncurses.inc
@@ -0,0 +1,292 @@
1SUMMARY = "The New Curses library"
2DESCRIPTION = "SVr4 and XSI-Curses compatible curses library and terminfo tools including tic, infocmp, captoinfo. Supports color, multiple highlights, forms-drawing characters, and automatic recognition of keypad and function-key sequences. Extensions include resizable windows and mouse support on both xterm and Linux console using the gpm library."
3HOMEPAGE = "http://www.gnu.org/software/ncurses/ncurses.html"
4LICENSE = "MIT"
5LIC_FILES_CHKSUM = "file://ncurses/base/version.c;beginline=1;endline=27;md5=cbc180a8c44ca642e97c35452fab5f66"
6SECTION = "libs"
7DEPENDS = "ncurses-native"
8DEPENDS_class-native = ""
9INC_PR = "r15"
10
11inherit autotools binconfig multilib_header
12
13# Upstream has useful patches at times at ftp://invisible-island.net/ncurses/
14SRC_URI = "${GNU_MIRROR}/ncurses/ncurses-${PV}.tar.gz"
15
16EXTRA_AUTORECONF = "-I m4"
17CONFIG_SITE =+ "${WORKDIR}/config.cache"
18
19# Whether to enable separate widec libraries; must be 'true' or 'false'
20#
21# TODO: remove this variable when widec is supported in every setup?
22ENABLE_WIDEC ?= "true"
23
24# _GNU_SOURCE is required for widec stuff and is detected automatically
25# for target objects. But it must be set manually for native and sdk
26# builds.
27BUILD_CPPFLAGS += "-D_GNU_SOURCE"
28
29# natives don't generally look in base_libdir
30base_libdir_class-native = "${libdir}"
31
32# Display corruption occurs on 64 bit hosts without these settings
33# This was derrived from the upstream debian ncurses which uses
34# these settings for 32 and 64 bit hosts.
35EXCONFIG_ARGS = ""
36EXCONFIG_ARGS_class-native = " \
37 --disable-lp64 \
38 --with-chtype='long' \
39 --with-mmask-t='long'"
40EXCONFIG_ARGS_class-nativesdk = " \
41 --disable-lp64 \
42 --with-chtype='long' \
43 --with-mmask-t='long'"
44
45PACKAGES_DYNAMIC = "^${PN}-lib.*"
46
47# Fall back to the host termcap / terminfo for -nativesdk and -native
48# The reality is a work around for strange problems with things like
49# "bitbake -c menuconfig busybox" where it cannot find the terminfo
50# because the sstate had a hard coded search path. Until this is fixed
51# another way this is deemed good enough.
52EX_TERMCAP = ""
53EX_TERMCAP_class-native = ":/etc/termcap:/usr/share/misc/termcap"
54EX_TERMCAP_class-nativesdk = ":/etc/termcap:/usr/share/misc/termcap"
55EX_TERMINFO = ""
56EX_TERMINFO_class-native = ":/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo"
57EX_TERMINFO_class-nativesdk = ":/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo"
58
59# Helper function for do_configure to allow multiple configurations
60# $1 the directory to run configure in
61# $@ the arguments to pass to configure
62ncurses_configure() {
63 mkdir -p $1
64 cd $1
65 shift
66 oe_runconf \
67 --disable-static \
68 --without-debug \
69 --without-ada \
70 --without-gpm \
71 --enable-hard-tabs \
72 --enable-xmc-glitch \
73 --enable-colorfgbg \
74 --with-termpath='${sysconfdir}/termcap:${datadir}/misc/termcap${EX_TERMCAP}' \
75 --with-terminfo-dirs='${sysconfdir}/terminfo:${datadir}/terminfo${EX_TERMINFO}' \
76 --with-shared \
77 --disable-big-core \
78 --program-prefix= \
79 --with-ticlib \
80 --with-termlib=tinfo \
81 --enable-sigwinch \
82 --enable-pc-files \
83 --disable-rpath-hack \
84 ${EXCONFIG_ARGS} \
85 --with-manpage-format=normal \
86 "$@" || return 1
87 cd ..
88}
89
90# Override the function from the autotools class; ncurses requires a
91# patched autoconf213 to generate the configure script. This autoconf
92# is not available so that the shipped script will be used.
93do_configure() {
94 # check does not work with cross-compiling and is generally
95 # broken because it requires stdin to be pollable (which is
96 # not the case for /dev/null redirections)
97 export cf_cv_working_poll=yes
98
99 ( cd ${S}; gnu-configize --force )
100 ncurses_configure "narrowc" || \
101 return 1
102 ! ${ENABLE_WIDEC} || \
103 ncurses_configure "widec" "--enable-widec" "--without-progs"
104}
105
106do_compile() {
107 oe_runmake -C narrowc libs
108 oe_runmake -C narrowc/progs
109
110 ! ${ENABLE_WIDEC} || \
111 oe_runmake -C widec libs
112}
113
114# set of expected differences between narrowc and widec header
115#
116# TODO: the NCURSES_CH_T difference can cause real problems :(
117_unifdef_cleanup = " \
118 -e '\!/\* \$Id: curses.wide,v!,\!/\* \$Id: curses.tail,v!d' \
119 -e '/^#define NCURSES_CH_T /d' \
120 -e '/^#include <wchar.h>/d' \
121 -e '\!^/\* .* \*/!d' \
122"
123
124do_test[depends] = "unifdef-native:do_populate_sysroot"
125do_test[dirs] = "${S}"
126do_test() {
127 ${ENABLE_WIDEC} || return 0
128
129 # make sure that the narrow and widec header are compatible
130 # and differ only in minor details.
131 unifdef -k narrowc/include/curses.h | \
132 sed ${_unifdef_cleanup} > curses-narrowc.h
133 unifdef -k widec/include/curses.h | \
134 sed ${_unifdef_cleanup} > curses-widec.h
135
136 diff curses-narrowc.h curses-widec.h
137}
138
139# Split original _install_opts to two parts.
140# One is the options to install contents, the other is the parameters \
141# when running command "make install"
142_install_opts = "\
143 install.libs install.includes install.man \
144"
145_install_cfgs = "\
146 DESTDIR='${D}' \
147 PKG_CONFIG_LIBDIR='${libdir}/pkgconfig' \
148"
149
150do_install() {
151 # Order of installation is important; widec installs a 'curses.h'
152 # header with more definitions and must be installed last hence.
153 # Compatibility of these headers will be checked in 'do_test()'.
154 oe_runmake -C narrowc ${_install_cfgs} ${_install_opts} \
155 install.progs
156
157 # The install.data should run after install.libs, otherwise
158 # there would be a race issue in a very critical conditon, since
159 # tic will be run by install.data, and tic needs libtinfo.so
160 # which would be regenerated by install.libs.
161 oe_runmake -C narrowc ${_install_cfgs} \
162 install.data
163
164
165 ! ${ENABLE_WIDEC} || \
166 oe_runmake -C widec ${_install_cfgs} ${_install_opts}
167
168 cd narrowc
169
170 # include some basic terminfo files
171 # stolen ;) from gentoo and modified a bit
172 for x in ansi console dumb linux rxvt screen sun vt52 vt100 vt102 vt200 vt220 xterm-color xterm-xfree86 xterm-256color
173 do
174 local termfile="$(find "${D}${datadir}/terminfo/" -name "${x}" 2>/dev/null)"
175 local basedir="$(basename $(dirname "${termfile}"))"
176
177 if [ -n "${termfile}" ]
178 then
179 install -d ${D}${sysconfdir}/terminfo/${basedir}
180 mv ${termfile} ${D}${sysconfdir}/terminfo/${basedir}/
181 ln -s /etc/terminfo/${basedir}/${x} \
182 ${D}${datadir}/terminfo/${basedir}/${x}
183 fi
184 done
185 # i think we can use xterm-color as default xterm
186 if [ -e ${D}${sysconfdir}/terminfo/x/xterm-color ]
187 then
188 ln -sf xterm-color ${D}${sysconfdir}/terminfo/x/xterm
189 fi
190
191 rm -f ${D}${libdir}/terminfo
192
193 # create linker scripts for libcurses.so and libncurses to
194 # link against -ltinfo when needed. Some builds might break
195 # else when '-Wl,--no-copy-dt-needed-entries' has been set in
196 # linker flags.
197 for i in libncurses libncursesw; do
198 f=${D}${libdir}/$i.so
199 test -h $f || continue
200 rm -f $f
201 echo '/* GNU ld script */' >$f
202 echo "INPUT($i.so.5 AS_NEEDED(-ltinfo))" >>$f
203 done
204
205 # Make sure that libcurses is linked so that it gets -ltinfo
206 # also, this should be addressed upstream really.
207 ln -sf libncurses.so ${D}${libdir}/libcurses.so
208
209 # create libtermcap.so linker script for backward compatibility
210 f=${D}${libdir}/libtermcap.so
211 echo '/* GNU ld script */' >$f
212 echo 'INPUT(AS_NEEDED(-ltinfo))' >>$f
213
214 if [ ! -d "${D}${base_libdir}" ]; then
215 # Setting base_libdir to libdir as is done in the -native
216 # case will skip this code
217 mkdir ${D}${base_libdir}
218 mv ${D}${libdir}/libncurses.so.* ${D}${base_libdir}
219 ! ${ENABLE_WIDEC} || \
220 mv ${D}${libdir}/libncursesw.so.* ${D}${base_libdir}
221
222 mv ${D}${libdir}/libtinfo.so.* ${D}${base_libdir}
223 rm ${D}${libdir}/libtinfo.so
224
225 # Use lnr to ensure this is a relative link despite absolute paths
226 # (as we can't know the relationship between base_libdir and libdir).
227 # At some point we can rely on coreutils 8.16 which has ln -r.
228 lnr ${D}${base_libdir}/libtinfo.so.5 ${D}${libdir}/libtinfo.so
229 fi
230
231 oe_multilib_header curses.h
232}
233
234python populate_packages_prepend () {
235 libdir = d.expand("${libdir}")
236 base_libdir = d.expand("${base_libdir}")
237 pnbase = d.expand("${PN}-lib%s")
238 do_split_packages(d, libdir, '^lib(.*)\.so\..*', pnbase, 'ncurses %s library', prepend=True, extra_depends = '', allow_links=True)
239 if libdir is not base_libdir:
240 do_split_packages(d, base_libdir, '^lib(.*)\.so\..*', pnbase, 'ncurses %s library', prepend=True, extra_depends = '', allow_links=True)
241}
242
243
244inherit update-alternatives
245
246ALTERNATIVE_PRIORITY = "100"
247
248ALTERNATIVE_ncurses-tools_class-target = "clear reset"
249
250BBCLASSEXTEND = "native nativesdk"
251
252PACKAGES += " \
253 ${PN}-tools \
254 ${PN}-terminfo \
255 ${PN}-terminfo-base \
256"
257
258FILES_${PN} = "\
259 ${bindir}/tput \
260 ${bindir}/tset \
261 ${bindir}/ncurses5-config \
262 ${bindir}/ncursesw5-config \
263 ${datadir}/tabset \
264"
265
266# This keeps only tput/tset in ncurses
267# clear/reset are in already busybox
268FILES_${PN}-tools = "\
269 ${bindir}/tic \
270 ${bindir}/toe \
271 ${bindir}/infotocap \
272 ${bindir}/captoinfo \
273 ${bindir}/infocmp \
274 ${bindir}/clear${@['', '.${BPN\x7d']['${CLASSOVERRIDE}' == 'class-target']} \
275 ${bindir}/reset${@['', '.${BPN\x7d']['${CLASSOVERRIDE}' == 'class-target']} \
276 ${bindir}/tack \
277 ${bindir}/tabs \
278"
279
280# 'reset' is a symlink to 'tset' which is in the 'ncurses' package
281RDEPENDS_${PN}-tools = "${PN}"
282
283FILES_${PN}-terminfo = "\
284 ${datadir}/terminfo \
285"
286
287FILES_${PN}-terminfo-base = "\
288 ${sysconfdir}/terminfo \
289"
290
291RSUGGESTS_${PN}-libtinfo = "${PN}-terminfo"
292RRECOMMENDS_${PN}-libtinfo = "${PN}-terminfo-base"