]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network, meson: allow statically linked build
authorRobert Scheck <robert@fedoraproject.org>
Wed, 8 Jan 2020 01:36:07 +0000 (02:36 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 8 Jan 2020 08:50:32 +0000 (09:50 +0100)
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.

meson.build
meson_options.txt
src/network/meson.build

index 004f01521cb5ee8c183f20f09ed709d9ddc21a58..3b3786bbdb512942ab416754f465a63a844decda 100644 (file)
@@ -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
index 8a1143a7ec4c30843cb39e6d9ccba3cff42e29b2..4d641c3671240fea9f428e595d1fbfb0c97179ff 100644 (file)
@@ -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''')
index 3843ffbca9727c3884a57a494090b36bd28b0c6d..7cb1bb5a388a82fbbb94698047f68681e5850597 100644 (file)
@@ -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