]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: build .standalone versions of the report binaries
authorZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Fri, 3 Jul 2026 11:28:36 +0000 (13:28 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Tue, 7 Jul 2026 11:40:13 +0000 (13:40 +0200)
The goal is to be allow the use of those binaries on systemd with older
systemd. The report stuff is generally independent of the running systemd
version.

When built with -Dinstall-tests=true -Dstandalone-binaries=true
-Dbuildtype=release -Db_lto=true, gcc-16.1.1-2.fc44.x86_64, the sizes
are quite reasonable:

$ ls -lG build-lto/*.standalone
-rwxr-xr-x 1 zbyszek  713200 Jul  3 13:16 build-lto/systemd-report.standalone
-rwxr-xr-x 1 zbyszek  662936 Jul  3 13:16 build-lto/systemd-report-basic.standalone
-rwxr-xr-x 1 zbyszek  567424 Jul  3 13:16 build-lto/systemd-report-cgroup.standalone
-rwxr-xr-x 1 zbyszek  592856 Jul  3 13:16 build-lto/systemd-report-files.standalone
-rwxr-xr-x 1 zbyszek  589864 Jul  3 13:16 build-lto/systemd-report-sign-plain.standalone
-rwxr-xr-x 1 zbyszek  548624 Jul  3 13:16 build-lto/systemd-report-sign-tsm.standalone

src/report/meson.build

index cc2cea521e41b4966eddcfe9ad2babbd23455ac5..2c49a97fbf64f5625e7c552222ff28a4cb33ea82 100644 (file)
@@ -1,10 +1,10 @@
 # SPDX-License-Identifier: LGPL-2.1-or-later
 
-executables += [
-        libexec_template + {
+report_executables = [
+        {
                 'name' : 'systemd-report',
                 'public' : true,
-                'sources' : files(
+                'export' : files(
                         'report.c',
                         'report-generate.c',
                         'report-sign.c',
@@ -14,43 +14,63 @@ executables += [
                         libcurl_cflags,
                 ],
         },
-
-        libexec_template + {
+        {
                 'name' : 'systemd-report-basic',
                 'public' : true,
-                'sources' : files(
-                        'report-basic-server.c',
+                'export' : files(
                         'report-basic.c',
+                        'report-basic-server.c',
                 ),
         },
-        libexec_template + {
+        {
                 'name' : 'systemd-report-cgroup',
-                'sources' : files(
+                'export' : files(
                         'report-cgroup.c',
                         'report-cgroup-server.c',
                 ),
         },
-        libexec_template + {
+        {
                 'name' : 'systemd-report-files',
-                'sources' : files(
+                'export' : files(
                         'report-files.c',
                         'report-files-server.c',
                 ),
         },
-        libexec_template + {
+        {
                 'name' : 'systemd-report-sign-plain',
-                'sources' : files(
+                'export' : files(
                         'report-sign-plain.c',
                 ),
                 'dependencies' : libopenssl_cflags,
-                'conditions' : [
-                        'HAVE_OPENSSL',
-                ],
+                'conditions' : ['HAVE_OPENSSL'],
         },
-        libexec_template + {
+        {
                 'name' : 'systemd-report-sign-tsm',
-                'sources' : files(
+                'export' : files(
                         'report-sign-tsm.c',
                 ),
         },
 ]
+
+foreach exe : report_executables
+        exe2 = {
+                'name' : exe['name'] + '.standalone',
+                'import' : [exe['name']],
+                'link_with' : [
+                        libc_wrapper_static,
+                        libbasic_static,
+                        libshared_static,
+                        libsystemd_static,
+                ]
+        }
+        foreach optional : ['public', 'dependencies', 'conditions']
+                if optional in exe
+                        exe2 += { optional : exe[optional] }
+                endif
+        endforeach
+
+        executables += [
+                libexec_template + exe,
+                libexec_template + exe2,
+        ]
+endforeach