Commit graph

192 commits

Author SHA1 Message Date
Daniel Eklöf
7c686208a1
meson: add -Ddocs=disabled|enabled|auto command line option
When enabled (the default, if scdoc is found), we build and install
the man pages, example foot.ini, readme, changelog and license files.
2021-07-24 13:12:10 +02:00
Daniel Eklöf
cd8c96d746
meson/pkgbuild: bump version to 1.8.2 2021-07-18 17:58:05 +02:00
Daniel Eklöf
1d488bb6a7
meson/pkgbuild: bump version to 1.8.1 2021-07-01 20:14:35 +02:00
Daniel Eklöf
0a455174f4
meson/pkgbuild: bump version to 1.8.0 2021-06-25 08:24:42 +02:00
Daniel Eklöf
ad981930c3
meson: add utf8proc dep to all libraries pulling in terminal.h 2021-06-24 20:29:15 +02:00
Daniel Eklöf
fe8ca23cfe
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 17:30:49 +02:00
Daniel Eklöf
b9ef703eb1
wip: grapheme shaping 2021-06-24 17:30:45 +02:00
Daniel Eklöf
6268fc536b
meson: add -Dterminfo-install-location=disabled|custom-path
Add a new meson option, ‘terminfo-install-location’, that allows you
to customize _where_ the terminfo files are installed, relative to the
installation prefix.

It also recognizes the special value ‘disabled’, in which case the
terminfo files are not installed at all. The terminfo files _are_
however built (allowing us to catch build errors), and foot still
defaults to the ‘foot’ terminfo.

It defaults to $datadir/terminfo

If (the other option) ‘terminfo’ is set to disabled (or tic cannot be
found), terminfo-install-location is automatically set to ‘disabled’.
2021-06-23 16:43:36 +02:00
Daniel Eklöf
136d60606a
client: send overrides for everything that is publicly visible in the conf
Send a generic “overrides” list to the server, containing options in
text, on the format “section.key=value”.

This reduces the size of the base client/server protocol packet, as
well as opens up for a generic -o,--override command line option (not
yet implemented).
2021-06-23 15:12:08 +02:00
Daniel Eklöf
03e1b906ab
meson: add xdg-activation-v1.xml conditionally
Only enable XDG activation when compiling against wayland-protocols
1.21. Older versions don’t have this protocol.

When available, define HAVE_XDG_ACTIVATION.

Make all usages of xdg_activation_v1 and xdg_activation_token_v1
conditional.
2021-05-14 13:26:13 +02:00
Daniel Eklöf
3e92361534
xdg-activation: initial support for setting urgency using XDG activation 2021-05-14 13:26:04 +02:00
Daniel Eklöf
96ae2d2bd7
meson: require fcft >= 2.4 2021-05-07 11:31:33 +02:00
Daniel Eklöf
7edda924a0
meson: add ‘xkb’ as a dependency to vtlib, pgolib and pgo
All of these include wayland.h (either directly, or indirectly), which
pulls in xkbcommon.h.

Reported by swayyyy on IRC:

  FAILED: libvtlib.a.p/dcs.c.o

  In file included from ../../terminal.h:19,
                   from ../../dcs.h:4,
                   from ../../dcs.c:1:
  ../../wayland.h:9:10: fatal error: xkbcommon/xkbcommon.h: No such file or directory
      9 | #include <xkbcommon/xkbcommon.h>
        |          ^
