--- /dev/null
+TERMUX_PKG_HOMEPAGE=https://notmuchmail.org
+TERMUX_PKG_DESCRIPTION="Thread-based email index, search and tagging system"
+TERMUX_PKG_VERSION=0.24.1
+TERMUX_PKG_SRCURL=https://notmuchmail.org/releases/notmuch-${TERMUX_PKG_VERSION}.tar.gz
+TERMUX_PKG_SHA256=fa117de2c6096dd896a333b9c770572a939e04a02abe6745b6b07f5363063ca3
+TERMUX_PKG_BUILD_IN_SRC=yes
+TERMUX_PKG_DEPENDS="glib, libgmime, libtalloc, libxapian"
+
+termux_step_configure () {
+ cd $TERMUX_PKG_SRCDIR
+ XAPIAN_CONFIG=$TERMUX_PREFIX/bin/xapian-config ./configure \
+ --prefix=$TERMUX_PREFIX \
+ --without-api-docs \
+ --without-desktop \
+ --without-emacs \
+ --without-ruby
+}
--- /dev/null
+diff -u -r ../notmuch-0.24.1/configure ./configure
+--- ../notmuch-0.24.1/configure 2017-04-01 14:29:38.000000000 +0200
++++ ./configure 2017-04-07 00:53:36.743033402 +0200
+@@ -352,7 +352,7 @@
+ return 0;
+ }
+ EOF
+-if ${CC} ${CFLAGS} _libversion.c -o _libversion > /dev/null 2>&1 && \
++if ${CC_FOR_BUILD} _libversion.c -o _libversion > /dev/null 2>&1 && \
+ ./_libversion > _libversion.sh && . ./_libversion.sh
+ then
+ printf "OK.\n"
+@@ -554,14 +554,6 @@
+ valgrind_cflags=
+ fi
+
+-printf "Checking for bash-completion (>= 1.90)... "
+-if pkg-config --atleast-version=1.90 bash-completion; then
+- printf "Yes.\n"
+-else
+- printf "No (will not install bash completion).\n"
+- WITH_BASH=0
+-fi
+-
+ if [ -z "${EMACSLISPDIR-}" ]; then
+ EMACSLISPDIR="\$(prefix)/share/emacs/site-lisp"
+ fi
--- /dev/null
+diff -u -r ../notmuch-0.24.1/lib/message-property.cc ./lib/message-property.cc
+--- ../notmuch-0.24.1/lib/message-property.cc 2017-04-01 14:29:38.000000000 +0200
++++ ./lib/message-property.cc 2017-04-07 00:48:00.914918764 +0200
+@@ -51,7 +51,7 @@
+ if (key == NULL || value == NULL)
+ return NOTMUCH_STATUS_NULL_POINTER;
+
+- if (index (key, '='))
++ if (strchr (key, '='))
+ return NOTMUCH_STATUS_ILLEGAL_ARGUMENT;
+
+ term = talloc_asprintf (message, "%s=%s", key, value);
--- /dev/null
+diff -u -r ../notmuch-0.24.1/lib/message.cc ./lib/message.cc
+--- ../notmuch-0.24.1/lib/message.cc 2017-04-01 14:29:38.000000000 +0200
++++ ./lib/message.cc 2017-04-07 00:45:52.192408149 +0200
+@@ -1837,7 +1837,7 @@
+ const char *key;
+ char *value;
+
+- value = index(node->string, '=');
++ value = strchr(node->string, '=');
+ if (!value)
+ INTERNAL_ERROR ("malformed property term");
+
--- /dev/null
+diff -u -r ../notmuch-0.24.1/notmuch-config.c ./notmuch-config.c
+--- ../notmuch-0.24.1/notmuch-config.c 2017-04-01 14:29:38.000000000 +0200
++++ ./notmuch-config.c 2017-04-07 01:01:21.205661688 +0200
+@@ -157,6 +157,8 @@
+ pw_buf = talloc_zero_size(ctx, pw_buf_size);
+ }
+
++#if !defined(__ANDROID__) || defined(__LP64__)
++ /* Only 64-bit Android has the pw_gecos field. */
+ if (e == 0) {
+ char *comma = strchr (passwd.pw_gecos, ',');
+ if (comma)
+@@ -167,6 +169,9 @@
+ } else {
+ name = talloc_strdup (ctx, "");
+ }
++#else
++ name = talloc_strdup (ctx, "");
++#endif
+
+ talloc_free (pw_buf);
+