texlive-bin: disable fdsan for luatex as well

Fixes https://github.com/termux/science-packages/issues/72.
This commit is contained in:
Henrik Grimler 2021-06-29 22:21:01 +02:00
parent 325e316926
commit 8c4ac406c7
2 changed files with 37 additions and 0 deletions

View File

@ -4,6 +4,7 @@ TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_MAINTAINER="Henrik Grimler @Grimler91"
TERMUX_PKG_VERSION=20210325
_SVN_VERSION=58837
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://github.com/TeX-Live/texlive-source/archive/svn${_SVN_VERSION}.tar.gz
TERMUX_PKG_SHA256=0afa6919e44675b7afe0fa45344747afef07b6ee98eeb14ff6a2ef78f458fc12
TERMUX_PKG_DEPENDS="libc++, libiconv, freetype, libpng, libgd, libgmp, libmpfr, libicu, liblua52, libgraphite, harfbuzz, harfbuzz-icu, teckit, libpixman, libcairo, zlib, zziplib"

View File

@ -31,3 +31,39 @@
&& (f = gzdopen(fileno((FILE*)f), FOPEN_WBIN_MODE)) \
&& (gzsetparams(f, 1, Z_DEFAULT_STRATEGY) == Z_OK))
#define wclose(f) gzclose(f)
--- ./texk/web2c/luatexdir/tex/mainbody.c~ 2021-04-11 21:33:43.000000000 +0000
+++ ./texk/web2c/luatexdir/tex/mainbody.c 2021-06-29 17:10:06.155100280 +0000
@@ -23,6 +23,23 @@
#include "ptexlib.h"
+#ifdef __ANDROID__
+#include <android/fdsan.h>
+#include <dlfcn.h>
+#endif
+
+void disable_fdsan() {
+ // For Android 11+.
+ void *lib_handle = dlopen("libc.so", RTLD_LAZY);
+ if (lib_handle) {
+ void (*set_fdsan_error_level)(enum android_fdsan_error_level newlevel) = dlsym(lib_handle, "android_fdsan_set_error_level");
+ if (set_fdsan_error_level) {
+ set_fdsan_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED);
+ }
+ dlclose(lib_handle);
+ }
+}
+
/*tex
This is where the action starts. We're speaking of \LUATEX, a continuation of
@@ -506,6 +523,9 @@
int bad = main_initialize();
/*tex in case we quit during initialization */
history = fatal_error_stop;
+#ifdef __ANDROID__
+ disable_fdsan();
+#endif
/*tex open the terminal for output */
t_open_out();
if (!luainit)