imlib2: Update to 1.9.0

* Remove no longer necessary `dlopen()` hack for `libandroid-shmem`
This commit is contained in:
Tee KOBAYASHI 2022-04-29 15:13:55 +09:00 committed by xtkoba
parent 60cde2c2c7
commit 6b26dce921
3 changed files with 18 additions and 126 deletions

View File

@ -1,93 +0,0 @@
diff -uNr imlib2-1.6.1/src/lib/ximage.c imlib2-1.6.1.mod/src/lib/ximage.c
--- imlib2-1.6.1/src/lib/ximage.c 2019-11-08 21:08:08.000000000 +0200
+++ imlib2-1.6.1.mod/src/lib/ximage.c 2019-12-16 14:55:16.041906425 +0200
@@ -9,7 +9,8 @@
#include <sys/mman.h>
#endif
#include <sys/ipc.h>
-#include <sys/shm.h>
+#include <linux/shm.h>
+#include <dlfcn.h>
#include "ximage.h"
@@ -36,6 +37,79 @@
/* temporary X error catcher we use later */
static char _x_err = 0;
+#ifndef shmid_ds
+# define shmid_ds shmid64_ds
+#endif
+
+static void * (*android_shmat)(int shmid, const void *shmaddr, int shmflg) = NULL;
+static int (*android_shmdt)(const void *shmaddr) = NULL;
+static int (*android_shmget)(key_t key, size_t size, int shmflg) = NULL;
+static int (*android_shmctl)(int shmid, int cmd, struct shmid_ds *buf) = NULL;
+
+static void * shmat(int shmid, const void *shmaddr, int shmflg) {
+ if (!android_shmat) {
+ void *handle = dlopen("@TERMUX_PREFIX@/lib/libandroid-shmem.so", RTLD_LOCAL | RTLD_LAZY);
+
+ if (!handle) {
+ abort();
+ }
+
+ android_shmat = dlsym(handle, "shmat");
+
+ dlclose(handle);
+ }
+
+ return android_shmat(shmid, shmaddr, shmflg);
+}
+
+static int shmdt(const void *shmaddr) {
+ if (!android_shmdt) {
+ void *handle = dlopen("@TERMUX_PREFIX@/lib/libandroid-shmem.so", RTLD_LOCAL | RTLD_LAZY);
+
+ if (!handle) {
+ abort();
+ }
+
+ android_shmdt = dlsym(handle, "shmdt");
+
+ dlclose(handle);
+ }
+
+ return android_shmdt(shmaddr);
+}
+
+static int shmget(key_t key, size_t size, int shmflg) {
+ if (!android_shmget) {
+ void *handle = dlopen("@TERMUX_PREFIX@/lib/libandroid-shmem.so", RTLD_LOCAL | RTLD_LAZY);
+
+ if (!handle) {
+ abort();
+ }
+
+ android_shmget = dlsym(handle, "shmget");
+
+ dlclose(handle);
+ }
+
+ return android_shmget(key, size, shmflg);
+}
+
+static int shmctl(int shmid, int cmd, struct shmid_ds *buf) {
+ if (!android_shmctl) {
+ void *handle = dlopen("@TERMUX_PREFIX@/lib/libandroid-shmem.so", RTLD_LOCAL | RTLD_LAZY);
+
+ if (!handle) {
+ abort();
+ }
+
+ android_shmctl = dlsym(handle, "shmctl");
+
+ dlclose(handle);
+ }
+
+ return android_shmctl(shmid, cmd, buf);
+}
+
/* the function we use for catching the error */
static int
TmpXError(Display * d, XErrorEvent * ev)

View File

