From e58fe232ef1630414daa21da3ddc3464f90c4e17 Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Fri, 5 Nov 2010 10:45:06 -0400 Subject: termcap: add 2.0.8 with gentoo patchset No one should really be using this, but what the heck. Signed-off-by: Chris Larson --- .../termcap-2.0.8/001_all_termcap-shared.patch | 11 ++ .../termcap-2.0.8/002_all_termcap-setuid.patch | 43 +++++++ .../003_all_termcap-inst-no-root.patch | 34 ++++++ .../004_all_termcap-compat-glibc21.patch | 28 +++++ .../termcap-2.0.8/005_all_termcap-xref.patch | 11 ++ .../termcap-2.0.8/006_all_termcap-fix-tc.patch | 131 +++++++++++++++++++++ .../termcap-2.0.8/007_all_termcap-ignore-p.patch | 13 ++ .../termcap-2.0.8/008_all_termcap-buffer.patch | 13 ++ .../009_all_termcap-bufsize--needs-011.patch | 22 ++++ .../termcap-2.0.8/010_all_termcap-colon.patch | 11 ++ .../termcap-2.0.8/011_all_termcap-AAARGH.patch | 57 +++++++++ .../012_all_libtermcap-compat-2.0.8-fPIC.patch | 29 +++++ .../013_all_libtermcap-compat_bcopy_fix.patch | 14 +++ recipes/termcap/termcap_1.3.1.bb | 5 +- recipes/termcap/termcap_2.0.8.bb | 41 +++++++ 15 files changed, 461 insertions(+), 2 deletions(-) create mode 100644 recipes/termcap/termcap-2.0.8/001_all_termcap-shared.patch create mode 100644 recipes/termcap/termcap-2.0.8/002_all_termcap-setuid.patch create mode 100644 recipes/termcap/termcap-2.0.8/003_all_termcap-inst-no-root.patch create mode 100644 recipes/termcap/termcap-2.0.8/004_all_termcap-compat-glibc21.patch create mode 100644 recipes/termcap/termcap-2.0.8/005_all_termcap-xref.patch create mode 100644 recipes/termcap/termcap-2.0.8/006_all_termcap-fix-tc.patch create mode 100644 recipes/termcap/termcap-2.0.8/007_all_termcap-ignore-p.patch create mode 100644 recipes/termcap/termcap-2.0.8/008_all_termcap-buffer.patch create mode 100644 recipes/termcap/termcap-2.0.8/009_all_termcap-bufsize--needs-011.patch create mode 100644 recipes/termcap/termcap-2.0.8/010_all_termcap-colon.patch create mode 100644 recipes/termcap/termcap-2.0.8/011_all_termcap-AAARGH.patch create mode 100644 recipes/termcap/termcap-2.0.8/012_all_libtermcap-compat-2.0.8-fPIC.patch create mode 100644 recipes/termcap/termcap-2.0.8/013_all_libtermcap-compat_bcopy_fix.patch create mode 100644 recipes/termcap/termcap_2.0.8.bb (limited to 'recipes/termcap') diff --git a/recipes/termcap/termcap-2.0.8/001_all_termcap-shared.patch b/recipes/termcap/termcap-2.0.8/001_all_termcap-shared.patch new file mode 100644 index 0000000000..08e7938cf6 --- /dev/null +++ b/recipes/termcap/termcap-2.0.8/001_all_termcap-shared.patch @@ -0,0 +1,11 @@ +--- termcap-2.0.8/Makefile.ewt ++++ termcap-2.0.8/Makefile +@@ -41,7 +41,7 @@ + + $(SHARED_LIB): $(OBJS) + cd pic; \ +- $(CC) -shared -o ../$@ -Wl,-soname,$(SONAME_SHARED_LIB) $(OBJS) ++ $(CC) -shared -o ../$@ -Wl,-soname,$(SONAME_SHARED_LIB) $(OBJS) -lc + + pic: + -if [ ! -d pic ]; then mkdir pic; fi diff --git a/recipes/termcap/termcap-2.0.8/002_all_termcap-setuid.patch b/recipes/termcap/termcap-2.0.8/002_all_termcap-setuid.patch new file mode 100644 index 0000000000..d881dae6c8 --- /dev/null +++ b/recipes/termcap/termcap-2.0.8/002_all_termcap-setuid.patch @@ -0,0 +1,43 @@ +--- termcap-2.0.8/termcap.c~ ++++ termcap-2.0.8/termcap.c +@@ -339,13 +339,17 @@ + struct tc_ent *l = NULL; + int first = 1; + int loop = 0; ++ int tc_set = 0; + + *tcp = NULL; + + /* See if we have a TERMCAP environment variable. */ + if ((tc = getenv("TERMCAP")) != NULL) { + if (*tc == '/') ++ { + tc_file = tc; ++ tc_set=1; ++ } + else { + /* check if TERMCAP is term */ + if (tc_comp(tc, term)) { +@@ -366,8 +370,21 @@ + printf("Using file %s\n", tc_file); + #endif + ++ if(tc_set) ++ { ++ setfsuid(getuid()); ++ setfsgid(getgid()); ++ } + /* Now read the termcap file. */ +- if ((fp = fopen(tc_file, "r")) == NULL) return(NULL); ++ fp = fopen(tc_file, "r"); ++ ++ if(tc_set) ++ { ++ setfsuid(geteuid()); ++ setfsgid(getegid()); ++ } ++ if (fp == NULL) ++ return(NULL); + + while(term) { + if (++loop > 16) { diff --git a/recipes/termcap/termcap-2.0.8/003_all_termcap-inst-no-root.patch b/recipes/termcap/termcap-2.0.8/003_all_termcap-inst-no-root.patch new file mode 100644 index 0000000000..81d2710f8f --- /dev/null +++ b/recipes/termcap/termcap-2.0.8/003_all_termcap-inst-no-root.patch @@ -0,0 +1,34 @@ +--- termcap-2.0.8/Makefile.nochown ++++ termcap-2.0.8/Makefile +@@ -53,11 +53,7 @@ + $(prefix)/lib/backup/$(SHARED_LIB).$$$$; \ + fi + cp $(SHARED_LIB) $(prefix)/lib +- chown $(OWNER) $(prefix)/lib/$(SHARED_LIB) +- if [ -x /sbin/ldconfig -o -x /etc/ldconfig ]; then \ +- ldconfig; \ +- fi + -if [ $(prefix) = "/" ]; then \ + cp -f $(STATIC_LIB) /usr/lib; \ + rm -f /lib/libtermcap.so; \ + rm -f /usr/lib/libtermcap.so; \ +@@ -75,10 +74,6 @@ + ln -s $(prefix)/lib/$(SHARED_LIB) \ + $(prefix)/lib/libtermcap.so; \ + cp -f termcap.h $(prefix)/include; \ +- chown $(OWNER) \ +- $(prefix)/lib/$(STATIC_LIB) \ +- $(prefix)/lib/libtermcap.so \ +- $(prefix)/include/termcap.h; \ + fi + + install-dirs: +@@ -89,7 +84,7 @@ + install-data: + -if [ $(prefix) = "/" ]; then \ + cp termcap.src /etc/termcap; \ +- chown $(OWNER) /etc/termcap; \ ++ #chown $(OWNER) /etc/termcap; \ + fi + + info: termcap.info diff --git a/recipes/termcap/termcap-2.0.8/004_all_termcap-compat-glibc21.patch b/recipes/termcap/termcap-2.0.8/004_all_termcap-compat-glibc21.patch new file mode 100644 index 0000000000..6d10125bb7 --- /dev/null +++ b/recipes/termcap/termcap-2.0.8/004_all_termcap-compat-glibc21.patch @@ -0,0 +1,28 @@ +--- termcap-2.0.8/termcap.h.compat21 ++++ termcap-2.0.8/termcap.h +@@ -34,7 +34,11 @@ + + __BEGIN_DECLS + ++#if defined(__PMT) /* XXX glibc-2.1 wants this */ ++typedef int (*outfuntype) __PMT((int)); ++#else + typedef int (*outfuntype) __P((int)); ++#endif + + extern int tgetent __P((void *__buffer, __const char *__termtype)); + extern int tgetflag __P((__const char *__name)); +@@ -44,8 +48,14 @@ + int __vpos)); + extern char *tparam __P((__const char *__ctlstring, void *__buffer, + int __size, ...)); ++ ++#if defined(__PMT) /* XXX glibc-2.1 wants this */ ++extern void tputs __P((__const char *__string, int __nlines, ++ int (*) __PMT((int)))); ++#else + extern void tputs __P((__const char *__string, int __nlines, + int (*) __P((int)))); ++#endif + + __END_DECLS diff --git a/recipes/termcap/termcap-2.0.8/005_all_termcap-xref.patch b/recipes/termcap/termcap-2.0.8/005_all_termcap-xref.patch new file mode 100644 index 0000000000..13de136ae4 --- /dev/null +++ b/recipes/termcap/termcap-2.0.8/005_all_termcap-xref.patch @@ -0,0 +1,11 @@ +--- termcap-2.0.8/termcap.texi~ ++++ termcap-2.0.8/termcap.texi +@@ -2612,7 +2612,7 @@ + @samp{so} magic cookie on the screen. (It may also be possible to remove a + cookie which is not at the beginning of a line by clearing that line.) The + @samp{xt} capability also has implications for the use of tab characters, +-but in that regard it is obsolete (@xref{Cursor Motion}). ++but in that regard it is obsolete (@xref{Cursor Motion}. ). + + @table @samp + @item so diff --git a/recipes/termcap/termcap-2.0.8/006_all_termcap-fix-tc.patch b/recipes/termcap/termcap-2.0.8/006_all_termcap-fix-tc.patch new file mode 100644 index 0000000000..ce61286d3a --- /dev/null +++ b/recipes/termcap/termcap-2.0.8/006_all_termcap-fix-tc.patch @@ -0,0 +1,131 @@ +--- termcap-2.0.8-clean/termcap.c ++++ termcap-2.0.8/termcap.c +@@ -26,6 +26,9 @@ + #include + #include + ++/* Maximum terminal type includes (tc=) */ ++#define MAX_TERMS 16 ++ + /* Escape sequences we know about. */ + static char *escapes = "E\033r\rn\nb\bt\tf\f\\\\"; + +@@ -71,6 +74,28 @@ + return(x); + } + ++/* Add a copy of a string to the end of a list */ ++static int add_to_list(char **list, char *s, int max_entries) ++{ ++ int i; ++ int done = 0; ++ ++ if (! list) ++ return(0); ++ ++ for(i = 0; i < max_entries; i++) ++ if (list[i] == NULL) { ++ list[i] = strsave (s); ++ list[i + 1] = NULL; ++ done = 1; ++ break; ++ } else if (strcmp (s, list[i]) == 0) { ++ done = 1; ++ break; ++ } ++ return(done); ++} ++ + /* + * Try to shrink a capability. + */ +@@ -120,12 +145,11 @@ + } + + /* Build a linked list with capabilities. */ +-static char *build_list(struct tc_ent **listp, char *buf) ++static void build_list(struct tc_ent **listp, char *buf, char **term_list) + { + struct tc_ent *i, *last = NULL, *list = *listp; + char *s, *sp, *bp; + int len; +- char *tc_next = NULL; + + /* Skip name field. */ + for(sp = buf; *sp && *sp != ':'; sp++) +@@ -148,8 +172,8 @@ + if (*bp == 0 || *bp == ':' || *bp == '.') continue; + + /* Is this the "tc" capability? */ +- if (!tc_next && strncmp(bp, "tc=", 3) == 0) { +- tc_next = strsave(bp + 3); ++ if (strncmp(bp, "tc=", 3) == 0) { ++ add_to_list(term_list, bp + 3, MAX_TERMS); + continue; + } + +@@ -184,7 +208,6 @@ + } + /* Done. */ + *listp = list; +- return(tc_next); + } + + /* Add OR change a capability (hardcoded for li# and co#) */ +@@ -337,9 +360,9 @@ + char *desc = NULL; + char *tc_file = "/etc/termcap"; + struct tc_ent *l = NULL; +- int first = 1; +- int loop = 0; ++ int index; + int tc_set = 0; ++ char *term_list[MAX_TERMS + 1]; + + *tcp = NULL; + +@@ -358,8 +381,7 @@ + #endif + /* Just read the TERMCAP variable. */ + sp = strsave(tc); +- tc = build_list(&l, sp); +- if (tc) free(tc); ++ build_list(&l, sp, NULL); + *tcp = l; + return(sp); + } +@@ -386,24 +408,21 @@ + if (fp == NULL) + return(NULL); + +- while(term) { +- if (++loop > 16) { +- write(2, "tgetent: loop detected, check your termcap\n", 43); +- break; +- } ++ desc = term; ++ term_list[0] = term; ++ term_list[1] = NULL; ++ for(index = 0; (index < MAX_TERMS) && term_list[index]; index++) { + #if DEBUG +- printf("LOOKUP: term %s\n", term); ++ printf("LOOKUP: term %s\n", term_list[index]); + #endif +- sp = get_one_entry(fp, term); ++ sp = get_one_entry(fp, term_list[index]); + if (sp == NULL) break; +- term = build_list(&l, sp); +- if (first) +- desc = sp; +- else +- free(sp); +- first = 0; ++ build_list(&l, sp, term_list); + } + fclose(fp); ++ ++ for(index = 1; term_list[index] != NULL; index++) ++ free (term_list[index]); + + /* Done. */ + *tcp = l; diff --git a/recipes/termcap/termcap-2.0.8/007_all_termcap-ignore-p.patch b/recipes/termcap/termcap-2.0.8/007_all_termcap-ignore-p.patch new file mode 100644 index 0000000000..70410e5f55 --- /dev/null +++ b/recipes/termcap/termcap-2.0.8/007_all_termcap-ignore-p.patch @@ -0,0 +1,13 @@ +--- termcap-2.0.8-clean/tparam.c ++++ termcap-2.0.8/tparam.c +@@ -299,6 +299,10 @@ + case 'D': /* %D means weird Delta Data transformation. */ + argp[0] -= 2 * (tem % 16); + break; ++ ++ case 'p': /* %p means push nth arg - ignore. */ ++ *p++; ++ break; + } + } + else diff --git a/recipes/termcap/termcap-2.0.8/008_all_termcap-buffer.patch b/recipes/termcap/termcap-2.0.8/008_all_termcap-buffer.patch new file mode 100644 index 0000000000..f177149990 --- /dev/null +++ b/recipes/termcap/termcap-2.0.8/008_all_termcap-buffer.patch @@ -0,0 +1,13 @@ +--- termcap-2.0.8.orig/termcap.c ++++ termcap-2.0.8/termcap.c +@@ -471,6 +471,10 @@ + for(bp = s; *bp; bp++) { + *sp++ = *bp; + count++; ++ if (count >= maxlen-1) { ++ write(2, "tgetent: warning: termcap entry too long\n", 41); ++ break; ++ } + } + *sp++ = ':'; + count++; diff --git a/recipes/termcap/termcap-2.0.8/009_all_termcap-bufsize--needs-011.patch b/recipes/termcap/termcap-2.0.8/009_all_termcap-bufsize--needs-011.patch new file mode 100644 index 0000000000..3c5926d326 --- /dev/null +++ b/recipes/termcap/termcap-2.0.8/009_all_termcap-bufsize--needs-011.patch @@ -0,0 +1,22 @@ +--- termcap-2.0.8/termcap.c.bufsize ++++ termcap-2.0.8/termcap.c +@@ -46,7 +46,10 @@ + speed_t ospeed; + int tputs_baud_rate; + char PC; +-int tgetent_bufsize = 1024; ++#if !defined(TGETENT_BUFSIZE) ++#define TGETENT_BUFSIZE 1536 /* XXX used to be 1024 */ ++#endif ++int tgetent_bufsize = TGETENT_BUFSIZE; + + /* We store a terminal description in a linked list. */ + struct tc_ent { +@@ -692,7 +695,7 @@ + /*ARGSUSED*/ + int main(int argc, char **argv) + { +- char buf[1024]; ++ char buf[TGETENT_BUFSIZE]; + char *s; + char *ts; diff --git a/recipes/termcap/termcap-2.0.8/010_all_termcap-colon.patch b/recipes/termcap/termcap-2.0.8/010_all_termcap-colon.patch new file mode 100644 index 0000000000..936a62d62f --- /dev/null +++ b/recipes/termcap/termcap-2.0.8/010_all_termcap-colon.patch @@ -0,0 +1,11 @@ +--- termcap-2.0.8/termcap.c.colon ++++ termcap-2.0.8/termcap.c +@@ -136,7 +136,7 @@ + c = *s++ & 0x1f; + + /* See if we want to translate. */ +- if ((c & 0x7f) > 31) ++ if ((c & 0x7f) > 31 && c != ':') + *r++ = c; + else { + len = s - start; diff --git a/recipes/termcap/termcap-2.0.8/011_all_termcap-AAARGH.patch b/recipes/termcap/termcap-2.0.8/011_all_termcap-AAARGH.patch new file mode 100644 index 0000000000..1ba98a0065 --- /dev/null +++ b/recipes/termcap/termcap-2.0.8/011_all_termcap-AAARGH.patch @@ -0,0 +1,57 @@ +--- termcap-2.0.8/termcap.c.aaargh ++++ termcap-2.0.8/termcap.c +@@ -469,10 +469,12 @@ + if (is_malloced && term_entry) free(term_entry); + + /* Do we already have a buffer? */ +- if (sp) { +- maxlen = tgetent_bufsize - 1; +- is_malloced = 0; +- } else { ++ /* No we don't. I don't care if they pass us a few gigabytes ++ * of storage. We're ignoring it. */ ++ /* if (sp) { ++ * maxlen = tgetent_bufsize - 1; ++ * is_malloced = 0; ++ * } else { */ + /* Count how many bytes we need. */ + count = strlen(s) + 1; + for(i = l; i; i = i->next) +@@ -483,7 +485,7 @@ + sp = xmalloc(count); + maxlen = count + 32; /* Just a lot. */ + is_malloced = 1; +- } ++/* } */ + + /* Save buffer into static variable (yuk!) */ + term_entry = sp; +@@ -587,14 +589,16 @@ + s = find_cap(term_entry, cap, '='); + if (s == NULL) return(s); + ++ /* Yawn. Let's ignore bufp, too. */ + /* Where to put the result. */ +- if (bufp == (char **)NULL) { ++ /* if (bufp == (char **)NULL) { */ + for(sp = s; *sp != ':' && *sp; sp++) { + if (*sp =='\\' && sp[1] == ':') sp++; + } + ret = xmalloc(sp - s + 1); +- } else +- ret = *bufp; ++ /* } else ++ * ret = *bufp; ++ */ + r = ret; + + /* Translate escaped characters and hat-notation. */ +@@ -628,7 +632,7 @@ + *r++ = 0; + + /* Do we need to update bufp? */ +- if (bufp) *bufp = r; ++ /* if (bufp) *bufp = r; */ + + return(ret); + } diff --git a/recipes/termcap/termcap-2.0.8/012_all_libtermcap-compat-2.0.8-fPIC.patch b/recipes/termcap/termcap-2.0.8/012_all_libtermcap-compat-2.0.8-fPIC.patch new file mode 100644 index 0000000000..c90229ec58 --- /dev/null +++ b/recipes/termcap/termcap-2.0.8/012_all_libtermcap-compat-2.0.8-fPIC.patch @@ -0,0 +1,29 @@ +--- Makefile ++++ Makefile +@@ -28,23 +28,18 @@ + prefix=/ + + .c.o: +- $(CC) $(CFLAGS) -c $< +- $(CC) $(CFLAGS) -fPIC -c $< -o pic/$@ ++ $(CC) $(CFLAGS) -fPIC -c $< -o $@ + + SRCS = termcap.c tparam.c version.c + OBJS= $(SRCS:.c=.o) + +-all lib: pic .depend $(TARGETS) info ++all lib: .depend $(TARGETS) info + + $(STATIC_LIB): $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + + $(SHARED_LIB): $(OBJS) +- cd pic; \ +- $(CC) -shared -o ../$@ -Wl,-soname,$(SONAME_SHARED_LIB) $(OBJS) -lc +- +-pic: +- -if [ ! -d pic ]; then mkdir pic; fi ++ $(CC) -shared -o $@ -Wl,-soname,$(SONAME_SHARED_LIB) $(OBJS) -lc + + install: lib install-dirs install-data + -if [ -f $(prefix)/lib/$(SHARED_LIB) ]; then \ diff --git a/recipes/termcap/termcap-2.0.8/013_all_libtermcap-compat_bcopy_fix.patch b/recipes/termcap/termcap-2.0.8/013_all_libtermcap-compat_bcopy_fix.patch new file mode 100644 index 0000000000..ca8b55960d --- /dev/null +++ b/recipes/termcap/termcap-2.0.8/013_all_libtermcap-compat_bcopy_fix.patch @@ -0,0 +1,14 @@ +--- tparam.c.orig ++++ tparam.c +@@ -24,9 +24,11 @@ + #undef STDC_HEADERS + #define STDC_HEADERS + #define HAVE_UNISTD_H ++/* + #if defined(HAVE_STRING_H) || defined(STDC_HEADERS) + #define bcopy(s, d, n) memcpy ((d), (s), (n)) + #endif ++ */ + #endif + + #ifdef STDC_HEADERS diff --git a/recipes/termcap/termcap_1.3.1.bb b/recipes/termcap/termcap_1.3.1.bb index 6f78bbf40c..a3e6773eec 100644 --- a/recipes/termcap/termcap_1.3.1.bb +++ b/recipes/termcap/termcap_1.3.1.bb @@ -6,14 +6,14 @@ HOMEPAGE = "http://freshmeat.net/projects/termcap/" LICENSE = "GPLv2" DEPENDS = "" PE = "1" -PR = "0" +PR = "1" SRC_URI = "${GNU_MIRROR}/termcap/termcap-${PV}.tar.gz" SRC_URI[md5sum] = "ffe6f86e63a3a29fa53ac645faaabdfa" SRC_URI[sha256sum] = "91a0e22e5387ca4467b5bcb18edf1c51b930262fd466d5fda396dd9d26719100" EXTRA_OECONF += "\ - --enable-install-termcap \ + --disable-install-termcap \ --with-termcap=${sysconfdir}/termcap \ " @@ -32,4 +32,5 @@ do_install () { 'oldincludedir=' } +NATIVE_INSTALL_WORKS = "1" BBCLASSEXTEND += "native nativesdk" diff --git a/recipes/termcap/termcap_2.0.8.bb b/recipes/termcap/termcap_2.0.8.bb new file mode 100644 index 0000000000..ac456a1fc2 --- /dev/null +++ b/recipes/termcap/termcap_2.0.8.bb @@ -0,0 +1,41 @@ +DESCRIPTION = "A library of C functions that enable programs to send control strings to terminals in a way independent of the terminal type" +# Note that tparam.c is from emacs or glibc and appears to be GPL, whereas +# termcap.c is under the GNU LGPL. +LICENSE = "GPLv2" +PR = "0" + +SRC_URI = "\ + ftp://ftp.linux.org.uk/pub/linux/libc/termcap-2.0.8.tar.gz \ + file://001_all_termcap-shared.patch \ + file://002_all_termcap-setuid.patch \ + file://003_all_termcap-inst-no-root.patch \ + file://004_all_termcap-compat-glibc21.patch \ + file://005_all_termcap-xref.patch \ + file://006_all_termcap-fix-tc.patch \ + file://007_all_termcap-ignore-p.patch \ + file://008_all_termcap-buffer.patch \ + file://009_all_termcap-bufsize--needs-011.patch \ + file://010_all_termcap-colon.patch \ + file://011_all_termcap-AAARGH.patch \ + file://012_all_libtermcap-compat-2.0.8-fPIC.patch;striplevel=0 \ + file://013_all_libtermcap-compat_bcopy_fix.patch;striplevel=0 \ +" +SRC_URI[md5sum] = "b9256cccfd4ddf725e20bf100f8c001a" +SRC_URI[sha256sum] = "83764f2be5e9a7cb174ada280b26b2ca8a4fd645efdf8e41857143b84cea4e8f" + +EXTRA_OEMAKE = "\ + 'CC=${CC}' \ + 'AR=${AR}' \ + 'CFLAGS=${CFLAGS} -I.' \ +" + +do_install () { + oe_libinstall -a -so -s libtermcap ${D}${libdir} + install -d ${D}${infodir} + install -m 0644 termcap.info* ${D}${infodir}/ + install -d ${D}${sysconfdir} + install -m 0644 termcap.src ${D}${sysconfdir}/termcap +} + +NATIVE_INSTALL_WORKS = "1" +BBCLASSEXTEND += "native nativesdk" -- cgit 1.2.3-korg