mirror of
https://github.com/systemd/systemd.git
synced 2025-03-19 22:50:17 +03:00
Merge pull request #8689 from davide125/static
meson: add support for building static libsystemd and libudev
This commit is contained in:
commit
f5ce2e764f
62
meson.build
62
meson.build
@ -1323,6 +1323,31 @@ libsystemd = shared_library(
|
||||
install : true,
|
||||
install_dir : rootlibdir)
|
||||
|
||||
static_libsystemd = get_option('static-libsystemd')
|
||||
static_libsystemd_pic = static_libsystemd == 'true' or static_libsystemd == 'pic'
|
||||
|
||||
install_libsystemd_static = static_library(
|
||||
'systemd',
|
||||
libsystemd_sources,
|
||||
journal_client_sources,
|
||||
basic_sources,
|
||||
basic_gcrypt_sources,
|
||||
include_directories : includes,
|
||||
build_by_default : static_libsystemd != 'false',
|
||||
install : static_libsystemd != 'false',
|
||||
install_dir : rootlibdir,
|
||||
pic : static_libsystemd == 'true' or static_libsystemd == 'pic',
|
||||
dependencies : [threads,
|
||||
librt,
|
||||
libxz,
|
||||
liblz4,
|
||||
libcap,
|
||||
libblkid,
|
||||
libmount,
|
||||
libselinux,
|
||||
libgcrypt],
|
||||
c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
|
||||
|
||||
############################################################
|
||||
|
||||
# binaries that have --help and are intended for use by humans,
|
||||
@ -2522,17 +2547,30 @@ foreach tuple : tests
|
||||
endif
|
||||
endforeach
|
||||
|
||||
test_libsystemd_sym = executable(
|
||||
exe = executable(
|
||||
'test-libsystemd-sym',
|
||||
test_libsystemd_sym_c,
|
||||
include_directories : includes,
|
||||
link_with : [libsystemd],
|
||||
install : install_tests,
|
||||
install_dir : testsdir)
|
||||
test('test-libsystemd-sym',
|
||||
test_libsystemd_sym)
|
||||
test('test-libsystemd-sym', exe)
|
||||
|
||||
test_libudev_sym = executable(
|
||||
exe = executable(
|
||||
'test-libsystemd-static-sym',
|
||||
test_libsystemd_sym_c,
|
||||
include_directories : includes,
|
||||
link_with : [install_libsystemd_static],
|
||||
dependencies : [threads], # threads is already included in dependencies on the library,
|
||||
# but does not seem to get propagated. Add here as a work-around.
|
||||
build_by_default : static_libsystemd_pic,
|
||||
install : install_tests and static_libsystemd_pic,
|
||||
install_dir : testsdir)
|
||||
if static_libsystemd_pic
|
||||
test('test-libsystemd-static-sym', exe)
|
||||
endif
|
||||
|
||||
exe = executable(
|
||||
'test-libudev-sym',
|
||||
test_libudev_sym_c,
|
||||
include_directories : includes,
|
||||
@ -2540,8 +2578,20 @@ test_libudev_sym = executable(
|
||||
link_with : [libudev],
|
||||
install : install_tests,
|
||||
install_dir : testsdir)
|
||||
test('test-libudev-sym',
|
||||
test_libudev_sym)
|
||||
test('test-libudev-sym', exe)
|
||||
|
||||
exe = executable(
|
||||
'test-libudev-static-sym',
|
||||
test_libudev_sym_c,
|
||||
include_directories : includes,
|
||||
c_args : ['-Wno-deprecated-declarations'],
|
||||
link_with : [install_libudev_static],
|
||||
build_by_default : static_libudev_pic,
|
||||
install : install_tests and static_libudev_pic,
|
||||
install_dir : testsdir)
|
||||
if static_libudev_pic
|
||||
test('test-libudev-static-sym', exe)
|
||||
endif
|
||||
|
||||
############################################################
|
||||
|
||||
|
@ -13,6 +13,12 @@ option('rootprefix', type : 'string',
|
||||
description : '''override the root prefix''')
|
||||
option('link-udev-shared', type : 'boolean',
|
||||
description : 'link systemd-udev and its helpers to libsystemd-shared.so')
|
||||
option('static-libsystemd', type : 'combo',
|
||||
choices : ['false', 'true', 'pic', 'no-pic'],
|
||||
description : '''install a static library for libsystemd''')
|
||||
option('static-libudev', type : 'combo',
|
||||
choices : ['false', 'true', 'pic', 'no-pic'],
|
||||
description : '''install a static library for libudev''')
|
||||
|
||||
option('sysvinit-path', type : 'string', value : '/etc/init.d',
|
||||
description : 'the directory where the SysV init scripts are located')
|
||||
|
@ -302,6 +302,9 @@ foreach item : [['af', af_list_txt, 'af', ''],
|
||||
endforeach
|
||||
|
||||
basic_sources += [missing_h] + generated_gperf_headers
|
||||
basic_gcrypt_sources = files(
|
||||
'gcrypt-util.c',
|
||||
'gcrypt-util.h')
|
||||
|
||||
libbasic = static_library(
|
||||
'basic',
|
||||
@ -319,8 +322,7 @@ libbasic = static_library(
|
||||
# unnecessary linking to libgcrypt.
|
||||
libbasic_gcrypt = static_library(
|
||||
'basic-gcrypt',
|
||||
'gcrypt-util.c',
|
||||
'gcrypt-util.h',
|
||||
basic_gcrypt_sources,
|
||||
include_directories : includes,
|
||||
dependencies : [libgcrypt],
|
||||
c_args : ['-fvisibility=default'])
|
||||
|
@ -82,15 +82,17 @@ libsystemd_sources = files('''
|
||||
sd-utf8/sd-utf8.c
|
||||
'''.split()) + id128_sources + sd_daemon_c + sd_event_c + sd_login_c
|
||||
|
||||
libsystemd_c_args = ['-fvisibility=default']
|
||||
|
||||
libsystemd_static = static_library(
|
||||
'systemd',
|
||||
'systemd_static',
|
||||
libsystemd_sources,
|
||||
install : false,
|
||||
include_directories : includes,
|
||||
link_with : libbasic,
|
||||
dependencies : [threads,
|
||||
librt],
|
||||
c_args : ['-fvisibility=default'])
|
||||
c_args : libsystemd_c_args)
|
||||
|
||||
libsystemd_sym = 'src/libsystemd/libsystemd.sym'
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#
|
||||
# Copyright 2017 Zbigniew Jędrzejewski-Szmek
|
||||
|
||||
shared_sources = '''
|
||||
shared_sources = files('''
|
||||
acl-util.h
|
||||
acpi-fpdt.c
|
||||
acpi-fpdt.h
|
||||
@ -104,25 +104,25 @@ shared_sources = '''
|
||||
watchdog.c
|
||||
watchdog.h
|
||||
wireguard-netlink.h
|
||||
'''.split()
|
||||
'''.split())
|
||||
|
||||
test_tables_h = files('test-tables.h')
|
||||
shared_sources += [test_tables_h]
|
||||
|
||||
if conf.get('HAVE_ACL') == 1
|
||||
shared_sources += ['acl-util.c']
|
||||
shared_sources += files('acl-util.c')
|
||||
endif
|
||||
|
||||
if conf.get('ENABLE_UTMP') == 1
|
||||
shared_sources += ['utmp-wtmp.c']
|
||||
shared_sources += files('utmp-wtmp.c')
|
||||
endif
|
||||
|
||||
if conf.get('HAVE_SECCOMP') == 1
|
||||
shared_sources += ['seccomp-util.c']
|
||||
shared_sources += files('seccomp-util.c')
|
||||
endif
|
||||
|
||||
if conf.get('HAVE_LIBIPTC') == 1
|
||||
shared_sources += ['firewall-util.c']
|
||||
shared_sources += files('firewall-util.c')
|
||||
endif
|
||||
|
||||
libshared_name = 'systemd-shared-@0@'.format(meson.project_version())
|
||||
|
@ -111,12 +111,29 @@ libudev_basic = static_library(
|
||||
c_args : ['-fvisibility=default'])
|
||||
|
||||
libudev_static = static_library(
|
||||
'udev',
|
||||
'udev_static',
|
||||
'udev.h',
|
||||
include_directories : includes,
|
||||
link_with : udev_link_with,
|
||||
link_whole : libudev_basic)
|
||||
|
||||
static_libudev = get_option('static-libudev')
|
||||
static_libudev_pic = static_libudev == 'true' or static_libudev == 'pic'
|
||||
install_libudev_static = static_library(
|
||||
'udev',
|
||||
basic_sources,
|
||||
shared_sources,
|
||||
libsystemd_sources,
|
||||
libudev_sources,
|
||||
include_directories : includes,
|
||||
build_by_default : static_libudev != 'false',
|
||||
install : static_libudev != 'false',
|
||||
install_dir : rootlibdir,
|
||||
link_depends : libudev_sym,
|
||||
dependencies : libshared_deps + [libmount],
|
||||
c_args : static_libudev_pic ? [] : ['-fno-PIC'],
|
||||
pic : static_libudev_pic)
|
||||
|
||||
libudev = shared_library(
|
||||
'udev',
|
||||
'udev.h', # pick a header file at random to work around old meson bug
|
||||
|
Loading…
x
Reference in New Issue
Block a user