From 786a11c9dd2f0b0ac3adc949d8d2e569c51bf228 Mon Sep 17 00:00:00 2001 From: Edouard Tisserant Date: Tue, 1 Dec 2015 01:41:03 +0100 Subject: [PATCH] Dirty patch for gnupg to run on Android 6+, without link() --- android/external/Makefile | 3 +- .../gnupg_use_rename_for_dotlock.patch | 38 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 android/external/gnupg_use_rename_for_dotlock.patch diff --git a/android/external/Makefile b/android/external/Makefile index e6fb89b..d61eed9 100644 --- a/android/external/Makefile +++ b/android/external/Makefile @@ -12,7 +12,7 @@ NDK_ABI ?= arm NDK_TOOLCHAIN_VERSION ?= 4.8 APP_ABI ?= armeabi-v7a APP_PLATFORM ?= android-15 -PEP_PACKAGE_NAME ?= com.pep.pepjniaaractivity +PEP_PACKAGE_NAME ?= com.pep.k9 all: build assets @@ -327,6 +327,7 @@ gnupg/configure: gnupg.src.stamp gnupg/configure.ac gnupg/Makefile: gnupg/configure -patch -N -p1 --reject-file=- gnupg/gl/stdint_.h gnupg_fix_gmulib_stdint_with_bionic.patch + -patch -N -p1 --reject-file=- gnupg/jnlib/dotlock.c gnupg_use_rename_for_dotlock.patch cd gnupg && \ CC="$(CC)" AR="$(AR)" RANLIB=$(RANLIB) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \ ./configure \ diff --git a/android/external/gnupg_use_rename_for_dotlock.patch b/android/external/gnupg_use_rename_for_dotlock.patch new file mode 100644 index 0000000..4dedea5 --- /dev/null +++ b/android/external/gnupg_use_rename_for_dotlock.patch @@ -0,0 +1,38 @@ +--- dotlock.c.orig 2015-12-01 01:07:02.212643687 +0100 ++++ dotlock.c 2015-12-01 01:07:46.746899721 +0100 +@@ -412,7 +412,7 @@ + for (;;) + { + #ifndef HAVE_DOSISH_SYSTEM +-# ifndef __riscos__ ++# if 0 /*ndef __riscos__ + if ( !link(h->tname, h->lockname) ) + { + /* fixme: better use stat to check the link count */ +@@ -425,7 +425,7 @@ + return -1; + } + # else /* __riscos__ */ +- if ( !renamefile(h->tname, h->lockname) ) ++ if ( !rename(h->tname, h->lockname) ) + { + h->locked = 1; + return 0; /* okay */ +@@ -562,7 +562,7 @@ + return -1; + } + +-#ifndef __riscos__ ++# if 0 /*ndef __riscos__ + if ( unlink( h->lockname ) ) + { + log_error ("release_dotlock: error removing lockfile `%s'\n", +@@ -572,7 +572,7 @@ + /* Fixme: As an extra check we could check whether the link count is + now really at 1. */ + #else /* __riscos__ */ +- if ( renamefile (h->lockname, h->tname) ) ++ if ( rename (h->lockname, h->tname) ) + { + log_error ("release_dotlock: error renaming lockfile `%s' to `%s'\n", + h->lockname, h->tname);