mesa: Revert hack for `libandroid-shmem`

which is no longer necessary after `libandroid-shmem` update.

Effectively reverts commit 671b39bc2c.

%ci:no-build
This commit is contained in:
Tee KOBAYASHI 2022-04-10 15:01:24 +09:00 committed by Yaksh Bariya
parent 40a3dfa14d
commit 475ded7195
No known key found for this signature in database
GPG Key ID: F7486BA7D3D27581
2 changed files with 2 additions and 86 deletions

View File

@ -4,7 +4,7 @@ TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_LICENSE_FILE="docs/license.rst"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=21.3.7
TERMUX_PKG_REVISION=2
TERMUX_PKG_REVISION=3
TERMUX_PKG_SRCURL=https://archive.mesa3d.org/mesa-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=b4fa9db7aa61bf209ef0b40bef83080999d86ad98df8b8b4fada7c128a1efc3d
TERMUX_PKG_DEPENDS="libandroid-shmem, libc++, libx11, libxext, zlib, libexpat"
@ -28,7 +28,7 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
termux_step_pre_configure() {
CPPFLAGS+=" -D__USE_GNU"
# Note: -landroid-shmem in LDFLAGS is not needed because it is dlopen()ed
LDFLAGS+=" -landroid-shmem"
}
termux_step_post_massage() {

View File

@ -1,84 +0,0 @@
--- a/src/mesa/drivers/x11/xm_buffer.c
+++ b/src/mesa/drivers/x11/xm_buffer.c
@@ -45,6 +45,81 @@
#if defined(USE_XSHM)
static volatile int mesaXErrorFlag = 0;
+#ifdef __ANDROID__
+
+#include <dlfcn.h>
+
+typedef int (*shmctl_func_t)(int, int, struct shmid_ds *);
+typedef int (*shmget_func_t)(key_t, size_t, int);
+typedef void *(*shmat_func_t)(int, void const *, int);
+typedef int (*shmdt_func_t)(void const *);
+static shmctl_func_t shmctl_func;
+static shmget_func_t shmget_func;
+static shmat_func_t shmat_func;
+static shmdt_func_t shmdt_func;
+#undef shmctl
+#undef shmget
+#undef shmat
+#undef shmdt
+static int libandroid_shmem_funcs_initialized;
+
+static void
+libandroid_shmem_initialize(void)
+{
+ if (!libandroid_shmem_funcs_initialized) {
+ void *libandroid_shmem_handle = dlopen("libandroid-shmem.so", RTLD_NOW);
+ if (libandroid_shmem_handle != NULL) {
+ shmctl_func = dlsym(libandroid_shmem_handle, "shmctl");
+ shmget_func = dlsym(libandroid_shmem_handle, "shmget");
+ shmat_func = dlsym(libandroid_shmem_handle, "shmat");
+ shmdt_func = dlsym(libandroid_shmem_handle, "shmdt");
+ }
+ libandroid_shmem_funcs_initialized = 1;
+ }
+}
+
+#pragma GCC visibility push(hidden)
+
+int
+shmctl(int shmid, int cmd, struct shmid_ds *buf)
+{
+ if (!libandroid_shmem_funcs_initialized) {
+ libandroid_shmem_initialize();
+ }
+ return shmctl_func(shmid, cmd, buf);
+}
+
+int
+shmget(key_t key, size_t size, int shmflg)
+{
+ if (!libandroid_shmem_funcs_initialized) {
+ libandroid_shmem_initialize();
+ }
+ return shmget_func(key, size, shmflg);
+}
+
+void *
+shmat(int shmid, void const *shmaddr, int shmflg)
+{
+ if (!libandroid_shmem_funcs_initialized) {
+ libandroid_shmem_initialize();
+ }
+ return shmat_func(shmid, shmaddr, shmflg);
+}
+
+int
+shmdt(void const *shmaddr)
+{
+ if (!libandroid_shmem_funcs_initialized) {
+ libandroid_shmem_initialize();
+ }
+ return shmdt_func(shmaddr);
+}
+
+#pragma GCC visibility pop
+
+#endif /* __ANDROID__ */
+
/**
* Catches potential Xlib errors.
*/