2019-07-11 20:10:59 +02:00
|
|
|
project('foot', 'c',
|
2021-07-18 17:58:05 +02:00
|
|
|
version: '1.8.2',
|
2019-06-12 20:08:54 +02:00
|
|
|
license: 'MIT',
|
2020-04-24 20:32:37 +02:00
|
|
|
meson_version: '>=0.53.0',
|
2019-06-12 20:08:54 +02:00
|
|
|
default_options: [
|
2020-12-20 16:43:42 +01:00
|
|
|
'c_std=c11',
|
2019-06-12 20:08:54 +02:00
|
|
|
'warning_level=1',
|
|
|
|
|
'werror=true',
|
|
|
|
|
'b_ndebug=if-release'])
|
|
|
|
|
|
|
|
|
|
is_debug_build = get_option('buildtype').startswith('debug')
|
|
|
|
|
|
2020-02-16 14:40:02 +01:00
|
|
|
cc = meson.get_compiler('c')
|
|
|
|
|
|
2021-01-19 14:20:55 +00:00
|
|
|
if cc.has_function('memfd_create')
|
|
|
|
|
add_project_arguments('-DMEMFD_CREATE', language: 'c')
|
|
|
|
|
endif
|
|
|
|
|
|
2019-06-12 20:08:54 +02:00
|
|
|
add_project_arguments(
|
meson: don't force POSIX compliance
foot uses a number of functions not in any POSIX version. On non-glibc
systems defining _POSIX_C_SOURCE usually hides non-compliant interfaces.
In file included from grid.c:1:
In file included from grid.h:4:
terminal.h:45:15: error: expected parameter declarator
static_assert(sizeof(struct attributes) == 8, "bad size");
^
terminal.h:45:15: error: expected ')'
terminal.h:45:14: note: to match this '('
static_assert(sizeof(struct attributes) == 8, "bad size");
^
terminal.h:45:1: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
static_assert(sizeof(struct attributes) == 8, "bad size");
^
terminal.h:55:15: error: expected parameter declarator
static_assert(sizeof(struct cell) == 12, "bad size");
^
terminal.h:55:15: error: expected ')'
terminal.h:55:14: note: to match this '('
static_assert(sizeof(struct cell) == 12, "bad size");
^
terminal.h:55:1: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
static_assert(sizeof(struct cell) == 12, "bad size");
^
grid.c:317:32: error: implicit declaration of function 'wcwidth' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
int width = max(1, wcwidth(wc));
^
grid.c:317:32: note: did you mean '__wcwidth'?
/usr/include/_ctype.h:161:1: note: '__wcwidth' declared here
__wcwidth(__ct_rune_t _c)
^
selection.c:1695:9: error: implicit declaration of function 'pipe2' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (pipe2(fds, O_CLOEXEC) == -1) {
^
selection.c:1695:9: note: did you mean 'pipe'?
/usr/include/unistd.h:358:6: note: 'pipe' declared here
int pipe(int *);
^
selection.c:1842:9: error: implicit declaration of function 'pipe2' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (pipe2(fds, O_CLOEXEC) == -1) {
^
selection.c:2129:9: error: implicit declaration of function 'pipe2' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (pipe2(fds, O_CLOEXEC) == -1) {
^
vt.c:241:12: error: implicit declaration of function 'wcwidth' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
assert(wcwidth(c) == 1);
^
vt.c:241:12: note: did you mean '__wcwidth'?
/usr/include/_ctype.h:161:1: note: '__wcwidth' declared here
__wcwidth(__ct_rune_t _c)
^
vt.c:544:17: error: implicit declaration of function 'wcwidth' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
int width = wcwidth(wc);
^
csi.c:713:35: error: implicit declaration of function 'wcwidth' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
const int width = wcwidth(term->vt.last_printed);
^
csi.c:713:35: note: did you mean '__wcwidth'?
/usr/include/_ctype.h:161:1: note: '__wcwidth' declared here
__wcwidth(__ct_rune_t _c)
^
ime.c:169:25: error: implicit declaration of function 'wcwidth' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
int width = max(wcwidth(term->ime.preedit.text[i]), 1);
^
ime.c:169:25: note: did you mean '__wcwidth'?
/usr/include/_ctype.h:161:1: note: '__wcwidth' declared here
__wcwidth(__ct_rune_t _c)
^
quirks.c:81:22: error: implicit declaration of function 'strcasestr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
is_kde = strcasestr(cur_desktop, "kde") != NULL;
^
quirks.c:81:53: error: comparison between pointer and integer ('int' and 'void *') [-Werror,-Wpointer-integer-compare]
is_kde = strcasestr(cur_desktop, "kde") != NULL;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~
config.c:89:15: error: expected ')'
static_assert(ALEN(binding_action_map) == BIND_ACTION_COUNT,
^
util.h:5:18: note: expanded from macro 'ALEN'
#define ALEN(v) (sizeof(v) / sizeof((v)[0]))
^
config.c:358:12: error: implicit declaration of function 'strcasecmp' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
return strcasecmp(s, "on") == 0 ||
^
config.c:358:12: note: did you mean 'wcscasecmp'?
/usr/include/wchar.h:223:5: note: 'wcscasecmp' declared here
int wcscasecmp(const wchar_t *, const wchar_t *);
^
config.c:510:23: error: implicit declaration of function 'strcasecmp' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
bool center = strcasecmp(mode, "center") == 0;
^
config.c:1243:13: error: implicit declaration of function 'strcasecmp' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (strcasecmp(value, "none") == 0) {
^
config.c:1330:13: error: implicit declaration of function 'strcasecmp' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (strcasecmp(value, "none") == 0) {
^
config.c:1534:13: error: implicit declaration of function 'strcasecmp' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (strcasecmp(value, "none") == 0) {
^
spawn.c:20:9: error: implicit declaration of function 'pipe2' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (pipe2(pipe_fds, O_CLOEXEC) < 0) {
^
spawn.c:20:9: note: did you mean 'pipe'?
/usr/include/unistd.h:358:6: note: 'pipe' declared here
int pipe(int *);
^
spawn.c:52:5: error: implicit declaration of function 'static_assert' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
static_assert(sizeof(_errno) == sizeof(errno), "errno size mismatch");
^
server.c:309:21: error: implicit declaration of function 'accept4' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
int client_fd = accept4(
^
server.c:309:21: note: did you mean 'accept'?
/usr/include/sys/socket.h:679:5: note: 'accept' declared here
int accept(int, struct sockaddr * __restrict, socklen_t * __restrict);
^
server.c:310:59: error: use of undeclared identifier 'SOCK_CLOEXEC'
server->fd, (struct sockaddr *)&addr, &addr_size, SOCK_CLOEXEC | SOCK_NONBLOCK);
^
server.c:310:74: error: use of undeclared identifier 'SOCK_NONBLOCK'
server->fd, (struct sockaddr *)&addr, &addr_size, SOCK_CLOEXEC | SOCK_NONBLOCK);
^
server.c:341:44: error: use of undeclared identifier 'SOCK_CLOEXEC'
int fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);
^
server.c:341:59: error: use of undeclared identifier 'SOCK_NONBLOCK'
int fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);
^
server.c:371:44: error: use of undeclared identifier 'SOCK_CLOEXEC'
int fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);
^
server.c:371:59: error: use of undeclared identifier 'SOCK_NONBLOCK'
int fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);
^
shm.c:138:26: error: use of undeclared identifier '_SC_PAGE_SIZE'
long n = sysconf(_SC_PAGE_SIZE);
^
shm.c:279:15: error: implicit declaration of function 'memfd_create' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
pool_fd = memfd_create("foot-wayland-shm-buffer-pool", MFD_CLOEXEC | MFD_ALLOW_SEALING);
^
shm.c:279:15: note: did you mean 'timer_create'?
/usr/include/time.h:170:5: note: 'timer_create' declared here
int timer_create(clockid_t, struct sigevent *__restrict, timer_t *__restrict);
^
shm.c:279:60: error: use of undeclared identifier 'MFD_CLOEXEC'
pool_fd = memfd_create("foot-wayland-shm-buffer-pool", MFD_CLOEXEC | MFD_ALLOW_SEALING);
^
shm.c:279:74: error: use of undeclared identifier 'MFD_ALLOW_SEALING'
pool_fd = memfd_create("foot-wayland-shm-buffer-pool", MFD_CLOEXEC | MFD_ALLOW_SEALING);
^
shm.c:350:15: error: use of undeclared identifier 'F_SEAL_GROW'
F_SEAL_GROW | F_SEAL_SHRINK | /*F_SEAL_FUTURE_WRITE |*/ F_SEAL_SEAL) < 0)
^
shm.c:350:29: error: use of undeclared identifier 'F_SEAL_SHRINK'
F_SEAL_GROW | F_SEAL_SHRINK | /*F_SEAL_FUTURE_WRITE |*/ F_SEAL_SEAL) < 0)
^
shm.c:350:71: error: use of undeclared identifier 'F_SEAL_SEAL'
F_SEAL_GROW | F_SEAL_SHRINK | /*F_SEAL_FUTURE_WRITE |*/ F_SEAL_SEAL) < 0)
^
shm.c:349:24: error: use of undeclared identifier 'F_ADD_SEALS'
if (fcntl(pool_fd, F_ADD_SEALS,
^
slave.c:151:28: error: implicit declaration of function 'ptsname' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
const char *pts_name = ptsname(ptmx);
^
slave.c:151:28: note: did you mean 'ttyname'?
/usr/include/unistd.h:371:7: note: 'ttyname' declared here
char *ttyname(int);
^
slave.c:151:17: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Werror,-Wint-conversion]
const char *pts_name = ptsname(ptmx);
^ ~~~~~~~~~~~~~
slave.c:153:9: error: implicit declaration of function 'grantpt' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (grantpt(ptmx) == -1) {
^
slave.c:157:9: error: implicit declaration of function 'unlockpt' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (unlockpt(ptmx) == -1) {
^
slave.c:252:9: error: implicit declaration of function 'pipe2' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (pipe2(fork_pipe, O_CLOEXEC) < 0) {
^
slave.c:252:9: note: did you mean 'pipe'?
/usr/include/unistd.h:358:6: note: 'pipe' declared here
int pipe(int *);
^
render.c:1166:28: error: implicit declaration of function 'wcwidth' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
int width = max(1, wcwidth(cell->wc));
^
render.c:1166:28: note: did you mean '__wcwidth'?
/usr/include/_ctype.h:161:1: note: '__wcwidth' declared here
__wcwidth(__ct_rune_t _c)
^
render.c:1932:9: error: implicit declaration of function 'gettimeofday' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
gettimeofday(&start_time, NULL);
^
render.c:2240:28: error: implicit declaration of function 'wcwidth' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
widths[i] = max(1, wcwidth(text[i]));
^
render.c:2243:32: error: implicit declaration of function 'wcswidth' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
const size_t total_cells = wcswidth(text, text_len);
^
render.c:2243:32: note: did you mean 'wcwidth'?
render.c:1166:28: note: 'wcwidth' declared here
int width = max(1, wcwidth(cell->wc));
^
util.h:7:27: note: expanded from macro 'max'
#define max(x, y) ((x) > (y) ? (x) : (y))
^
input.c:1540:9: error: implicit declaration of function 'gettimeofday' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
gettimeofday(&now, NULL);
^
2021-01-19 15:40:32 +00:00
|
|
|
['-D_GNU_SOURCE=200809L'] +
|
2020-08-19 17:22:21 +01:00
|
|
|
(is_debug_build
|
|
|
|
|
? ['-D_DEBUG']
|
|
|
|
|
: [cc.get_supported_arguments('-fno-asynchronous-unwind-tables')]) +
|
2020-12-03 18:36:56 +01:00
|
|
|
(get_option('ime')
|
|
|
|
|
? ['-DFOOT_IME_ENABLED=1']
|
|
|
|
|
: []) +
|
2021-03-26 20:30:13 +01:00
|
|
|
(get_option('b_pgo') == 'use'
|
|
|
|
|
? ['-DFOOT_PGO_ENABLED=1']
|
|
|
|
|
: []) +
|
2020-02-16 14:40:15 +01:00
|
|
|
cc.get_supported_arguments(
|
2020-08-23 09:49:15 +02:00
|
|
|
['-pedantic',
|
|
|
|
|
'-fstrict-aliasing',
|
2020-05-25 21:15:17 +02:00
|
|
|
'-Wstrict-aliasing']),
|
2019-06-12 20:08:54 +02:00
|
|
|
language: 'c',
|
|
|
|
|
)
|
2019-06-13 16:24:35 +02:00
|
|
|
|
2020-02-16 14:40:02 +01:00
|
|
|
# Compute the relative path used by compiler invocations.
|
|
|
|
|
source_root = meson.current_source_dir().split('/')
|
|
|
|
|
build_root = meson.build_root().split('/')
|
|
|
|
|
relative_dir_parts = []
|
|
|
|
|
i = 0
|
|
|
|
|
in_prefix = true
|
|
|
|
|
foreach p : build_root
|
|
|
|
|
if i >= source_root.length() or not in_prefix or p != source_root[i]
|
|
|
|
|
in_prefix = false
|
|
|
|
|
relative_dir_parts += '..'
|
|
|
|
|
endif
|
|
|
|
|
i += 1
|
|
|
|
|
endforeach
|
|
|
|
|
i = 0
|
|
|
|
|
in_prefix = true
|
|
|
|
|
foreach p : source_root
|
|
|
|
|
if i >= build_root.length() or not in_prefix or build_root[i] != p
|
|
|
|
|
in_prefix = false
|
|
|
|
|
relative_dir_parts += p
|
|
|
|
|
endif
|
|
|
|
|
i += 1
|
|
|
|
|
endforeach
|
|
|
|
|
relative_dir = join_paths(relative_dir_parts) + '/'
|
|
|
|
|
|
|
|
|
|
if cc.has_argument('-fmacro-prefix-map=/foo=')
|
|
|
|
|
add_project_arguments('-fmacro-prefix-map=@0@='.format(relative_dir), language: 'c')
|
|
|
|
|
endif
|
|
|
|
|
|
2019-12-05 19:35:54 +01:00
|
|
|
math = cc.find_library('m')
|
2021-01-19 15:48:56 +00:00
|
|
|
threads = [dependency('threads'), cc.find_library('stdthreads', required: false)]
|
2021-01-19 15:54:18 +00:00
|
|
|
libepoll = dependency('epoll-shim', required: false)
|
2019-08-15 21:21:22 +02:00
|
|
|
pixman = dependency('pixman-1')
|
2019-06-12 20:08:54 +02:00
|
|
|
wayland_protocols = dependency('wayland-protocols')
|
|
|
|
|
wayland_client = dependency('wayland-client')
|
|
|
|
|
wayland_cursor = dependency('wayland-cursor')
|
2021-03-07 19:28:17 +00:00
|
|
|
xkb = dependency('xkbcommon', version: '>=1.0.0')
|
2020-07-07 10:44:55 +02:00
|
|
|
fontconfig = dependency('fontconfig')
|
2020-08-20 19:25:35 +02:00
|
|
|
utf8proc = dependency('libutf8proc', required: get_option('grapheme-clustering'))
|
|
|
|
|
|
|
|
|
|
if utf8proc.found()
|
|
|
|
|
add_project_arguments('-DFOOT_GRAPHEME_CLUSTERING=1', language: 'c')
|
|
|
|
|
endif
|
2019-06-12 20:08:54 +02:00
|
|
|
|
2020-08-25 18:52:44 +02:00
|
|
|
tllist = dependency('tllist', version: '>=1.0.4', fallback: 'tllist')
|
2021-05-07 11:31:33 +02:00
|
|
|
fcft = dependency('fcft', version: ['>=2.4.0', '<3.0.0'], fallback: 'fcft')
|
2019-12-01 16:11:35 +01:00
|
|
|
|
2021-01-19 14:22:41 +00:00
|
|
|
tic = find_program('tic', native: true, required: get_option('terminfo'))
|
|
|
|
|
if tic.found()
|
|
|
|
|
add_project_arguments('-DHAVE_TERMINFO', language: 'c')
|
|
|
|
|
endif
|
|
|
|
|
|
2019-06-12 20:08:54 +02:00
|
|
|
wayland_protocols_datadir = wayland_protocols.get_pkgconfig_variable('pkgdatadir')
|
|
|
|
|
|
|
|
|
|
wscanner = dependency('wayland-scanner', native: true)
|
|
|
|
|
wscanner_prog = find_program(
|
|
|
|
|
wscanner.get_pkgconfig_variable('wayland_scanner'), native: true)
|
|
|
|
|
|
|
|
|
|
wl_proto_headers = []
|
|
|
|
|
wl_proto_src = []
|
2021-05-11 17:58:40 +02:00
|
|
|
wl_proto_xml = [
|
2019-06-12 20:08:54 +02:00
|
|
|
wayland_protocols_datadir + '/stable/xdg-shell/xdg-shell.xml',
|
2019-08-30 17:55:45 +02:00
|
|
|
wayland_protocols_datadir + '/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml',
|
2019-08-12 21:22:38 +02:00
|
|
|
wayland_protocols_datadir + '/unstable/xdg-output/xdg-output-unstable-v1.xml',
|
2019-07-11 17:02:21 +02:00
|
|
|
wayland_protocols_datadir + '/unstable/primary-selection/primary-selection-unstable-v1.xml',
|
2019-12-31 15:39:40 +01:00
|
|
|
wayland_protocols_datadir + '/stable/presentation-time/presentation-time.xml',
|
2020-10-10 22:14:35 +02:00
|
|
|
wayland_protocols_datadir + '/unstable/text-input/text-input-unstable-v3.xml',
|
2019-06-12 20:08:54 +02:00
|
|
|
]
|
|
|
|
|
|
2021-05-11 17:58:40 +02:00
|
|
|
if wayland_protocols.version().version_compare('>=1.21')
|
|
|
|
|
add_project_arguments('-DHAVE_XDG_ACTIVATION', language: 'c')
|
|
|
|
|
wl_proto_xml += [wayland_protocols_datadir + '/staging/xdg-activation/xdg-activation-v1.xml']
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
foreach prot : wl_proto_xml
|
2019-06-12 20:08:54 +02:00
|
|
|
wl_proto_headers += custom_target(
|
|
|
|
|
prot.underscorify() + '-client-header',
|
|
|
|
|
output: '@BASENAME@.h',
|
|
|
|
|
input: prot,
|
|
|
|
|
command: [wscanner_prog, 'client-header', '@INPUT@', '@OUTPUT@'])
|
|
|
|
|
|
|
|
|
|
wl_proto_src += custom_target(
|
|
|
|
|
prot.underscorify() + '-private-code',
|
|
|
|
|
output: '@BASENAME@.c',
|
|
|
|
|
input: prot,
|
|
|
|
|
command: [wscanner_prog, 'private-code', '@INPUT@', '@OUTPUT@'])
|
|
|
|
|
endforeach
|
|
|
|
|
|
2019-10-19 22:09:52 +02:00
|
|
|
generate_version_sh = files('generate-version.sh')
|
|
|
|
|
version = custom_target(
|
|
|
|
|
'generate_version',
|
|
|
|
|
build_always_stale: true,
|
|
|
|
|
output: 'version.h',
|
2021-03-11 17:30:00 +01:00
|
|
|
command: [generate_version_sh, meson.project_version(), '@SOURCE_ROOT@', '@OUTPUT@'])
|
2019-10-19 22:09:52 +02:00
|
|
|
|
2021-03-27 13:17:43 +01:00
|
|
|
common = static_library(
|
|
|
|
|
'common',
|
|
|
|
|
'log.c', 'log.h',
|
|
|
|
|
'debug.c', 'debug.h',
|
|
|
|
|
'xmalloc.c', 'xmalloc.h',
|
|
|
|
|
'xsnprintf.c', 'xsnprintf.h'
|
|
|
|
|
)
|
2021-03-26 20:31:09 +01:00
|
|
|
|
2020-11-14 11:00:43 +01:00
|
|
|
misc = static_library(
|
|
|
|
|
'misc',
|
|
|
|
|
'hsl.c', 'hsl.h',
|
|
|
|
|
'macros.h',
|
|
|
|
|
'misc.c', 'misc.h',
|
2021-03-26 20:31:09 +01:00
|
|
|
'uri.c', 'uri.h'
|
2020-11-14 11:00:43 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
vtlib = static_library(
|
|
|
|
|
'vtlib',
|
|
|
|
|
'base64.c', 'base64.h',
|
composed: store compose chains in a binary search tree
The previous implementation stored compose chains in a dynamically
allocated array. Adding a chain was easy: resize the array and append
the new chain at the end. Looking up a compose chain given a compose
chain key/index was also easy: just index into the array.
However, searching for a pre-existing chain given a codepoint sequence
was very slow. Since the array wasn’t sorted, we typically had to scan
through the entire array, just to realize that there is no
pre-existing chain, and that we need to add a new one.
Since this happens for *each* codepoint in a grapheme cluster, things
quickly became really slow.
Things were ok:ish as long as the compose chain struct was small, as
that made it possible to hold all the chains in the cache. Once the
number of chains reached a certain point, or when we were forced to
bump maximum number of allowed codepoints in a chain, we started
thrashing the cache and things got much much worse.
So what can we do?
We can’t sort the array, because
a) that would invalidate all existing chain keys in the grid (and
iterating the entire scrollback and updating compose keys is *not* an
option).
b) inserting a chain becomes slow as we need to first find _where_ to
insert it, and then memmove() the rest of the array.
This patch uses a binary search tree to store the chains instead of a
simple array.
The tree is sorted on a “key”, which is the XOR of all codepoints,
truncated to the CELL_COMB_CHARS_HI-CELL_COMB_CHARS_LO range.
The grid now stores CELL_COMB_CHARS_LO+key, instead of
CELL_COMB_CHARS_LO+index.
Since the key is truncated, collisions may occur. This is handled by
incrementing the key by 1.
Lookup is of course slower than before, O(log n) instead of
O(1).
Insertion is slightly slower as well: technically it’s O(log n)
instead of O(1). However, we also need to take into account the
re-allocating the array will occasionally force a full copy of the
array when it cannot simply be growed.
But finding a pre-existing chain is now *much* faster: O(log n)
instead of O(n). In most cases, the first lookup will either
succeed (return a true match), or fail (return NULL). However, since
key collisions are possible, it may also return false matches. This
means we need to verify the contents of the chain before deciding to
use it instead of inserting a new chain. But remember that this
comparison was being done for each and every chain in the previous
implementation.
With lookups being much faster, and in particular, no longer requiring
us to check the chain contents for every singlec chain, we can now use
a dynamically allocated ‘chars’ array in the chain. This was
previously a hardcoded array of 10 chars.
Using a dynamic allocated array means looking in the array is slower,
since we now need two loads: one to load the pointer, and a second to
load _from_ the pointer.
As a result, the base size of a compose chain (i.e. an “empty” chain)
has now been reduced from 48 bytes to 32. A chain with two codepoints
is 40 bytes. This means we have up to 4 codepoints while still using
less, or the same amount, of memory as before.
Furthermore, the Unicode random test (i.e. write random “unicode”
chars) is now **faster** than current master (i.e. before text-shaping
support was added), **with** test-shaping enabled. With text-shaping
disabled, we’re _even_ faster.
2021-06-24 13:17:07 +02:00
|
|
|
'composed.c', 'composed.h',
|
2020-11-14 11:00:43 +01:00
|
|
|
'csi.c', 'csi.h',
|
|
|
|
|
'dcs.c', 'dcs.h',
|
|
|
|
|
'osc.c', 'osc.h',
|
|
|
|
|
'sixel.c', 'sixel.h',
|
|
|
|
|
'vt.c', 'vt.h',
|
2020-12-19 22:09:03 +00:00
|
|
|
wl_proto_src + wl_proto_headers,
|
2020-11-14 12:42:08 +01:00
|
|
|
version,
|
2020-08-20 19:25:35 +02:00
|
|
|
dependencies: [libepoll, pixman, fcft, tllist, wayland_client, xkb, utf8proc],
|
2021-03-27 13:17:43 +01:00
|
|
|
link_with: [common, misc],
|
2020-11-14 11:00:43 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
pgolib = static_library(
|
|
|
|
|
'pgolib',
|
|
|
|
|
'grid.c', 'grid.h',
|
2020-11-14 22:37:47 +01:00
|
|
|
'selection.c', 'selection.h',
|
2020-11-14 11:00:43 +01:00
|
|
|
'terminal.c', 'terminal.h',
|
2020-12-19 22:09:03 +00:00
|
|
|
wl_proto_src + wl_proto_headers,
|
2021-06-24 20:16:58 +02:00
|
|
|
dependencies: [libepoll, pixman, fcft, tllist, wayland_client, xkb, utf8proc],
|
2020-11-14 11:00:43 +01:00
|
|
|
link_with: vtlib,
|
|
|
|
|
)
|
|
|
|
|
|
2021-03-26 20:34:18 +01:00
|
|
|
if get_option('b_pgo') == 'generate'
|
|
|
|
|
executable(
|
|
|
|
|
'pgo',
|
|
|
|
|
'pgo/pgo.c',
|
|
|
|
|
wl_proto_src + wl_proto_headers,
|
2021-06-24 20:16:58 +02:00
|
|
|
dependencies: [math, threads, libepoll, pixman, wayland_client, xkb, utf8proc, fcft, tllist],
|
2021-03-26 20:34:18 +01:00
|
|
|
link_with: pgolib,
|
|
|
|
|
)
|
|
|
|
|
endif
|
2020-11-14 11:00:43 +01:00
|
|
|
|
2019-06-12 20:08:54 +02:00
|
|
|
executable(
|
2019-07-11 20:10:59 +02:00
|
|
|
'foot',
|
2019-11-04 13:45:38 +01:00
|
|
|
'async.c', 'async.h',
|
2020-12-26 16:24:16 +01:00
|
|
|
'box-drawing.c', 'box-drawing.h',
|
2019-07-16 11:52:22 +02:00
|
|
|
'config.c', 'config.h',
|
2019-07-09 16:26:36 +02:00
|
|
|
'commands.c', 'commands.h',
|
2020-07-15 11:19:18 +02:00
|
|
|
'extract.c', 'extract.h',
|
2019-10-27 11:46:18 +01:00
|
|
|
'fdm.c', 'fdm.h',
|
2020-12-04 18:57:49 +01:00
|
|
|
'foot-features.h',
|
2020-10-10 22:14:35 +02:00
|
|
|
'ime.c', 'ime.h',
|
2019-06-19 10:04:47 +02:00
|
|
|
'input.c', 'input.h',
|
2019-06-12 20:08:54 +02:00
|
|
|
'main.c',
|
2020-12-10 18:06:24 +01:00
|
|
|
'notify.c', 'notify.h',
|
2020-03-01 13:06:00 +01:00
|
|
|
'quirks.c', 'quirks.h',
|
2020-05-21 20:15:10 +02:00
|
|
|
'reaper.c', 'reaper.h',
|
2019-07-05 10:16:56 +02:00
|
|
|
'render.c', 'render.h',
|
2019-08-27 17:23:28 +02:00
|
|
|
'search.c', 'search.h',
|
2020-11-21 20:21:18 +01:00
|
|
|
'server.c', 'server.h', 'client-protocol.h',
|
2019-06-12 20:08:54 +02:00
|
|
|
'shm.c', 'shm.h',
|
2019-06-13 15:19:10 +02:00
|
|
|
'slave.c', 'slave.h',
|
2020-07-15 12:39:10 +02:00
|
|
|
'spawn.c', 'spawn.h',
|
2019-07-17 09:46:45 +02:00
|
|
|
'tokenize.c', 'tokenize.h',
|
2021-01-31 11:12:07 +01:00
|
|
|
'url-mode.c', 'url-mode.h',
|
2021-02-12 09:25:29 +01:00
|
|
|
'user-notification.c', 'user-notification.h',
|
2019-10-27 15:57:23 +01:00
|
|
|
'wayland.c', 'wayland.h',
|
2020-05-08 23:36:33 +02:00
|
|
|
wl_proto_src + wl_proto_headers, version,
|
2021-06-24 20:16:58 +02:00
|
|
|
dependencies: [math, threads, libepoll, pixman, wayland_client, wayland_cursor, xkb, fontconfig, utf8proc,
|
2020-07-07 10:44:55 +02:00
|
|
|
tllist, fcft],
|
2020-11-14 11:00:43 +01:00
|
|
|
link_with: pgolib,
|
2019-06-12 20:08:54 +02:00
|
|
|
install: true)
|
2019-07-15 15:47:45 +02:00
|
|
|
|
2019-11-01 20:39:34 +01:00
|
|
|
executable(
|
|
|
|
|
'footclient',
|
2020-11-21 20:21:18 +01:00
|
|
|
'client.c', 'client-protocol.h',
|
2020-12-04 18:57:49 +01:00
|
|
|
'foot-features.h',
|
2020-08-08 20:34:30 +01:00
|
|
|
'macros.h',
|
2021-02-11 11:08:18 +00:00
|
|
|
'util.h',
|
2020-08-08 20:34:30 +01:00
|
|
|
version,
|
2021-06-23 14:22:18 +02:00
|
|
|
dependencies: [tllist],
|
2021-03-27 13:17:43 +01:00
|
|
|
link_with: common,
|
2019-11-01 20:39:34 +01:00
|
|
|
install: true)
|
|
|
|
|
|
2021-01-19 14:22:41 +00:00
|
|
|
if tic.found()
|
2021-06-23 16:43:36 +02:00
|
|
|
terminfo_install_location = get_option('terminfo-install-location')
|
|
|
|
|
if terminfo_install_location == ''
|
|
|
|
|
terminfo_install_location = join_paths(get_option('datadir'), 'terminfo')
|
|
|
|
|
endif
|
|
|
|
|
|
2021-01-19 14:22:41 +00:00
|
|
|
custom_target(
|
|
|
|
|
'terminfo',
|
|
|
|
|
output: 'f',
|
|
|
|
|
input: 'foot.info',
|
|
|
|
|
command: [tic, '-x', '-o', '@OUTDIR@', '-e', 'foot,foot-direct', '@INPUT@'],
|
2021-06-23 16:43:36 +02:00
|
|
|
install: terminfo_install_location != 'disabled',
|
|
|
|
|
install_dir: terminfo_install_location)
|
|
|
|
|
else
|
|
|
|
|
terminfo_install_location = 'disabled'
|
2021-01-19 14:22:41 +00:00
|
|
|
endif
|
2019-07-18 14:00:33 +02:00
|
|
|
|
2020-07-25 09:05:11 +02:00
|
|
|
install_data(
|
|
|
|
|
'LICENSE', 'README.md', 'CHANGELOG.md',
|
|
|
|
|
install_dir: join_paths(get_option('datadir'), 'doc', 'foot'))
|
|
|
|
|
install_data(
|
|
|
|
|
'foot.desktop', 'foot-server.desktop',
|
|
|
|
|
install_dir: join_paths(get_option('datadir'), 'applications'))
|
2020-08-27 20:02:30 +02:00
|
|
|
install_data('foot.ini', install_dir: join_paths(get_option('datadir'), 'foot'))
|
2019-08-11 20:54:28 +02:00
|
|
|
|
2019-10-20 11:54:58 +02:00
|
|
|
subdir('completions')
|
2019-08-11 20:54:28 +02:00
|
|
|
subdir('doc')
|
2020-06-25 21:33:09 +02:00
|
|
|
subdir('icons')
|
2020-05-01 12:32:10 +02:00
|
|
|
|
2020-12-03 18:36:56 +01:00
|
|
|
summary(
|
|
|
|
|
{
|
|
|
|
|
'IME': get_option('ime'),
|
2020-08-20 19:25:35 +02:00
|
|
|
'Grapheme clustering': utf8proc.found(),
|
2021-06-23 16:43:36 +02:00
|
|
|
'Terminfo': tic.found(),
|
|
|
|
|
'Terminfo install location': terminfo_install_location,
|
2020-12-03 18:36:56 +01:00
|
|
|
},
|
|
|
|
|
bool_yn: true
|
|
|
|
|
)
|