1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-28 03:25:31 +03:00

Merge pull request #21774 from keszybz/make-libcore-shared-and-add-lib-tag-option

Make libcore shared and add private shared lib tag option
This commit is contained in:
Yu Watanabe 2021-12-25 18:02:54 +09:00 committed by GitHub
commit 61d99ab9fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 36 additions and 25 deletions

View File

@ -599,6 +599,11 @@ endif
versiondep = declare_dependency(sources: version_h)
shared_lib_tag = get_option('shared-lib-tag')
if shared_lib_tag == ''
shared_lib_tag = meson.project_version()
endif
sh = find_program('sh')
echo = find_program('echo')
sed = find_program('sed')
@ -2021,12 +2026,7 @@ dbus_programs += executable(
link_with : [libcore,
libshared],
dependencies : [versiondep,
threads,
librt,
libseccomp,
libselinux,
libmount,
libblkid],
libseccomp],
install_rpath : rootlibexecdir,
install : true,
install_dir : rootlibexecdir)
@ -2042,12 +2042,7 @@ public_programs += executable(
link_with : [libcore,
libshared],
dependencies : [versiondep,
threads,
librt,
libseccomp,
libselinux,
libmount,
libblkid],
libseccomp],
install_rpath : rootlibexecdir,
install : conf.get('ENABLE_ANALYZE'))
@ -3912,6 +3907,7 @@ summary({
'D-Bus system directory' : dbussystemservicedir,
'bash completions directory' : bashcompletiondir,
'zsh completions directory' : zshcompletiondir,
'private shared lib version tag' : shared_lib_tag,
'extra start script' : get_option('rc-local'),
'debug shell' : '@0@ @ @1@'.format(get_option('debug-shell'),
get_option('debug-tty')),

View File

@ -3,6 +3,8 @@
option('version-tag', type : 'string',
description : 'override the git version string')
option('shared-lib-tag', type : 'string',
description : 'override the private shared library version tag (defaults to project version)')
option('mode', type : 'combo', choices : ['developer', 'release'],
description : 'autoenable features suitable for systemd development/release builds')

View File

@ -167,12 +167,18 @@ load_fragment_gperf_nulstr_c = custom_target(
command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
capture : true)
libcore = static_library(
'core',
libcore_name = 'systemd-core-@0@'.format(shared_lib_tag)
libcore = shared_library(
libcore_name,
libcore_sources,
load_fragment_gperf_c,
load_fragment_gperf_nulstr_c,
include_directories : includes,
c_args : ['-fvisibility=default'],
link_args : ['-shared',
'-Wl,--version-script=' + libshared_sym_path],
link_with : libshared,
dependencies : [versiondep,
threads,
libdl,
@ -184,8 +190,10 @@ libcore = static_library(
libapparmor,
libselinux,
libmount,
libblkid,
libacl],
build_by_default : false)
install : true,
install_dir : rootlibexecdir)
core_includes = [includes, include_directories('.')]

View File

@ -430,7 +430,7 @@ target2 = custom_target(
shared_generated_gperf_headers = [target1, target2]
shared_sources += shared_generated_gperf_headers
libshared_name = 'systemd-shared-@0@'.format(meson.project_version())
libshared_name = 'systemd-shared-@0@'.format(shared_lib_tag)
libshared_deps = [threads,
libacl,
@ -465,13 +465,13 @@ libshared_static = static_library(
libshared = shared_library(
libshared_name,
include_directories : includes,
c_args : ['-fvisibility=default'],
link_args : ['-shared',
'-Wl,--version-script=' + libshared_sym_path],
link_whole : [libshared_static,
libbasic,
libbasic_gcrypt,
libsystemd_static],
c_args : ['-fvisibility=default'],
dependencies : libshared_deps,
install : true,
install_dir : rootlibexecdir)

View File

@ -419,7 +419,8 @@ tests += [
libmount,
libxz,
liblz4,
libblkid],
libblkid,
libselinux],
[core_includes, journal_includes, udev_includes]],
[['src/test/test-prioq.c']],

View File

@ -1932,11 +1932,9 @@ inst_libs() {
while read -r line; do
[[ "$line" = 'not a dynamic executable' ]] && break
# Skip a harmless error when running the tests on a system with a significantly
# older systemd version (ldd tries to resolve the unprefixed RPATH for libsystemd.so.0,
# which is in this case older than the already installed libsystemd.so.0 in $initdir).
# The issue is triggered by installing test dependencies in install_missing_libraries().
[[ "$line" =~ libsystemd.so.*:\ version\ .*\ not\ found ]] && continue
# Ignore errors about our own stuff missing. This is most likely caused
# by ldd attempting to use the unprefixed RPATH.
[[ "$line" =~ libsystemd.*\ not\ found ]] && continue
if [[ "$line" =~ $so_regex ]]; then
file="${BASH_REMATCH[1]}"
@ -2309,7 +2307,7 @@ inst_binary() {
# In certain cases we might attempt to install a binary which is already
# present in the test image, yet it's missing from the host system.
# In such cases, let's check if the binary indeed exists in the image
# before doing any other chcecks. If it does, immediately return with
# before doing any other checks. If it does, immediately return with
# success.
if [[ $# -eq 1 ]]; then
for path in "" bin sbin usr/bin usr/sbin; do
@ -2328,6 +2326,10 @@ inst_binary() {
while read -r line; do
[[ "$line" = 'not a dynamic executable' ]] && break
# Ignore errors about our own stuff missing. This is most likely caused
# by ldd attempting to use the unprefixed RPATH.
[[ "$line" =~ libsystemd.*\ not\ found ]] && continue
if [[ "$line" =~ $so_regex ]]; then
file="${BASH_REMATCH[1]}"
[[ -e "${initdir}/$file" ]] && continue

View File

@ -67,7 +67,9 @@ df="$build/dns-fuzzing"
git clone --depth 1 https://github.com/CZ-NIC/dns-fuzzing "$df"
zip -jqr "$OUT/fuzz-dns-packet_seed_corpus.zip" "$df/packet"
install -Dt "$OUT/src/shared/" "$build"/src/shared/libsystemd-shared-*.so
install -Dt "$OUT/src/shared/" \
"$build"/src/shared/libsystemd-shared-*.so \
"$build"/src/core/libsystemd-core-*.so
wget -O "$OUT/fuzz-json.dict" https://raw.githubusercontent.com/rc0r/afl-fuzz/master/dictionaries/json.dict