2025-08-29 00:18:02 +02:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
2025-09-21 21:58:59 +02:00
|
|
|
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
2025-08-29 00:18:02 +02:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
# SPDX-FileCopyrightText: 2025 crueter
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
[ -z "$CPM_SOURCE_CACHE" ] && CPM_SOURCE_CACHE=$PWD/.cache/cpm
|
|
|
|
|
|
|
|
mkdir -p $CPM_SOURCE_CACHE
|
|
|
|
|
|
|
|
ROOTDIR="$PWD"
|
|
|
|
|
|
|
|
TMP=$(mktemp -d)
|
|
|
|
|
|
|
|
download_package() {
|
|
|
|
FILENAME=$(basename "$DOWNLOAD")
|
|
|
|
|
|
|
|
OUTFILE="$TMP/$FILENAME"
|
|
|
|
|
|
|
|
LOWER_PACKAGE=$(tr '[:upper:]' '[:lower:]' <<< "$PACKAGE_NAME")
|
|
|
|
OUTDIR="${CPM_SOURCE_CACHE}/${LOWER_PACKAGE}/${KEY}"
|
|
|
|
[ -d "$OUTDIR" ] && return
|
|
|
|
|
|
|
|
curl "$DOWNLOAD" -sS -L -o "$OUTFILE"
|
|
|
|
|
|
|
|
ACTUAL_HASH=$(${HASH_ALGO}sum "$OUTFILE" | cut -d" " -f1)
|
2025-09-23 19:38:11 +02:00
|
|
|
[ "$ACTUAL_HASH" != "$HASH" ] && echo "!! $FILENAME did not match expected hash; expected $HASH but got $ACTUAL_HASH" && exit 1
|
2025-08-29 00:18:02 +02:00
|
|
|
|
|
|
|
mkdir -p "$OUTDIR"
|
|
|
|
|
|
|
|
pushd "$OUTDIR" > /dev/null
|
|
|
|
|
|
|
|
case "$FILENAME" in
|
|
|
|
(*.7z)
|
|
|
|
7z x "$OUTFILE" > /dev/null
|
|
|
|
;;
|
|
|
|
(*.tar*)
|
|
|
|
tar xf "$OUTFILE" > /dev/null
|
|
|
|
;;
|
|
|
|
(*.zip)
|
|
|
|
unzip "$OUTFILE" > /dev/null
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# basically if only one real item exists at the top we just move everything from there
|
|
|
|
# since github and some vendors hate me
|
|
|
|
DIRS=$(find -maxdepth 1 -type d -o -type f)
|
|
|
|
|
|
|
|
# thanks gnu
|
|
|
|
if [ $(wc -l <<< "$DIRS") -eq 2 ]; then
|
|
|
|
SUBDIR=$(find . -maxdepth 1 -type d -not -name ".")
|
|
|
|
mv "$SUBDIR"/* .
|
|
|
|
mv "$SUBDIR"/.* . 2>/dev/null || true
|
|
|
|
rmdir "$SUBDIR"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if grep -e "patches" <<< "$JSON" > /dev/null; then
|
|
|
|
PATCHES=$(jq -r '.patches | join(" ")' <<< "$JSON")
|
|
|
|
for patch in $PATCHES; do
|
2025-09-09 20:47:49 +02:00
|
|
|
patch --binary -p1 < "$ROOTDIR"/.patch/$package/$patch
|
2025-08-29 00:18:02 +02:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
popd > /dev/null
|
|
|
|
}
|
|
|
|
|
|
|
|
ci_package() {
|
|
|
|
REPO=$(jq -r ".repo" <<< "$JSON")
|
|
|
|
EXT=$(jq -r '.extension' <<< "$JSON")
|
2025-09-23 19:38:11 +02:00
|
|
|
[ "$EXT" = null ] && EXT="tar.zst"
|
2025-08-29 00:18:02 +02:00
|
|
|
|
|
|
|
VERSION=$(jq -r ".version" <<< "$JSON")
|
2025-09-23 19:38:11 +02:00
|
|
|
|
|
|
|
NAME=$(jq -r ".name" <<< "$JSON")
|
|
|
|
[ "$NAME" = null ] && NAME="$PACKAGE"
|
|
|
|
|
2025-08-29 00:18:02 +02:00
|
|
|
PACKAGE=$(jq -r ".package | \"$package\"" <<< "$JSON")
|
|
|
|
|
2025-09-23 19:38:11 +02:00
|
|
|
DISABLED=$(jq -j '.disabled_platforms' <<< "$JSON")
|
2025-08-29 00:18:02 +02:00
|
|
|
|
2025-09-23 19:38:11 +02:00
|
|
|
[ "$REPO" = null ] && echo "No repo defined for CI package $package" && return
|
2025-08-29 00:18:02 +02:00
|
|
|
|
2025-09-23 19:38:11 +02:00
|
|
|
echo "-- CI package $PACKAGE"
|
2025-08-29 00:18:02 +02:00
|
|
|
|
[cmake] update CI deps, feat: sirit CI + new CI spec (#2655)
Updates sirit to our fork's latest version w/ SPIRV Headers included
(end goal is to remove spirv-headers entirely, as spirv-tools-ci should
include them inline as well)
Adds a sirit CI on our fork for all platforms (saves a bit of compile
time)
My CI spec has changed a little bit, and now there is no need for an
additional CMake file after the initial CMakeLists.txt (since targets
are now global imported). Plus, UNIX amd64 now has the amd64 suffix like
aarch64 and windows
Updates SDL2 to 2.32.10 and OpenSSL to 3.6.0
Finally, on Solaris all CI packages (sans FFmpeg) are now built with OmniOS, which
should in theory be fully compatible with OpenIndiana (our recommended
Sun-based target) but obviously will need testing
Need testing:
- [ ] Make sure I didn't nuke shader emission
- [ ] Make sure FreeBSD, OpenBSD, and OpenIndiana work fine with bundled
sirit (check linking especially)
- [ ] Make sure SDL2, OpenSSL work with OpenIndiana now
- [ ] SDL2 on all platforms (input, etc)
Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2655
2025-10-04 09:27:13 +02:00
|
|
|
for platform in windows-amd64 windows-arm64 android solaris-amd64 freebsd-amd64 linux-amd64 linux-aarch64 macos-universal; do
|
2025-09-23 19:38:11 +02:00
|
|
|
echo "-- * platform $platform"
|
|
|
|
|
|
|
|
case $DISABLED in
|
|
|
|
(*"$platform"*)
|
|
|
|
echo "-- * -- disabled"
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
(*) ;;
|
|
|
|
esac
|
|
|
|
|
2025-08-29 00:18:02 +02:00
|
|
|
FILENAME="${NAME}-${platform}-${VERSION}.${EXT}"
|
2025-09-08 19:21:38 +02:00
|
|
|
DOWNLOAD="https://$GIT_HOST/${REPO}/releases/download/v${VERSION}/${FILENAME}"
|
2025-08-29 00:18:02 +02:00
|
|
|
PACKAGE_NAME="$PACKAGE"
|
|
|
|
KEY=$platform
|
|
|
|
|
2025-09-23 19:38:11 +02:00
|
|
|
LOWER_PACKAGE=$(tr '[:upper:]' '[:lower:]' <<< "$PACKAGE_NAME")
|
|
|
|
OUTDIR="${CPM_SOURCE_CACHE}/${LOWER_PACKAGE}/${KEY}"
|
|
|
|
[ -d "$OUTDIR" ] && continue
|
2025-08-29 00:18:02 +02:00
|
|
|
|
|
|
|
HASH_ALGO=$(jq -r ".hash_algo" <<< "$JSON")
|
2025-09-23 19:38:11 +02:00
|
|
|
[ "$HASH_ALGO" = null ] && HASH_ALGO=sha512
|
2025-08-29 00:18:02 +02:00
|
|
|
|
|
|
|
HASH_SUFFIX="${HASH_ALGO}sum"
|
|
|
|
HASH_URL="${DOWNLOAD}.${HASH_SUFFIX}"
|
|
|
|
|
|
|
|
HASH=$(curl "$HASH_URL" -sS -q -L -o -)
|
|
|
|
|
|
|
|
download_package
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
for package in $@
|
|
|
|
do
|
|
|
|
# prepare for cancer
|
2025-09-15 17:21:18 +02:00
|
|
|
# TODO(crueter): Fetch json once?
|
2025-09-23 19:38:11 +02:00
|
|
|
JSON=$(find . src -maxdepth 3 -name cpmfile.json -exec jq -r ".\"$package\" | select( . != null )" {} \;)
|
2025-08-29 00:18:02 +02:00
|
|
|
|
2025-09-23 19:38:11 +02:00
|
|
|
[ -z "$JSON" ] && echo "!! No cpmfile definition for $package" && continue
|
2025-08-29 00:18:02 +02:00
|
|
|
|
|
|
|
PACKAGE_NAME=$(jq -r ".package" <<< "$JSON")
|
2025-09-23 19:38:11 +02:00
|
|
|
[ "$PACKAGE_NAME" = null ] && PACKAGE_NAME="$package"
|
|
|
|
|
|
|
|
GIT_HOST=$(jq -r ".git_host" <<< "$JSON")
|
|
|
|
[ "$GIT_HOST" = null ] && GIT_HOST=github.com
|
|
|
|
REPO=$(jq -r ".repo" <<< "$JSON")
|
2025-08-29 00:18:02 +02:00
|
|
|
|
|
|
|
CI=$(jq -r ".ci" <<< "$JSON")
|
|
|
|
if [ "$CI" != null ]; then
|
|
|
|
ci_package
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2025-09-09 20:47:49 +02:00
|
|
|
VERSION=$(jq -r ".version" <<< "$JSON")
|
|
|
|
GIT_VERSION=$(jq -r ".git_version" <<< "$JSON")
|
|
|
|
TAG=$(jq -r ".tag" <<< "$JSON")
|
|
|
|
SHA=$(jq -r ".sha" <<< "$JSON")
|
|
|
|
|
2025-09-23 19:38:11 +02:00
|
|
|
[ "$GIT_VERSION" = null ] && GIT_VERSION="$VERSION"
|
|
|
|
[ "$GIT_VERSION" = null ] && GIT_VERSION="$TAG"
|
2025-09-09 20:47:49 +02:00
|
|
|
|
2025-08-29 00:18:02 +02:00
|
|
|
# url parsing WOOOHOOHOHOOHOHOH
|
|
|
|
URL=$(jq -r ".url" <<< "$JSON")
|
|
|
|
SHA=$(jq -r ".sha" <<< "$JSON")
|
2025-09-08 19:21:38 +02:00
|
|
|
|
|
|
|
VERSION=$(jq -r ".version" <<< "$JSON")
|
|
|
|
GIT_VERSION=$(jq -r ".git_version" <<< "$JSON")
|
|
|
|
|
|
|
|
if [ "$GIT_VERSION" != null ]; then
|
|
|
|
VERSION_REPLACE="$GIT_VERSION"
|
|
|
|
else
|
|
|
|
VERSION_REPLACE="$VERSION"
|
|
|
|
fi
|
|
|
|
|
|
|
|
TAG=$(jq -r ".tag" <<< "$JSON")
|
|
|
|
|
|
|
|
TAG=$(sed "s/%VERSION%/$VERSION_REPLACE/" <<< $TAG)
|
|
|
|
|
|
|
|
ARTIFACT=$(jq -r ".artifact" <<< "$JSON")
|
|
|
|
ARTIFACT=$(sed "s/%VERSION%/$VERSION_REPLACE/" <<< $ARTIFACT)
|
|
|
|
ARTIFACT=$(sed "s/%TAG%/$TAG/" <<< $ARTIFACT)
|
2025-08-29 00:18:02 +02:00
|
|
|
|
|
|
|
if [ "$URL" != "null" ]; then
|
|
|
|
DOWNLOAD="$URL"
|
|
|
|
elif [ "$REPO" != "null" ]; then
|
2025-09-08 19:21:38 +02:00
|
|
|
GIT_URL="https://$GIT_HOST/$REPO"
|
2025-08-29 00:18:02 +02:00
|
|
|
|
|
|
|
BRANCH=$(jq -r ".branch" <<< "$JSON")
|
|
|
|
|
|
|
|
if [ "$TAG" != "null" ]; then
|
|
|
|
if [ "$ARTIFACT" != "null" ]; then
|
|
|
|
DOWNLOAD="${GIT_URL}/releases/download/${TAG}/${ARTIFACT}"
|
|
|
|
else
|
|
|
|
DOWNLOAD="${GIT_URL}/archive/refs/tags/${TAG}.tar.gz"
|
|
|
|
fi
|
|
|
|
elif [ "$SHA" != "null" ]; then
|
|
|
|
DOWNLOAD="${GIT_URL}/archive/${SHA}.zip"
|
|
|
|
else
|
2025-09-23 19:38:11 +02:00
|
|
|
if [ "$BRANCH" = null ]; then
|
2025-08-29 00:18:02 +02:00
|
|
|
BRANCH=master
|
|
|
|
fi
|
|
|
|
|
|
|
|
DOWNLOAD="${GIT_URL}/archive/refs/heads/${BRANCH}.zip"
|
|
|
|
fi
|
|
|
|
else
|
2025-09-23 19:38:11 +02:00
|
|
|
echo "!! No repo or URL defined for $package"
|
2025-08-29 00:18:02 +02:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
# key parsing
|
|
|
|
KEY=$(jq -r ".key" <<< "$JSON")
|
|
|
|
|
2025-09-23 19:38:11 +02:00
|
|
|
if [ "$KEY" = null ]; then
|
2025-08-29 00:18:02 +02:00
|
|
|
if [ "$SHA" != null ]; then
|
|
|
|
KEY=$(cut -c1-4 - <<< "$SHA")
|
|
|
|
elif [ "$GIT_VERSION" != null ]; then
|
|
|
|
KEY="$GIT_VERSION"
|
2025-09-08 19:21:38 +02:00
|
|
|
elif [ "$TAG" != null ]; then
|
|
|
|
KEY="$TAG"
|
2025-08-29 00:18:02 +02:00
|
|
|
elif [ "$VERSION" != null ]; then
|
|
|
|
KEY="$VERSION"
|
|
|
|
else
|
2025-09-23 19:38:11 +02:00
|
|
|
echo "!! No valid key could be determined for $package. Must define one of: key, sha, tag, version, git_version"
|
2025-08-29 00:18:02 +02:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2025-09-23 19:38:11 +02:00
|
|
|
echo "-- Downloading regular package $package, with key $KEY, from $DOWNLOAD"
|
2025-08-29 00:18:02 +02:00
|
|
|
|
|
|
|
# hash parsing
|
|
|
|
HASH_ALGO=$(jq -r ".hash_algo" <<< "$JSON")
|
2025-09-23 19:38:11 +02:00
|
|
|
[ "$HASH_ALGO" = null ] && HASH_ALGO=sha512
|
2025-08-29 00:18:02 +02:00
|
|
|
|
|
|
|
HASH=$(jq -r ".hash" <<< "$JSON")
|
|
|
|
|
2025-09-23 19:38:11 +02:00
|
|
|
if [ "$HASH" = null ]; then
|
2025-08-29 00:18:02 +02:00
|
|
|
HASH_SUFFIX="${HASH_ALGO}sum"
|
|
|
|
HASH_URL=$(jq -r ".hash_url" <<< "$JSON")
|
|
|
|
|
2025-09-23 19:38:11 +02:00
|
|
|
if [ "$HASH_URL" = null ]; then
|
2025-08-29 00:18:02 +02:00
|
|
|
HASH_URL="${DOWNLOAD}.${HASH_SUFFIX}"
|
|
|
|
fi
|
|
|
|
|
[cmake] update CI deps, feat: sirit CI + new CI spec (#2655)
Updates sirit to our fork's latest version w/ SPIRV Headers included
(end goal is to remove spirv-headers entirely, as spirv-tools-ci should
include them inline as well)
Adds a sirit CI on our fork for all platforms (saves a bit of compile
time)
My CI spec has changed a little bit, and now there is no need for an
additional CMake file after the initial CMakeLists.txt (since targets
are now global imported). Plus, UNIX amd64 now has the amd64 suffix like
aarch64 and windows
Updates SDL2 to 2.32.10 and OpenSSL to 3.6.0
Finally, on Solaris all CI packages (sans FFmpeg) are now built with OmniOS, which
should in theory be fully compatible with OpenIndiana (our recommended
Sun-based target) but obviously will need testing
Need testing:
- [ ] Make sure I didn't nuke shader emission
- [ ] Make sure FreeBSD, OpenBSD, and OpenIndiana work fine with bundled
sirit (check linking especially)
- [ ] Make sure SDL2, OpenSSL work with OpenIndiana now
- [ ] SDL2 on all platforms (input, etc)
Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2655
2025-10-04 09:27:13 +02:00
|
|
|
HASH=$(curl "$HASH_URL" -sS -L -o -)
|
2025-08-29 00:18:02 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
download_package
|
|
|
|
done
|
|
|
|
|
|
|
|
rm -rf $TMP
|