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