Skip to content

Commit 61f66a1

Browse files
committed
ncurses: Add support for terminfo database
Along with the termcap database, ncurses will now lookup for the terminfo database, note that the terminfo database is being looked up first and then it fallsback on the termcap one. While here drop our custom reader for the termcap database, over the time it is needed maintenance to be able to catchup with changes on ncurses side. Install the ncurses tools which are needed to deal with the terminfo database: tic, infocmp, toe Replace our termcap only aware tools with the ncurses counterpart: tput, tabs, tset, clear and reset In particular they can your the extra capabilities described in the terminfo database, which does not exist in termcap Note that to add a new terminfo information to the database from ports the ports will just need to add their extra information into: /usr/local/share/site-terminfo/<firstletteroftheterm>/<term> Tested by: jbeich, manu
1 parent 3fd63dd commit 61f66a1

23 files changed

+98
-2486
lines changed

Diff for: lib/ncurses/config.mk

+12-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
# This Makefile is shared by libncurses, libform, libmenu, libpanel.
44

55
NCURSES_DIR= ${SRCTOP}/contrib/ncurses
6+
NCURSES_MAJOR= 6
7+
NCURSES_MINOR= 2
8+
NCURSES_PATCH= 20200215
69

7-
CFLAGS+= -D_XOPEN_SOURCE_EXTENDED -DENABLE_WIDEC
10+
CFLAGS+= -D_XOPEN_SOURCE_EXTENDED
811
NCURSES_CFG_H= ${.CURDIR}/ncurses_cfg.h
912

1013
CFLAGS+= -I.
@@ -41,5 +44,12 @@ MANFILTER= sed -e 's%@TERMINFO@%${TERMINFODIR}/terminfo%g' \
4144
-e 's%@NCURSES_MAJOR@%${NCURSES_MAJOR}%g' \
4245
-e 's%@NCURSES_MINOR@%${NCURSES_MINOR}%g' \
4346
-e 's%@NCURSES_PATCH@%${NCURSES_PATCH}%g' \
47+
-e 's%@TSET@%tset%g' \
48+
-e 's%@RESET@%reset%g' \
49+
-e 's%@CLEAR@%clear%g' \
50+
-e 's%@TABS@%tabs%g' \
4451
-e 's%@TIC@%tic%g' \
45-
-e 's%@INFOCMP@%infocmp%g'
52+
-e 's%@TOE@%toe%g' \
53+
-e 's%@INFOCMP@%infocmp%g' \
54+
-e 's%@CAPTOINFO@%captoinfo%g' \
55+
-e 's%@INFOTOCAP@%infotocap%g'

Diff for: lib/ncurses/ncurses/Makefile

+3-6
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ SRCS+= \
216216
obsolete.c \
217217
parse_entry.c \
218218
read_entry.c \
219+
read_termcap.c \
219220
strings.c \
220221
trim_sgr0.c \
221222
write_entry.c
@@ -270,14 +271,10 @@ DBGSRCS= \
270271
trace_xnames.c \
271272
varargs.c
272273

273-
# From our old libtermcap.
274-
# Used instead of the hideous read_termcap.c abomination.
275-
SRCS+= termcap.c
276-
277274
CLEANFILES= ${GENSRCS} ${GENHDRS} keys.list make_hash term.h.new \
278275
make_keys MKterm.h.awk comp_captab.c curses.head
279276

280-
CFLAGS+= -DFREEBSD_NATIVE -DTERMIOS
277+
CFLAGS+= -DTERMIOS
281278

282279
# Installed
283280
HEADERS= curses.h term.h termcap.h unctrl.h
@@ -416,7 +413,7 @@ make_hash: make_hash.c hashsize.h ncurses_def.h ${HEADERS} ${BUILD_TOOLS_META}
416413
MKterm.h.awk: MKterm.h.awk.in
417414
sed <${NCURSES_DIR}/include/MKterm.h.awk.in >$@ \
418415
-e "/@BROKEN_LINKER@/s%%${BROKEN_LINKER}%" \
419-
-e "s%@NCURSES_USE_DATABASE@%0%g" \
416+
-e "s%@NCURSES_USE_DATABASE@%1%g" \
420417
-e "s%@NCURSES_USE_TERMCAP@%1%g" \
421418
-e "/@NCURSES_MAJOR@/s%%${NCURSES_MAJOR}%" \
422419
-e "/@NCURSES_MINOR@/s%%${NCURSES_MINOR}%" \

Diff for: lib/ncurses/ncurses/ncurses_cfg.h

