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