1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

network, meson: allow statically linked build

Build option "link-networkd-shared" to build a statically linked
systemd-networkd by using

  -Dlink-udev-shared=false -Dlink-networkd-shared=false

on systems with full systemd stack except systemd-networkd, such
as RHEL/CentOS 8.
This commit is contained in:
Robert Scheck 2020-01-08 02:36:07 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent 31ffbfd101
commit 5ac8b50d58
3 changed files with 22 additions and 10 deletions

View File

@ -2762,7 +2762,7 @@ if conf.get('ENABLE_NETWORKD') == 1
link_with : [libnetworkd_core, link_with : [libnetworkd_core,
libsystemd_network, libsystemd_network,
libudev_static, libudev_static,
libshared], networkd_link_with],
dependencies : [threads], dependencies : [threads],
install_rpath : rootlibexecdir, install_rpath : rootlibexecdir,
install : true, install : true,
@ -2772,7 +2772,7 @@ if conf.get('ENABLE_NETWORKD') == 1
systemd_networkd_wait_online_sources, systemd_networkd_wait_online_sources,
include_directories : includes, include_directories : includes,
link_with : [libnetworkd_core, link_with : [libnetworkd_core,
libshared], networkd_link_with],
install_rpath : rootlibexecdir, install_rpath : rootlibexecdir,
install : true, install : true,
install_dir : rootlibexecdir) install_dir : rootlibexecdir)
@ -2781,7 +2781,7 @@ if conf.get('ENABLE_NETWORKD') == 1
networkctl_sources, networkctl_sources,
include_directories : includes, include_directories : includes,
link_with : [libsystemd_network, link_with : [libsystemd_network,
libshared], networkd_link_with],
install_rpath : rootlibexecdir, install_rpath : rootlibexecdir,
install : true, install : true,
install_dir : rootbindir) install_dir : rootbindir)
@ -2790,7 +2790,7 @@ if conf.get('ENABLE_NETWORKD') == 1
executable('systemd-network-generator', executable('systemd-network-generator',
network_generator_sources, network_generator_sources,
include_directories : includes, include_directories : includes,
link_with : [libshared], link_with : [networkd_link_with],
install_rpath : rootlibexecdir, install_rpath : rootlibexecdir,
install : true, install : true,
install_dir : rootlibexecdir) install_dir : rootlibexecdir)
@ -3296,6 +3296,7 @@ foreach tuple : [
['trace logging', conf.get('LOG_TRACE') == 1], ['trace logging', conf.get('LOG_TRACE') == 1],
['link-udev-shared', get_option('link-udev-shared')], ['link-udev-shared', get_option('link-udev-shared')],
['link-systemctl-shared', get_option('link-systemctl-shared')], ['link-systemctl-shared', get_option('link-systemctl-shared')],
['link-networkd-shared', get_option('link-networkd-shared')],
] ]
if tuple.length() >= 2 if tuple.length() >= 2

View File

@ -16,6 +16,8 @@ option('link-udev-shared', type : 'boolean',
description : 'link systemd-udev and its helpers to libsystemd-shared.so') description : 'link systemd-udev and its helpers to libsystemd-shared.so')
option('link-systemctl-shared', type: 'boolean', option('link-systemctl-shared', type: 'boolean',
description : 'link systemctl against libsystemd-shared.so') description : 'link systemctl against libsystemd-shared.so')
option('link-networkd-shared', type: 'boolean',
description : 'link systemd-networkd and its helpers to libsystemd-shared.so')
option('static-libsystemd', type : 'combo', option('static-libsystemd', type : 'combo',
choices : ['false', 'true', 'pic', 'no-pic'], choices : ['false', 'true', 'pic', 'no-pic'],
description : '''install a static library for libsystemd''') description : '''install a static library for libsystemd''')

View File

@ -146,6 +146,15 @@ network_generator_sources = files('''
network_include_dir = [includes, include_directories(['.', 'netdev', 'tc'])] network_include_dir = [includes, include_directories(['.', 'netdev', 'tc'])]
if conf.get('ENABLE_NETWORKD') == 1 if conf.get('ENABLE_NETWORKD') == 1
if get_option('link-networkd-shared')
networkd_link_with = [libshared]
else
networkd_link_with = [libsystemd_static,
libshared_static,
libjournal_client,
libbasic_gcrypt]
endif
networkd_gperf_c = custom_target( networkd_gperf_c = custom_target(
'networkd-gperf.c', 'networkd-gperf.c',
input : 'networkd-gperf.gperf', input : 'networkd-gperf.gperf',
@ -172,7 +181,7 @@ if conf.get('ENABLE_NETWORKD') == 1
networkd_network_gperf_c, networkd_network_gperf_c,
netdev_gperf_c, netdev_gperf_c,
include_directories : network_include_dir, include_directories : network_include_dir,
link_with : [libshared]) link_with : [networkd_link_with])
install_data('org.freedesktop.network1.conf', install_data('org.freedesktop.network1.conf',
install_dir : dbuspolicydir) install_dir : dbuspolicydir)
@ -198,7 +207,7 @@ if conf.get('ENABLE_NETWORKD') == 1
[libnetworkd_core, [libnetworkd_core,
libudev_static, libudev_static,
libsystemd_network, libsystemd_network,
libshared], networkd_link_with],
[threads], [threads],
[], [],
network_include_dir], network_include_dir],
@ -208,7 +217,7 @@ if conf.get('ENABLE_NETWORKD') == 1
[libnetworkd_core, [libnetworkd_core,
libudev_static, libudev_static,
libsystemd_network, libsystemd_network,
libshared], networkd_link_with],
[threads], [threads],
[], [],
network_include_dir], network_include_dir],
@ -225,7 +234,7 @@ if conf.get('ENABLE_NETWORKD') == 1
[libnetworkd_core, [libnetworkd_core,
libudev_static, libudev_static,
libsystemd_network, libsystemd_network,
libshared], networkd_link_with],
[threads], [threads],
'', '', [], network_include_dir], '', '', [], network_include_dir],
@ -240,7 +249,7 @@ if conf.get('ENABLE_NETWORKD') == 1
[libnetworkd_core, [libnetworkd_core,
libudev_static, libudev_static,
libsystemd_network, libsystemd_network,
libshared], networkd_link_with],
[threads], [threads],
'', '', [], '', '', [],
[network_include_dir]], [network_include_dir]],
@ -248,7 +257,7 @@ if conf.get('ENABLE_NETWORKD') == 1
[['src/network/generator/test-network-generator.c', [['src/network/generator/test-network-generator.c',
'src/network/generator/network-generator.c', 'src/network/generator/network-generator.c',
'src/network/generator/network-generator.h'], 'src/network/generator/network-generator.h'],
[libshared], [networkd_link_with],
[], '', '', [], network_include_dir], [], '', '', [], network_include_dir],
] ]
endif endif