summaryrefslogtreecommitdiffstats
path: root/mkosi.clangd
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2024-09-21 19:29:15 +0200
committerDaan De Meyer <daan.j.demeyer@gmail.com>2024-09-22 15:23:01 +0200
commit6d862a9dc08285fffb9da29055235b5c9935dcf8 (patch)
treeebd4807759776ce8dcf6075b4273cd847fbbd5c7 /mkosi.clangd
parentPreset user units on first boot as well (diff)
downloadsystemd-6d862a9dc08285fffb9da29055235b5c9935dcf8.tar.xz
systemd-6d862a9dc08285fffb9da29055235b5c9935dcf8.zip
mkosi: Add back support for running clangd within mkosi
This allows hacking on systemd without installing any build dependencies except mkosi on the host machine.
Diffstat (limited to 'mkosi.clangd')
-rwxr-xr-xmkosi.clangd20
1 files changed, 20 insertions, 0 deletions
diff --git a/mkosi.clangd b/mkosi.clangd
new file mode 100755
index 0000000000..80d544677a
--- /dev/null
+++ b/mkosi.clangd
@@ -0,0 +1,20 @@
+#!/bin/bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+MKOSI_CONFIG="$(mkosi --json summary | jq -r .Images[-1])"
+DISTRIBUTION="$(jq -r .Distribution <<< "$MKOSI_CONFIG")"
+RELEASE="$(jq -r .Release <<< "$MKOSI_CONFIG")"
+ARCH="$(jq -r .Architecture <<< "$MKOSI_CONFIG")"
+
+exec mkosi \
+ --incremental=strict \
+ --format=none \
+ build \
+ clangd \
+ --compile-commands-dir=/work/build \
+ --path-mappings="\
+$(pwd)=/work/src,\
+$(pwd)/build/mkosi.builddir/$DISTRIBUTION~$RELEASE~$ARCH/=/work/build,\
+$(pwd)/build/mkosi.cache/$DISTRIBUTION~$RELEASE~$ARCH~build.cache/usr/include/=/usr/include" \
+ "$@"
+