Skip to content
This repository was archived by the owner on Dec 6, 2024. It is now read-only.

Commit a2c767a

Browse files
authored
keyboard (#4)
1 parent e61f70c commit a2c767a

File tree

13 files changed

+426
-3
lines changed

13 files changed

+426
-3
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ jobs:
2323

2424
- name: Install dependencies
2525
run: |
26-
sudo apt install -y ninja-build
26+
sudo apt install -y ninja-build \
27+
meson
2728
2829
- name: Install emsdk
2930
run: |
@@ -36,10 +37,14 @@ jobs:
3637
run: |
3738
. emsdk/emsdk_env.sh
3839
python scripts/fmt.py
40+
python scripts/iso-codes.py
3941
python scripts/json.py
4042
python scripts/json-c.py
41-
python scripts/marisa.py
43+
python scripts/libexpat.py
4244
python scripts/libthai.py
45+
python scripts/libxkbcommon.py
46+
python scripts/xkeyboard-config.py
47+
python scripts/marisa.py
4348
4449
- name: Release
4550
if: ${{ github.ref == 'refs/heads/master' }}

.gitmodules

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,15 @@
1313
[submodule "libthai"]
1414
path = libthai
1515
url = https://github.com/tlwg/libthai
16+
[submodule "libxkbcommon"]
17+
path = libxkbcommon
18+
url = https://github.com/xkbcommon/libxkbcommon
19+
[submodule "iso-codes"]
20+
path = iso-codes
21+
url = https://salsa.debian.org/iso-codes-team/iso-codes
22+
[submodule "libexpat"]
23+
path = libexpat
24+
url = https://github.com/libexpat/libexpat
25+
[submodule "xkeyboard-config"]
26+
path = xkeyboard-config
27+
url = https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config

iso-codes

Submodule iso-codes added at c2fcaad

libexpat

Submodule libexpat added at dfa90b8

libxkbcommon

Submodule libxkbcommon added at 7a31e35

patches/libxkbcommon.patch

Lines changed: 323 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,323 @@
1+
diff --git a/meson.build b/meson.build
2+
index 2de4ee9..1a42dcc 100644
3+
--- a/meson.build
4+
+++ b/meson.build
5+
@@ -94,12 +94,6 @@ endif
6+
if cc.links('int main(){if(__builtin_expect(1<0,0)){}}', name: '__builtin_expect')
7+
configh_data.set('HAVE___BUILTIN_EXPECT', 1)
8+
endif
9+
-if cc.has_header_symbol('unistd.h', 'eaccess', prefix: system_ext_define)
10+
- configh_data.set('HAVE_EACCESS', 1)
11+
-endif
12+
-if cc.has_header_symbol('unistd.h', 'euidaccess', prefix: system_ext_define)
13+
- configh_data.set('HAVE_EUIDACCESS', 1)
14+
-endif
15+
if cc.has_header_symbol('sys/mman.h', 'mmap')
16+
configh_data.set('HAVE_MMAP', 1)
17+
endif
18+
@@ -600,281 +594,6 @@ configure_file(input: 'test/xkeyboard-config-test.py.in',
19+
output: 'xkeyboard-config-test',
20+
configuration: xkct_config)
21+
22+
-# Tests
23+
-test_env = environment()
24+
-test_env.set('XKB_LOG_LEVEL', 'debug')
25+
-test_env.set('XKB_LOG_VERBOSITY', '10')
26+
-test_env.set('top_srcdir', meson.current_source_dir())
27+
-test_env.set('top_builddir', meson.current_build_dir())
28+
-test_env.set('HAVE_XKBCLI_INTERACTIVE_EVDEV', configh_data.get('HAVE_XKBCLI_INTERACTIVE_EVDEV', 0).to_string())
29+
-test_env.set('HAVE_XKBCLI_INTERACTIVE_WAYLAND', configh_data.get('HAVE_XKBCLI_INTERACTIVE_WAYLAND', 0).to_string())
30+
-test_env.set('HAVE_XKBCLI_INTERACTIVE_X11', configh_data.get('HAVE_XKBCLI_INTERACTIVE_X11', 0).to_string())
31+
-test_env.set('HAVE_XKBCLI_LIST', configh_data.get('HAVE_XKBCLI_LIST', 0).to_string())
32+
-
33+
-test_configh_data = configuration_data()
34+
-test_configh_data.set_quoted('TEST_XKB_CONFIG_ROOT', meson.current_source_dir()/'test'/'data')
35+
-configure_file(output: 'test-config.h', configuration: test_configh_data)
36+
-
37+
-# Some tests need to use unexported symbols, so we link them against
38+
-# an internal copy of libxkbcommon with all symbols exposed.
39+
-libxkbcommon_test_internal = static_library(
40+
- 'xkbcommon-test-internal',
41+
- 'test/common.c',
42+
- 'test/test.h',
43+
- 'test/evdev-scancodes.h',
44+
- 'bench/bench.c',
45+
- 'bench/bench.h',
46+
- libxkbcommon_sources,
47+
- include_directories: include_directories('src', 'include'),
48+
- c_args: ['-DENABLE_PRIVATE_APIS'],
49+
-)
50+
-test_dep = declare_dependency(
51+
- include_directories: include_directories('src', 'include'),
52+
- link_with: libxkbcommon_test_internal,
53+
- dependencies: [tools_dep],
54+
-)
55+
-if get_option('enable-x11')
56+
- libxkbcommon_x11_test_internal = static_library(
57+
- 'xkbcommon-x11-internal',
58+
- libxkbcommon_x11_sources,
59+
- 'test/xvfb-wrapper.c',
60+
- 'test/xvfb-wrapper.h',
61+
- include_directories: include_directories('src', 'include'),
62+
- link_with: libxkbcommon_test_internal,
63+
- dependencies: [
64+
- xcb_dep,
65+
- xcb_xkb_dep,
66+
- ],
67+
- )
68+
- x11_test_dep = declare_dependency(
69+
- link_with: libxkbcommon_x11_test_internal,
70+
- dependencies: [
71+
- test_dep,
72+
- xcb_dep,
73+
- xcb_xkb_dep,
74+
- ],
75+
- )
76+
-endif
77+
-# TODO: version range?
78+
-keysyms_test_dep = [test_dep]
79+
-keysyms_test_c_args = ['-DENABLE_PRIVATE_APIS']
80+
-icu_dep = dependency('icu-uc', required: false)
81+
-if icu_dep.found()
82+
- keysyms_test_dep += [icu_dep]
83+
- configh_data.set10('HAVE_ICU', true)
84+
-endif
85+
-test(
86+
- 'keysym',
87+
- executable('test-keysym', 'test/keysym.c', 'test/keysym.h',
88+
- dependencies: keysyms_test_dep,
89+
- c_args: keysyms_test_c_args),
90+
- env: test_env,
91+
-)
92+
-test(
93+
- 'keymap',
94+
- executable('test-keymap', 'test/keymap.c', 'test/keysym.h',
95+
- dependencies: test_dep),
96+
- env: test_env,
97+
-)
98+
-test(
99+
- 'filecomp',
100+
- executable('test-filecomp', 'test/filecomp.c', dependencies: test_dep),
101+
- env: test_env,
102+
-)
103+
-test(
104+
- 'context',
105+
- executable('test-context', 'test/context.c', dependencies: test_dep),
106+
- env: test_env,
107+
-)
108+
-test(
109+
- 'rules-file',
110+
- executable('test-rules-file', 'test/rules-file.c', dependencies: test_dep),
111+
- env: test_env,
112+
-)
113+
-test(
114+
- 'rules-file-includes',
115+
- executable('test-rules-file-includes', 'test/rules-file-includes.c', dependencies: test_dep),
116+
- env: test_env,
117+
-)
118+
-test(
119+
- 'stringcomp',
120+
- executable('test-stringcomp', 'test/stringcomp.c', dependencies: test_dep),
121+
- env: test_env,
122+
-)
123+
-test(
124+
- 'buffercomp',
125+
- executable('test-buffercomp', 'test/buffercomp.c', dependencies: test_dep),
126+
- env: test_env,
127+
-)
128+
-test(
129+
- 'log',
130+
- executable('test-log', 'test/log.c', dependencies: test_dep),
131+
- env: test_env,
132+
-)
133+
-test(
134+
- 'atom',
135+
- executable('test-atom', 'test/atom.c', dependencies: test_dep),
136+
- env: test_env,
137+
-)
138+
-test(
139+
- 'utf8',
140+
- executable('test-utf8', 'test/utf8.c', dependencies: test_dep),
141+
- env: test_env,
142+
-)
143+
-test(
144+
- 'state',
145+
- executable('test-state', 'test/state.c', dependencies: test_dep),
146+
- env: test_env,
147+
-)
148+
-test(
149+
- 'keyseq',
150+
- executable('test-keyseq', 'test/keyseq.c', dependencies: test_dep),
151+
- env: test_env,
152+
-)
153+
-test(
154+
- 'rulescomp',
155+
- executable('test-rulescomp', 'test/rulescomp.c', dependencies: test_dep),
156+
- env: test_env,
157+
-)
158+
-test(
159+
- 'compose',
160+
- executable('test-compose', 'test/compose.c', dependencies: test_dep),
161+
- env: test_env,
162+
-)
163+
-test(
164+
- 'utils',
165+
- executable('test-utils', 'test/utils.c', dependencies: test_dep),
166+
- env: test_env,
167+
-)
168+
-test(
169+
- 'symbols-leak-test',
170+
- find_program('test/symbols-leak-test.py'),
171+
- env: test_env,
172+
- suite: ['python-tests'],
173+
-)
174+
-test(
175+
- 'modifiers',
176+
- executable('test-modifiers', 'test/modifiers.c', dependencies: test_dep),
177+
- env: test_env,
178+
-)
179+
-test(
180+
- 'messages',
181+
- executable(
182+
- 'test-messages',
183+
- 'test/messages.c',
184+
- 'tools/messages.c',
185+
- 'tools/messages.h',
186+
- include_directories: include_directories('src', 'include', 'tools'),
187+
- dependencies: test_dep),
188+
- env: test_env,
189+
-)
190+
-if get_option('enable-x11')
191+
- test(
192+
- 'x11',
193+
- executable('test-x11', 'test/x11.c', dependencies: x11_test_dep),
194+
- env: test_env,
195+
- is_parallel : false,
196+
- )
197+
- test(
198+
- 'x11comp',
199+
- executable('test-x11comp', 'test/x11comp.c', dependencies: x11_test_dep),
200+
- env: test_env,
201+
- is_parallel : false,
202+
- )
203+
-endif
204+
-if get_option('enable-xkbregistry')
205+
- test(
206+
- 'registry',
207+
- executable('test-registry', 'test/registry.c',
208+
- include_directories: include_directories('src'),
209+
- dependencies: [dep_libxkbregistry, test_dep]),
210+
- env: test_env,
211+
- )
212+
-endif
213+
-if build_tools
214+
- test('tool-option-parsing',
215+
- find_program('test/tool-option-parsing.py'),
216+
- env: test_env,
217+
- suite: ['python-tests'])
218+
-
219+
- # A set of keysyms to test for. Add one or two symbols to this array
220+
- # whenever the xorgproto gets updated to make sure we resolve them.
221+
- keysyms_to_test = [
222+
- 'XF86Macro23',
223+
- ]
224+
-
225+
- env = environment()
226+
- env.set('XKB_CONFIG_ROOT', meson.current_source_dir()/'test'/'data')
227+
- foreach keysym: keysyms_to_test
228+
- test('keysym-test-@0@'.format(keysym),
229+
- find_program('test/test-keysym.py'),
230+
- env: env,
231+
- args: [keysym, '--tool', xkbcli_compile_keymap],
232+
- suite: ['python-tests'])
233+
- endforeach
234+
-endif
235+
-
236+
-valgrind = find_program('valgrind', required: false)
237+
-if valgrind.found()
238+
- add_test_setup('valgrind',
239+
- exe_wrapper: [valgrind,
240+
- '--leak-check=full',
241+
- '--track-origins=yes',
242+
- '--gen-suppressions=all',
243+
- '--error-exitcode=99'],
244+
- timeout_multiplier : 10)
245+
-else
246+
- message('valgrind not found, disabling valgrind test setup')
247+
-endif
248+
-
249+
-
250+
-# Fuzzing target programs.
251+
-executable('fuzz-keymap', 'fuzz/keymap/target.c', dependencies: test_dep)
252+
-executable('fuzz-compose', 'fuzz/compose/target.c', dependencies: test_dep)
253+
-
254+
-
255+
-# Benchmarks.
256+
-bench_env = environment()
257+
-bench_env.set('top_srcdir', meson.current_source_dir())
258+
-benchmark(
259+
- 'key-proc',
260+
- executable('bench-key-proc', 'bench/key-proc.c', dependencies: test_dep),
261+
- env: bench_env,
262+
-)
263+
-benchmark(
264+
- 'rules',
265+
- executable('bench-rules', 'bench/rules.c', dependencies: test_dep),
266+
- env: bench_env,
267+
-)
268+
-benchmark(
269+
- 'rulescomp',
270+
- executable('bench-rulescomp', 'bench/rulescomp.c', dependencies: test_dep),
271+
- env: bench_env,
272+
-)
273+
-benchmark(
274+
- 'compose',
275+
- executable('bench-compose', 'bench/compose.c', dependencies: test_dep),
276+
- env: bench_env,
277+
-)
278+
-benchmark(
279+
- 'compose-traversal',
280+
- executable('bench-compose-traversal', 'bench/compose-traversal.c', dependencies: test_dep),
281+
- env: bench_env,
282+
-)
283+
-benchmark(
284+
- 'atom',
285+
- executable('bench-atom', 'bench/atom.c', dependencies: test_dep),
286+
- env: bench_env,
287+
-)
288+
-if get_option('enable-x11')
289+
- benchmark(
290+
- 'x11',
291+
- executable('bench-x11', 'bench/x11.c', dependencies: x11_test_dep),
292+
- env: bench_env,
293+
- )
294+
-endif
295+
-
296+
-
297+
# Documentation.
298+
if get_option('enable-docs')
299+
doxygen = find_program('doxygen', required: false)
300+
diff --git a/src/utils.h b/src/utils.h
301+
index 7fd13bf..750a8e1 100644
302+
--- a/src/utils.h
303+
+++ b/src/utils.h
304+
@@ -289,13 +289,13 @@ open_file(const char *path);
305+
306+
/* Compiler Attributes */
307+
308+
-#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__CYGWIN__)
309+
-# define XKB_EXPORT __attribute__((visibility("default")))
310+
-#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
311+
-# define XKB_EXPORT __global
312+
-#else /* not gcc >= 4 and not Sun Studio >= 8 */
313+
+// #if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__CYGWIN__)
314+
+// # define XKB_EXPORT __attribute__((visibility("default")))
315+
+// #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
316+
+// # define XKB_EXPORT __global
317+
+// #else /* not gcc >= 4 and not Sun Studio >= 8 */
318+
# define XKB_EXPORT
319+
-#endif
320+
+// #endif
321+
322+
#if defined(__MINGW32__)
323+
# define ATTR_PRINTF(x,y) __attribute__((__format__(__MINGW_PRINTF_FORMAT, x, y)))

0 commit comments

Comments
 (0)