summaryrefslogtreecommitdiffstats
path: root/src/bin/compile-db
diff options
context:
space:
mode:
authorPS <p@0x53.net>2026-02-01 12:02:03 +0100
committerPS <p@0x53.net>2026-02-01 12:02:03 +0100
commit980c5408489a3a3a56e49c3873f1bce6a0155cad (patch)
tree91df5fa62e7eca03d04b8ed114b20b337b99a556 /src/bin/compile-db
downloadgoetia-base-980c5408489a3a3a56e49c3873f1bce6a0155cad.tar.gz
goetia-base-980c5408489a3a3a56e49c3873f1bce6a0155cad.tar.bz2
goetia-base-980c5408489a3a3a56e49c3873f1bce6a0155cad.zip
version 0.2.0.0
Diffstat (limited to 'src/bin/compile-db')
-rwxr-xr-xsrc/bin/compile-db27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/bin/compile-db b/src/bin/compile-db
new file mode 100755
index 0000000..22b63b4
--- /dev/null
+++ b/src/bin/compile-db
@@ -0,0 +1,27 @@
+#!@shebangdir@/execlineb -WS2
+
+# ISC license.
+
+multisubstitute {
+ define CONFIGDIR ${1}
+ define LIVEDIR ${2}
+}
+
+backtick -ED" " OLDDB { realpath ${CONFIGDIR}/compiled }
+backtick -E DATE { date +%s }
+elglob SOURCES ${CONFIGDIR}/src/*
+
+if { s6-rc-compile -v2 ${CONFIGDIR}/compiled-${DATE} ${SOURCES} }
+
+if {
+ if -x0 { eltest -d ${LIVEDIR} }
+ if -n -x0 { s6-rc-update -v2 -l ${LIVEDIR} ${CONFIGDIR}/compiled-${DATE} }
+ if { s6-rc-update -v2 -l ${LIVEDIR} ${CONFIGDIR}/compiled }
+ if { rm -Rf ${CONFIGDIR}/compiled-${DATE} }
+ exit 1
+}
+
+if { ln -sf compiled-${DATE} ${CONFIGDIR}/compiled/compiled }
+if { mv -f ${CONFIGDIR}/compiled/compiled ${CONFIGDIR}/ }
+
+rm -Rf ${OLDDB}