Skip to content

Commit

Permalink
Make systemd optional
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
angerman committed May 10, 2020
1 parent fbb0358 commit d1009d3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion cardano-config/cardano-config.cabal
Expand Up @@ -10,9 +10,18 @@ build-type: Simple
cabal-version: >= 1.10
extra-source-files: README.md

flag systemd
description: Enable systemd support
default: True
manual: False

library
hs-source-dirs: src

if os(linux) && flag(systemd)
cpp-options: -DSYSTEMD
build-depends: lobemo-scribe-systemd

exposed-modules: Cardano.Config.Byron.Parsers
Cardano.Config.Byron.Protocol
Cardano.Config.GitRev
Expand Down Expand Up @@ -67,7 +76,6 @@ library
, lobemo-backend-ekg
, lobemo-backend-monitoring
, lobemo-backend-trace-forwarder
, lobemo-scribe-systemd
, network
, network-mux
, optparse-applicative
Expand Down
4 changes: 2 additions & 2 deletions cardano-config/src/Cardano/Config/Logging.hs
Expand Up @@ -48,7 +48,7 @@ import Cardano.BM.Data.SubTrace
import qualified Cardano.BM.Observer.Monadic as Monadic
import qualified Cardano.BM.Observer.STM as Stm
import Cardano.BM.Plugin (loadPlugin)
#if defined(linux_HOST_OS)
#if defined(SYSTEMD)
import Cardano.BM.Scribe.Systemd (plugin)
#endif
import Cardano.BM.Setup (setupTrace_, shutdown)
Expand Down Expand Up @@ -184,7 +184,7 @@ createLoggingFeature ver _ nodecli@NodeCLI{configFile} = do
Cardano.BM.Backend.Monitoring.plugin logConfig trace switchBoard
>>= loadPlugin switchBoard

#if defined(linux_HOST_OS)
#if defined(SYSTEMD)
Cardano.BM.Scribe.Systemd.plugin logConfig trace switchBoard "cardano"
>>= loadPlugin switchBoard
#endif
Expand Down

0 comments on commit d1009d3

Please sign in to comment.