Skip to content

Commit d1009d3

Browse files
committed
Make systemd optional
This introduces the `systemd` flag, which defaults to `true`. Disabling this flag will drop the dependency on `systemd` and subsequently lack systemd-logging support. Useful when building fully static (musl) `cardano-node`s.
1 parent fbb0358 commit d1009d3

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

cardano-config/cardano-config.cabal

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,18 @@ build-type: Simple
1010
cabal-version: >= 1.10
1111
extra-source-files: README.md
1212

13+
flag systemd
14+
description: Enable systemd support
15+
default: True
16+
manual: False
17+
1318
library
1419
hs-source-dirs: src
1520

21+
if os(linux) && flag(systemd)
22+
cpp-options: -DSYSTEMD
23+
build-depends: lobemo-scribe-systemd
24+
1625
exposed-modules: Cardano.Config.Byron.Parsers
1726
Cardano.Config.Byron.Protocol
1827
Cardano.Config.GitRev
@@ -67,7 +76,6 @@ library
6776
, lobemo-backend-ekg
6877
, lobemo-backend-monitoring
6978
, lobemo-backend-trace-forwarder
70-
, lobemo-scribe-systemd
7179
, network
7280
, network-mux
7381
, optparse-applicative

cardano-config/src/Cardano/Config/Logging.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ import Cardano.BM.Data.SubTrace
4848
import qualified Cardano.BM.Observer.Monadic as Monadic
4949
import qualified Cardano.BM.Observer.STM as Stm
5050
import Cardano.BM.Plugin (loadPlugin)
51-
#if defined(linux_HOST_OS)
51+
#if defined(SYSTEMD)
5252
import Cardano.BM.Scribe.Systemd (plugin)
5353
#endif
5454
import Cardano.BM.Setup (setupTrace_, shutdown)
@@ -184,7 +184,7 @@ createLoggingFeature ver _ nodecli@NodeCLI{configFile} = do
184184
Cardano.BM.Backend.Monitoring.plugin logConfig trace switchBoard
185185
>>= loadPlugin switchBoard
186186

187-
#if defined(linux_HOST_OS)
187+
#if defined(SYSTEMD)
188188
Cardano.BM.Scribe.Systemd.plugin logConfig trace switchBoard "cardano"
189189
>>= loadPlugin switchBoard
190190
#endif

0 commit comments

Comments
 (0)