1 DESCRIPTION = "Ncurses library"
2 HOMEPAGE = "http://www.gnu.org/software/ncurses/ncurses.html"
7 DEPENDS = "ncurses-native unifdef-native"
8 DEPENDS_virtclass-native = "unifdef-native"
10 inherit autotools binconfig test
12 SRC_URI = "${GNU_MIRROR}/ncurses/ncurses-${PV}.tar.gz \
13 file://tic-hang.patch;patch=1 \
17 SRC_URI[md5sum] = "8cb9c412e5f2d96bc6f459aa8c6282a1"
18 SRC_URI[sha256sum] = "9046298fb440324c9d4135ecea7879ffed8546dd1b58e59430ea07a4633f563b"
21 EXTRA_AUTORECONF = "-I m4"
22 CONFIG_SITE =+ "${WORKDIR}/config.cache"
24 # Whether to enable separate widec libraries; must be 'true' or 'false'
26 # TODO: remove this variable when widec is supported in every setup?
29 # _GNU_SOURCE is required for widec stuff and is detected automatically
30 # for target objects. But it must be set manually for native and sdk
32 BUILD_CPPFLAGS += "-D_GNU_SOURCE"
34 # Override the function from the autotools class; ncurses requires a
35 # patched autoconf213 to generate the configure script. This autoconf
36 # is not available so that the shipped script will be used.
38 # check does not work with cross-compiling and is generally
39 # broken because it requires stdin to be pollable (which is
40 # not the case for /dev/null redirections)
41 export cf_cv_working_poll=yes
45 'widec --enable-widec --without-progs'; do
59 --with-termpath='${sysconfdir}/termcap:${datadir}/misc/termcap' \
60 --with-terminfo-dirs='${sysconfdir}/terminfo:${datadir}/terminfo' \
65 --with-termlib=tinfo \
68 --disable-rpath-hack \
69 --with-build-cc="${BUILD_CC}" \
70 --with-build-cpp="${BUILD_CPP}" \
71 --with-build-ld="${BUILD_LD}" \
72 --with-build-cflags='${BUILD_CFLAGS}' \
73 --with-build-cppflags='${BUILD_CPPFLAGS}' \
74 --with-build-ldflags='${BUILD_LDFLAGS}' \
81 oe_runmake -C narrowc libs
82 oe_runmake -C narrowc/progs
84 ! ${ENABLE_WIDEC} || \
85 oe_runmake -C widec libs
88 # set of expected differences between narrowc and widec header
90 # TODO: the NCURSES_CH_T difference can cause real problems :(
91 _unifdef_cleanup = " \
92 -e '\!/\* \$Id: curses.wide,v!,\!/\* \$Id: curses.tail,v!d' \
93 -e '/^#define NCURSES_CH_T /d' \
94 -e '/^#include <wchar.h>/d' \
95 -e '\!^/\* .* \*/!d' \
98 do_test[dirs] = "${S}"
100 ${ENABLE_WIDEC} || return 0
102 # make sure that the narrow and widec header are compatible
103 # and differ only in minor details.
104 unifdef -k narrowc/include/curses.h | \
105 sed ${_unifdef_cleanup} > curses-narrowc.h
106 unifdef -k widec/include/curses.h | \
107 sed ${_unifdef_cleanup} > curses-widec.h
109 diff curses-narrowc.h curses-widec.h
114 PKG_CONFIG_LIBDIR='${libdir}/pkgconfig' \
115 install.libs install.includes install.man \
119 # Order of installation is important; widec installs a 'curses.h'
120 # header with more definitions and must be installed last hence.
121 # Compatibility of these headers will be checked in 'do_test()'.
122 oe_runmake -C narrowc ${_install_opts} \
123 install.data install.progs
125 ! ${ENABLE_WIDEC} || \
126 oe_runmake -C widec ${_install_opts}
131 # include some basic terminfo files
132 # stolen ;) from gentoo and modified a bit
133 for x in ansi console dumb linux rxvt screen screen-256color sun vt52 vt100 vt102 vt200 vt220 xterm-color xterm-xfree86 xterm-256color
135 local termfile="$(find "${D}${datadir}/terminfo/" -name "${x}" 2>/dev/null)"
136 local basedir="$(basename $(dirname "${termfile}"))"
138 if [ -n "${termfile}" ]
140 install -d ${D}${sysconfdir}/terminfo/${basedir}
141 mv ${termfile} ${D}${sysconfdir}/terminfo/${basedir}/
142 ln -s /etc/terminfo/${basedir}/${x} \
143 ${D}${datadir}/terminfo/${basedir}/${x}
146 # i think we can use xterm-color as default xterm
147 #if [ -e ${D}${sysconfdir}/terminfo/x/xterm-color ]
149 # ln -sf xterm-color ${D}${sysconfdir}/terminfo/x/xterm
152 if [ "${PN}" = "ncurses" ]; then
153 mv ${D}${bindir}/clear ${D}${bindir}/clear.${PN}
154 mv ${D}${bindir}/reset ${D}${bindir}/reset.${PN}
158 # create linker scripts for libcurses.so and libncurses to
159 # link against -ltinfo when needed. Some builds might break
160 # else when '-Wl,--no-copy-dt-needed-entries' has been set in
162 for i in libncurses libncursesw; do
163 f=${D}${libdir}/$i.so
164 test -h $f || continue
166 echo '/* GNU ld script */' >$f
167 echo "INPUT($i.so.5 AS_NEEDED(-ltinfo))" >>$f
170 # create libtermcap.so linker script for backward compatibility
171 f=${D}${libdir}/libtermcap.so
172 echo '/* GNU ld script */' >$f
173 echo 'INPUT(AS_NEEDED(-ltinfo))' >>$f
176 #python populate_packages_prepend () {
177 # libdir = bb.data.expand("${libdir}", d)
178 # pnbase = bb.data.expand("${PN}-lib%s", d)
179 # do_split_packages(d, libdir, '^lib(.*)\.so\..*', pnbase, 'ncurses %s library', prepend=True, extra_depends = '', allow_links=True)
183 pkg_postinst_ncurses-tools () {
184 if [ "${PN}" = "ncurses" ]; then
185 update-alternatives --install ${bindir}/clear clear clear.${PN} 100
186 update-alternatives --install ${bindir}/reset reset reset.${PN} 100
190 pkg_prerm_ncurses-tools () {
191 if [ "${PN}" = "ncurses" ]; then
192 update-alternatives --remove clear clear.${PN}
193 update-alternatives --remove reset reset.${PN}
197 BBCLASSEXTEND = "native sdk"
202 # ${PN}-terminfo-base \
210 ${libdir}/lib*.so.* \
212 ${sysconfdir}/terminfo \
215 # This keeps only tput/tset in ncurses
216 # clear/reset are in already busybox
217 FILES_${PN}-tools = "\
220 ${bindir}/infotocap \
221 ${bindir}/captoinfo \
223 ${bindir}/clear.${PN} \
224 ${bindir}/reset.${PN} \
228 # 'reset' is a symlink to 'tset' which is in the 'ncurses' package
229 RDEPENDS_${PN}-tools = "${PN}"
231 FILES_${PN}-terminfo = "\
232 ${datadir}/terminfo \
235 #FILES_${PN}-terminfo-base = "\
236 # ${sysconfdir}/terminfo \
239 RSUGGESTS_${PN}-libtinfo = "${PN}-terminfo"
240 #RRECOMMENDS_${PN}-libtinfo = "${PN}-terminfo-base"