1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-13 00:58:27 +03:00
systemd/mkosi.clangd
Daan De Meyer 531750e9b0 mkosi: Fix mkosi.clangd
- Add missing '--' delimiter
- Use the new BuildSubdirectory JSON field to figure out the build
  subdirectory.
- Remove the /usr/include path mapping for now. This means we can't
  jump into system headers anymore if they don't exist on the host,
  we can find a way to add this back later if it turns out to be
  crucial.
2025-02-14 17:13:10 +01:00

28 lines
630 B
Bash
Executable File

#!/bin/bash
# SPDX-License-Identifier: LGPL-2.1-or-later
set -e
if command -v flatpak-spawn >/dev/null; then
SPAWN=(flatpak-spawn --host)
else
SPAWN=()
fi
MKOSI_CONFIG="$("${SPAWN[@]}" mkosi --json summary | jq -r .Images[-1])"
BUILDDIR="$(jq -r .BuildDirectory <<< "$MKOSI_CONFIG")"
BUILDSUBDIR="$(jq -r .BuildSubdirectory <<< "$MKOSI_CONFIG")"
exec "${SPAWN[@]}" mkosi \
--incremental=strict \
--build-sources-ephemeral=no \
--format=none \
build \
-- \
clangd \
--compile-commands-dir=/work/build \
--path-mappings="\
$(pwd)=/work/src,\
$BUILDDIR/$BUILDSUBDIR=/work/build"\
"$@"