--- /dev/null
+TERMUX_PKG_HOMEPAGE=https://tmate.io
+TERMUX_PKG_DESCRIPTION="Terminal multiplexer with instant terminal sharing"
+TERMUX_PKG_VERSION=2.2.1
+TERMUX_PKG_SRCURL=https://github.com/tmate-io/tmate/archive/${TERMUX_PKG_VERSION}.tar.gz
+TERMUX_PKG_SHA256=d9c2ac59f42e65aac5f500f0548ea8056fd79c9c5285e5af324d833e2a84c305
+TERMUX_PKG_FOLDERNAME=tmate-${TERMUX_PKG_VERSION}
+TERMUX_PKG_DEPENDS="libandroid-support, libevent, libmsgpack, libssh, libutil, ncurses"
+
+termux_step_pre_configure () {
+ CFLAGS+=" -DIOV_MAX=1024"
+
+ cd $TERMUX_PKG_SRCDIR
+ ./autogen.sh
+}
--- /dev/null
+diff -u -r ../tmate-2.2.1/tmate-debug.c ./tmate-debug.c
+--- ../tmate-2.2.1/tmate-debug.c 2016-03-28 23:30:07.000000000 -0400
++++ ./tmate-debug.c 2016-08-26 16:42:38.475688775 -0400
+@@ -1,4 +1,6 @@
++#ifndef __ANDROID__
+ #include <execinfo.h>
++#endif
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <regex.h>
+@@ -55,6 +57,9 @@
+
+ void tmate_print_stack_trace(void)
+ {
++#ifdef __ANDROID__
++ tmate_info ("Not supported on Android");
++#else
+ void *array[20];
+ size_t size;
+ char **strings;
+@@ -73,6 +78,7 @@
+ }
+
+ free (strings);
++#endif
+ }
+
+
--- /dev/null
+diff -u -r ../tmate-2.2.1/tmux.h ./tmux.h
+--- ../tmate-2.2.1/tmux.h 2016-03-28 23:30:07.000000000 -0400
++++ ./tmux.h 2016-08-26 16:57:50.901952193 -0400
+@@ -53,7 +53,7 @@
+ struct tmuxproc;
+
+ /* Default global configuration file. */
+-#define TMUX_CONF "/etc/tmux.conf"
++#define TMUX_CONF "@TERMUX_PREFIX@/etc/tmux.conf"
+
+ /*
+ * Minimum layout cell size, NOT including separator line. The scroll region