From 50f6d03229b09c2dea4f30121f08550cb77d735f Mon Sep 17 00:00:00 2001 From: its-pointless Date: Wed, 21 Dec 2016 12:58:47 +1100 Subject: [PATCH] screen compiling and working mostly (#608) --- disabled-packages/screen/attacher.c.patch | 30 +++++++++++++ disabled-packages/screen/build.sh | 4 +- disabled-packages/screen/misc.c.patch | 19 ++++++++ disabled-packages/screen/os.h.patch | 30 +++++++++++++ disabled-packages/screen/osdef.h.in.patch | 13 ++++++ disabled-packages/screen/screen.h.patch | 14 ++++++ disabled-packages/screen/utmp.c.patch | 55 +++++++++++++++++++++++ disabled-packages/screen/window.c.patch | 11 +++++ 8 files changed, 175 insertions(+), 1 deletion(-) create mode 100644 disabled-packages/screen/attacher.c.patch create mode 100644 disabled-packages/screen/misc.c.patch create mode 100644 disabled-packages/screen/os.h.patch create mode 100644 disabled-packages/screen/osdef.h.in.patch create mode 100644 disabled-packages/screen/screen.h.patch create mode 100644 disabled-packages/screen/utmp.c.patch create mode 100644 disabled-packages/screen/window.c.patch diff --git a/disabled-packages/screen/attacher.c.patch b/disabled-packages/screen/attacher.c.patch new file mode 100644 index 000000000..e23e1914e --- /dev/null +++ b/disabled-packages/screen/attacher.c.patch @@ -0,0 +1,30 @@ +--- ../cache/screen-4.4.0/attacher.c 2016-06-19 19:41:03.000000000 +0000 ++++ ./attacher.c 2016-12-20 06:59:46.351839178 +0000 +@@ -71,7 +71,19 @@ + static int multipipe[2]; + # endif + #endif ++#ifdef __ANDROID__ ++#define PWDLEN 128 /* used by Linux */ + ++char *getpass (const char *prompt) ++{ ++ char *s; ++ static char pwd[PWDLEN]; ++ fputs (prompt,stdout); ++ fgets (pwd,PWDLEN-1,stdin); ++ if (s = strchr (pwd,'\n')) *s = '\0'; ++ return pwd; ++} ++#endif + + static int ContinuePlease; + +@@ -921,7 +933,6 @@ + #endif + + debug("screen_builtin_lck looking in gcos field\n"); +- strncpy(fullname, ppp->pw_gecos, sizeof(fullname) - 9); + fullname[sizeof(fullname) - 9] = 0; + + if ((cp1 = index(fullname, ',')) != NULL) diff --git a/disabled-packages/screen/build.sh b/disabled-packages/screen/build.sh index dfb5c36f5..92896bbf2 100644 --- a/disabled-packages/screen/build.sh +++ b/disabled-packages/screen/build.sh @@ -3,10 +3,12 @@ TERMUX_PKG_DESCRIPTION="Terminal multiplexer with VT100/ANSI terminal emulation" TERMUX_PKG_VERSION=4.4.0 TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/screen/screen-${TERMUX_PKG_VERSION}.tar.gz # TERMUX_PKG_DEPENDS="pcre, openssl, libuuid" -# TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--with-ssl=openssl" +TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--enable-colors256 --with-ssl=openssl --disable-socket-dir" termux_step_pre_configure () { # Run autoreconf since we have patched configure.ac cd $TERMUX_PKG_SRCDIR autoconf + CFLAGS+=" -DGETUTENT" + LDFLAGS+=" -llog" } diff --git a/disabled-packages/screen/misc.c.patch b/disabled-packages/screen/misc.c.patch new file mode 100644 index 000000000..8fcff2950 --- /dev/null +++ b/disabled-packages/screen/misc.c.patch @@ -0,0 +1,19 @@ +--- ../cache/screen-4.4.0/misc.c 2016-06-19 19:41:03.000000000 +0000 ++++ ./misc.c 2016-12-20 03:13:04.387236649 +0000 +@@ -37,7 +37,6 @@ + #ifdef SVR4 + # include + #endif +- + extern struct layer *flayer; + + extern int eff_uid, real_uid; +@@ -379,6 +378,8 @@ + #endif /* SVR4 */ + #if defined(SYSV) && defined(NOFILE) && !defined(ISC) + f = NOFILE; ++#elif defined(__ANDROID__) ++ f = sysconf(_SC_OPEN_MAX); + #else /* SYSV && !ISC */ + f = getdtablesize(); + #endif /* SYSV && !ISC */ diff --git a/disabled-packages/screen/os.h.patch b/disabled-packages/screen/os.h.patch new file mode 100644 index 000000000..4d9bdbef6 --- /dev/null +++ b/disabled-packages/screen/os.h.patch @@ -0,0 +1,30 @@ +--- ../cache/screen-4.4.0/os.h 2016-06-19 19:41:03.000000000 +0000 ++++ ./os.h 2016-12-20 02:03:49.513365234 +0000 +@@ -129,15 +129,17 @@ + #ifdef SYSV + # define index strchr + # define rindex strrchr ++#ifndef __ANDROID__ + # define bzero(poi,len) memset(poi,0,len) ++#endif + # define bcmp memcmp + # define killpg(pgrp,sig) kill( -(pgrp), sig) + #endif +- + #ifndef HAVE_GETCWD + # define getcwd(b,l) getwd(b) + #endif + ++#ifndef __ANDROID__ + #ifndef USEBCOPY + # ifdef USEMEMMOVE + # define bcopy(s,d,len) memmove(d,s,len) +@@ -150,6 +152,8 @@ + # endif + # endif + #endif ++#endif ++ + + #if defined(HAVE_SETRESUID) && !defined(HAVE_SETREUID) + # define setreuid(ruid, euid) setresuid(ruid, euid, -1) diff --git a/disabled-packages/screen/osdef.h.in.patch b/disabled-packages/screen/osdef.h.in.patch new file mode 100644 index 000000000..325f4ae79 --- /dev/null +++ b/disabled-packages/screen/osdef.h.in.patch @@ -0,0 +1,13 @@ +--- ../cache/screen-4.4.0/osdef.h.in 2016-06-19 19:41:03.000000000 +0000 ++++ ./osdef.h.in 2016-12-20 06:56:21.153724184 +0000 +@@ -133,8 +133,9 @@ + extern char *getwd __P((char *)); + extern char *getenv __P((char *)); + extern time_t time __P((time_t *)); +- ++#ifndef __ANDROID__ + extern char *getpass __P((char *)); ++#endif + extern char *getlogin __P((void)); + extern char *ttyname __P((int)); + diff --git a/disabled-packages/screen/screen.h.patch b/disabled-packages/screen/screen.h.patch new file mode 100644 index 000000000..1a861554f --- /dev/null +++ b/disabled-packages/screen/screen.h.patch @@ -0,0 +1,14 @@ +--- ../cache/screen-4.4.0/screen.h 2016-06-19 19:41:03.000000000 +0000 ++++ ./screen.h 2016-12-20 04:29:51.331170619 +0000 +@@ -104,9 +104,9 @@ + #define MAXHISTHEIGHT 3000 + #define DEFAULTHISTHEIGHT 100 + #if defined(NAME_MAX) && NAME_MAX < 16 +-# define DEFAULT_BUFFERFILE "/tmp/screen-xchg" ++# define DEFAULT_BUFFERFILE "/data/data/com.termux/files/usr/tmp/screen-xchg" + #else +-# define DEFAULT_BUFFERFILE "/tmp/screen-exchange" ++# define DEFAULT_BUFFERFILE "/data/data/com.termux/files/usr/tmp/screen-exchange" + #endif + + diff --git a/disabled-packages/screen/utmp.c.patch b/disabled-packages/screen/utmp.c.patch new file mode 100644 index 000000000..3dd8396c3 --- /dev/null +++ b/disabled-packages/screen/utmp.c.patch @@ -0,0 +1,55 @@ +--- ../cache/screen-4.4.0/utmp.c 2016-06-19 19:41:03.000000000 +0000 ++++ ./utmp.c 2016-12-20 04:10:53.775426042 +0000 +@@ -33,11 +33,13 @@ + #include "config.h" + #include "screen.h" + #include "extern.h" +- ++#include "os.h" + #ifdef HAVE_UTEMPTER + #include + #endif +- ++#ifdef __ANDROID__ ++#define DEAD_PROCESS 8 ++#endif + + extern struct display *display; + #ifdef CAREFULUTMP +@@ -94,11 +96,12 @@ + static int initutmp __P((void)); + static void setutent __P((void)); + #endif ++#ifndef __ANDROID__ + #if defined(linux) && defined(GETUTENT) + static struct utmp *xpututline __P((struct utmp *utmp)); + # define pututline xpututline + #endif +- ++#endif + + static int utmpok; + static char UtmpName[] = UTMPFILE; +@@ -558,7 +561,6 @@ + bzero((char *)&u, sizeof(u)); + strncpy(u.ut_line, slot, sizeof(u.ut_line)); + setutent(); +- return getutline(&u); + } + + static int +@@ -872,7 +874,7 @@ + return *retbuf ? retbuf : NULL; + } + # endif /* BUGGYGETLOGIN */ +- ++#ifndef __ANDROID__ + #if defined(linux) && defined(GETUTENT) + # undef pututline + +@@ -890,4 +892,5 @@ + return u->ut_type == u2->ut_type ? u : 0; + } + #endif ++#endif + diff --git a/disabled-packages/screen/window.c.patch b/disabled-packages/screen/window.c.patch new file mode 100644 index 000000000..6d1de1085 --- /dev/null +++ b/disabled-packages/screen/window.c.patch @@ -0,0 +1,11 @@ +--- ../cache/screen-4.4.0/window.c 2016-06-19 19:41:03.000000000 +0000 ++++ ./window.c 2016-12-20 04:50:22.247981493 +0000 +@@ -112,7 +112,7 @@ + + int VerboseCreate = 0; /* XXX move this to user.h */ + +-char DefaultShell[] = "/bin/sh"; ++char DefaultShell[] = "/data/data/com.termux/files/home/.termux/shell"; + #ifndef HAVE_EXECVPE + static char DefaultPath[] = ":/usr/ucb:/bin:/usr/bin"; + #endif