From 798a0aab2fbb5aed01bbd8419b65a03fb4602b3f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 3 Apr 2017 15:54:25 +0200 Subject: Make agent simple systemd daemon, add worker stub --- bbot/buildfile | 49 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 8 deletions(-) (limited to 'bbot/buildfile') diff --git a/bbot/buildfile b/bbot/buildfile index bcd0b93..c2d5d05 100644 --- a/bbot/buildfile +++ b/bbot/buildfile @@ -2,17 +2,49 @@ # copyright : Copyright (c) 2014-2017 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file +# Systemd .service file. +# +# @@ Currently the executable path is hardcoded as /usr/bin/bbot-agent. To +# handle this properly would need to generate/pre-process it )and detect +# update for install). +# +define service: file +service{*}: extension = service +service{*}: install = lib/systemd/system/ +service{*}: install.mode = 644 + import libs = libbutl%lib{butl} import libs += libbbot%lib{bbot} -exe{bbot-agent}: \ -{ cxx}{ agent } {hxx ixx cxx}{ agent-options } \ - {hxx ixx cxx}{ common-options } \ -{hxx cxx}{ diagnostics } \ -{hxx }{ types } \ -{hxx cxx}{ types-parsers } \ -{hxx cxx}{ utility } \ -{hxx }{ version-impl } \ +# Agent is a systemd service. +# +# @@ Have to package on Linux. +# +if ($cxx.target.class == "linux") +{ + ./: exe{bbot-agent} service{'bbot-agent@'} + + exe{bbot-agent}: \ + { cxx}{ agent } {hxx ixx cxx}{ agent-options } \ + {hxx ixx cxx}{ common-options } \ + {hxx cxx}{ diagnostics } \ + {hxx }{ types } \ + {hxx cxx}{ types-parsers } \ + {hxx cxx}{ utility } \ + {hxx }{ version-impl } \ + $libs +} + +./: exe{bbot-worker} + +exe{bbot-worker}: \ +{ cxx}{ worker } {hxx ixx cxx}{ worker-options } \ + {hxx ixx cxx}{ common-options } \ +{hxx cxx}{ diagnostics } \ +{hxx }{ types } \ +{hxx cxx}{ types-parsers } \ +{hxx cxx}{ utility } \ +{hxx }{ version-impl } \ $libs # Generated options parser. @@ -21,6 +53,7 @@ if $cli.configured { cli.cxx{common-options}: cli{common} cli.cxx{agent-options}: cli{agent} + cli.cxx{worker-options}: cli{worker} cli.options += -I $src_root --include-with-brackets --include-prefix bbot \ --guard-prefix BBOT --cxx-prologue "#include " \ -- cgit v1.1