mc: Make mcedit work
authorFredrik Fornwall <fredrik@fornwall.net>
Tue, 15 Mar 2016 02:15:40 +0000 (22:15 -0400)
committerFredrik Fornwall <fredrik@fornwall.net>
Tue, 15 Mar 2016 02:15:40 +0000 (22:15 -0400)
Fixes #165.

packages/mc/build.sh
packages/mc/fix-small-mode-t.patch [new file with mode: 0644]
packages/mc/strutil.patch [deleted file]
packages/mc/strutilutf8.patch [deleted file]

index 06322f5..f253421 100755 (executable)
@@ -1,8 +1,9 @@
 TERMUX_PKG_VERSION=4.8.16
 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_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
 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
diff --git a/packages/mc/fix-small-mode-t.patch b/packages/mc/fix-small-mode-t.patch
new file mode 100644 (file)
index 0000000..396f49c
--- /dev/null
@@ -0,0 +1,35 @@
+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;
diff --git a/packages/mc/strutil.patch b/packages/mc/strutil.patch
deleted file mode 100644 (file)
index 010057d..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-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
diff --git a/packages/mc/strutilutf8.patch b/packages/mc/strutilutf8.patch
deleted file mode 100644 (file)
index d6513ed..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-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"