2021-05-01 22:47:35 +02:00
Daniel Eklöf
4044b6fa99
Merge branch 'releases/1.7' 2021-04-18 20:16:48 +02:00
Daniel Eklöf
0d4e61bbe8
meson/pkgbuild: bump version to 1.7.2 2021-04-18 20:12:40 +02:00
Daniel Eklöf
353c2f012a
main: call fcft_log_init(). Note that this requires fcft >= 2.3.90 2021-04-17 19:31:17 +02:00
Daniel Eklöf
ca89f977b5
meson/pkgbuild: bump version to 1.7.1 2021-03-28 14:25:29 +02:00
Daniel Eklöf
b5ceed7b2b
meson: replace log+debug+xmalloc static libraries with a single ‘common’ library
There are cyclic dependencies between the log, debug and xmalloc
libraries. While having them as separate static libraries work, as
long as consumers of them link against all of them, having them in a
single library feels slightly better.
2021-03-27 13:20:54 +01:00
Daniel Eklöf
ae6a656f49
meson: only build the pgo helper binary when -Db_pgo=generate
This is the only time it’s needed.

In non-PGO builds, it is completely unnecessary, and we’re only
wasting CPU cycles building it.

In full PGO builds, with -Db_pgo=use, we get link warnings and/or
failures, depending on compiler, since the pgo binary hasn’t been
executed.
2021-03-26 20:34:18 +01:00
Daniel Eklöf
c6fb10863d
meson: build source files common to both foot and footclient as libraries
Source files used by both foot and footclient are now compiled as
static libraries, which foot and footclient links against.
2021-03-26 20:31:09 +01:00
Daniel Eklöf
9b20764f35
features: --version now logs +/-pgo
That is, whether the binary was compiled with PGO or not.
2021-03-26 20:30:13 +01:00
Daniel Eklöf
c1a64bfb14
meson/pkgbuild: bump version to 1.7.0 2021-03-20 14:01:29 +01:00
Daniel Eklöf
928b819934
meson: SOURCE_DIR is not a valid macro in custom_target()
But appears to have been allowed in older versions of meson.

Fixes an issue where foot’s version was always reported as the last
stable release, even though it was a git build.
2021-03-11 17:30:00 +01:00
Craig Barnes
2e31a1ec7a meson: bump minimum xkbcommon version to 1.0.0
This requirement is due to the recently added maybe_repair_key_combo()
function, which is making use of xkb_keymap_key_get_mods_for_level().

See also: commit a5b554761a.
2021-03-07 19:28:17 +00:00
Daniel Eklöf
2a99c5a093
user-notification: add new function ‘user_notification_add()’ 2021-02-12 21:42:53 +01:00
Daniel Eklöf
df1ed1c8cf
Merge branch 'releases/1.6' 2021-02-12 21:41:53 +01:00
Daniel Eklöf
dcd4f1ca79
meson/pkgbuild: bump version to 1.6.4 2021-02-12 21:27:47 +01:00
Craig Barnes
5437321f97 main: client: factor out some common code for "--log-level" option 2021-02-11 11:08:18 +00:00
Daniel Eklöf
2cc84db979
urls: initial support for detecting URLs and rendering jump-labels
The jump labels work, but is currently hardcoded to use xdg-open
2021-02-07 16:33:31 +01:00
Daniel Eklöf
c4363ef336
Merge branch 'releases/1.6' 2021-01-29 20:12:32 +01:00
Daniel Eklöf
4c168b84cf
meson/pkgbuild: bump version to 1.6.3 2021-01-29 19:53:10 +01:00
Jan Beich
8b092256d1
meson: optionalize terminfo dependency
ncurses on FreeBSD still uses termcap(5) while foot works fine with
xterm-256color sans status line and visible bell. Having more than
one ncurses version installed may break other applications.

Document -Dterminfo=false uses --term=xterm-256color by default
2021-01-23 10:18:09 +01:00
Jan Beich
0b07bf78f0
meson: depend on wayland-client when using wayland-protocols
Base compiler on BSDs doesn't look where packages are installed to
avoid tainting build environment. When system fcft is installed to
the same prefix as wayland-client it passes CFLAGS that satisfy both
but when using subprojects/fcft there's a build error.

