2019-06-09 23:35:34 +02:00
|
|
|
|
|
|
|
|
|
package=service
|
|
|
|
|
version=0.1.0
|
|
|
|
|
|
|
|
|
|
variables+=(
|
|
|
|
|
LIBEXECDIR '$(PREFIX)/libexec'
|
|
|
|
|
SYSCONFDIR '/etc'
|
|
|
|
|
VARSTATEDIR '/var'
|
2019-10-26 14:00:11 +02:00
|
|
|
|
DATADIR '/srv'
|
2019-06-09 23:35:34 +02:00
|
|
|
|
)
|
|
|
|
|
|
2019-10-29 12:32:49 +01:00
|
|
|
|
targets=(service status gen-config get-port)
|
2019-06-09 23:35:34 +02:00
|
|
|
|
|
2019-10-29 12:32:49 +01:00
|
|
|
|
for target in service status gen-config get-port; do
|
2019-06-09 23:35:34 +02:00
|
|
|
|
type[$target]=crystal
|
|
|
|
|
sources[$target]=src/${target}.cr
|
|
|
|
|
depends[$target]=src/config.cr
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
targets+=(src/config.cr)
|
|
|
|
|
type[src/config.cr]=script
|
|
|
|
|
sources[src/config.cr]=src/config.cr.in
|
2019-10-19 18:17:50 +02:00
|
|
|
|
install[src/config.cr]=false
|
2019-06-09 23:35:34 +02:00
|
|
|
|
auto[src/config.cr]=true # Don’t display it in `make help`.
|
2019-10-24 00:48:20 +02:00
|
|
|
|
chmod[src/config.cr]=0644
|
2019-06-09 23:35:34 +02:00
|
|
|
|
|
2019-10-19 18:17:50 +02:00
|
|
|
|
for file in services/*.spec; do
|
|
|
|
|
targets+=($file)
|
|
|
|
|
type[$file]=script
|
|
|
|
|
install[$file]='$(SHAREDIR)/services'
|
|
|
|
|
auto[$file]=true
|
2019-10-24 00:48:20 +02:00
|
|
|
|
chmod[$file]=0644
|
2019-10-19 18:17:50 +02:00
|
|
|
|
done
|
|
|
|
|
|
2019-10-24 00:41:34 +02:00
|
|
|
|
for file in templates/*.j2; do
|
|
|
|
|
targets+=($file)
|
|
|
|
|
type[$file]=script
|
2019-10-24 12:52:50 +02:00
|
|
|
|
install[$file]='$(SHAREDIR)/templates'
|
2019-10-24 00:41:34 +02:00
|
|
|
|
auto[$file]=true
|
2019-10-24 00:48:20 +02:00
|
|
|
|
chmod[$file]=0644
|
2019-10-24 00:41:34 +02:00
|
|
|
|
done
|
|
|
|
|
|
2019-10-25 15:14:22 +02:00
|
|
|
|
for file in utils/*; do
|
|
|
|
|
targets+=($file)
|
|
|
|
|
type[$file]=script
|
|
|
|
|
done
|
|
|
|
|
|
2019-11-12 20:03:45 +01:00
|
|
|
|
for file in doc/*; do
|
|
|
|
|
[[ "$file" =~ .*\.scd$ ]] || continue
|
|
|
|
|
|
|
|
|
|
targets+=(${file%.scd})
|
|
|
|
|
type[${file%.scd}]=scdoc
|
|
|
|
|
sources[${file%.scd}]=${file}
|
|
|
|
|
done
|
|
|
|
|
|
2019-10-19 18:17:50 +02:00
|
|
|
|
# FIXME: This should be upstreamed.
|
2019-06-09 23:35:34 +02:00
|
|
|
|
function script.install {
|
2019-10-19 18:17:50 +02:00
|
|
|
|
if [[ "false" = "${install[$target]}" ]]; then
|
|
|
|
|
ofile.install "$@"
|
|
|
|
|
else
|
|
|
|
|
binary.install "$@"
|
|
|
|
|
fi
|
2019-06-09 23:35:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
install[status]='$(LIBEXECDIR)/service'
|
|
|
|
|
|
2019-11-12 20:03:45 +01:00
|
|
|
|
function scdoc.prelude {
|
|
|
|
|
for target in $targets; do
|
|
|
|
|
[[ "${type[$target]}" == "scdoc" ]] || continue
|
|
|
|
|
|
|
|
|
|
if [[ -z "${install[$target]}" ]]; then
|
|
|
|
|
local section="${file%.scd}"
|
|
|
|
|
section="${section#*.}"
|
|
|
|
|
|
|
|
|
|
install[$target]="\$(SHAREDIR)/man/man${section}"
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function SCD {
|
|
|
|
|
SED "$@" | sed 's|SED|SCD|'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function scdoc.build {
|
|
|
|
|
write "${target}: ${sources[$target]}"
|
|
|
|
|
write "\t@echo '$(SCD $target)'"
|
|
|
|
|
write "\t${Q}scdoc < ${sources[$target]} > $target || rm $target"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function scdoc.install {
|
|
|
|
|
script.install "$@"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function scdoc.uninstall {
|
|
|
|
|
script.uninstall "$@"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function scdoc.clean {
|
|
|
|
|
script.clean "$@"
|
|
|
|
|
}
|
|
|
|
|
|