meson: add feature flag for sleep

sleep builds and installs binaries, docs, units, etc. Add a
feature flag to make it easier to avoid shipping it.
This commit is contained in:
Luca Boccassi authored and Yu Watanabe committed 2026-10-25 09:34:00 +09:00
1 parent 349712802c
commit 2ce176286a
9 files changed
+32 -10

No files matched your search

+1 -1
View File
@@ -170,7 +170,7 @@ for phase in "${PHASES[@]}"; do
MESON_ARGS+=(-Db_lundef=false -Dfuzz-tests=true)
if [[ "$phase" == "RUN_CLANG_ASAN_UBSAN_NO_DEPS" ]]; then
MESON_ARGS+=(--auto-features=disabled -Dnspawn=enabled)
MESON_ARGS+=(--auto-features=disabled -Dhibernate=false -Dnspawn=enabled)
fi
fi
MESON_ARGS+=(--fatal-meson-warnings)
+2 -2
View File
@@ -1276,7 +1276,7 @@ manpages = [
['systemd-run-generator', '8', [], ''],
['systemd-run', '1', [], ''],
['systemd-sbsign', '1', [], ''],
['systemd-sleep.conf', '5', ['sleep.conf.d'], ''],
['systemd-sleep.conf', '5', ['sleep.conf.d'], 'ENABLE_SLEEP'],
['systemd-socket-activate', '1', [], ''],
['systemd-socket-proxyd', '8', [], ''],
['systemd-soft-reboot.service', '8', [], ''],
@@ -1303,7 +1303,7 @@ manpages = [
'systemd-hybrid-sleep.service',
'systemd-sleep',
'systemd-suspend-then-hibernate.service'],
''],
'ENABLE_SLEEP'],
['systemd-sysctl.service', '8', ['systemd-sysctl'], ''],
['systemd-sysext',
'8',
+1 -1
View File
@@ -3,7 +3,7 @@
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
<refentry id="systemd-sleep.conf"
<refentry id="systemd-sleep.conf" conditional="ENABLE_SLEEP"
xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>
<title>systemd-sleep.conf</title>
+1 -1
View File
@@ -3,7 +3,7 @@
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
<refentry id="systemd-suspend.service"
<refentry id="systemd-suspend.service" conditional="ENABLE_SLEEP"
xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>
+3 -1
View File
@@ -1796,6 +1796,7 @@ conf.set10('DEFAULT_MOUNTFSD_TRUSTED_DIRECTORIES', get_option('default-mountfsd-
conf.set10('ENABLE_BATTERY_CHECK', get_option('battery-check').allowed())
conf.set10('ENABLE_CLONESETUP', get_option('clonesetup').allowed())
conf.set10('ENABLE_GROWFS', get_option('growfs').allowed())
conf.set10('ENABLE_SLEEP', get_option('sleep').allowed())
have = get_option('integritysetup').require(
conf.get('HAVE_LIBCRYPTSETUP') == 1,
@@ -1813,7 +1814,7 @@ foreach tuple : [
['environment-d'],
['firstboot'],
['gshadow', get_option('libc') != 'musl', 'musl does not support it'],
['hibernate'],
['hibernate', conf.get('ENABLE_SLEEP') == 1, 'sleep support is disabled'],
['hostnamed'],
['hwdb'],
['idn', conf.get('HAVE_NI_IDN') == 1, 'NI_IDN is not defined'],
@@ -3484,6 +3485,7 @@ foreach tuple : [
['resolve'],
['rfkill'],
['rust', have_rust],
['sleep'],
['sysext'],
['sysinstall'],
['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1],
+3 -1
View File
@@ -184,7 +184,7 @@ option('firstboot', type : 'boolean',
option('growfs', type : 'feature',
description : 'install systemd-growfs, systemd-makefs, and associated files')
option('hibernate', type : 'boolean',
description : 'support for hibernation')
description : 'support for hibernation (requires sleep support)')
option('homed', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
description : 'install the systemd-homed stack')
option('hostnamed', type : 'boolean',
@@ -251,6 +251,8 @@ option('resolve', type : 'boolean',
description : 'systemd-resolved stack')
option('rfkill', type : 'boolean',
description : 'support for the rfkill tools')
option('sleep', type : 'feature',
description : 'install systemd-sleep and associated files')
option('storagetm', type : 'boolean',
description : 'support for Storage Target Mode')
option('sysext', type : 'boolean',
+4
View File
@@ -1,5 +1,9 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('ENABLE_SLEEP') != 1
subdir_done()
endif
executables += [
libexec_template + {
'name' : 'systemd-sleep',
+5
View File
@@ -134,6 +134,11 @@ teardown_suspend() (
testcase_suspend_on_lid() {
local pid input_name lid_dev
if [[ ! -x /usr/lib/systemd/systemd-sleep ]]; then
echo "systemd-sleep is not installed, skipping suspend test"
return
fi
if systemd-detect-virt --quiet --container; then
echo "Skipping suspend test in container"
return
+12 -3
View File
@@ -217,7 +217,10 @@ units = [
{ 'file' : 'serial-getty@.service.in' },
{ 'file' : 'shutdown.target' },
{ 'file' : 'sigpwr.target' },
{ 'file' : 'sleep.target' },
{
'file' : 'sleep.target',
'conditions' : ['ENABLE_SLEEP'],
},
{ 'file' : 'slices.target' },
{ 'file' : 'smartcard.target' },
{ 'file' : 'sockets.target' },
@@ -228,7 +231,10 @@ units = [
'file' : 'suspend-then-hibernate.target',
'conditions' : ['ENABLE_HIBERNATE'],
},
{ 'file' : 'suspend.target' },
{
'file' : 'suspend.target',
'conditions' : ['ENABLE_SLEEP'],
},
{ 'file' : 'swap.target' },
{
'file' : 'sys-fs-fuse-connections.mount',
@@ -923,7 +929,10 @@ units = [
'file' : 'systemd-suspend-then-hibernate.service.in',
'conditions' : ['ENABLE_HIBERNATE'],
},
{ 'file' : 'systemd-suspend.service.in' },
{
'file' : 'systemd-suspend.service.in',
'conditions' : ['ENABLE_SLEEP'],
},
{
'file' : 'systemd-sysctl.service.in',
'symlinks' : ['sysinit.target.wants/'],