xdg-shell.c:33:10: fatal error: 'wayland-util.h' file not found
xdg-decoration-unstable-v1.c:28:10: fatal error: 'wayland-util.h' file not found
xdg-output-unstable-v1.c:28:10: fatal error: 'wayland-util.h' file not found
presentation-time.c:28:10: fatal error: 'wayland-util.h' file not found
primary-selection-unstable-v1.c:28:10: fatal error: 'wayland-util.h' file not found
text-input-unstable-v3.c:33:10: fatal error: 'wayland-util.h' file not found
In file included from ../../foot/grid.c:1:
In file included from ../../foot/grid.h:5:
In file included from ../../foot/terminal.h:19:
../../foot/wayland.h:8:10: fatal error: 'wayland-client.h' file not found
In file included from ../../foot/selection.c:1:
../../foot/selection.h:4:10: fatal error: 'wayland-client.h' file not found
2021-01-23 10:16:52 +01:00
Jan Beich
3ac107ce82
meson: require epoll-shim on BSDs
epoll/timerfd are Linux-only but BSDs have a shim via kqueue.
libwayland on FreeBSD uses epoll-shim by default, so the build may
fail at linking instead of compilation stage.

csi.c:13:10: fatal error: 'sys/timerfd.h' file not found
 #include <sys/timerfd.h>
          ^~~~~~~~~~~~~~~
selection.c:10:10: fatal error: 'sys/epoll.h' file not found
 #include <sys/epoll.h>
          ^~~~~~~~~~~~~
terminal.c:15:10: fatal error: 'sys/epoll.h' file not found
 #include <sys/epoll.h>
          ^~~~~~~~~~~~~
ld: error: undefined symbol: timerfd_create
>>> referenced by pgo.c:154 (pgo/pgo.c:154)
>>>               pgo.p/pgo_pgo.c.o:(main)
>>> referenced by pgo.c:158 (pgo/pgo.c:158)
>>>               pgo.p/pgo_pgo.c.o:(main)
>>> referenced by terminal.c:2022 (terminal.c:2022)
>>>               terminal.c.o:(cursor_blink_rearm_timer) in archive libpgolib.a
>>> referenced 7 more times

ld: error: undefined symbol: epoll_shim_close
>>> referenced by pgo.c:160 (pgo/pgo.c:160)
>>>               pgo.p/pgo_pgo.c.o:(main)
>>> referenced by pgo.c:258 (pgo/pgo.c:258)
>>>               pgo.p/pgo_pgo.c.o:(main)
>>> referenced by pgo.c:277 (pgo/pgo.c:277)
>>>               pgo.p/pgo_pgo.c.o:(main)
>>> referenced 14 more times

ld: error: undefined symbol: epoll_shim_read
>>> referenced by pgo.c:251 (pgo/pgo.c:251)
>>>               pgo.p/pgo_pgo.c.o:(main)
>>> referenced by terminal.c:237 (terminal.c:237)
>>>               terminal.c.o:(fdm_ptmx) in archive libpgolib.a
>>> referenced by terminal.c:363 (terminal.c:363)
>>>               terminal.c.o:(fdm_blink) in archive libpgolib.a
>>> referenced 8 more times

ld: error: undefined symbol: timerfd_settime
>>> referenced by terminal.c:301 (terminal.c:301)
>>>               terminal.c.o:(fdm_ptmx) in archive libpgolib.a
>>> referenced by terminal.c:309 (terminal.c:309)
>>>               terminal.c.o:(fdm_ptmx) in archive libpgolib.a
>>> referenced by terminal.c:2041 (terminal.c:2041)
>>>               terminal.c.o:(cursor_blink_rearm_timer) in archive libpgolib.a
>>> referenced 11 more times

ld: error: undefined symbol: timerfd_gettime
>>> referenced by selection.c:1165 (selection.c:1165)
>>>               selection.c.o:(selection_start_scroll_timer) in archive libpgolib.a
2021-01-23 10:16:48 +01:00
Jan Beich
796301f228
meson: libpthread may lack C11 threads e.g., on FreeBSD
ld: error: undefined symbol: mtx_init
>>> referenced by terminal.c:579 (terminal.c:579)
>>>               terminal.c.o:(initialize_render_workers) in archive libpgolib.a