+31-32
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
#define HAVE_LONG_FILE_NAMES 1
6060
#define MIXEDCASE_FILENAMES 1
6161
#define USE_SYSMOUSE 1
62+
#define TERMINFO_DIRS "/usr/share/terminfo:/usr/local/share/site-terminfo"
63+
#define TERMINFO "/usr/share/terminfo"
6264
#define HAVE_BIG_CORE 1
6365
#define TERMPATH "/etc/termcap:/usr/share/misc/termcap"
6466
#define USE_GETCAP 1
@@ -70,6 +72,23 @@
7072
#define USE_LINKS 1
7173
#define BSD_TPUTS 1
7274
#define HAVE_LANGINFO_CODESET 1
75+
#define USE_WIDEC_SUPPORT 1
76+
#define NCURSES_WIDECHAR 1
77+
#define HAVE_WCHAR_H 1
78+
#define HAVE_WCTYPE_H 1
79+
#define HAVE_PUTWC 1
80+
#define HAVE_BTOWC 1
81+
#define HAVE_WCTOB 1
82+
#define HAVE_MBTOWC 1
83+
#define HAVE_WCTOMB 1
84+
#define HAVE_MBLEN 1
85+
#define HAVE_MBRLEN 1
86+
#define HAVE_MBRTOWC 1
87+
#define HAVE_WCSRTOMBS 1
88+
#define HAVE_MBSRTOWCS 1
89+
#define HAVE_WCSTOMBS 1
90+
#define HAVE_MBSTOWCS 1
91+
#define NEED_WCHAR_H 1
7392
#define HAVE_FSEEKO 1
7493
#define STDC_HEADERS 1
7594
#define HAVE_SYS_TYPES_H 1
@@ -96,6 +115,10 @@
96115
#define HAVE_WRESIZE 1
97116
#define NCURSES_SP_FUNCS 1
98117
#define HAVE_TPUTS_SP 1
118+
#define NCURSES_EXT_COLORS 1
119+
#define HAVE_ALLOC_PAIR 1
120+
#define HAVE_INIT_EXTENDED_COLOR 1
121+
#define HAVE_RESET_COLOR_PAIRS 1
99122
#define NCURSES_EXT_PUTWIN 1
100123
#define NCURSES_NO_PADDING 1
101124
#define USE_SIGWINCH 1
@@ -133,6 +156,11 @@
133156
#define HAVE_UNISTD_H 1
134157
#define HAVE_GETOPT_H 1
135158
#define HAVE_GETOPT_HEADER 1
159+
#define DECL_ENVIRON 1
160+
#define HAVE_ENVIRON 1
161+
#define HAVE_PUTENV 1
162+
#define HAVE_SETENV 1
163+
#define HAVE_STRDUP 1
136164
#define HAVE_SYS_TIME_SELECT 1
137165
#define SIG_ATOMIC_T volatile sig_atomic_t
138166
#define HAVE_ERRNO 1
@@ -153,6 +181,7 @@
153181
#define HAVE_SETVBUF 1
154182
#define HAVE_SIGACTION 1
155183
#define HAVE_SIGVEC 1
184+
#define HAVE_SNPRINTF 1
156185
#define HAVE_STRDUP 1
157186
#define HAVE_STRSTR 1
158187
#define HAVE_SYSCONF 1
@@ -181,11 +210,12 @@
181210
#define USE_FOPEN_BIN_R 1
182211
#define USE_OPENPTY_HEADER <libutil.h>
183212
#define USE_XTERM_PTY 1
184-
#define USE_HASHED_DB 1
185213
#define HAVE_TYPEINFO 1
186214
#define HAVE_IOSTREAM 1
187215
#define IOSTREAM_NAMESPACE 1
216+
#define SIZEOF_BOOL 1
188217
#define CPP_HAS_STATIC_CAST 1
218+
#define SIZEOF_WCHAR_T 4
189219
#define HAVE_SLK_COLOR 1
190220
#define HAVE_PANEL_H 1
191221
#define HAVE_LIBPANEL 1
@@ -198,37 +228,6 @@
198228
#define NCURSES_OSPEED_COMPAT 1
199229
#define HAVE_CURSES_DATA_BOOLNAMES 1
200230

201-
/*
202-
* Begin FreeBSD-specific changes
203-
*/
204-
/* Support ENABLE_WIDEC */
205-
#ifdef ENABLE_WIDEC
206-
#define USE_WIDEC_SUPPORT 1
207-
#define NCURSES_WIDECHAR 1
208-
#define NCURSES_EXT_FUNCS 1
209-
#define NCURSES_EXT_COLORS 1
210-
#define HAVE_ALLOC_PAIR 1
211-
#define HAVE_INIT_EXTENDED_COLOR 1
212-
#define HAVE_RESET_COLOR_PAIRS 1
213-
#define HAVE_PUTWC 1
214-
#define HAVE_BTOWC 1
215-
#define HAVE_WCTOB 1
216-
#define HAVE_MBTOWC 1
217-
#define HAVE_WCTOMB 1
218-
#define HAVE_MBLEN 1
219-
#define HAVE_MBRLEN 1
220-
#define HAVE_MBRTOWC 1
221-
#define HAVE_WCSRTOMBS 1
222-
#define HAVE_MBSRTOWCS 1
223-
#define HAVE_WCSTOMBS 1
224-
#define HAVE_MBSTOWCS 1
225-
#define NEED_WCHAR_H 1
226-
#define SIZEOF_WCHAR_T 4
227-
#endif
228-
/*
229-
* End FreeBSD-specific changes
230-
*/
231-
232231
#include <ncurses_def.h>
233232

234233
/* The C compiler may not treat these properly but C++ has to */

0 commit comments

Comments
 (0)