From 0bfa1c059a0e1d95c7077f9a413c82407bac6b5d Mon Sep 17 00:00:00 2001 From: crueter Date: Mon, 3 Nov 2025 14:49:07 -0500 Subject: [PATCH] [cmake] update CPMUtil to support mingw Signed-off-by: crueter --- CMakeModules/CPMUtil.cmake | 13 ++++-- docs/CPMUtil/AddCIPackage.md | 2 + externals/cpmfile.json | 6 ++- tools/cpm/check-updates.sh | 89 +++++++++++++++++++++--------------- tools/cpm/download.sh | 2 +- 5 files changed, 69 insertions(+), 43 deletions(-) diff --git a/CMakeModules/CPMUtil.cmake b/CMakeModules/CPMUtil.cmake index 1e954b2dc0..1c4a4874c6 100644 --- a/CMakeModules/CPMUtil.cmake +++ b/CMakeModules/CPMUtil.cmake @@ -586,15 +586,22 @@ function(AddCIPackage) set(ARTIFACT_REPO ${PKG_ARGS_REPO}) set(ARTIFACT_PACKAGE ${PKG_ARGS_PACKAGE}) - # TODO: separate MinGW packages if applicable - if ((WIN32 AND ARCHITECTURE_x86_64) AND NOT "windows-amd64" IN_LIST DISABLED_PLATFORMS) + if ((MSVC AND ARCHITECTURE_x86_64) AND NOT "windows-amd64" IN_LIST DISABLED_PLATFORMS) add_ci_package(windows-amd64) endif() - if ((WIN32 AND ARCHITECTURE_arm64) AND NOT "windows-arm64" IN_LIST DISABLED_PLATFORMS) + if ((MSVC AND ARCHITECTURE_arm64) AND NOT "windows-arm64" IN_LIST DISABLED_PLATFORMS) add_ci_package(windows-arm64) endif() + if ((MINGW AND ARCHITECTURE_x86_64) AND NOT "mingw-amd64" IN_LIST DISABLED_PLATFORMS) + add_ci_package(mingw-amd64) + endif() + + if ((MINGW AND ARCHITECTURE_arm64) AND NOT "mingw-arm64" IN_LIST DISABLED_PLATFORMS) + add_ci_package(mingw-arm64) + endif() + if (ANDROID AND NOT "android" IN_LIST DISABLED_PLATFORMS) add_ci_package(android) endif() diff --git a/docs/CPMUtil/AddCIPackage.md b/docs/CPMUtil/AddCIPackage.md index 559db69ea9..bcd72e10da 100644 --- a/docs/CPMUtil/AddCIPackage.md +++ b/docs/CPMUtil/AddCIPackage.md @@ -9,6 +9,8 @@ - `DISABLED_PLATFORMS`: List of platforms that lack artifacts for this package. Options: * `windows-amd64` * `windows-arm64` + * `mingw-amd64` + * `mingw-arm64` * `android` * `solaris-amd64` * `freebsd-amd64` diff --git a/externals/cpmfile.json b/externals/cpmfile.json index 73cdf3e305..a8376db540 100644 --- a/externals/cpmfile.json +++ b/externals/cpmfile.json @@ -23,7 +23,11 @@ "package": "sirit", "name": "sirit", "repo": "eden-emulator/sirit", - "version": "1.0.2" + "version": "1.0.2", + "disabled_platforms": [ + "mingw-amd64", + "mingw-arm64" + ] }, "httplib": { "repo": "yhirose/cpp-httplib", diff --git a/tools/cpm/check-updates.sh b/tools/cpm/check-updates.sh index 7fa1904e4e..ae38b7294d 100755 --- a/tools/cpm/check-updates.sh +++ b/tools/cpm/check-updates.sh @@ -37,11 +37,20 @@ EOF while true; do case "$1" in - (-uf|--force) UPDATE=true; FORCE=true; continue ;; - (-u|--update) UPDATE=true; continue ;; - (-h) usage ;; - ("$0") break ;; - ("") break ;; + -f | --force) + UPDATE=true + FORCE=true + shift + continue + ;; + -u | --update) + UPDATE=true + shift + continue + ;; + -h) usage ;; + "$0") break ;; + "") break ;; esac PACKAGE="$1" @@ -52,68 +61,72 @@ while true; do # shellcheck disable=SC1091 . tools/cpm/package.sh - SKIP=$(value "skip_updates") + SKIP=$(value "skip_updates") - [ "$SKIP" = "true" ] && continue + [ "$SKIP" = "true" ] && continue - [ "$REPO" = null ] && continue - [ "$GIT_HOST" != "github.com" ] && continue # TODO - # shellcheck disable=SC2153 - [ "$TAG" = null ] && continue + [ "$REPO" = null ] && continue + [ "$GIT_HOST" != "github.com" ] && continue # TODO + # shellcheck disable=SC2153 + [ "$TAG" = null ] && continue - echo "-- Package $PACKAGE" + echo "-- Package $PACKAGE" # TODO(crueter): Support for Forgejo updates w/ forgejo_token - # Use gh-cli to avoid ratelimits lmao - TAGS=$(gh api --method GET "/repos/$REPO/tags") + # Use gh-cli to avoid ratelimits lmao + TAGS=$(gh api --method GET "/repos/$REPO/tags") - # filter out some commonly known annoyances + # filter out some commonly known annoyances # TODO add more - filter vulkan-sdk # vulkan - filter yotta # mbedtls + filter vulkan-sdk # vulkan + filter yotta # mbedtls - # ignore betas/alphas (remove if needed) + # ignore betas/alphas (remove if needed) filter alpha filter beta filter rc # Add package-specific overrides here, e.g. here for fmt: - [ "$PACKAGE" = fmt ] && filter v0.11 + [ "$PACKAGE" = fmt ] && filter v0.11 - LATEST=$(echo "$TAGS" | jq -r '.[0].name') + LATEST=$(echo "$TAGS" | jq -r '.[0].name') - [ "$LATEST" = "$TAG" ] && [ "$FORCE" != "true" ] && echo "-- * Up-to-date" && continue + [ "$LATEST" = "$TAG" ] && [ "$FORCE" != "true" ] && echo "-- * Up-to-date" && continue RETURN=1 - if [ "$HAS_REPLACE" = "true" ]; then - # this just extracts the tag prefix - VERSION_PREFIX=$(echo "$ORIGINAL_TAG" | cut -d"%" -f1) + 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 - NEW_GIT_VERSION=$(echo "$LATEST" | sed "s/$VERSION_PREFIX//g") - fi + # 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="$LATEST" + else + NEW_GIT_VERSION=$(echo "$LATEST" | sed "s/$VERSION_PREFIX//g") + fi + fi - echo "-- * Version $LATEST available, current is $TAG" + echo "-- * Version $LATEST available, current is $TAG" - HASH=$(tools/cpm/hash.sh "$REPO" "$LATEST") + HASH=$(tools/cpm/hash.sh "$REPO" "$LATEST") - echo "-- * New hash: $HASH" + echo "-- * New hash: $HASH" - if [ "$UPDATE" = "true" ]; then + if [ "$UPDATE" = "true" ]; then RETURN=0 - if [ "$HAS_REPLACE" = "true" ]; then - NEW_JSON=$(echo "$JSON" | jq ".hash = \"$HASH\" | .git_version = \"$NEW_GIT_VERSION\"") - else - NEW_JSON=$(echo "$JSON" | jq ".hash = \"$HASH\" | .tag = \"$LATEST\"") - fi + if [ "$HAS_REPLACE" = "true" ]; then + NEW_JSON=$(echo "$JSON" | jq ".hash = \"$HASH\" | .git_version = \"$NEW_GIT_VERSION\"") + else + NEW_JSON=$(echo "$JSON" | jq ".hash = \"$HASH\" | .tag = \"$LATEST\"") + fi export NEW_JSON tools/cpm/replace.sh - fi + fi done -exit $RETURN \ No newline at end of file +exit $RETURN diff --git a/tools/cpm/download.sh b/tools/cpm/download.sh index 315f01d54b..9793db0c04 100755 --- a/tools/cpm/download.sh +++ b/tools/cpm/download.sh @@ -65,7 +65,7 @@ ci_package() { echo "-- CI package $PACKAGE_NAME" - for platform in windows-amd64 windows-arm64 android solaris-amd64 freebsd-amd64 linux-amd64 linux-aarch64 macos-universal; do + for platform in windows-amd64 windows-arm64 mingw-amd64 mingw-arm64 android solaris-amd64 freebsd-amd64 openbsd-amd64 linux-amd64 linux-aarch64 macos-universal; do echo "-- * platform $platform" case $DISABLED in