ld: error: undefined symbol: thrd_create
>>> referenced by terminal.c:595 (terminal.c:595)
>>>               terminal.c.o:(initialize_render_workers) in archive libpgolib.a
>>> referenced by terminal.c:935 (terminal.c:935)
>>>               terminal.c.o:(reload_fonts) in archive libpgolib.a
>>> did you mean: thr_create
>>> defined in: /lib/libc.so.7

ld: error: undefined symbol: mtx_lock
>>> referenced by terminal.c:1410 (terminal.c:1410)
>>>               terminal.c.o:(term_destroy) in archive libpgolib.a

ld: error: undefined symbol: mtx_unlock
>>> referenced by terminal.c:1427 (terminal.c:1427)
>>>               terminal.c.o:(term_destroy) in archive libpgolib.a

ld: error: undefined symbol: thrd_join
>>> referenced by terminal.c:1462 (terminal.c:1462)
>>>               terminal.c.o:(term_destroy) in archive libpgolib.a
>>> referenced by terminal.c:947 (terminal.c:947)
>>>               terminal.c.o:(reload_fonts) in archive libpgolib.a

ld: error: undefined symbol: mtx_destroy
>>> referenced by terminal.c:1466 (terminal.c:1466)
>>>               terminal.c.o:(term_destroy) in archive libpgolib.a
2021-01-23 10:16:46 +01:00
Jan Beich
909938b83c
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-23 10:16:43 +01:00
Jan Beich
fcf3f124d6
shm: unbreak build without memfd_create
New FreeBSD versions have memfd_create but other BSDs don't.

pgo/pgo.c:260:22: error: implicit declaration of function 'memfd_create' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        int mem_fd = memfd_create("foot-pgo-ptmx", MFD_CLOEXEC);
                     ^
pgo/pgo.c:260:52: error: use of undeclared identifier 'MFD_CLOEXEC'
        int mem_fd = memfd_create("foot-pgo-ptmx", MFD_CLOEXEC);
                                                   ^
shm.c:13:10: fatal error: 'linux/mman.h' file not found
 #include <linux/mman.h>
          ^~~~~~~~~~~~~~
shm.c:277: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:277:60: error: use of undeclared identifier 'MFD_CLOEXEC'
    pool_fd = memfd_create("foot-wayland-shm-buffer-pool", MFD_CLOEXEC | MFD_ALLOW_SEALING);
                                                           ^
