2025-10-05 03:04:53 +02:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
|
|
|
# SPDX-FileCopyrightText: 2025 crueter
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
##################################
|
|
|
|
# CHANGE THESE FOR YOUR PROJECT! #
|
|
|
|
##################################
|
|
|
|
|
|
|
|
# How many levels to go (3 is 2 subdirs max)
|
|
|
|
MAXDEPTH=3
|
|
|
|
|
2025-10-20 03:43:15 +02:00
|
|
|
# For your project you'll want to change this to define what dirs you have cpmfiles in
|
|
|
|
# Remember to account for the MAXDEPTH variable!
|
|
|
|
# Adding ./ before each will help to remove duplicates
|
|
|
|
[ -z "$CPMFILES" ] && CPMFILES=$(find . ./src -maxdepth "$MAXDEPTH" -name cpmfile.json | sort | uniq)
|
|
|
|
|
2025-10-05 03:04:53 +02:00
|
|
|
# shellcheck disable=SC2016
|
2025-10-20 03:43:15 +02:00
|
|
|
[ -z "$PACKAGES" ] && PACKAGES=$(echo "$CPMFILES" | xargs jq -s 'reduce .[] as $item ({}; . * $item)')
|
2025-10-05 03:04:53 +02:00
|
|
|
|
|
|
|
LIBS=$(echo "$PACKAGES" | jq -j 'keys_unsorted | join(" ")')
|
|
|
|
|
|
|
|
export PACKAGES
|
2025-10-20 03:43:15 +02:00
|
|
|
export CPMFILES
|
2025-10-05 03:04:53 +02:00
|
|
|
export LIBS
|
|
|
|
export DIRS
|
|
|
|
export MAXDEPTH
|
|
|
|
|
|
|
|
value() {
|
|
|
|
echo "$JSON" | jq -r ".$1"
|
|
|
|
}
|