diff --git a/packages/mosh/build.sh b/packages/mosh/build.sh
index caf4608e9..44aa23f8f 100644
--- a/packages/mosh/build.sh
+++ b/packages/mosh/build.sh
@@ -7,7 +7,7 @@ _COMMIT=f30738e3256e90850e945c08624fce90b1ba78a1
TERMUX_PKG_SRCURL=https://github.com/mobile-shell/mosh/archive/${_COMMIT}.zip
TERMUX_PKG_FOLDERNAME=mosh-${_COMMIT}
-TERMUX_PKG_DEPENDS="libandroid-support, protobuf, ncurses, openssl, openssh, libutil, perl, libgnustl"
+TERMUX_PKG_DEPENDS="libandroid-support, protobuf, ncurses, openssl, openssh, libutil, libgnustl"
export PROTOC=$TERMUX_TOPDIR/protobuf/host-build/src/protoc
@@ -21,4 +21,7 @@ termux_step_pre_configure () {
termux_step_post_make_install () {
# Avoid env and specify perl directly:
sed -i'' '1 s|^.*$|#! /bin/perl|' $TERMUX_PREFIX/bin/mosh
+ cd $TERMUX_PREFIX/bin
+ mv mosh mosh.pl
+ ln -s mosh-cfront mosh
}
diff --git a/packages/mosh/configure.ac.patch b/packages/mosh/configure.ac.patch
new file mode 100644
index 000000000..db6ef32af
--- /dev/null
+++ b/packages/mosh/configure.ac.patch
@@ -0,0 +1,15 @@
+--- ../mosh/configure.ac 2016-04-08 10:26:08.000000000 +1000
++++ ./configure.ac 2016-04-29 00:39:20.295727049 +1000
+@@ -141,6 +141,12 @@
+ [build_server="yes"])
+ AM_CONDITIONAL([BUILD_SERVER], [test x"$build_server" != xno])
+
++AC_ARG_ENABLE([cfront],
++ [AS_HELP_STRING([--enable-cfront], [Build the mosh c program instead of perl @<:@yes@:])],
++ [build_cfront="$enableval"],
++ [build_cfront="yes"])
++AM_CONDITIONAL([BUILD_CFRONT], [test x"$build_cfront" != xno])
++
+ AC_ARG_ENABLE([examples],
+ [AS_HELP_STRING([--enable-examples], [Build the miscellaneous programs in src/examples @<:@no@:>@])],
+ [build_examples="$enableval"],
diff --git a/packages/mosh/makefile.am.patch b/packages/mosh/makefile.am.patch
new file mode 100644
index 000000000..4059c9b68
--- /dev/null
+++ b/packages/mosh/makefile.am.patch
@@ -0,0 +1,17 @@
+--- ../mosh/src/frontend/Makefile.am 2016-04-08 10:26:08.000000000 +1000
++++ ./src/frontend/Makefile.am 2016-04-29 00:42:03.147468293 +1000
+@@ -11,9 +11,14 @@
+ bin_PROGRAMS += mosh-client
+ endif
+
++if BUILD_CFRONT
++ bin_PROGRAMS += mosh-cfront
++endif
++
+ if BUILD_SERVER
+ bin_PROGRAMS += mosh-server
+ endif
+
+ mosh_client_SOURCES = mosh-client.cc stmclient.cc stmclient.h terminaloverlay.cc terminaloverlay.h
+ mosh_server_SOURCES = mosh-server.cc
++mosh_cfront_SOURCES = mosh.cc pty.cc shittypty.h
diff --git a/packages/mosh/mosh.cc.patch b/packages/mosh/mosh.cc.patch
new file mode 100644
index 000000000..1f303c2b8
--- /dev/null
+++ b/packages/mosh/mosh.cc.patch
@@ -0,0 +1,524 @@
+--- ../mosh/src/frontend/mosh.cc 2016-04-29 00:42:24.837700203 +1000
++++ ./src/frontend/mosh.cc 2016-04-29 00:40:13.346294286 +1000
+@@ -0,0 +1,521 @@
++// Mosh: the mobile shell
++// Copyright 2012 Keith Winstein
++//
++// This program is free software: you can redistribute it and/or modify
++// it under the terms of the GNU General Public License as published by
++// the Free Software Foundation, either version 3 of the License, or
++// (at your option) any later version.
++//
++// This program is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++//
++// You should have received a copy of the GNU General Public License
++// along with this program. If not, see .
++
++#include "config.h"
++#include
++#include
++#include
++#include
++#include
++#include
++#include