blob: fd4d6880dbeb1f6be63d7e48774d4779eac85232 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
SUBMODULES="$(git submodule status --recursive | cut -c2-)"
: "${SUBMODULES:?No submodules defined!}"
IFS="
"
for i in $SUBMODULES; do
commit=$(echo "$i" -d" " -f1 | cut -c1-10)
short_commit=$(echo "$i" -d" " -f1 | cut -c1-7)
ref=$(echo "$i" | cut -d" " -f3 | tr -d '()')
case "$ref" in
# ref == commit, use commit versioning
"$short_commit") version="$commit" ;;
# ref is a branch, use commit versioning
heads/*) version="$commit" ;;
# ref is (probably) a tag, use tag versioning
*) version="$ref" ;;
esac
path=$(echo "$i" | cut -d" " -f2)
name=$(echo "$path" | awk -F/ '{print $NF}')
remote=$(git -C "$path" remote get-url origin)
host=$(echo "$remote" | cut -d"/" -f3)
repo=$(echo "$remote" | cut -d"/" -f4-5 | cut -d'.' -f1)
cmake -DKEY="$name" -DVERSION="$version" -DREPO="$repo" -DGIT_HOST="$host" \
-P "$CMAKE/package/add.cmake"
done
|