Codebergdnkl
foot
master
1project('foot', 'c',
2 version: '1.28.0',
3 license: 'MIT',
4 meson_version: '>=0.59.0',
5 default_options: [
6 'c_std=c11',
7 'warning_level=1',
8 'werror=true',
9 'b_ndebug=if-release'])
11is_debug_build = get_option('buildtype').startswith('debug')
13cc = meson.get_compiler('c')
15# Newer clang versions warns when using __COUNTER__ without -std=c2y
16if cc.has_argument('-Wc2y-extensions')
17 add_project_arguments('-Wno-c2y-extensions', language: 'c')
18endif
20if cc.has_function('memfd_create',
21 args: ['-D_GNU_SOURCE'],
22 prefix: '#include <sys/mman.h>')
23 add_project_arguments('-DMEMFD_CREATE', language: 'c')
24endif
26# Missing on DragonFly, FreeBSD < 14.1
27if cc.has_function('execvpe',
28 args: ['-D_GNU_SOURCE'],
29 prefix: '#include <unistd.h>')
30 add_project_arguments('-DEXECVPE', language: 'c')
31endif
33if cc.has_function('sigabbrev_np',
34 args: ['-D_GNU_SOURCE'],
35 prefix: '#include <string.h>')
36 add_project_arguments('-DSIGABBREV_NP', language: 'c')
37endif
39utmp_backend = get_option('utmp-backend')
40if utmp_backend == 'auto'
41 host_os = host_machine.system()
42 if host_os == 'linux'
43 utmp_backend = 'libutempter'
44 elif host_os == 'freebsd'
45 utmp_backend = 'ulog'
46 else
47 utmp_backend = 'none'
48 endif
49endif
51utmp_default_helper_path = get_option('utmp-default-helper-path')
53if utmp_backend == 'none'
54 utmp_add = ''
55 utmp_del = ''
56 utmp_del_have_argument = false
57 utmp_default_helper_path = ''
58elif utmp_backend == 'libutempter'
59 utmp_add = 'add'
60 utmp_del = 'del'
61 utmp_del_have_argument = false
62 if utmp_default_helper_path == 'auto'
63 utmp_default_helper_path = join_paths('/usr', get_option('libdir'), 'utempter', 'utempter')
64 endif
65elif utmp_backend == 'ulog'
66 utmp_add = 'login'
67 utmp_del = 'logout'
68 utmp_del_have_argument = false
69 if utmp_default_helper_path == 'auto'
70 utmp_default_helper_path = join_paths('/usr', get_option('libexecdir'), 'ulog-helper')
71 endif
72else
73 error('invalid utmp backend')
74endif
76add_project_arguments(
77 ['-D_GNU_SOURCE=200809L',
78 '-DFOOT_DEFAULT_TERM="@0@"'.format(get_option('default-terminfo'))] +
79 (utmp_backend != 'none'
80 ? ['-DUTMP_ADD="@0@"'.format(utmp_add),
81 '-DUTMP_DEL="@0@"'.format(utmp_del),
82 '-DUTMP_DEFAULT_HELPER_PATH="@0@"'.format(utmp_default_helper_path)]
83 : []) +
84 (utmp_del_have_argument
85 ? ['-DUTMP_DEL_HAVE_ARGUMENT=1']
86 : []) +
87 (is_debug_build
88 ? ['-D_DEBUG']
89 : [cc.get_supported_arguments('-fno-asynchronous-unwind-tables')]) +
90 (get_option('ime')
91 ? ['-DFOOT_IME_ENABLED=1']
92 : []) +
93 (get_option('b_pgo') == 'use'
94 ? ['-DFOOT_PGO_ENABLED=1']
95 : []) +
96 cc.get_supported_arguments(
97 ['-pedantic',
98 '-fstrict-aliasing',
99 '-Wstrict-aliasing']) +
100 (get_option('fanalyzer')
101 ? ['-fanalyzer']
102 : []),
103 language: 'c',
104)
106terminfo_install_location = get_option('custom-terminfo-install-location')
108if terminfo_install_location != ''
109 add_project_arguments(
110 ['-DFOOT_TERMINFO_PATH="@0@"'.format(
111 join_paths(get_option('prefix'), terminfo_install_location))],
112 language: 'c')
113else
114 terminfo_install_location = join_paths(get_option('datadir'), 'terminfo')
115endif
117# Compute the relative path used by compiler invocations.
118source_root = meson.current_source_dir().split('/')
119build_root = meson.global_build_root().split('/')
120relative_dir_parts = []
121i = 0
122in_prefix = true
123foreach p : build_root
124 if i >= source_root.length() or not in_prefix or p != source_root[i]
125 in_prefix = false
126 relative_dir_parts += '..'
127 endif
128 i += 1
129endforeach
130i = 0
131in_prefix = true
132foreach p : source_root
133 if i >= build_root.length() or not in_prefix or build_root[i] != p
134 in_prefix = false
135 relative_dir_parts += p
136 endif
137 i += 1
138endforeach
139relative_dir = join_paths(relative_dir_parts) + '/'
141if cc.has_argument('-fmacro-prefix-map=/foo=')
142 add_project_arguments('-fmacro-prefix-map=@0@='.format(relative_dir), language: 'c')
143endif
145math = cc.find_library('m')
146threads = [dependency('threads'), cc.find_library('stdthreads', required: false)]
147libepoll = dependency('epoll-shim', required: false)
148pixman = dependency('pixman-1')
149wayland_protocols = dependency('wayland-protocols', version: '>=1.41',
150 fallback: 'wayland-protocols',
151 default_options: ['tests=false'])
152wayland_client = dependency('wayland-client')
153wayland_cursor = dependency('wayland-cursor')
154xkb = dependency('xkbcommon', version: '>=1.6.0')
155fontconfig = dependency('fontconfig')
156utf8proc = dependency('libutf8proc', required: get_option('grapheme-clustering'))
158if utf8proc.found()
159 add_project_arguments('-DFOOT_GRAPHEME_CLUSTERING=1', language: 'c')
160endif
162if pixman.version().version_compare('>=0.46.0')
163 add_project_arguments('-DHAVE_PIXMAN_RGBA_16', language: 'c')
164endif
166tllist = dependency('tllist', version: '>=1.1.0', fallback: 'tllist')
167fcft = dependency('fcft', version: ['>=3.3.1', '<4.0.0'], fallback: 'fcft')
169wayland_protocols_datadir = wayland_protocols.get_variable('pkgdatadir')
171wscanner = dependency('wayland-scanner', native: true)
172wscanner_prog = find_program(
173 wscanner.get_variable('wayland_scanner'), native: true)
175wl_proto_headers = []
176wl_proto_src = []
177wl_proto_xml = [
178 wayland_protocols_datadir / 'stable/xdg-shell/xdg-shell.xml',
179 wayland_protocols_datadir / 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml',
180 wayland_protocols_datadir / 'unstable/xdg-output/xdg-output-unstable-v1.xml',
181 wayland_protocols_datadir / 'unstable/primary-selection/primary-selection-unstable-v1.xml',
182 wayland_protocols_datadir / 'stable/presentation-time/presentation-time.xml',
183 wayland_protocols_datadir / 'unstable/text-input/text-input-unstable-v3.xml',
184 wayland_protocols_datadir / 'staging/xdg-activation/xdg-activation-v1.xml',
185 wayland_protocols_datadir / 'stable/viewporter/viewporter.xml',
186 wayland_protocols_datadir / 'staging/fractional-scale/fractional-scale-v1.xml',
187 wayland_protocols_datadir / 'unstable/tablet/tablet-unstable-v2.xml', # required by cursor-shape-v1
188 wayland_protocols_datadir / 'staging/cursor-shape/cursor-shape-v1.xml',
189 wayland_protocols_datadir / 'staging/single-pixel-buffer/single-pixel-buffer-v1.xml',
190 wayland_protocols_datadir / 'staging/xdg-toplevel-icon/xdg-toplevel-icon-v1.xml',
191 wayland_protocols_datadir / 'staging/xdg-system-bell/xdg-system-bell-v1.xml',
192 wayland_protocols_datadir / 'staging/color-management/color-management-v1.xml',
193]
195if (wayland_protocols.version().version_compare('>=1.43'))
196 wl_proto_xml += [wayland_protocols_datadir / 'staging/xdg-toplevel-tag/xdg-toplevel-tag-v1.xml']
197 add_project_arguments('-DHAVE_XDG_TOPLEVEL_TAG=1', language: 'c')
198endif
199if (wayland_protocols.version().version_compare('>=1.45'))
200 wl_proto_xml += [wayland_protocols_datadir / 'staging/ext-background-effect/ext-background-effect-v1.xml']
201 add_project_arguments('-DHAVE_EXT_BACKGROUND_EFFECT=1', language: 'c')
202endif
204foreach prot : wl_proto_xml
205 wl_proto_headers += custom_target(
206 prot.underscorify() + '-client-header',
207 output: '@BASENAME@.h',
208 input: prot,
209 command: [wscanner_prog, 'client-header', '@INPUT@', '@OUTPUT@'])
211 wl_proto_src += custom_target(
212 prot.underscorify() + '-private-code',
213 output: '@BASENAME@.c',
214 input: prot,
215 command: [wscanner_prog, 'private-code', '@INPUT@', '@OUTPUT@'])
216endforeach
218env = find_program('env', native: true)
219generate_version_sh = files('generate-version.sh')
220version = custom_target(
221 'generate_version',
222 build_always_stale: true,
223 output: 'version.h',
224 command: [env, 'LC_ALL=C', generate_version_sh, meson.project_version(), '@CURRENT_SOURCE_DIR@', '@OUTPUT@'])
226python = find_program('python3', native: true)
227generate_builtin_terminfo_py = files('scripts/generate-builtin-terminfo.py')
228foot_terminfo = files('foot.info')
229builtin_terminfo = custom_target(
230 'generate_builtin_terminfo',
231 output: 'foot-terminfo.h',
232 command: [python, generate_builtin_terminfo_py,
233 '@default_terminfo@', foot_terminfo, 'foot', '@OUTPUT@']
234)
236generate_emoji_variation_sequences = files('scripts/generate-emoji-variation-sequences.py')
237emoji_variation_sequences = custom_target(
238 'generate_emoji_variation_sequences',
239 input: 'unicode/emoji-variation-sequences.txt',
240 output: 'emoji-variation-sequences.h',
241 command: [python, generate_emoji_variation_sequences, '@INPUT@', '@OUTPUT@']
242)
244generate_srgb_funcs = files('scripts/srgb.py')
245srgb_funcs = custom_target(
246 'generate_srgb_funcs',
247 output: ['srgb.c', 'srgb.h'],
248 command: [python, generate_srgb_funcs, '@OUTPUT0@', '@OUTPUT1@']
249)
251common = static_library(
252 'common',
253 'log.c', 'log.h',
254 'char32.c', 'char32.h',
255 'debug.c', 'debug.h',
256 'macros.h',
257 'xmalloc.c', 'xmalloc.h',
258 'xsnprintf.c', 'xsnprintf.h',
259 dependencies: [utf8proc]
260)
262misc = static_library(
263 'misc',
264 'hsl.c', 'hsl.h',
265 'macros.h',
266 'misc.c', 'misc.h',
267 'uri.c', 'uri.h',
268 dependencies: [utf8proc],
269 link_with: [common]
270)
272vtlib = static_library(
273 'vtlib',
274 'base64.c', 'base64.h',
275 'composed.c', 'composed.h',
276 'cursor-shape.c', 'cursor-shape.h',
277 'csi.c', 'csi.h',
278 'dcs.c', 'dcs.h',
279 'macros.h',
280 'osc.c', 'osc.h',
281 'sixel.c', 'sixel.h',
282 'vt.c', 'vt.h',
283 builtin_terminfo, srgb_funcs,
284 wl_proto_src + wl_proto_headers,
285 version,
286 dependencies: [libepoll, pixman, fcft, tllist, wayland_client, xkb, utf8proc],
287 link_with: [common, misc],
288)
290pgolib = static_library(
291 'pgolib',
292 'grid.c', 'grid.h',
293 'selection.c', 'selection.h',
294 'terminal.c', 'terminal.h',
295 emoji_variation_sequences,
296 wl_proto_src + wl_proto_headers,
297 dependencies: [libepoll, pixman, fcft, tllist, wayland_client, xkb, utf8proc],
298 link_with: vtlib,
299)
301tokenize = static_library(
302 'tokenizelib',
303 'tokenize.c',
304 dependencies: [utf8proc],
305 link_with: [common],
306)
308if get_option('b_pgo') == 'generate'
309 executable(
310 'pgo',
311 'pgo/pgo.c',
312 wl_proto_src + wl_proto_headers,
313 dependencies: [math, threads, libepoll, pixman, wayland_client, xkb, utf8proc, fcft, tllist],
314 link_with: pgolib,
315 )
316endif
318executable(
319 'foot',
320 'async.c', 'async.h',
321 'box-drawing.c', 'box-drawing.h',
322 'config.c', 'config.h',
323 'commands.c', 'commands.h',
324 'extract.c', 'extract.h',
325 'fdm.c', 'fdm.h',
326 'foot-features.c', 'foot-features.h',
327 'ime.c', 'ime.h',
328 'input.c', 'input.h',
329 'key-binding.c', 'key-binding.h',
330 'main.c',
331 'notify.c', 'notify.h',
332 'quirks.c', 'quirks.h',
333 'reaper.c', 'reaper.h',
334 'render.c', 'render.h',
335 'search.c', 'search.h',
336 'server.c', 'server.h', 'client-protocol.h',
337 'shm.c', 'shm.h',
338 'slave.c', 'slave.h',
339 'spawn.c', 'spawn.h',
340 'tokenize.c', 'tokenize.h',
341 'unicode-mode.c', 'unicode-mode.h',
342 'url-mode.c', 'url-mode.h',
343 'user-notification.c', 'user-notification.h',
344 'wayland.c', 'wayland.h', 'shm-formats.h',
345 'xkbcommon-vmod.h',
346 srgb_funcs, wl_proto_src + wl_proto_headers, version,
347 dependencies: [math, threads, libepoll, pixman, wayland_client, wayland_cursor, xkb, fontconfig, utf8proc,
348 tllist, fcft],
349 link_with: pgolib,
350 install: true)
352executable(
353 'footclient',
354 'client.c', 'client-protocol.h',
355 'foot-features.c', 'foot-features.h',
356 'macros.h',
357 'util.h',
358 version,
359 dependencies: [tllist, utf8proc],
360 link_with: [common, misc],
361 install: true)
363install_data(
364 'foot.desktop', 'foot-server.desktop', 'footclient.desktop',
365 install_dir: join_paths(get_option('datadir'), 'applications'))
367systemd = dependency('systemd', required: false)
368custom_systemd_units_dir = get_option('systemd-units-dir')
370if systemd.found() or custom_systemd_units_dir != ''
371 configuration = configuration_data()
372 configuration.set('bindir', join_paths(get_option('prefix'), get_option('bindir')))
374 if (custom_systemd_units_dir == '')
375 systemd_units_dir = systemd.get_variable('systemduserunitdir')
376 else
377 systemd_units_dir = custom_systemd_units_dir
378 endif
380 configure_file(
381 configuration: configuration,
382 input: 'foot-server.service.in',
383 output: '@BASENAME@',
384 install_dir: systemd_units_dir
385 )
387 install_data(
388 'foot-server.socket',
389 install_dir: systemd_units_dir)
390endif
392scdoc = dependency('scdoc', native: true, required: get_option('docs'))
393install_data('foot.ini', install_dir: join_paths(get_option('sysconfdir'), 'xdg', 'foot'))
394if scdoc.found()
395 install_data(
396 'LICENSE', 'README.md', 'CHANGELOG.md',
397 install_dir: join_paths(get_option('datadir'), 'doc', 'foot'))
398 subdir('doc')
399endif
401if get_option('themes')
402 install_subdir('themes', install_dir: join_paths(get_option('datadir'), 'foot'))
403endif
405terminfo_base_name = get_option('terminfo-base-name')
406if terminfo_base_name == ''
407 terminfo_base_name = get_option('default-terminfo')
408endif
410tic = find_program('tic', native: true, required: get_option('terminfo'))
411if tic.found()
412 conf_data = configuration_data(
413 {
414 'default_terminfo': terminfo_base_name
415 }
416 )
418 preprocessed = configure_file(
419 input: 'foot.info',
420 output: 'foot.info.preprocessed',
421 configuration: conf_data,
422 )
423 custom_target(
424 'terminfo',
425 output: terminfo_base_name[0],
426 input: preprocessed,
427 command: [tic, '-x', '-o', '@OUTDIR@', '-e', '@0@,@0@-direct'.format(terminfo_base_name), '@INPUT@'],
428 install: true,
429 install_dir: terminfo_install_location
430 )
431endif
433subdir('completions')
434subdir('icons')
435subdir('utils')
437if (get_option('tests'))
438 subdir('tests')
439endif
441summary(
442 {
443 'Documentation': scdoc.found(),
444 'Themes': get_option('themes'),
445 'IME': get_option('ime'),
446 'Grapheme clustering': utf8proc.found(),
447 'utmp backend': utmp_backend,
448 'utmp helper default path': utmp_default_helper_path,
449 'Build terminfo': tic.found(),
450 'Terminfo base name': terminfo_base_name,
451 'Terminfo install location': terminfo_install_location,
452 'Default TERM': get_option('default-terminfo'),
453 'Set TERMINFO': get_option('custom-terminfo-install-location') != '',
454 'Build tests': get_option('tests'),
455 },
456 bool_yn: true
457)
Diagnostics5 git calls · 31 ms
CallStatusSizeTime031 ms
discover200178 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=178 git.server.agent=git/2.56.1-Linux git.server.object_format=sha1 git.server.caps=agent ls-refs fetch server-option object-format git.server.fetch=shallow wait-for-done filter git.protocol.version=2 git.pkt.frames=9 git.pkt.data=7 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=178 git.pkt.payload.max=35
ls-refs20010 KiB · hit3 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=10322 git.response.cache=HIT git.response.duration_ms=3 git.protocol.version=2 git.pkt.frames=108 git.pkt.data=107 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=10322 git.pkt.payload.max=106 git.ls_refs.count=107 git.ls_refs.head=refs/heads/master
fetchcombine:blob:none+tree:2 · deepen 12008.6 KiB · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=8830 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=combine:blob:none+tree:2 git.fetch.wants=c0d2c3e95d74cb60526ff28aec9f34ee3df545e0 git.fetch.haves.count=0 git.fetch.deepen=1 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=7 git.pkt.data=5 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=8830 git.pkt.payload.max=8730 git.sideband.band1.bytes=8730 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=14 git.pack.bytes=8730 git.fetch.wide.objects=14 git.fetch.wide.extra_bytes=9909 git.fetch.wide.blobs=0
fetchtree:0 · deepen 102009.3 KiB · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=24 git.response.bytes=9489 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=tree:0 git.fetch.wants=c0d2c3e95d74cb60526ff28aec9f34ee3df545e0 git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=7 git.pkt.data=5 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=9489 git.pkt.payload.max=9389 git.sideband.band1.bytes=9389 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=10 git.pack.bytes=9389 git.pack.ofs_delta=0 git.pack.ref_delta=0 git.pack.chain.max=0 git.pack.trailer=de930681b6073ba5b599a0f956bfbd114762ad5a git.pack.full=10Open pack map
fetch2003.9 KiB · hit25 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=4044 git.response.cache=HIT git.response.duration_ms=25 git.fetch.wants=13257849a2e096fee0085476ade0b850cfa9e226 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=4 git.pkt.data=3 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=4044 git.pkt.payload.max=4017 git.sideband.band1.bytes=4017 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://codeberg.org/dnkl/foot
- Ref
- refs/heads/master
- Commit
- c0d2c3e95d74cb60526ff28aec9f34ee3df545e0
- cf-ray
- a5e15f684cb7725b
- Request
- c4d53b4a…
- Protocol
- v2 · sha1
- Agent
- git/2.56.1-Linux
- Filter
- advertised
- Fetch
- shallow wait-for-done filter
- Capabilities
- agent ls-refs fetch server-option object-format