Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | SUMMARY = "The New Curses library" |
| 2 | DESCRIPTION = "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." |
| 3 | HOMEPAGE = "http://www.gnu.org/software/ncurses/ncurses.html" |
| 4 | LICENSE = "MIT" |
| 5 | LIC_FILES_CHKSUM = "file://ncurses/base/version.c;beginline=1;endline=27;md5=cbc180a8c44ca642e97c35452fab5f66" |
| 6 | SECTION = "libs" |
| 7 | DEPENDS = "ncurses-native" |
| 8 | DEPENDS_class-native = "" |
| 9 | INC_PR = "r15" |
| 10 | |
| 11 | BINCONFIG = "${bindir}/ncurses-config" |
| 12 | |
| 13 | inherit autotools binconfig-disabled multilib_header pkgconfig |
| 14 | |
| 15 | # Upstream has useful patches at times at ftp://invisible-island.net/ncurses/ |
| 16 | SRC_URI = "ftp://invisible-island.net/${BPN}/current/${BP}-${REVISION}.tgz" |
| 17 | |
| 18 | EXTRA_AUTORECONF = "-I m4" |
| 19 | CONFIG_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? |
| 24 | ENABLE_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. |
| 29 | BUILD_CPPFLAGS += "-D_GNU_SOURCE" |
| 30 | |
| 31 | # natives don't generally look in base_libdir |
| 32 | base_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. |
| 37 | EXCONFIG_ARGS = "" |
| 38 | EXCONFIG_ARGS_class-native = " \ |
| 39 | --disable-lp64 \ |
| 40 | --with-chtype='long' \ |
| 41 | --with-mmask-t='long'" |
| 42 | EXCONFIG_ARGS_class-nativesdk = " \ |
| 43 | --disable-lp64 \ |
| 44 | --with-chtype='long' \ |
| 45 | --with-mmask-t='long'" |
| 46 | |
| 47 | PACKAGES_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. |
| 54 | EX_TERMCAP = "" |
| 55 | EX_TERMCAP_class-native = ":/etc/termcap:/usr/share/misc/termcap" |
| 56 | EX_TERMCAP_class-nativesdk = ":/etc/termcap:/usr/share/misc/termcap" |
| 57 | EX_TERMINFO = "" |
| 58 | EX_TERMINFO_class-native = ":/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo" |
| 59 | EX_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 |
| 64 | ncurses_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. |
| 95 | do_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 | #Remove ${includedir} from CPPFLAGS, need for cross compile |
| 101 | sed -i 's#-I${cf_includedir}##g' ${S}/configure || die "sed CPPFLAGS" |
| 102 | |
| 103 | # The --enable-pc-files requires PKG_CONFIG_LIBDIR existed |
| 104 | mkdir -p ${PKG_CONFIG_LIBDIR} |
| 105 | ( cd ${S}; gnu-configize --force ) |
| 106 | ncurses_configure "narrowc" || \ |
| 107 | return 1 |
| 108 | ! ${ENABLE_WIDEC} || \ |
| 109 | ncurses_configure "widec" "--enable-widec" "--without-progs" |
| 110 | |
| 111 | } |
| 112 | |
| 113 | do_compile() { |
| 114 | oe_runmake -C narrowc libs |
| 115 | oe_runmake -C narrowc/progs |
| 116 | |
| 117 | ! ${ENABLE_WIDEC} || \ |
| 118 | oe_runmake -C widec libs |
| 119 | } |
| 120 | |
| 121 | # set of expected differences between narrowc and widec header |
| 122 | # |
| 123 | # TODO: the NCURSES_CH_T difference can cause real problems :( |
| 124 | _unifdef_cleanup = " \ |
| 125 | -e '\!/\* \$Id: curses.wide,v!,\!/\* \$Id: curses.tail,v!d' \ |
| 126 | -e '/^#define NCURSES_CH_T /d' \ |
| 127 | -e '/^#include <wchar.h>/d' \ |
| 128 | -e '\!^/\* .* \*/!d' \ |
| 129 | " |
| 130 | |
| 131 | do_test[depends] = "unifdef-native:do_populate_sysroot" |
| 132 | do_test[dirs] = "${S}" |
| 133 | do_test() { |
| 134 | ${ENABLE_WIDEC} || return 0 |
| 135 | |
| 136 | # make sure that the narrow and widec header are compatible |
| 137 | # and differ only in minor details. |
| 138 | unifdef -k narrowc/include/curses.h | \ |
| 139 | sed ${_unifdef_cleanup} > curses-narrowc.h |
| 140 | unifdef -k widec/include/curses.h | \ |
| 141 | sed ${_unifdef_cleanup} > curses-widec.h |
| 142 | |
| 143 | diff curses-narrowc.h curses-widec.h |
| 144 | } |
| 145 | |
| 146 | # Split original _install_opts to two parts. |
| 147 | # One is the options to install contents, the other is the parameters \ |
| 148 | # when running command "make install" |
| 149 | _install_opts = "\ |
| 150 | install.libs install.includes install.man \ |
| 151 | " |
| 152 | _install_cfgs = "\ |
| 153 | DESTDIR='${D}' \ |
| 154 | PKG_CONFIG_LIBDIR='${libdir}/pkgconfig' \ |
| 155 | " |
| 156 | |
| 157 | do_install() { |
| 158 | # Order of installation is important; widec installs a 'curses.h' |
| 159 | # header with more definitions and must be installed last hence. |
| 160 | # Compatibility of these headers will be checked in 'do_test()'. |
| 161 | oe_runmake -C narrowc ${_install_cfgs} ${_install_opts} \ |
| 162 | install.progs |
| 163 | |
| 164 | # The install.data should run after install.libs, otherwise |
| 165 | # there would be a race issue in a very critical conditon, since |
| 166 | # tic will be run by install.data, and tic needs libtinfo.so |
| 167 | # which would be regenerated by install.libs. |
| 168 | oe_runmake -C narrowc ${_install_cfgs} \ |
| 169 | install.data |
| 170 | |
| 171 | |
| 172 | ! ${ENABLE_WIDEC} || \ |
| 173 | oe_runmake -C widec ${_install_cfgs} ${_install_opts} |
| 174 | |
| 175 | cd narrowc |
| 176 | |
| 177 | # include some basic terminfo files |
| 178 | # stolen ;) from gentoo and modified a bit |
| 179 | for x in ansi console dumb linux rxvt screen screen-256color sun vt52 vt100 vt102 vt200 vt220 xterm-color xterm-xfree86 xterm-256color |
| 180 | do |
| 181 | local termfile="$(find "${D}${datadir}/terminfo/" -name "${x}" 2>/dev/null)" |
| 182 | local basedir="$(basename $(dirname "${termfile}"))" |
| 183 | |
| 184 | if [ -n "${termfile}" ] |
| 185 | then |
| 186 | install -d ${D}${sysconfdir}/terminfo/${basedir} |
| 187 | mv ${termfile} ${D}${sysconfdir}/terminfo/${basedir}/ |
| 188 | ln -s /etc/terminfo/${basedir}/${x} \ |
| 189 | ${D}${datadir}/terminfo/${basedir}/${x} |
| 190 | fi |
| 191 | done |
| 192 | # i think we can use xterm-color as default xterm |
| 193 | if [ -e ${D}${sysconfdir}/terminfo/x/xterm-color ] |
| 194 | then |
| 195 | ln -sf xterm-color ${D}${sysconfdir}/terminfo/x/xterm |
| 196 | fi |
| 197 | |
| 198 | rm -f ${D}${libdir}/terminfo |
| 199 | |
| 200 | # create linker scripts for libcurses.so and libncurses to |
| 201 | # link against -ltinfo when needed. Some builds might break |
| 202 | # else when '-Wl,--no-copy-dt-needed-entries' has been set in |
| 203 | # linker flags. |
| 204 | for i in libncurses libncursesw; do |
| 205 | f=${D}${libdir}/$i.so |
| 206 | test -h $f || continue |
| 207 | rm -f $f |
| 208 | echo '/* GNU ld script */' >$f |
| 209 | echo "INPUT($i.so.5 AS_NEEDED(-ltinfo))" >>$f |
| 210 | done |
| 211 | |
| 212 | # Make sure that libcurses is linked so that it gets -ltinfo |
| 213 | # also, this should be addressed upstream really. |
| 214 | ln -sf libncurses.so ${D}${libdir}/libcurses.so |
| 215 | |
| 216 | # create libtermcap.so linker script for backward compatibility |
| 217 | f=${D}${libdir}/libtermcap.so |
| 218 | echo '/* GNU ld script */' >$f |
| 219 | echo 'INPUT(AS_NEEDED(-ltinfo))' >>$f |
| 220 | |
| 221 | if [ ! -d "${D}${base_libdir}" ]; then |
| 222 | # Setting base_libdir to libdir as is done in the -native |
| 223 | # case will skip this code |
| 224 | mkdir ${D}${base_libdir} |
| 225 | mv ${D}${libdir}/libncurses.so.* ${D}${base_libdir} |
| 226 | ! ${ENABLE_WIDEC} || \ |
| 227 | mv ${D}${libdir}/libncursesw.so.* ${D}${base_libdir} |
| 228 | |
| 229 | mv ${D}${libdir}/libtinfo.so.* ${D}${base_libdir} |
| 230 | rm ${D}${libdir}/libtinfo.so |
| 231 | |
| 232 | # Use lnr to ensure this is a relative link despite absolute paths |
| 233 | # (as we can't know the relationship between base_libdir and libdir). |
| 234 | # At some point we can rely on coreutils 8.16 which has ln -r. |
| 235 | lnr ${D}${base_libdir}/libtinfo.so.5 ${D}${libdir}/libtinfo.so |
| 236 | fi |
| 237 | if [ -d "${D}${includedir}/ncurses" ]; then |
| 238 | for f in `find ${D}${includedir}/ncurses -name "*.h"` |
| 239 | do |
| 240 | f=`basename $f` |
| 241 | test -e ${D}${includedir}/$f && continue |
| 242 | ln -sf ncurses/$f ${D}${includedir}/$f |
| 243 | done |
| 244 | fi |
| 245 | oe_multilib_header curses.h |
| 246 | } |
| 247 | |
| 248 | python populate_packages_prepend () { |
| 249 | libdir = d.expand("${libdir}") |
| 250 | base_libdir = d.expand("${base_libdir}") |
| 251 | pnbase = d.expand("${PN}-lib%s") |
| 252 | do_split_packages(d, libdir, '^lib(.*)\.so\..*', pnbase, 'ncurses %s library', prepend=True, extra_depends = '', allow_links=True) |
| 253 | if libdir is not base_libdir: |
| 254 | do_split_packages(d, base_libdir, '^lib(.*)\.so\..*', pnbase, 'ncurses %s library', prepend=True, extra_depends = '', allow_links=True) |
| 255 | } |
| 256 | |
| 257 | |
| 258 | inherit update-alternatives |
| 259 | |
| 260 | ALTERNATIVE_PRIORITY = "100" |
| 261 | |
| 262 | ALTERNATIVE_ncurses-tools_class-target = "clear reset" |
| 263 | |
| 264 | BBCLASSEXTEND = "native nativesdk" |
| 265 | |
| 266 | PACKAGES += " \ |
| 267 | ${PN}-tools \ |
| 268 | ${PN}-terminfo \ |
| 269 | ${PN}-terminfo-base \ |
| 270 | " |
| 271 | |
| 272 | FILES_${PN} = "\ |
| 273 | ${bindir}/tput \ |
| 274 | ${bindir}/tset \ |
| 275 | ${bindir}/ncurses5-config \ |
| 276 | ${bindir}/ncursesw5-config \ |
| 277 | ${datadir}/tabset \ |
| 278 | " |
| 279 | |
| 280 | # This keeps only tput/tset in ncurses |
| 281 | # clear/reset are in already busybox |
| 282 | FILES_${PN}-tools = "\ |
| 283 | ${bindir}/tic \ |
| 284 | ${bindir}/toe \ |
| 285 | ${bindir}/infotocap \ |
| 286 | ${bindir}/captoinfo \ |
| 287 | ${bindir}/infocmp \ |
| 288 | ${bindir}/clear${@['', '.${BPN\x7d']['${CLASSOVERRIDE}' == 'class-target']} \ |
| 289 | ${bindir}/reset${@['', '.${BPN\x7d']['${CLASSOVERRIDE}' == 'class-target']} \ |
| 290 | ${bindir}/tack \ |
| 291 | ${bindir}/tabs \ |
| 292 | " |
| 293 | |
| 294 | # 'reset' is a symlink to 'tset' which is in the 'ncurses' package |
| 295 | RDEPENDS_${PN}-tools = "${PN}" |
| 296 | |
| 297 | FILES_${PN}-terminfo = "\ |
| 298 | ${datadir}/terminfo \ |
| 299 | " |
| 300 | |
| 301 | FILES_${PN}-terminfo-base = "\ |
| 302 | ${sysconfdir}/terminfo \ |
| 303 | " |
| 304 | |
| 305 | RSUGGESTS_${PN}-libtinfo = "${PN}-terminfo" |
| 306 | RRECOMMENDS_${PN}-libtinfo = "${PN}-terminfo-base" |