meson: add test-libsystemd-sym, fix linking of libsystemd
This is quite messy. I think libtool might have been using something like -Wl,--whole-archive, but I don't think meson has support for that. For now, just recompile all the sources for linking into libsystemd directly. This should not matter much for efficiency, since it's a few small files.
This commit is contained in:
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/python3
|
||||
import sys, re
|
||||
|
||||
print('#include <stdio.h>')
|
||||
for header in sys.argv[2:]:
|
||||
print('#include "{}"'.format(header.split('/')[-1]))
|
||||
|
||||
print('''
|
||||
void* functions[] = {''')
|
||||
|
||||
for line in open(sys.argv[1]):
|
||||
match = re.search('^ +([a-zA-Z0-9_]+);', line)
|
||||
if match:
|
||||
print(' {},'.format(match.group(1)))
|
||||
|
||||
print('''};
|
||||
|
||||
int main(void) {
|
||||
unsigned i;
|
||||
for (i = 0; i < sizeof(functions)/sizeof(void*); i++)
|
||||
printf("%p\\n", functions[i]);
|
||||
return 0;
|
||||
}''')
|
||||
@@ -17,6 +17,19 @@ test_env.set('SYSTEMD_LANGUAGE_FALLBACK_MAP', language_fallback_map)
|
||||
test_env.set('PATH', path)
|
||||
test_env.prepend('PATH', meson.build_root())
|
||||
|
||||
############################################################
|
||||
|
||||
generate_sym_test_py = find_program('generate-sym-test.py')
|
||||
|
||||
test_libsystemd_sym_c = custom_target(
|
||||
'test-libsystemd-sym.c',
|
||||
input : [libsystemd_sym_path] + systemd_headers,
|
||||
output : 'test-libsystemd-sym.c',
|
||||
command : [generate_sym_test_py, libsystemd_sym_path] + systemd_headers,
|
||||
capture : true)
|
||||
|
||||
############################################################
|
||||
|
||||
tests += [
|
||||
[['src/test/test-device-nodes.c'],
|
||||
[libshared],
|
||||
|
||||
Reference in New Issue
Block a user