TERMUX_PKG_VERSION=4.8.16
+TERMUX_PKG_BUILD_REVISION=2
TERMUX_PKG_HOMEPAGE=https://www.midnight-commander.org/
TERMUX_PKG_DESCRIPTION="Midnight Commander - a powerful file manager"
TERMUX_PKG_SRCURL="http://ftp.midnight-commander.org/mc-${TERMUX_PKG_VERSION}.tar.xz"
-TERMUX_PKG_DEPENDS="ncurses, glib"
+TERMUX_PKG_DEPENDS="libandroid-support, ncurses, glib"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--with-ncurses-libs=$TERMUX_PREFIX/lib --with-screen=ncurses"
# mc uses the deprecated S_IWRITE definition, which android does not define:
# https://code.google.com/p/android/issues/detail?id=19710
--- /dev/null
+Following compiler warning:
+
+/home/fornwall/termux/mc/src/lib/vfs/interface.c: In function 'mc_open':
+/home/fornwall/termux/mc/src/lib/vfs/interface.c:203:28: warning: 'mode_t' is promoted to 'int' when passed through '...'
+ mode = va_arg (ap, mode_t);
+ ^
+/home/fornwall/termux/mc/src/lib/vfs/interface.c:203:28: note: (so you should pass 'int' not 'mode_t' to 'va_arg')
+/home/fornwall/termux/mc/src/lib/vfs/interface.c:203:28: note: if this code is reached, the program will abort
+
+which causes crash on arm devices due to mode_t being unsigned int.
+
+diff -u -r ../mc-4.8.16/lib/vfs/interface.c ./lib/vfs/interface.c
+--- ../mc-4.8.16/lib/vfs/interface.c 2016-03-12 10:45:47.000000000 -0500
++++ ./lib/vfs/interface.c 2016-03-14 22:03:41.417524612 -0400
+@@ -200,7 +200,7 @@
+ {
+ va_list ap;
+ va_start (ap, flags);
+- mode = va_arg (ap, mode_t);
++ mode = (mode_t) va_arg (ap, unsigned int);
+ va_end (ap);
+ }
+
+diff -u -r ../mc-4.8.16/src/editor/editcmd.c ./src/editor/editcmd.c
+--- ../mc-4.8.16/src/editor/editcmd.c 2016-03-12 10:45:47.000000000 -0500
++++ ./src/editor/editcmd.c 2016-03-14 22:03:02.094128021 -0400
+@@ -301,7 +301,7 @@
+ (void) mc_chown (savename_vpath, edit->stat1.st_uid, edit->stat1.st_gid);
+ (void) mc_chmod (savename_vpath, edit->stat1.st_mode);
+
+- fd = mc_open (savename_vpath, O_CREAT | O_WRONLY | O_TRUNC | O_BINARY, edit->stat1.st_mode);
++ fd = mc_open (savename_vpath, O_CREAT | O_WRONLY | O_TRUNC | O_BINARY, (unsigned int) edit->stat1.st_mode);
+ if (fd == -1)
+ goto error_save;
+
+++ /dev/null
-diff -u -r ../mc-4.8.11/lib/strutil/strutil.c ./lib/strutil/strutil.c
---- ../mc-4.8.11/lib/strutil/strutil.c 2013-11-29 19:27:07.000000000 +0100
-+++ ./lib/strutil/strutil.c 2014-02-07 01:55:53.000000000 +0100
-@@ -26,7 +26,9 @@
- #include <config.h>
-
- #include <stdlib.h>
-+#ifndef __ANDROID__
- #include <langinfo.h>
-+#endif
- #include <string.h>
- #include <errno.h>
-
-@@ -306,6 +308,9 @@
- const char *
- str_detect_termencoding (void)
- {
-+#ifdef __ANDROID__
-+ return "utf-8";
-+#else
- if (term_encoding == NULL)
- {
- /* On Linux, nl_langinfo (CODESET) returns upper case UTF-8 whether the LANG is set
-@@ -316,6 +321,7 @@
- }
-
- return term_encoding;
-+#endif
- }
-
- static int
+++ /dev/null
-diff -u -r ../mc-4.8.11/lib/strutil/strutilutf8.c ./lib/strutil/strutilutf8.c
---- ../mc-4.8.11/lib/strutil/strutilutf8.c 2013-11-29 19:27:07.000000000 +0100
-+++ ./lib/strutil/strutilutf8.c 2014-02-07 01:56:32.000000000 +0100
-@@ -26,7 +26,9 @@
- #include <config.h>
-
- #include <stdlib.h>
-+#ifndef __ANDROID__
- #include <langinfo.h>
-+#endif
- #include <string.h>
-
- #include "lib/global.h"