2025-10-05 09:04:53 +08:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
|
2026-01-15 02:29:13 +08:00
|
|
|
# SPDX-FileCopyrightText: Copyright 2026 crueter
|
2026-01-01 00:16:46 +08:00
|
|
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
2025-10-05 09:04:53 +08:00
|
|
|
|
|
|
|
|
##################################
|
|
|
|
|
# CHANGE THESE FOR YOUR PROJECT! #
|
|
|
|
|
##################################
|
|
|
|
|
|
2026-01-01 00:16:46 +08:00
|
|
|
# TODO: cache cpmfile defs
|
|
|
|
|
|
2026-01-15 02:29:13 +08:00
|
|
|
must_install() {
|
|
|
|
|
for cmd in "$@"; do
|
|
|
|
|
command -v "$cmd" >/dev/null 2>&1 || { echo "-- $cmd must be installed" && exit 1; }
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
must_install jq find mktemp tar 7z unzip sha512sum git patch curl xargs
|
|
|
|
|
|
2025-10-05 09:04:53 +08:00
|
|
|
# How many levels to go (3 is 2 subdirs max)
|
|
|
|
|
MAXDEPTH=3
|
|
|
|
|
|
2025-10-20 09:43:15 +08: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
|
2026-02-05 02:15:10 +08:00
|
|
|
CPMFILES=$(find . -maxdepth "$MAXDEPTH" -name cpmfile.json | sort | uniq)
|
2025-10-20 09:43:15 +08:00
|
|
|
|
2025-10-05 09:04:53 +08:00
|
|
|
# shellcheck disable=SC2016
|
2026-01-01 00:16:46 +08:00
|
|
|
PACKAGES=$(echo "$CPMFILES" | xargs jq -s 'reduce .[] as $item ({}; . * $item)')
|
2025-10-05 09:04:53 +08:00
|
|
|
|
|
|
|
|
LIBS=$(echo "$PACKAGES" | jq -j 'keys_unsorted | join(" ")')
|
|
|
|
|
|
|
|
|
|
export PACKAGES
|
2025-10-20 09:43:15 +08:00
|
|
|
export CPMFILES
|
2025-10-05 09:04:53 +08:00
|
|
|
export LIBS
|
|
|
|
|
export DIRS
|
|
|
|
|
export MAXDEPTH
|