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