eden-miror/tools/cpm/package/version.sh
crueter 89f72d286a
[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
2026-01-14 19:29:13 +01:00

60 lines
1.5 KiB
Bash
Executable file

#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
# shellcheck disable=SC1091
usage() {
cat <<EOF
Usage: cpmutil.sh package version [PACKAGE] [VERSION]
Update a package's version. If the package uses a sha, you must provide a sha,
and if the package uses a tag, you must provide the fully qualified tag.
EOF
exit 0
}
PACKAGE="$1"
NEW_VERSION="$2"
[ -n "$PACKAGE" ] || usage
[ -n "$NEW_VERSION" ] || usage
export PACKAGE
. "$SCRIPTS"/vars.sh
[ "$REPO" != null ] || exit 0
if [ "$HAS_REPLACE" = "true" ]; then
# this just extracts the tag prefix
VERSION_PREFIX=$(echo "$ORIGINAL_TAG" | cut -d"%" -f1)
# then we strip out the prefix from the new tag, and make that our new git_version
if [ -z "$VERSION_PREFIX" ]; then
NEW_GIT_VERSION="$NEW_VERSION"
else
NEW_GIT_VERSION=$(echo "$NEW_VERSION" | sed "s/$VERSION_PREFIX//g")
fi
fi
if [ "$SHA" != null ]; then
NEW_JSON=$(echo "$JSON" | jq ".sha = \"$NEW_VERSION\"")
elif [ "$CI" = "true" ]; then
NEW_JSON=$(echo "$JSON" | jq ".version = \"$NEW_VERSION\"")
elif [ "$HAS_REPLACE" = "true" ]; then
NEW_JSON=$(echo "$JSON" | jq ".git_version = \"$NEW_GIT_VERSION\"")
else
NEW_JSON=$(echo "$JSON" | jq ".tag = \"$NEW_VERSION\"")
fi
echo "-- * -- Updating $PACKAGE to version $NEW_VERSION"
"$SCRIPTS"/util/replace.sh "$PACKAGE" "$NEW_JSON"
[ "$CI" != "true" ] || exit 0
echo "-- * -- Fixing hash"
. "$ROOTDIR"/common.sh
UPDATE=true QUIET=true "$SCRIPTS"/util/fix-hash.sh