aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/slang/slang/terminfo_fixes.patch
blob: 3e6d15aa79ee734c5ff0caec1eb64343563a2709 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
Do not use the JD_TERMCAP macro since we cannot get the terminfo from
ncurses pkg-config, but fix the macro to not reference host directories.
Also add src/test/Makefile.in so that we can use -ltermcap if we want to.

Upstream-Status: Pending

Signed-off-by: Joe Slater <joe.slater@windriver.com>


--- a/autoconf/aclocal.m4
+++ b/autoconf/aclocal.m4
@@ -506,14 +506,10 @@ then
 else
    MISC_TERMINFO_DIRS=""
 fi
-JD_Terminfo_Dirs="$MISC_TERMINFO_DIRS \
-                  /usr/lib/terminfo \
-                  /usr/share/terminfo \
-                  /usr/share/lib/terminfo \
-		  /usr/local/lib/terminfo"
+
 TERMCAP=-ltermcap
 
-for terminfo_dir in $JD_Terminfo_Dirs
+for terminfo_dir in $MISC_TERMINFO_DIRS
 do
    if test -d $terminfo_dir
    then
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -249,7 +249,14 @@ AC_CHECK_SIZEOF(size_t)
 JD_CHECK_LONG_LONG
 JD_LARGE_FILE_SUPPORT
 
-JD_TERMCAP
+dnl Do not use JD_TERMCAP, since we cannot get terminfo from ncurses*-config anymore.
+dnl Set TERMCAP=-ltermcap and AC_DEFINE(USE_TERMCAP,1,[Define to use termcap])
+dnl to use libtermcap.
+TERMCAP=""
+MISC_TERMINFO_DIRS=""
+AC_SUBST(TERMCAP)dnl
+AC_SUBST(MISC_TERMINFO_DIRS)dnl
+
 JD_GCC_WARNINGS
 
 JD_SET_OBJ_SRC_DIR(src)
@@ -364,7 +371,7 @@ AC_CONFIG_HEADER(src/sysconf.h:src/confi
 dnl AC_CONFIG_SUBDIRS(demo)
 
 AC_OUTPUT(Makefile:autoconf/Makefile.in \
-  src/Makefile slsh/Makefile modules/Makefile demo/Makefile \
+  src/Makefile src/test/Makefile slsh/Makefile modules/Makefile demo/Makefile \
   slang.pc:autoconf/slangpc.in \
 )
 
--- /dev/null
+++ b/src/test/Makefile.in
@@ -0,0 +1,90 @@
+# -*- make -*-
+TEST_SCRIPTS_SLC = argv syntax scircuit eqs sscanf loops arith array strops \
+  bstring pack stdio assoc selfload struct nspace path ifeval anytype arrmult \
+  time utf8 except bugs list regexp method deref naninf overflow sort \
+  longlong signal dollar req docfun debug qualif compare break multline \
+  stack misc posixio posdir proc math
+
+TEST_SCRIPTS_NO_SLC = autoload nspace2 prep
+
+TEST_SCRIPTS = $(TEST_SCRIPTS_SLC) $(TEST_SCRIPTS_NO_SLC)
+
+TEST_PGM = sltest
+MEMCHECK = valgrind --tool=memcheck --leak-check=yes --leak-resolution=med --num-callers=20
+RUN_TEST_PGM = ./$(TEST_PGM)
+SLANGINC = ..
+SLANGLIB = ../$(ARCH)objs
+OTHER_LIBS = -lm @TERMCAP@
+OTHER_CFLAGS =
+
+runtests: $(TEST_PGM) cleantmp
+	@tests=""; \
+	for test in $(TEST_SCRIPTS); \
+	do \
+	   tests="$$tests $$test.sl"; \
+	done; \
+	for test in $(TEST_SCRIPTS_SLC); \
+	do \
+	   tests="$$tests $$test.slc"; \
+	done; \
+	MAKERUNNING=1 ./runtests.sh $$tests
+#	@touch $(TEST_PGM).c
+
+update: $(TEST_PGM) cleantmp
+	@tests=""; \
+	for X in $(TEST_SCRIPTS); \
+	do \
+	  if [ ! -e lastrun/$$X.sl ] || [ $$X.sl -nt lastrun/$$X.sl ] ; \
+	  then \
+	   tests="$$tests $$X.sl"; \
+	  fi \
+	done; \
+	for X in $(TEST_SCRIPTS_SLC); \
+	do \
+	  if [ ! -e lastrun/$$X.slc ] || [ $$X.sl -nt lastrun/$$X.slc ] ; \
+	  then \
+	   tests="$$tests $$X.slc"; \
+	  fi \
+	done; \
+	if test -n "$$tests"; \
+	then \
+	  MAKERUNNING=1 ./runtests.sh $$tests; \
+	fi
+#	@touch $(TEST_PGM).c
+
+memcheck_runtests: $(TEST_PGM) cleantmp
+	@echo ""
+	@echo "Running tests:"
+	@echo ""
+	-@for X in $(TEST_SCRIPTS); \
+	do \
+	   $(MEMCHECK) --log-file=log.$${X} $(RUN_TEST_PGM) $$X.sl; \
+	   grep ERROR log.$${X}; grep 'lost: [^0]' log.$${X}; \
+	   $(MEMCHECK) --log-file=log.$${X}_u $(RUN_TEST_PGM) -utf8 $$X.sl; \
+	   grep ERROR log.$${X}_u; grep 'lost: [^0]' log.$${X}_u; \
+	done
+#	touch $(TEST_PGM).c
+
+memcheck_runtests_slc: $(TEST_PGM) cleantmp
+	@echo ""
+	@echo "Running tests:"
+	@echo ""
+	-@for X in $(TEST_SCRIPTS_SLC); \
+	do \
+	   $(MEMCHECK) --log-file=log.$${X}_c $(RUN_TEST_PGM) $$X.slc; \
+	   $(MEMCHECK) --log-file=log.$${X}_uc $(RUN_TEST_PGM) -utf8 $$X.slc; \
+	done
+#	touch $(TEST_PGM).c
+
+memcheck: memcheck_runtests memcheck_runtests_slc
+
+$(TEST_PGM): $(TEST_PGM).c assoc.c list.c $(SLANGLIB)/libslang.a
+	$(CC) $(CFLAGS) $(OTHER_CFLAGS) $(LDFLAGS) $(TEST_PGM).c -o $(TEST_PGM) -I$(SLANGINC) -L$(SLANGLIB) -lslang $(OTHER_LIBS)
+cleantmp:
+	-/bin/rm -rf tmpfile*.* tmpdir*.*
+clean: cleantmp
+	-/bin/rm -f *~ *.o *.log log.pid* *.slc log.* *.log-*
+distclean: clean
+	/bin/rm -f $(TEST_PGM) $(TEST_PGM).gcda $(TEST_PGM).gcno
+.PHONY: clean memcheck runtests memcheck_runtests_slc memcheck_runtests cleantmp
+