shm.c:277: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:339: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:339: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:339: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:338:24: error: use of undeclared identifier 'F_ADD_SEALS'
    if (fcntl(pool_fd, F_ADD_SEALS,
                       ^
2021-01-23 10:16:37 +01:00
Jan Beich
15f2bebdcb
meson: optionalize terminfo dependency
ncurses on FreeBSD still uses termcap(5) while foot works fine with
xterm-256color sans status line and visible bell. Having more than
one ncurses version installed may break other applications.

Document -Dterminfo=false uses --term=xterm-256color by default
2021-01-23 09:52:42 +01:00
Jan Beich
e3a1dfcf5a
meson: depend on wayland-client when using wayland-protocols
Base compiler on BSDs doesn't look where packages are installed to
avoid tainting build environment. When system fcft is installed to
the same prefix as wayland-client it passes CFLAGS that satisfy both
but when using subprojects/fcft there's a build error.

xdg-shell.c:33:10: fatal error: 'wayland-util.h' file not found
xdg-decoration-unstable-v1.c:28:10: fatal error: 'wayland-util.h' file not found
xdg-output-unstable-v1.c:28:10: fatal error: 'wayland-util.h' file not found
presentation-time.c:28:10: fatal error: 'wayland-util.h' file not found
primary-selection-unstable-v1.c:28:10: fatal error: 'wayland-util.h' file not found
text-input-unstable-v3.c:33:10: fatal error: 'wayland-util.h' file not found
In file included from ../../foot/grid.c:1:
In file included from ../../foot/grid.h:5:
In file included from ../../foot/terminal.h:19:
../../foot/wayland.h:8:10: fatal error: 'wayland-client.h' file not found
In file included from ../../foot/selection.c:1:
../../foot/selection.h:4:10: fatal error: 'wayland-client.h' file not found
2021-01-23 09:52:41 +01:00
Jan Beich
603bbcbcff
meson: require epoll-shim on BSDs
epoll/timerfd are Linux-only but BSDs have a shim via kqueue.
libwayland on FreeBSD uses epoll-shim by default, so the build may
fail at linking instead of compilation stage.

csi.c:13:10: fatal error: 'sys/timerfd.h' file not found
 #include <sys/timerfd.h>
          ^~~~~~~~~~~~~~~
selection.c:10:10: fatal error: 'sys/epoll.h' file not found
 #include <sys/epoll.h>
          ^~~~~~~~~~~~~
terminal.c:15:10: fatal error: 'sys/epoll.h' file not found
 #include <sys/epoll.h>
          ^~~~~~~~~~~~~
ld: error: undefined symbol: timerfd_create
>>> referenced by pgo.c:154 (pgo/pgo.c:154)
>>>               pgo.p/pgo_pgo.c.o:(main)
>>> referenced by pgo.c:158 (pgo/pgo.c:158)
>>>               pgo.p/pgo_pgo.c.o:(main)
>>> referenced by terminal.c:2022 (terminal.c:2022)
>>>               terminal.c.o:(cursor_blink_rearm_timer) in archive libpgolib.a
>>> referenced 7 more times

ld: error: undefined symbol: epoll_shim_close
>>> referenced by pgo.c:160 (pgo/pgo.c:160)
>>>               pgo.p/pgo_pgo.c.o:(main)
>>> referenced by pgo.c:258 (pgo/pgo.c:258)
>>>               pgo.p/pgo_pgo.c.o:(main)
>>> referenced by pgo.c:277 (pgo/pgo.c:277)
>>>               pgo.p/pgo_pgo.c.o:(main)
>>> referenced 14 more times

ld: error: undefined symbol: epoll_shim_read
>>> referenced by pgo.c:251 (pgo/pgo.c:251)
>>>               pgo.p/pgo_pgo.c.o:(main)
>>> referenced by terminal.c:237 (terminal.c:237)
>>>               terminal.c.o:(fdm_ptmx) in archive libpgolib.a
>>> referenced by terminal.c:363 (terminal.c:363)
>>>               terminal.c.o:(fdm_blink) in archive libpgolib.a
>>> referenced 8 more times

ld: error: undefined symbol: timerfd_settime
>>> referenced by terminal.c:301 (terminal.c:301)
>>>               terminal.c.o:(fdm_ptmx) in archive libpgolib.a
>>> referenced by terminal.c:309 (terminal.c:309)
>>>               terminal.c.o:(fdm_ptmx) in archive libpgolib.a
>>> referenced by terminal.c:2041 (terminal.c:2041)
>>>               terminal.c.o:(cursor_blink_rearm_timer) in archive libpgolib.a
>>> referenced 11 more times

ld: error: undefined symbol: timerfd_gettime
>>> referenced by selection.c:1165 (selection.c:1165)
>>>               selection.c.o:(selection_start_scroll_timer) in archive libpgolib.a
2021-01-23 09:52:41 +01:00
Jan Beich
d97b538917
meson: libpthread may lack C11 threads e.g., on FreeBSD
ld: error: undefined symbol: mtx_init
>>> referenced by terminal.c:579 (terminal.c:579)
>>>               terminal.c.o:(initialize_render_workers) in archive libpgolib.a

ld: error: undefined symbol: thrd_create
>>> referenced by terminal.c:595 (terminal.c:595)
>>>               terminal.c.o:(initialize_render_workers) in archive libpgolib.a
>>> referenced by terminal.c:935 (terminal.c:935)
>>>               terminal.c.o:(reload_fonts) in archive libpgolib.a
>>> did you mean: thr_create
>>> defined in: /lib/libc.so.7

ld: error: undefined symbol: mtx_lock
>>> referenced by terminal.c:1410 (terminal.c:1410)
>>>               terminal.c.o:(term_destroy) in archive libpgolib.a

ld: error: undefined symbol: mtx_unlock
>>> referenced by terminal.c:1427 (terminal.c:1427)
>>>               terminal.c.o:(term_destroy) in archive libpgolib.a

ld: error: undefined symbol: thrd_join
>>> referenced by terminal.c:1462 (terminal.c:1462)
>>>               terminal.c.o:(term_destroy) in archive libpgolib.a
>>> referenced by terminal.c:947 (terminal.c:947)
>>>               terminal.c.o:(reload_fonts) in archive libpgolib.a

ld: error: undefined symbol: mtx_destroy
>>> referenced by terminal.c:1466 (terminal.c:1466)
>>>               terminal.c.o:(term_destroy) in archive libpgolib.a
2021-01-23 09:52:41 +01:00
Jan Beich
36b6cc020a
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-23 09:52:41 +01:00
Jan Beich
db9dc7e908
shm: unbreak build without memfd_create
New FreeBSD versions have memfd_create but other BSDs don't.

pgo/pgo.c:260:22: error: implicit declaration of function 'memfd_create' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        int mem_fd = memfd_create("foot-pgo-ptmx", MFD_CLOEXEC);
                     ^
pgo/pgo.c:260:52: error: use of undeclared identifier 'MFD_CLOEXEC'
        int mem_fd = memfd_create("foot-pgo-ptmx", MFD_CLOEXEC);
                                                   ^
shm.c:13:10: fatal error: 'linux/mman.h' file not found
 #include <linux/mman.h>
          ^~~~~~~~~~~~~~
shm.c:277: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:277:60: error: use of undeclared identifier 'MFD_CLOEXEC'
    pool_fd = memfd_create("foot-wayland-shm-buffer-pool", MFD_CLOEXEC | MFD_ALLOW_SEALING);
                                                           ^
shm.c:277: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:339: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:339: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:339: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:338:24: error: use of undeclared identifier 'F_ADD_SEALS'
    if (fcntl(pool_fd, F_ADD_SEALS,
                       ^
2021-01-23 09:52:40 +01:00
Craig Barnes
d2c00d73ec
Add xsnprintf() and remove some unnecessary strlen(3) calls 2021-01-21 11:57:46 +01:00
Craig Barnes
22f25a9e4f Print stack trace on assert() failure or when calling fatal_error()
Note: this uses the __sanitizer_print_stack_trace() function from the
AddressSanitizer runtime, so it only works when AddressSanitizer is
in use.
2021-01-16 19:56:33 +00:00
Craig Barnes
3f4cfa338b Add xsnprintf() and remove some unnecessary strlen(3) calls 2021-01-14 21:30:06 +00:00
Daniel Eklöf
7acdb3a0dd
box-drawing: add infrastructure for rendering box drawing characters ourselves
* ‘term’ struct contains an array of 160 fcft glyph pointers
* the glyph pointers are lazily allocated when we need to draw a box
  drawings character
* Filtering out box drawings characters is easy - they are (except
  unicode 13, which isn’t handled yet )all in a single range.
2021-01-01 21:09:31 +01:00
Daniel Eklöf
c6a53d5e33
meson/pkgbuild: bump version to 1.6.2 2020-12-21 15:58:25 +01:00
sterni
5987b7c85f
meson: default to c11
We don't need any C18 specifics, so C11 is also fine and more widely
supported (i. e. in older clang versions).
2020-12-21 12:27:25 +01:00
Daniel Eklöf
06f84b9aaf
meson: add wl_proto_headers to pgo executable
This fixes a build failure of pgo.o
2020-12-20 15:46:28 +01:00