summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Scheck <robert@fedoraproject.org>2020-01-08 02:36:07 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-01-08 09:50:32 +0100
commit5ac8b50d58946156094f7d4e6da8eec1209d9c3a (patch)
treefe6f96f93541ffd9f7d2bc307d3d7818444b09c9
parent31ffbfd1010d78351461e303caa05b58e2947bac (diff)
downloadsystemd-5ac8b50d58946156094f7d4e6da8eec1209d9c3a.tar.gz
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.
-rw-r--r--meson.build9
-rw-r--r--meson_options.txt2
-rw-r--r--src/network/meson.build21
3 files changed, 22 insertions, 10 deletions
diff --git a/meson.build b/meson.build
index 004f01521c..3b3786bbdb 100644
--- a/meson.build
+++ b/meson.build
@@ -2762,7 +2762,7 @@ if conf.get('ENABLE_NETWORKD') == 1
link_with : [libnetworkd_core,
libsystemd_network,
libudev_static,
- libshared],
+ networkd_link_with],
dependencies : [threads],
install_rpath : rootlibexecdir,
install : true,
@@ -2772,7 +2772,7 @@ if conf.get('ENABLE_NETWORKD') == 1
systemd_networkd_wait_online_sources,
include_directories : includes,
link_with : [libnetworkd_core,
- libshared],
+ networkd_link_with],
install_rpath : rootlibexecdir,
install : true,
install_dir : rootlibexecdir)
@@ -2781,7 +2781,7 @@ if conf.get('ENABLE_NETWORKD') == 1
networkctl_sources,
include_directories : includes,
link_with : [libsystemd_network,
- libshared],
+ networkd_link_with],
install_rpath : rootlibexecdir,
install : true,
install_dir : rootbindir)
@@ -2790,7 +2790,7 @@ if conf.get('ENABLE_NETWORKD') == 1
executable('systemd-network-generator',
network_generator_sources,
include_directories : includes,
- link_with : [libshared],
+ link_with : [networkd_link_with],
install_rpath : rootlibexecdir,
install : true,
install_dir : rootlibexecdir)
@@ -3296,6 +3296,7 @@ foreach tuple : [
['trace logging', conf.get('LOG_TRACE') == 1],
['link-udev-shared', get_option('link-udev-shared')],
['link-systemctl-shared', get_option('link-systemctl-shared')],
+ ['link-networkd-shared', get_option('link-networkd-shared')],
]
if tuple.length() >= 2
diff --git a/meson_options.txt b/meson_options.txt
index 8a1143a7ec..4d641c3671 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -16,6 +16,8 @@ option('link-udev-shared', type : 'boolean',
description : 'link systemd-udev and its helpers to libsystemd-shared.so')
option('link-systemctl-shared', type: 'boolean',
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',
choices : ['false', 'true', 'pic', 'no-pic'],
description : '''install a static library for libsystemd''')
diff --git a/src/network/meson.build b/src/network/meson.build
index 3843ffbca9..7cb1bb5a38 100644
--- a/src/network/meson.build
+++ b/src/network/meson.build
@@ -146,6 +146,15 @@ network_generator_sources = files('''
network_include_dir = [includes, include_directories(['.', 'netdev', 'tc'])]
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',
input : 'networkd-gperf.gperf',
@@ -172,7 +181,7 @@ if conf.get('ENABLE_NETWORKD') == 1
networkd_network_gperf_c,
netdev_gperf_c,
include_directories : network_include_dir,
- link_with : [libshared])
+ link_with : [networkd_link_with])
install_data('org.freedesktop.network1.conf',
install_dir : dbuspolicydir)
@@ -198,7 +207,7 @@ if conf.get('ENABLE_NETWORKD') == 1
[libnetworkd_core,
libudev_static,
libsystemd_network,
- libshared],
+ networkd_link_with],
[threads],
[],
network_include_dir],
@@ -208,7 +217,7 @@ if conf.get('ENABLE_NETWORKD') == 1
[libnetworkd_core,
libudev_static,
libsystemd_network,
- libshared],
+ networkd_link_with],
[threads],
[],
network_include_dir],
@@ -225,7 +234,7 @@ if conf.get('ENABLE_NETWORKD') == 1
[libnetworkd_core,
libudev_static,
libsystemd_network,
- libshared],
+ networkd_link_with],
[threads],
'', '', [], network_include_dir],
@@ -240,7 +249,7 @@ if conf.get('ENABLE_NETWORKD') == 1
[libnetworkd_core,
libudev_static,
libsystemd_network,
- libshared],
+ networkd_link_with],
[threads],
'', '', [],
[network_include_dir]],
@@ -248,7 +257,7 @@ if conf.get('ENABLE_NETWORKD') == 1
[['src/network/generator/test-network-generator.c',
'src/network/generator/network-generator.c',
'src/network/generator/network-generator.h'],
- [libshared],
+ [networkd_link_with],
[], '', '', [], network_include_dir],
]
endif