]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
android: Upgrade liboath
authorKevin Cernekee <cernekee@gmail.com>
Mon, 29 Jan 2018 06:33:58 +0000 (22:33 -0800)
committerKevin Cernekee <cernekee@gmail.com>
Mon, 12 Feb 2018 03:39:14 +0000 (19:39 -0800)
liboath requires minor hacks to build with the latest NDK releases:

1) __freading() cannot be implemented, because older versions of
Bionic[0] do not keep track of the last operation on the stream.

2) Some of the autoconf checks need to be overridden from "cross" to
"yes".

3) Most of the stdio replacement code in gnulib doesn't compile,
because it requires access to internal libc structs.  The internals
are no longer exposed through NDK headers, and they vary from one
Android version to the next.

Fortunately, while these hacks would not pass muster upstream, they
are good enough for the special case of compiling liboath.

[0] https://android.googlesource.com/platform/bionic/+/android-8.1.0_r9/libc/stdio/stdio_ext.cpp#42

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
android/0001-fflush-freadahead-fseeko-Fix-for-Android.patch [deleted file]
android/Makefile

diff --git a/android/0001-fflush-freadahead-fseeko-Fix-for-Android.patch b/android/0001-fflush-freadahead-fseeko-Fix-for-Android.patch
deleted file mode 100644 (file)
index 21f8920..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-fflush, freadahead, and fseeko have trouble compiling on Android[1]
-because they need access to internal elements of the FILE struct.
-Bionic libc[2], like OpenBSD libc[3], puts the ungetc buffer "_ub"
-at the beginning of the __sfileext struct.  Therefore we can reuse the
-existing OpenBSD implementation for Android.
-
-Test results (Android 4.2.2, ARMv7, NDK r9):
-
-    root@android:/data/local/tmp # export srcdir=`pwd`
-    root@android:/data/local/tmp # ./test-fflush2.sh ; echo $?
-    0
-    root@android:/data/local/tmp # ./test-freadahead.sh ; echo $?
-    0
-    root@android:/data/local/tmp # ./test-fseeko.sh ; echo $?
-    0
-    root@android:/data/local/tmp # ./test-fseeko2.sh ; echo $?
-    Skipping test: ungetc cannot handle arbitrary bytes
-    77
-    root@android:/data/local/tmp # ./test-fseeko3.sh ; echo $?
-    0
-    root@android:/data/local/tmp # ./test-fseeko4.sh ; echo $?
-    0
-
-[1] http://lists.gnu.org/archive/html/bug-gnulib/2012-01/msg00295.html
-[2] https://android.googlesource.com/platform/bionic/+/android-4.3_r2.2/libc/stdio/fileext.h
-[3] http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=1.2;content-type=text%2Fplain
-
-diff --git a/liboath/gl/stdio-impl.h b/liboath/gl/stdio-impl.h
-index e00600a..45291cf 100644
---- a/liboath/gl/stdio-impl.h
-+++ b/liboath/gl/stdio-impl.h
-@@ -57,7 +57,7 @@
- #  define fp_ fp
- # endif
--# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ /* NetBSD >= 1.5ZA, OpenBSD */
-+# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __ANDROID__ /* NetBSD >= 1.5ZA, OpenBSD, Android */
-   /* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
-      and <http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */
-   struct __sfileext
--- 
-1.7.10.4
-
index d9dfeb188561d453cf1a1a2b3174d433dceda813..9406c48c483c1c6d6fae3b96ac6be80e6801cb4f 100644 (file)
@@ -273,9 +273,9 @@ stoken: $(STOKEN_DEPS)
 #
 # Build liboath
 #
-OATH_VER := 2.4.1
+OATH_VER := 2.6.2
 OATH_TAR := oath-toolkit-$(OATH_VER).tar.gz
-OATH_SHA := b0ca4c5f89c12c550f7227123c2f21f45b2bf969
+OATH_SHA := b03446fa4b549af5ebe4d35d7aba51163442d255660558cd861ebce536824aa0
 OATH_SRC := sources/oath-toolkit-$(OATH_VER)
 OATH_BUILD := $(TRIPLET)/oath
 
@@ -285,19 +285,21 @@ $(OATH_TAR):
 $(OATH_SRC)/configure: $(OATH_TAR)
        mkdir -p sources
        tar xfz $< -C sources
-       cd $(OATH_SRC) && patch -p1 < ../../0001-fflush-freadahead-fseeko-Fix-for-Android.patch
+       > $(OATH_SRC)/liboath/gl/freading.c
        touch $@
 
 $(OATH_BUILD)/Makefile: $(TOOLCHAIN_BUILT) $(OATH_SRC)/configure
        mkdir -p $(OATH_BUILD)
        cd $(OATH_BUILD) && ../../$(OATH_SRC)/configure $(CONFIGURE_ARGS) \
-               --disable-pskc --disable-pam
+               --disable-pskc --disable-pam \
+               gl_cv_func_fflush_stdin=yes \
+               gl_cv_func_fpurge_works=yes
 
 $(OATH_BUILD)/liboath/liboath.la: $(OATH_BUILD)/Makefile
-       $(MAKE) -C $(OATH_BUILD)
+       $(MAKE) -C $(OATH_BUILD)/liboath
 
 $(OC_SYSROOT)/lib/liboath.la: $(OATH_BUILD)/liboath/liboath.la
-       $(MAKEINSTALL) -C $(OATH_BUILD) install
+       $(MAKEINSTALL) -C $(OATH_BUILD)/liboath install
 
 OATH_DEPS := $(OC_SYSROOT)/lib/liboath.la