From 9155c0a5b9e65153b86b738682d2827f1c8761a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 3 Jul 2026 13:28:36 +0200 Subject: [PATCH] meson: build .standalone versions of the report binaries 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 | 56 ++++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/src/report/meson.build b/src/report/meson.build index cc2cea521e..2c49a97fbf 100644 --- a/src/report/meson.build +++ b/src/report/meson.build @@ -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