@@ -43,6 +43,32 @@ WIN_CMOCKA_DIR = vendor/cmocka-$(WIN_CMOCKA_VERSION)
43
43
package win32.package package_common utest win32.utest static
44
44
45
45
46
+ define TERMINFO_SCRIPT
47
+ # !/usr/bin/env bash
48
+
49
+ # Script to determine a value for TERMINFO and echo it on stdout
50
+
51
+ declare -r TERMINFO_FALLBACK=/mnt/c/MinGW/lib/terminfo
52
+
53
+ if [[ -n $${TERMINFO} && -d $${TERMINFO}/78 ]]; then
54
+ echo "Modern terminfo database found." >&2
55
+ echo $${TERMINFO}
56
+ else
57
+ echo "WARNING: Terminfo database not found or outdated." >&2
58
+ if [[ -d $${TERMINFO_FALLBACK}/78 ]]; then
59
+ echo "Using $${TERMINFO_FALLBACK} as fallback." >&2
60
+ echo $${TERMINFO_FALLBACK}
61
+ else
62
+ echo "ERROR: Fallback unavailable. " >&2
63
+ echo -n "Find a terminfo database that uses a hashed structure " >&2
64
+ echo "(hexadecimal numbers as directories, not single letters). " >&2
65
+ echo "Set its path in the TERMINFO_FALLBACK variable near the top of the root Makefile." >&2
66
+ exit 1
67
+ fi
68
+ fi
69
+ endef
70
+
71
+
46
72
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
47
73
# Build
48
74
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -124,10 +150,17 @@ vendor/libncurses-$(LIBNCURSES_VERSION).tar.gz: | vendor
124
150
curl -L https://invisible-mirror.net/archives/ncurses/ncurses-$(LIBNCURSES_VERSION ) .tar.gz --output $@
125
151
126
152
$(LIBNCURSES_DIR ) /lib/libncurses.a : vendor/libncurses-$(LIBNCURSES_VERSION ) .tar.gz
153
+ @echo TERMINFO=${TERMINFO}
127
154
tar -C vendor -xzf vendor/libncurses-$(LIBNCURSES_VERSION ) .tar.gz
128
- cd $(LIBNCURSES_DIR ) ; ./configure --enable-static ; $(MAKE )
155
+ cd $(LIBNCURSES_DIR ) ; ./configure --enable-static --enable-termcap; $(MAKE )
156
+
157
+ export TERMINFO_SCRIPT
158
+ $(OUT_DIR ) /terminfo-check.sh : | $(OUT_DIR )
159
+ echo " $$ TERMINFO_SCRIPT" > $@
129
160
130
- static : infomsg replaceinfos $(LIBUNISTRING_DIR ) /lib/.libs/libunistring.a $(PCRE2_DIR ) /.libs/libpcre2-32.a $(LIBNCURSES_DIR ) /lib/libncurses.a
161
+ static : infomsg replaceinfos $(LIBUNISTRING_DIR ) /lib/.libs/libunistring.a $(PCRE2_DIR ) /.libs/libpcre2-32.a $(OUT_DIR ) /terminfo-check.sh
162
+ TERMINFO=` $( OUT_DIR) /terminfo-check.sh` \
163
+ $(MAKE ) LIBNCURSES_DIR=$(LIBNCURSES_DIR ) LIBNCURSES_VERSION=$(LIBNCURSES_VERSION ) $(LIBNCURSES_DIR ) /lib/libncurses.a
131
164
$(MAKE ) -C src BOXES_PLATFORM=static LEX=$(BX_LEX ) YACC=$(BX_YACC ) LIBUNISTRING_DIR=$(LIBUNISTRING_DIR ) \
132
165
PCRE2_DIR =$(PCRE2_DIR ) LIBNCURSES_DIR=$(LIBNCURSES_DIR ) LIBNCURSES_WIN_INCLUDE=$(LIBNCURSES_WIN_INCLUDE ) $@
133
166
0 commit comments