aboutsummaryrefslogtreecommitdiff
path: root/wayland/imv
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2021-12-09 13:49:01 +0100
committerCem Keylan <cem@ckyln.com>2021-12-09 13:49:01 +0100
commita5b9d960725ca181e1becc64d7c80a6521d1af91 (patch)
tree614913aa4a826f98d83381a5ded78b9f96dac3c5 /wayland/imv
parente3cf2124bb2d30ad76987b4f3009566bdcd9ae52 (diff)
downloadrepository-a5b9d960725ca181e1becc64d7c80a6521d1af91.tar.gz
imv: switch back to upstream
Diffstat (limited to 'wayland/imv')
-rwxr-xr-xwayland/imv/build3
-rw-r--r--wayland/imv/checksums3
-rw-r--r--wayland/imv/patches/support-libgrapheme.patch129
-rw-r--r--wayland/imv/sources3
-rw-r--r--wayland/imv/version2
5 files changed, 137 insertions, 3 deletions
diff --git a/wayland/imv/build b/wayland/imv/build
index 2f31ec4b..1d28baa4 100755
--- a/wayland/imv/build
+++ b/wayland/imv/build
@@ -1,5 +1,7 @@
#!/bin/sh -e
+patch -p1 < support-libgrapheme.patch
+
export DESTDIR="$1"
cl-meson \
@@ -7,6 +9,7 @@ cl-meson \
-Dlibpng=enabled \
-Dlibtiff=enabled \
-Dlibrsvg="$(cpt l -C librsvg enabled disabled)" \
+ -Dunicode=grapheme \
-Dwindows=wayland \
. output
diff --git a/wayland/imv/checksums b/wayland/imv/checksums
index 67387d90..572c61f5 100644
--- a/wayland/imv/checksums
+++ b/wayland/imv/checksums
@@ -1,3 +1,4 @@
%BLAKE3
-3075afde1318718b3ffd0fea0b34a47f048178abfe0ba490b4d0e52416410f1d imv-5a3d696.tar.gz
+7071d65f47ef703423e22ddf8330879a146989dfa0d598a5eb231087d65dcb64 v4.3.0.tar.gz
3f3775e97c033b812a8a45c1587d6003fff54c99b64102ec366fe2e86f649e9b r52.tar.gz
+2ad333e1c8f277be3961bede9696a9c111636f63a8797b17b8780a6fb4c1e483 support-libgrapheme.patch
diff --git a/wayland/imv/patches/support-libgrapheme.patch b/wayland/imv/patches/support-libgrapheme.patch
new file mode 100644
index 00000000..693a8921
--- /dev/null
+++ b/wayland/imv/patches/support-libgrapheme.patch
@@ -0,0 +1,129 @@
+From a83304d4d673aae6efed51da1986bd7315a4d642 Mon Sep 17 00:00:00 2001
+From: Cem Keylan <cem@ckyln.com>
+Date: Tue, 7 Dec 2021 14:40:57 +0100
+Subject: [PATCH] Add support for libgrapheme as an icu replacement
+
+---
+ meson.build | 11 ++++++++++-
+ meson_options.txt | 8 ++++++++
+ src/console.c | 28 ++++++++++++++++++++++++++++
+ 3 files changed, 46 insertions(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index 7cf64b5..26ee0a1 100644
+--- a/meson.build
++++ b/meson.build
+@@ -38,6 +38,15 @@ else
+ target_single_ws = false
+ endif
+
++_unicode = get_option('unicode')
++if _unicode == 'icu'
++ unicode_lib = dependency('icu-io')
++ add_project_arguments('-DIMV_USE_ICU', language: 'c')
++elif _unicode == 'grapheme'
++ unicode_lib = cc.find_library('grapheme')
++ add_project_arguments('-DIMV_USE_GRAPHEME', language: 'c')
++endif
++
+ gl_dep = dependency('gl', required: false)
+ if not gl_dep.found()
+ # libglvnd fallback for pure-wayland systems
+@@ -49,7 +58,7 @@ deps_for_imv = [
+ gl_dep,
+ dependency('threads'),
+ dependency('xkbcommon'),
+- dependency('icu-io'),
++ unicode_lib,
+ dependency('inih', fallback : ['inih', 'inih_dep']),
+ m_dep,
+ ]
+diff --git a/meson_options.txt b/meson_options.txt
+index 389b7fd..c13ef7a 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -8,6 +8,14 @@ option('windows',
+ description : 'window system to use'
+ )
+
++# Unicode backend - default is ICU
++option('unicode',
++ type: 'combo',
++ value: 'icu',
++ choices : ['icu', 'grapheme'],
++ description : 'unicode library to use'
++)
++
+ option('test',
+ type : 'feature',
+ description : 'enable tests'
+diff --git a/src/console.c b/src/console.c
+index 073274f..323383f 100644
+--- a/src/console.c
++++ b/src/console.c
+@@ -6,8 +6,15 @@
+ #include <ctype.h>
+ #include <stdlib.h>
+ #include <string.h>
++
++#ifdef IMV_USE_ICU
+ #include <unicode/utext.h>
+ #include <unicode/ubrk.h>
++#endif
++
++#ifdef IMV_USE_GRAPHEME
++#include <grapheme.h>
++#endif
+
+ struct imv_console {
+ char *buffer;
+@@ -25,6 +32,7 @@ struct imv_console {
+ /* Iterates forwards over characters in a UTF-8 string */
+ static size_t next_char(char *buffer, size_t position)
+ {
++ #if defined(IMV_USE_ICU)
+ size_t result = position;
+ UErrorCode status = U_ZERO_ERROR;
+ UText *ut = utext_openUTF8(NULL, buffer, -1, &status);
+@@ -42,11 +50,19 @@ static size_t next_char(char *buffer, size_t position)
+ utext_close(ut);
+ assert(U_SUCCESS(status));
+ return result;
++ #elif defined(IMV_USE_GRAPHEME)
++ if (buffer[position] != 0) {
++ return position + grapheme_bytelen(buffer + position);
++ } else {
++ return position;
++ }
++ #endif
+ }
+
+ /* Iterates backwards over characters in a UTF-8 string */
+ static size_t prev_char(char *buffer, size_t position)
+ {
++ #if defined(IMV_USE_ICU)
+ size_t result = position;
+ UErrorCode status = U_ZERO_ERROR;
+ UText *ut = utext_openUTF8(NULL, buffer, -1, &status);
+@@ -64,6 +80,18 @@ static size_t prev_char(char *buffer, size_t position)
+ utext_close(ut);
+ assert(U_SUCCESS(status));
+ return result;
++
++ #elif defined(IMV_USE_GRAPHEME)
++ size_t result = 0;
++ size_t step;
++ do {
++ step = grapheme_bytelen(buffer + result);
++ if (result + step >= position)
++ break;
++ result += step;
++ } while (step > 0);
++ return result;
++ #endif
+ }
+
+ static void add_to_history(struct list *history, const char *line)
+--
+2.32.0
+
diff --git a/wayland/imv/sources b/wayland/imv/sources
index 13cfa27d..85c6a33b 100644
--- a/wayland/imv/sources
+++ b/wayland/imv/sources
@@ -1,2 +1,3 @@
-https://git.carbslinux.org/forks/imv/snapshot/imv-5a3d696.tar.gz
+https://git.sr.ht/~exec64/imv/archive/v4.3.0.tar.gz
https://github.com/benhoyt/inih/archive/r52.tar.gz subprojects/inih
+patches/support-libgrapheme.patch
diff --git a/wayland/imv/version b/wayland/imv/version
index 1fa6c9ae..c413e251 100644
--- a/wayland/imv/version
+++ b/wayland/imv/version
@@ -1 +1 @@
-4.3.0 1
+4.3.0 2