@ -1,31 +1,28 @@
diff -uNr imlib2-1.6.1/src/modules/loaders/loader_bz2.c imlib2-1.6.1.mod/src/modules/loaders/loader_bz2.c
--- imlib2-1.6.1/src/modules/loaders/loader_bz2.c 2019-12-12 17:33:39.000000000 +0200
+++ imlib2-1.6.1.mod/src/modules/loaders/loader_bz2.c 2019-12-16 14:57:48.727610807 +0200
@@ -52,7 +52,7 @@
--- a/src/modules/loaders/decompress_load.c
+++ b/src/modules/loaders/decompress_load.c
@@ -8,7 +8,7 @@
ImlibLoader *loader;
int dest, res;
const char *s, *p, *q;
- char tmp[] = "/tmp/imlib2_loader_bz2-XXXXXX";
+ char tmp[] = "@TERMUX_PREFIX@/tmp/imlib2_loader_bz2-XXXXXX";
- char tmp[] = "/tmp/imlib2_loader_dec-XXXXXX";
+ char tmp[] = "@TERMUX_PREFIX@/tmp/imlib2_loader_dec-XXXXXX";
char *real_ext;
void *fdata;
/* make sure this file ends in ".bz2" and that there's another ext
diff -uNr imlib2-1.6.1/src/modules/loaders/loader_id3.c imlib2-1.6.1.mod/src/modules/loaders/loader_id3.c
--- imlib2-1.6.1/src/modules/loaders/loader_id3.c 2019-12-12 17:33:39.000000000 +0200
+++ imlib2-1.6.1.mod/src/modules/loaders/loader_id3.c 2019-12-16 14:58:12.922721393 +0200
@@ -505,7 +505,7 @@
--- a/src/modules/loaders/loader_id3.c
+++ b/src/modules/loaders/loader_id3.c
@@ -507,7 +507,7 @@
if (loader)
{
- char tmp[] = "/tmp/imlib2_loader_id3-XXXXXX";
+ char tmp[] = "@TERMUX_PREFIX@/tmp/imlib2_loader_id3-XXXXXX";
int dest;
int dest, res;
if ((dest = mkstemp(tmp)) < 0)
diff -uNr imlib2-1.6.1/src/modules/loaders/loader_xpm.c imlib2-1.6.1.mod/src/modules/loaders/loader_xpm.c
--- imlib2-1.6.1/src/modules/loaders/loader_xpm.c 2019-12-12 17:33:39.000000000 +0200
+++ imlib2-1.6.1.mod/src/modules/loaders/loader_xpm.c 2019-12-16 14:58:43.882862535 +0200
@@ -55,11 +55,11 @@
--- a/src/modules/loaders/loader_xpm.c
+++ b/src/modules/loaders/loader_xpm.c
@@ -78,11 +78,11 @@
/* look in rgb txt database */
if (!rgb_txt)
@ -40,15 +37,3 @@ diff -uNr imlib2-1.6.1/src/modules/loaders/loader_xpm.c imlib2-1.6.1.mod/src/mod
if (!rgb_txt)
goto done;
diff -uNr imlib2-1.6.1/src/modules/loaders/loader_zlib.c imlib2-1.6.1.mod/src/modules/loaders/loader_zlib.c
--- imlib2-1.6.1/src/modules/loaders/loader_zlib.c 2019-12-12 17:33:39.000000000 +0200
+++ imlib2-1.6.1.mod/src/modules/loaders/loader_zlib.c 2019-12-16 14:59:48.137154277 +0200
@@ -45,7 +45,7 @@
ImlibLoader *loader;
int dest, res;
const char *s, *p, *q;
- char tmp[] = "/tmp/imlib2_loader_zlib-XXXXXX";
+ char tmp[] = "@TERMUX_PREFIX@/tmp/imlib2_loader_zlib-XXXXXX";
char *real_ext;
/* make sure this file ends in ".gz" and that there's another ext

View File

@ -1,10 +1,10 @@
TERMUX_PKG_HOMEPAGE=https://sourceforge.net/projects/enlightenment/
TERMUX_PKG_DESCRIPTION="Library that does image file loading and saving as well as rendering, manipulation, arbitrary polygon support"
TERMUX_PKG_LICENSE="BSD"
TERMUX_PKG_LICENSE="custom"
TERMUX_PKG_LICENSE_FILE="COPYING, COPYING-PLAIN"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=1.7.2
TERMUX_PKG_REVISION=2
TERMUX_PKG_SRCURL=https://downloads.sourceforge.net/enlightenment/imlib2-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=c15eb370225e3e3c64a6421c3f153a4117958e0a3b395e06926568b4090aa425
TERMUX_PKG_VERSION=1.9.0
TERMUX_PKG_SRCURL=https://downloads.sourceforge.net/enlightenment/imlib2-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=5ac9e8ca7c6700919fe72749ad7243c42de4b22823c81769a1bf8e480e14c650
TERMUX_PKG_DEPENDS="freetype, giflib, libandroid-shmem, libbz2, libid3tag, libjpeg-turbo, libpng, libtiff, libxext, zlib"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="LIBS=-landroid-shmem"