[cmake, tools] update CPMUtil and add support for CPMUtil bundled Qt, module updates, cleanups (#3289)

Support for bundled Qt, not through aqtinstall but rather my CI. Multimedia is
implemented too, works on both Windows and Linux, though we don't
actually use it so it doesn't really matter. Contains Declarative and all that so the Quick frontend will work once it becomes a thing.

Some options have changed, notably w.r.t LTO and faster
linker, which are now handled directly in the modules.

CPMUtil also has support for custom dirs (`PackageName_CUSTOM_DIR`) now. Probably most useful for adding external fragment shaders and whatnot.

Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3289
This commit is contained in:
crueter 2026-01-14 19:29:13 +01:00
parent ecd01e13fd
commit 89f72d286a
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6
48 changed files with 618 additions and 929 deletions

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
##################################
@ -9,6 +9,14 @@
# TODO: cache cpmfile defs
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
# How many levels to go (3 is 2 subdirs max)
MAXDEPTH=3

View file

@ -1,11 +1,10 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
SUBMODULES="$(git submodule status --recursive | cut -c2-)"
[ -z "$SUBMODULES" ] && echo "No submodules defined!" && exit 0
: "${SUBMODULES:?No submodules defined!}"
tmp=$(mktemp)
printf '{}' >"$tmp"
@ -22,7 +21,7 @@ for i in $SUBMODULES; do
remote=$(git -C "$path" remote get-url origin)
host=$(echo "$remote" | cut -d"/" -f3)
[ "$host" = github.com ] && host=
[ "$host" != github.com ] || host=
repo=$(echo "$remote" | cut -d"/" -f4-5 | cut -d'.' -f1)

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
RETURN=0
@ -31,48 +31,12 @@ export SCRIPTS
while :; do
case "$1" in
hash)
hash | update | fetch | add | rm | version | which | download)
cmd="$1"
shift
"$SCRIPTS"/hash.sh "$@"
"$SCRIPTS/$cmd".sh "$@"
break
;;
update)
shift
"$SCRIPTS"/update.sh "$@"
break
;;
fetch)
shift
"$SCRIPTS"/fetch.sh "$@"
break
;;
add)
shift
"$SCRIPTS"/add.sh "$@"
break
;;
rm)
shift
"$SCRIPTS"/rm.sh "$@"
break
;;
version)
shift
"$SCRIPTS"/version.sh "$@"
break
;;
which)
shift
"$SCRIPTS"/which.sh "$@"
break
;;
download)
shift
"$SCRIPTS"/download.sh "$@"
break
;;
-h | --help) usage ;;
"") usage ;;
*) usage ;;
esac

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
RETURN=0
@ -30,7 +30,7 @@ die() {
}
_cpmfile() {
[ -z "$1" ] && die "You must specify a valid cpmfile."
[ -n "$1" ] || die "You must specify a valid cpmfile."
CPMFILE="$1"
}
@ -70,7 +70,7 @@ done
: "${CPMFILE:=$PWD/cpmfile.json}"
[ -z "$PKG" ] && die "You must specify a package name."
[ -n "$PKG" ] || die "You must specify a package name."
export PKG
export CPMFILE

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
usage() {
@ -29,8 +29,8 @@ while :; do
shift
done
[ "$ALL" = 1 ] && packages="${LIBS:-$packages}"
[ -z "$packages" ] && usage
[ "$ALL" != 1 ] || packages="${LIBS:-$packages}"
[ -n "$packages" ] || usage
for pkg in $packages; do
PACKAGE="$pkg"

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
: "${CPM_SOURCE_CACHE:=$PWD/.cache/cpm}"
@ -73,11 +73,12 @@ download_package() {
}
ci_package() {
[ "$REPO" = null ] && echo "-- ! No repo defined" && return
[ "$REPO" != null ] || echo "-- ! No repo defined" && return
echo "-- CI package $PACKAGE_NAME"
for platform in windows-amd64 windows-arm64 \
for platform in \
windows-amd64 windows-arm64 \
mingw-amd64 mingw-arm64 \
android-aarch64 android-x86_64 \
solaris-amd64 freebsd-amd64 openbsd-amd64 \
@ -90,7 +91,6 @@ ci_package() {
echo "-- * -- disabled"
continue
;;
*) ;;
esac
FILENAME="${NAME}-${platform}-${VERSION}.${EXT}"
@ -102,7 +102,7 @@ ci_package() {
[ -d "$OUTDIR" ] && continue
HASH_ALGO=$(echo "$JSON" | jq -r ".hash_algo")
[ "$HASH_ALGO" = null ] && HASH_ALGO=sha512
[ "$HASH_ALGO" != null ] || HASH_ALGO=sha512
HASH_SUFFIX="${HASH_ALGO}sum"
HASH_URL="${DOWNLOAD}.${HASH_SUFFIX}"
@ -137,8 +137,8 @@ while :; do
shift
done
[ "$ALL" = 1 ] && packages="${LIBS:-$packages}"
[ -z "$packages" ] && usage
[ "$ALL" != 1 ] || packages="${LIBS:-$packages}"
[ -n "$packages" ] || usage
for PACKAGE in $packages; do
export PACKAGE

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
RETURN=0
@ -52,9 +52,9 @@ while :; do
shift
done
[ "$ALL" = 1 ] && packages="${LIBS:-$packages}"
[ "$ALL" != 1 ] || packages="${LIBS:-$packages}"
[ "$DRY" = 1 ] && UPDATE=false || UPDATE=true
[ -z "$packages" ] && usage
[ -n "$packages" ] || usage
export UPDATE

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
RETURN=0
@ -16,7 +16,7 @@ EOF
exit $RETURN
}
[ $# -lt 1 ] && usage
[ $# -ge 1 ] || usage
for pkg in "$@"; do
JSON=$("$SCRIPTS"/which.sh "$pkg") || {

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
filter_out() {
@ -37,13 +37,13 @@ while :; do
case "$char" in
a) ALL=1 ;;
n) DRY=1 ;;
n) UPDATE=false ;;
h) usage ;;
*) die "Invalid option -$char" ;;
esac
done
;;
--dry-run) DRY=1 ;;
--dry-run) UPDATE=false ;;
--all) ALL=1 ;;
--help) usage ;;
"$0") break ;;
@ -54,9 +54,9 @@ while :; do
shift
done
[ "$ALL" = 1 ] && packages="${LIBS:-$packages}"
[ "$DRY" = 1 ] && UPDATE=false || UPDATE=true
[ -z "$packages" ] && usage
[ "$ALL" != 1 ] || packages="${LIBS:-$packages}"
: "${UPDATE:=true}"
[ -n "$packages" ] || usage
for pkg in $packages; do
PACKAGE="$pkg"
@ -66,15 +66,15 @@ for pkg in $packages; do
SKIP=$(value "skip_updates")
[ "$SKIP" = "true" ] && continue
[ "$SKIP" != "true" ] || continue
[ "$REPO" = null ] && continue
[ "$GIT_HOST" != "github.com" ] && continue # TODO
[ "$REPO" != null ] || continue
[ "$GIT_HOST" = "github.com" ] || continue # TODO
[ "$CI" = "true" ] && continue
[ "$CI" != "true" ] || continue
# shellcheck disable=SC2153
[ "$TAG" = null ] && continue
[ "$TAG" != null ] || continue
echo "-- Package $PACKAGE"
@ -99,12 +99,15 @@ for pkg in $packages; do
filter_out rc
# Add package-specific overrides here, e.g. here for fmt:
[ "$PACKAGE" = fmt ] && filter_out v0.11
[ "$PACKAGE" != fmt ] || filter_out v0.11
LATEST=$(echo "$TAGS" | jq -r '.[0].name')
[ "$LATEST" = "null" ] && echo "-- * Up-to-date" && continue
[ "$LATEST" = "$TAG" ] && [ "$FORCE" != "true" ] && echo "-- * Up-to-date" && continue
if [ "$LATEST" = "null" ] ||
{ [ "$LATEST" = "$TAG" ] && [ "$FORCE" != "true" ]; }; then
echo "-- * Up-to-date"
continue
fi
if [ "$HAS_REPLACE" = "true" ]; then
# this just extracts the tag prefix

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
: "${PACKAGE:=$1}"
@ -13,7 +13,7 @@
[ "$HASH_URL" = null ] || exit 0
[ "$HASH_SUFFIX" = null ] || exit 0
[ "$HASH" = null ] && echo "-- * Package has no hash specified" && exit 0
[ "$HASH" != null ] || { echo "-- * Package has no hash specified" && exit 0; }
ACTUAL=$("$SCRIPTS"/util/url-hash.sh "$DOWNLOAD")

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
# This reads a single-line input from the user and also gives them
@ -13,7 +13,7 @@
read_single() {
while :; do
printf -- "-- %s" "$1"
[ -n "$2" ] && printf " (? for help, %s)" "$3"
[ -z "$2" ] || printf " (? for help, %s)" "$3"
printf ": "
if ! IFS= read -r reply; then
echo
@ -113,7 +113,7 @@ tag v1.3.0, then set this to 1.3.0 and set the tag to v%VERSION%."
"Most commonly this will be something like v%VERSION% or release-%VERSION%, or just %VERSION%."
TAGNAME="$reply"
[ -z "$TAGNAME" ] && TAGNAME="%VERSION%"
[ -n "$TAGNAME" ] || TAGNAME="%VERSION%"
optional "Name of the release artifact to download, if applicable.
-- %VERSION% is replaced by the numeric version and %TAG% is replaced by the tag name" \
@ -160,9 +160,9 @@ fi
jq_input='{repo: "'"$REPO"'"}'
# common trivial fields
[ -n "$PACKAGE" ] && jq_input="$jq_input + {package: \"$PACKAGE\"}"
[ -n "$MIN_VERSION" ] && jq_input="$jq_input + {min_version: \"$MIN_VERSION\"}"
[ -n "$FIND_ARGS" ] && jq_input="$jq_input + {find_args: \"$FIND_ARGS\"}"
[ -z "$PACKAGE" ] || jq_input="$jq_input + {package: \"$PACKAGE\"}"
[ -z "$MIN_VERSION" ] || jq_input="$jq_input + {min_version: \"$MIN_VERSION\"}"
[ -z "$FIND_ARGS" ] || jq_input="$jq_input + {find_args: \"$FIND_ARGS\"}"
if [ "$CI" = "true" ]; then
jq_input="$jq_input + {
@ -177,7 +177,7 @@ if [ "$CI" = "true" ]; then
jq_input="$jq_input + {disabled_platforms: $disabled_json}"
fi
else
[ -n "$MIN_VERSION" ] && jq_input="$jq_input + {version: \"$MIN_VERSION\"}"
[ -z "$MIN_VERSION" ] || jq_input="$jq_input + {version: \"$MIN_VERSION\"}"
jq_input="$jq_input + {hash: \"\"}"
# options
@ -194,8 +194,8 @@ else
# versioning stuff
if [ -n "$GIT_VERSION" ]; then
jq_input="$jq_input + {git_version: \"$GIT_VERSION\"}"
[ -n "$TAGNAME" ] && jq_input="$jq_input + {tag: \"$TAGNAME\"}"
[ -n "$ARTIFACT" ] && jq_input="$jq_input + {artifact: \"$ARTIFACT\"}"
[ -z "$TAGNAME" ] || jq_input="$jq_input + {tag: \"$TAGNAME\"}"
[ -z "$ARTIFACT" ] || jq_input="$jq_input + {artifact: \"$ARTIFACT\"}"
else
jq_input="$jq_input + {sha: \"$SHA\"}"
fi

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
# shellcheck disable=SC1091
@ -9,12 +9,15 @@ value() {
echo "$JSON" | jq -r ".$1"
}
[ -z "$PACKAGE" ] && echo "Package was not specified" && exit 0
[ -n "$PACKAGE" ] || { echo "Package was not specified" && exit 0; }
# shellcheck disable=SC2153
JSON=$(echo "$PACKAGES" | jq -r ".\"$PACKAGE\" | select( . != null )")
[ -z "$JSON" ] && echo "!! No cpmfile definition for $PACKAGE" >&2 && exit 1
if [ -z "$JSON" ]; then
echo "!! No cpmfile definition for $PACKAGE" >&2
exit 1
fi
# unset stuff
export PACKAGE_NAME="null"
@ -48,10 +51,10 @@ REPO=$(value "repo")
CI=$(value "ci")
PACKAGE_NAME=$(value "package")
[ "$PACKAGE_NAME" = null ] && PACKAGE_NAME="$PACKAGE"
[ "$PACKAGE_NAME" != null ] || PACKAGE_NAME="$PACKAGE"
GIT_HOST=$(value "git_host")
[ "$GIT_HOST" = null ] && GIT_HOST=github.com
[ "$GIT_HOST" != null ] || GIT_HOST=github.com
export PACKAGE_NAME
export REPO
@ -66,12 +69,12 @@ VERSION=$(value "version")
if [ "$CI" = "true" ]; then
EXT=$(value "extension")
[ "$EXT" = null ] && EXT="tar.zst"
[ "$EXT" != null ] || EXT="tar.zst"
NAME=$(value "name")
DISABLED=$(echo "$JSON" | jq -j '.disabled_platforms')
[ "$NAME" = null ] && NAME="$PACKAGE_NAME"
[ "$NAME" != null ] || NAME="$PACKAGE_NAME"
export EXT
export NAME
@ -90,7 +93,7 @@ ARTIFACT=$(value "artifact")
SHA=$(value "sha")
GIT_VERSION=$(value "git_version")
[ "$GIT_VERSION" = null ] && GIT_VERSION="$VERSION"
[ "$GIT_VERSION" != null ] || GIT_VERSION="$VERSION"
if [ "$GIT_VERSION" != null ]; then
VERSION_REPLACE="$GIT_VERSION"
@ -98,8 +101,11 @@ else
VERSION_REPLACE="$VERSION"
fi
echo "$TAG" | grep -e "%VERSION%" >/dev/null &&
HAS_REPLACE=true || HAS_REPLACE=false
if echo "$TAG" | grep -e "%VERSION%" >/dev/null; then
HAS_REPLACE=true
else
HAS_REPLACE=false
fi
ORIGINAL_TAG="$TAG"
@ -145,7 +151,7 @@ export KEY
################
HASH_ALGO=$(value "hash_algo")
[ "$HASH_ALGO" = null ] && HASH_ALGO=sha512
[ "$HASH_ALGO" != null ] || HASH_ALGO=sha512
HASH=$(value "hash")

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
# shellcheck disable=SC1091
@ -20,14 +20,14 @@ EOF
PACKAGE="$1"
NEW_VERSION="$2"
[ -z "$PACKAGE" ] && usage
[ -z "$NEW_VERSION" ] && usage
[ -n "$PACKAGE" ] || usage
[ -n "$NEW_VERSION" ] || usage
export PACKAGE
. "$SCRIPTS"/vars.sh
[ "$REPO" = null ] && exit 0
[ "$REPO" != null ] || exit 0
if [ "$HAS_REPLACE" = "true" ]; then
# this just extracts the tag prefix
@ -54,7 +54,7 @@ fi
echo "-- * -- Updating $PACKAGE to version $NEW_VERSION"
"$SCRIPTS"/util/replace.sh "$PACKAGE" "$NEW_JSON"
[ "$CI" = "true" ] && exit 0
[ "$CI" != "true" ] || exit 0
echo "-- * -- Fixing hash"
. "$ROOTDIR"/common.sh
UPDATE=true QUIET=true "$SCRIPTS"/util/fix-hash.sh

View file

@ -1,12 +1,12 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
# check which file a package is in
JSON=$(echo "$CPMFILES" | xargs grep -l "\"$1\"")
[ -z "$JSON" ] && echo "!! No cpmfile definition for $1" >&2 && exit 1
[ -n "$JSON" ] || { echo "!! No cpmfile definition for $1" >&2 && exit 1; }
echo "$JSON"

View file

@ -1,16 +1,19 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
# updates CPMUtil, its docs, and related tools from the latest release
if command -v zstd >/dev/null; then
if command -v zstd >/dev/null 2>&1; then
EXT=tar.zst
else
EXT=tar.gz
fi
wget "https://git.crueter.xyz/CMake/CPMUtil/releases/download/continuous/CPMUtil.$EXT"
tar xf "CPMUtil.$EXT"
rm "CPMUtil.$EXT"
file=CPMUtil.$EXT
url="https://git.crueter.xyz/CMake/CPMUtil/releases/download/continuous/$file"
curl -L "$url" -o "$file"
tar xf "$file"
rm "$file"

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
# shellcheck disable=SC1091
@ -49,26 +49,18 @@ export ROOTDIR
while :; do
case "$1" in
-h | --help) usage ;;
ls)
echo "$CPMFILES" | tr ' ' '\n'
break
;;
format)
"$SCRIPTS"/format.sh
break
;;
update)
"$SCRIPTS"/update.sh
break
;;
migrate)
"$SCRIPTS"/migrate.sh
format | update | migrate)
"$SCRIPTS/$1".sh
break
;;
package)
cmd="$1"
shift
"$SCRIPTS"/package.sh "$@"
"$SCRIPTS/$cmd".sh "$@"
break
;;
*) usage ;;