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:
parent
4e4ab1c32a
commit
37ab1a25ec
28
meson.build
28
meson.build
|
@ -967,18 +967,20 @@ libjournal_core = static_library(
|
||||||
libsystemd_journal_internal],
|
libsystemd_journal_internal],
|
||||||
install : false)
|
install : false)
|
||||||
|
|
||||||
version_script_arg = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
|
libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
|
||||||
libsystemd = shared_library(
|
libsystemd = shared_library(
|
||||||
'systemd',
|
'systemd',
|
||||||
libsystemd_internal_sources,
|
libsystemd_internal_sources,
|
||||||
|
libsystemd_journal_internal_sources,
|
||||||
version : '0.18.0',
|
version : '0.18.0',
|
||||||
include_directories : includes,
|
include_directories : includes,
|
||||||
link_args : ['-shared',
|
link_args : ['-shared',
|
||||||
'-Wl,--version-script=' + version_script_arg],
|
'-Wl,--version-script=' + libsystemd_sym_path],
|
||||||
link_with : [libbasic,
|
link_with : [libbasic],
|
||||||
libsystemd_internal,
|
dependencies : [threads,
|
||||||
libsystemd_journal_internal],
|
librt,
|
||||||
dependencies : [threads],
|
libxz,
|
||||||
|
liblz4],
|
||||||
link_depends : libsystemd_sym,
|
link_depends : libsystemd_sym,
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : rootlibdir)
|
install_dir : rootlibdir)
|
||||||
|
@ -1932,6 +1934,20 @@ foreach tuple : tests
|
||||||
endif
|
endif
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
|
test_libsystemd_sym = executable(
|
||||||
|
'test-libsystemd-sym',
|
||||||
|
test_libsystemd_sym_c,
|
||||||
|
include_directories : includes,
|
||||||
|
# link_with : [libsystemd],
|
||||||
|
# TODO: try again with https://github.com/mesonbuild/meson/pull/1545
|
||||||
|
link_args : ['libsystemd.so.0.18.0'],
|
||||||
|
# link_depends : [libsystemd],
|
||||||
|
# TODO: try again after "Link_depends arguments must be strings." is solved
|
||||||
|
install : install_tests,
|
||||||
|
install_dir : testsdir)
|
||||||
|
test('test-libsystemd-sym',
|
||||||
|
test_libsystemd_sym)
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
|
|
||||||
make_directive_index_py = find_program('tools/make-directive-index.py')
|
make_directive_index_py = find_program('tools/make-directive-index.py')
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- mode: meson -*-
|
# -*- mode: meson -*-
|
||||||
|
|
||||||
headers = '''
|
systemd_headers = files('''
|
||||||
sd-bus.h
|
sd-bus.h
|
||||||
sd-bus-protocol.h
|
sd-bus-protocol.h
|
||||||
sd-bus-vtable.h
|
sd-bus-vtable.h
|
||||||
|
@ -10,8 +10,7 @@ headers = '''
|
||||||
sd-journal.h
|
sd-journal.h
|
||||||
sd-login.h
|
sd-login.h
|
||||||
sd-messages.h
|
sd-messages.h
|
||||||
_sd-common.h
|
'''.split())
|
||||||
'''.split()
|
|
||||||
|
|
||||||
# sd-device.h
|
# sd-device.h
|
||||||
# sd-hwdb.h
|
# sd-hwdb.h
|
||||||
|
@ -30,4 +29,7 @@ headers = '''
|
||||||
# sd-resolve.h
|
# sd-resolve.h
|
||||||
# sd-utf8.h
|
# sd-utf8.h
|
||||||
|
|
||||||
install_headers(headers, subdir : 'systemd')
|
install_headers(
|
||||||
|
systemd_headers,
|
||||||
|
'_sd-common.h',
|
||||||
|
subdir : 'systemd')
|
||||||
|
|
|
@ -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.set('PATH', path)
|
||||||
test_env.prepend('PATH', meson.build_root())
|
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 += [
|
tests += [
|
||||||
[['src/test/test-device-nodes.c'],
|
[['src/test/test-device-nodes.c'],
|
||||||
[libshared],
|
[libshared],
|
||||||
|
|
Loading…
Reference in New Issue