diff --git a/.ci/android/build.sh b/.ci/android/build.sh index 1fb721b3b2..987d84eba3 100755 --- a/.ci/android/build.sh +++ b/.ci/android/build.sh @@ -1,11 +1,12 @@ #!/bin/bash -e -# SPDX-FileCopyrightText: 2025 eden Emulator Project +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project # SPDX-License-Identifier: GPL-3.0-or-later -export NDK_CCACHE=$(which ccache) +NDK_CCACHE=$(which ccache) +export NDK_CCACHE -if [ ! -z "${ANDROID_KEYSTORE_B64}" ]; then +if [ -n "${ANDROID_KEYSTORE_B64}" ]; then export ANDROID_KEYSTORE_FILE="${GITHUB_WORKSPACE}/ks.jks" base64 --decode <<< "${ANDROID_KEYSTORE_B64}" > "${ANDROID_KEYSTORE_FILE}" fi @@ -16,6 +17,6 @@ chmod +x ./gradlew ./gradlew assembleRelease ./gradlew bundleRelease -if [ ! -z "${ANDROID_KEYSTORE_B64}" ]; then +if [ -n "${ANDROID_KEYSTORE_B64}" ]; then rm "${ANDROID_KEYSTORE_FILE}" fi diff --git a/.ci/android/package.sh b/.ci/android/package.sh index c2eb975a02..50b7bbc332 100755 --- a/.ci/android/package.sh +++ b/.ci/android/package.sh @@ -1,6 +1,6 @@ #!/bin/sh -# SPDX-FileCopyrightText: 2025 eden Emulator Project +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project # SPDX-License-Identifier: GPL-3.0-or-later GITDATE="$(git show -s --date=short --format='%ad' | sed 's/-//g')" diff --git a/.ci/license-header.sh b/.ci/license-header.sh index 3d4929d1c1..d2e339b8f3 100755 --- a/.ci/license-header.sh +++ b/.ci/license-header.sh @@ -1,146 +1,208 @@ #!/bin/sh -e -HEADER="$(cat "$PWD/.ci/license/header.txt")" -HEADER_HASH="$(cat "$PWD/.ci/license/header-hash.txt")" +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later -echo "Getting branch changes" +COPYRIGHT_YEAR="2025" +COPYRIGHT_OWNER="Eden Emulator Project" +COPYRIGHT_LICENSE="GPL-3.0-or-later" -# BRANCH=`git rev-parse --abbrev-ref HEAD` -# COMMITS=`git log ${BRANCH} --not master --pretty=format:"%h"` -# RANGE="${COMMITS[${#COMMITS[@]}-1]}^..${COMMITS[0]}" -# FILES=`git diff-tree --no-commit-id --name-only ${RANGE} -r` +if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then + echo + echo "license-header.sh: Eden License Headers Accreditation Script" + echo + echo "This script checks and optionally fixes license headers in source, CMake and shell script files." + echo + echo "Environment Variables:" + echo " FIX=true | Automatically add the correct license headers to offending files." + echo " UPDATE=true | Automatically update current license headers of offending files." + echo " COMMIT=true | If FIX=true, commit the changes automatically." + echo + echo "Usage Examples:" + echo " # Just check headers (will fail if headers are missing)" + echo " .ci/license-header.sh" + echo + echo " # Fix headers only" + echo " FIX=true .ci/license-header.sh" + echo + echo " # Update headers only" + echo " # if COPYRIGHT_OWNER is '$COPYRIGHT_OWNER'" + echo " # or else will have 'FIX=true' behavior)" + echo " UPDATE=true .ci/license-header.sh" + echo + echo " # Fix headers and commit changes" + echo " FIX=true COMMIT=true .ci/license-header.sh" + echo + echo " # Update headers and commit changes" + echo " # if COPYRIGHT_OWNER is '$COPYRIGHT_OWNER'" + echo " # or else will have 'FIX=true' behavior)" + echo " UPDATE=true COMMIT=true .ci/license-header.sh" + exit 0 +fi -BASE=`git merge-base master HEAD` -FILES=`git diff --name-only $BASE` +SRC_FILES="" +OTHER_FILES="" -#FILES=$(git diff --name-only master) +BASE=$(git merge-base master HEAD) +if git diff --quiet "$BASE"..HEAD; then + echo + echo "license-header.sh: No commits on this branch different from master." + exit 0 +fi +FILES=$(git diff --name-only "$BASE") -echo "Done" - -check_header() { - CONTENT="`head -n3 < $1`" - case "$CONTENT" in - "$HEADER"*) ;; - *) BAD_FILES="$BAD_FILES $1" ;; - esac +echo_header() { + COMMENT_TYPE="$1" + echo "$COMMENT_TYPE SPDX-FileCopyrightText: Copyright $COPYRIGHT_YEAR $COPYRIGHT_OWNER" + echo "$COMMENT_TYPE SPDX-License-Identifier: $COPYRIGHT_LICENSE" } -check_cmake_header() { - CONTENT="`head -n3 < $1`" - - case "$CONTENT" in - "$HEADER_HASH"*) ;; - *) - BAD_CMAKE="$BAD_CMAKE $1" ;; - esac -} for file in $FILES; do [ -f "$file" ] || continue - if [ `basename -- "$file"` = "CMakeLists.txt" ]; then - check_cmake_header "$file" + case "$(basename "$file")" in + CMakeLists.txt) + COMMENT_TYPE="#" ;; + *) + EXT="${file##*.}" + case "$EXT" in + kts|kt|cpp|h) COMMENT_TYPE="//" ;; + cmake|sh|ps1) COMMENT_TYPE="#" ;; + *) continue ;; + esac ;; + esac + + HEADER=$(echo_header "$COMMENT_TYPE") + HEAD_LINES=$(head -n5 "$file") + + CORRECT_COPYRIGHT=$(echo "$HEAD_LINES" | awk \ + -v line1="$(echo "$HEADER" | sed -n '1p')" \ + -v line2="$(echo "$HEADER" | sed -n '2p')" \ + '($0==line1){getline; if($0==line2){f=1}else{f=0}} END{print (f?f:0)}') + + if [ "$CORRECT_COPYRIGHT" != "1" ]; then + case "$COMMENT_TYPE" in + "//") SRC_FILES="$SRC_FILES $file" ;; + "#") OTHER_FILES="$OTHER_FILES $file" ;; + esac + fi +done + +if [ -z "$SRC_FILES" ] && [ -z "$OTHER_FILES" ]; then + echo + echo "license-header.sh: All good!" + exit 0 +fi + +for TYPE in "SRC" "OTHER"; do + if [ "$TYPE" = "SRC" ] && [ -n "$SRC_FILES" ]; then + FILES_LIST="$SRC_FILES" + COMMENT_TYPE="//" + DESC="Source" + elif [ "$TYPE" = "OTHER" ] && [ -n "$OTHER_FILES" ]; then + FILES_LIST="$OTHER_FILES" + COMMENT_TYPE="#" + DESC="CMake and shell script" + else continue fi - EXTENSION="${file##*.}" - case "$EXTENSION" in - kts|kt|cpp|h) - check_header "$file" - ;; - cmake) - check_cmake_header "$file" - ;; - esac + echo + echo "------------------------------------------------------------" + echo "$DESC files" + echo "------------------------------------------------------------" + echo + echo " The following files contain incorrect license headers:" + for file in $FILES_LIST; do + echo " - $file" + done + + echo + echo " The correct license header to be added to all affected" + echo " '$DESC' files is:" + echo + echo "=== BEGIN ===" + echo_header "$COMMENT_TYPE" + echo "=== END ===" done -if [ "$BAD_FILES" = "" ] && [ "$BAD_CMAKE" = "" ]; then - echo - echo "All good." - - exit -fi - -if [ "$BAD_FILES" != "" ]; then - echo "The following source files have incorrect license headers:" - echo - - for file in $BAD_FILES; do echo $file; done - - cat << EOF - -The following license header should be added to the start of all offending SOURCE files: - -=== BEGIN === -$HEADER -=== END === - -EOF - -fi - -if [ "$BAD_CMAKE" != "" ]; then - echo "The following CMake files have incorrect license headers:" - echo - - for file in $BAD_CMAKE; do echo $file; done - - cat << EOF - -The following license header should be added to the start of all offending CMake files: - -=== BEGIN === -$HEADER_HASH -=== END === - -EOF - -fi - cat << EOF -If some of the code in this PR is not being contributed by the original author, -the files which have been exclusively changed by that code can be ignored. -If this happens, this PR requirement can be bypassed once all other files are addressed. + +------------------------------------------------------------ + + If some of the code in this pull request was not contributed by the original + author, the files that have been modified exclusively by that code can be + safely ignored. In such cases, this PR requirement may be bypassed once all + other files have been reviewed and addressed. EOF -if [ "$FIX" = "true" ]; then - echo - echo "FIX set to true. Fixing headers." +TMP_DIR=$(mktemp -d /tmp/license-header.XXXXXX) || exit 1 +if [ "$FIX" = "true" ] || [ "$UPDATE" = "true" ]; then echo + echo "license-header.sh: FIX set to true, fixing headers..." - for file in $BAD_FILES; do - cat $file > $file.bak + for file in $SRC_FILES $OTHER_FILES; do + BASENAME=$(basename "$file") - cat .ci/license/header.txt > $file - echo >> $file - cat $file.bak >> $file + case "$BASENAME" in + CMakeLists.txt) COMMENT_TYPE="#" ;; + *) + EXT="${file##*.}" + case "$EXT" in + kts|kt|cpp|h) COMMENT_TYPE="//" ;; + cmake|sh|ps1) COMMENT_TYPE="#" ;; + *) continue ;; + esac + ;; + esac - rm $file.bak + TMP="$TMP_DIR/$BASENAME.tmp" + UPDATED=0 + cp -p "$file" "$TMP" + > "$TMP" - git add $file + # this logic is bit hacky but sed don't work well with $VARIABLES + # it's this or complete remove this logic and keep only the old way + if [ "$UPDATE" = "true" ]; then + while IFS= read -r line || [ -n "$line" ]; do + if [ "$UPDATED" -eq 0 ] && echo "$line" | grep "$COPYRIGHT_OWNER" >/dev/null 2>&1; then + echo_header "$COMMENT_TYPE" >> "$TMP" + IFS= read -r _ || true + UPDATED=1 + else + echo "$line" >> "$TMP" + fi + done < "$file" + fi + + if [ "$UPDATED" -eq 0 ]; then + { + echo_header "$COMMENT_TYPE" + echo + cat "$TMP" + } > "$file" + else + mv "$TMP" "$file" + fi + + git add "$file" done - for file in $BAD_CMAKE; do - cat $file > $file.bak + rm -rf "$TMP_DIR" - cat .ci/license/header-hash.txt > $file - echo >> $file - cat $file.bak >> $file - - rm $file.bak - - git add $file - done - echo "License headers fixed." + echo + echo "license-header.sh: License headers fixed!" if [ "$COMMIT" = "true" ]; then echo - echo "COMMIT set to true. Committing changes." + echo "license-header.sh: COMMIT set to true, committing changes..." + + git commit -m "[license] Fix license headers [script]" + echo - - git commit -m "Fix license headers" - - echo "Changes committed. You may now push." + echo "license-header.sh: Changes committed. You may now push." fi else exit 1 fi + diff --git a/.ci/license/header-hash.txt b/.ci/license/header-hash.txt deleted file mode 100644 index 91bc195e23..0000000000 --- a/.ci/license/header-hash.txt +++ /dev/null @@ -1,2 +0,0 @@ -# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project -# SPDX-License-Identifier: GPL-3.0-or-later diff --git a/.ci/license/header.txt b/.ci/license/header.txt deleted file mode 100644 index 53a4f4396e..0000000000 --- a/.ci/license/header.txt +++ /dev/null @@ -1,2 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later diff --git a/.ci/linux/build.sh b/.ci/linux/build.sh index 8e3a452809..5721484faa 100755 --- a/.ci/linux/build.sh +++ b/.ci/linux/build.sh @@ -1,6 +1,6 @@ #!/bin/bash -e -# SPDX-FileCopyrightText: 2025 eden Emulator Project +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project # SPDX-License-Identifier: GPL-3.0-or-later case "$1" in @@ -87,7 +87,7 @@ if [ -z "$BUILD_TYPE" ]; then export BUILD_TYPE="Release" fi -export EXTRA_CMAKE_FLAGS=("${EXTRA_CMAKE_FLAGS[@]}" $@) +export EXTRA_CMAKE_FLAGS=("${EXTRA_CMAKE_FLAGS[@]}" "$@") mkdir -p build && cd build cmake .. -G Ninja \ @@ -107,7 +107,7 @@ cmake .. -G Ninja \ -DDYNARMIC_ENABLE_LTO=ON \ "${EXTRA_CMAKE_FLAGS[@]}" -ninja -j${NPROC} +ninja -j"${NPROC}" if [ -d "bin/Release" ]; then strip -s bin/Release/* diff --git a/.ci/linux/package.sh b/.ci/linux/package.sh index 837cfe07ef..b04943b94b 100755 --- a/.ci/linux/package.sh +++ b/.ci/linux/package.sh @@ -1,12 +1,13 @@ #!/bin/sh -e -# SPDX-FileCopyrightText: 2025 eden Emulator Project +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project # SPDX-License-Identifier: GPL-3.0-or-later # This script assumes you're in the source directory export APPIMAGE_EXTRACT_AND_RUN=1 -export BASE_ARCH="$(uname -m)" +BASE_ARCH="$(uname -m)" +export BASE_ARCH SHARUN="https://github.com/VHSgunzo/sharun/releases/latest/download/sharun-${BASE_ARCH}-aio" URUNTIME="https://github.com/VHSgunzo/uruntime/releases/latest/download/uruntime-appimage-dwarfs-${BASE_ARCH}" @@ -36,24 +37,26 @@ case "$1" in echo "Packaging armv9-a build of Eden" ARCH=armv9 ;; - native) + native) echo "Packaging native build of Eden" ARCH="$BASE_ARCH" ;; - + *) + echo "Unknown target: $1" + exit 1 + ;; esac export BUILDDIR="$2" -if [ "$BUILDDIR" = '' ] -then - BUILDDIR=build +if [ -z "$BUILDDIR" ]; then + BUILDDIR=build fi EDEN_TAG=$(git describe --tags --abbrev=0) echo "Making \"$EDEN_TAG\" build" # git checkout "$EDEN_TAG" -VERSION="$(echo "$EDEN_TAG")" +VERSION="$EDEN_TAG" # NOW MAKE APPIMAGE mkdir -p ./AppDir @@ -67,21 +70,19 @@ ln -sf ./dev.eden_emu.eden.svg ./.DirIcon UPINFO='gh-releases-zsync|eden-emulator|Releases|latest|*.AppImage.zsync' if [ "$DEVEL" = 'true' ]; then - sed -i 's|Name=Eden|Name=Eden Nightly|' ./dev.eden_emu.eden.desktop - UPINFO="$(echo "$UPINFO" | sed 's|Releases|nightly|')" + sed -i 's|Name=Eden|Name=Eden Nightly|' ./dev.eden_emu.eden.desktop + UPINFO="$(echo "$UPINFO" | sed 's|Releases|nightly|')" fi LIBDIR="/usr/lib" # Workaround for Gentoo -if [ ! -d "$LIBDIR/qt6" ] -then - LIBDIR="/usr/lib64" +if [ ! -d "$LIBDIR/qt6" ]; then + LIBDIR="/usr/lib64" fi # Workaround for Debian -if [ ! -d "$LIBDIR/qt6" ] -then +if [ ! -d "$LIBDIR/qt6" ]; then LIBDIR="/usr/lib/${BASE_ARCH}-linux-gnu" fi @@ -90,40 +91,38 @@ fi wget --retry-connrefused --tries=30 "$SHARUN" -O ./sharun-aio chmod +x ./sharun-aio xvfb-run -a ./sharun-aio l -p -v -e -s -k \ - ../$BUILDDIR/bin/eden* \ - $LIBDIR/lib*GL*.so* \ - $LIBDIR/dri/* \ - $LIBDIR/vdpau/* \ - $LIBDIR/libvulkan* \ - $LIBDIR/libXss.so* \ - $LIBDIR/libdecor-0.so* \ - $LIBDIR/libgamemode.so* \ - $LIBDIR/qt6/plugins/audio/* \ - $LIBDIR/qt6/plugins/bearer/* \ - $LIBDIR/qt6/plugins/imageformats/* \ - $LIBDIR/qt6/plugins/iconengines/* \ - $LIBDIR/qt6/plugins/platforms/* \ - $LIBDIR/qt6/plugins/platformthemes/* \ - $LIBDIR/qt6/plugins/platforminputcontexts/* \ - $LIBDIR/qt6/plugins/styles/* \ - $LIBDIR/qt6/plugins/xcbglintegrations/* \ - $LIBDIR/qt6/plugins/wayland-*/* \ - $LIBDIR/pulseaudio/* \ - $LIBDIR/pipewire-0.3/* \ - $LIBDIR/spa-0.2/*/* \ - $LIBDIR/alsa-lib/* - -rm -f ./sharun-aio + ../"$BUILDDIR"/bin/eden* \ + "$LIBDIR"/lib*GL*.so* \ + "$LIBDIR"/dri/* \ + "$LIBDIR"/vdpau/* \ + "$LIBDIR"/libvulkan* \ + "$LIBDIR"/libXss.so* \ + "$LIBDIR"/libdecor-0.so* \ + "$LIBDIR"/libgamemode.so* \ + "$LIBDIR"/qt6/plugins/audio/* \ + "$LIBDIR"/qt6/plugins/bearer/* \ + "$LIBDIR"/qt6/plugins/imageformats/* \ + "$LIBDIR"/qt6/plugins/iconengines/* \ + "$LIBDIR"/qt6/plugins/platforms/* \ + "$LIBDIR"/qt6/plugins/platformthemes/* \ + "$LIBDIR"/qt6/plugins/platforminputcontexts/* \ + "$LIBDIR"/qt6/plugins/styles/* \ + "$LIBDIR"/qt6/plugins/xcbglintegrations/* \ + "$LIBDIR"/qt6/plugins/wayland-*/* \ + "$LIBDIR"/pulseaudio/* \ + "$LIBDIR"/pipewire-0.3/* \ + "$LIBDIR"/spa-0.2/*/* \ + "$LIBDIR"/alsa-lib/* # Prepare sharun if [ "$ARCH" = 'aarch64' ]; then - # allow the host vulkan to be used for aarch64 given the sad situation - echo 'SHARUN_ALLOW_SYS_VKICD=1' > ./.env + # allow the host vulkan to be used for aarch64 given the sad situation + echo 'SHARUN_ALLOW_SYS_VKICD=1' > ./.env fi # Workaround for Gentoo if [ -d "shared/libproxy" ]; then - cp shared/libproxy/* lib/ + cp shared/libproxy/* lib/ fi ln -f ./sharun ./AppRun @@ -134,20 +133,20 @@ cd .. wget -q "$URUNTIME" -O ./uruntime chmod +x ./uruntime -#Add udpate info to runtime +# Add update info to runtime echo "Adding update information \"$UPINFO\" to runtime..." ./uruntime --appimage-addupdinfo "$UPINFO" echo "Generating AppImage..." ./uruntime --appimage-mkdwarfs -f \ - --set-owner 0 --set-group 0 \ - --no-history --no-create-timestamp \ - --categorize=hotness --hotness-list=.ci/linux/eden.dwfsprof \ - --compression zstd:level=22 -S26 -B32 \ - --header uruntime \ + --set-owner 0 --set-group 0 \ + --no-history --no-create-timestamp \ + --categorize=hotness --hotness-list=.ci/linux/eden.dwfsprof \ + --compression zstd:level=22 -S26 -B32 \ + --header uruntime \ -N 4 \ - -i ./AppDir -o Eden-"$VERSION"-"$ARCH".AppImage + -i ./AppDir -o "Eden-$VERSION-$ARCH.AppImage" echo "Generating zsync file..." -zsyncmake *.AppImage -u *.AppImage -echo "All Done!" \ No newline at end of file +zsyncmake ./*.AppImage -u ./*.AppImage +echo "All Done!" diff --git a/.ci/source.sh b/.ci/source.sh index cbdacd1cd7..41fafa63bb 100755 --- a/.ci/source.sh +++ b/.ci/source.sh @@ -1,22 +1,59 @@ -#!/bin/bash -ex +#!/bin/sh -e -# git-archive-all -export PATH="$PATH:/home/$USER/.local/bin" +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later -GITDATE="`git show -s --date=short --format='%ad' | sed 's/-//g'`" -GITREV="`git show -s --format='%h'`" +GITDATE=$(git show -s --date=short --format='%ad' | sed 's/-//g') +GITREV=$(git show -s --format='%h') REV_NAME="eden-unified-source-${GITDATE}-${GITREV}" -COMPAT_LIST='dist/compatibility_list/compatibility_list.json' +COMPAT_LIST="dist/compatibility_list/compatibility_list.json" +ARTIFACT_DIR="artifacts" +ARCHIVE_PATH="${ARTIFACT_DIR}/${REV_NAME}.tar" +XZ_PATH="${ARCHIVE_PATH}.xz" +SHA_PATH="${XZ_PATH}.sha256sum" -mkdir artifacts +# Abort if archive already exists +if [ -e "$XZ_PATH" ]; then + echo "Error: Archive '$XZ_PATH' already exists. Aborting." + exit 1 +fi -touch "${COMPAT_LIST}" -git describe --abbrev=0 --always HEAD > GIT-COMMIT -git describe --tags HEAD > GIT-TAG || echo 'unknown' > GIT-TAG -git-archive-all --include "${COMPAT_LIST}" --include GIT-COMMIT --include GIT-TAG --force-submodules artifacts/"${REV_NAME}.tar" +# Create output directory +mkdir -p "$ARTIFACT_DIR" + +# Create temporary directory +TMPDIR=$(mktemp -d) + +# Ensure compatibility list file exists +touch "$COMPAT_LIST" +cp "$COMPAT_LIST" "$TMPDIR/" + +# Create base archive from git +git archive --format=tar --prefix="${REV_NAME}/" HEAD > "$ARCHIVE_PATH" + +# Create commit and tag files with correct names +git describe --abbrev=0 --always HEAD > "$TMPDIR/GIT-COMMIT" +if ! git describe --tags HEAD > "$TMPDIR/GIT-TAG" 2>/dev/null; then + echo "unknown" > "$TMPDIR/GIT-TAG" +fi + +# Append extra files to archive +tar --append --file="$ARCHIVE_PATH" -C "$TMPDIR" "$(basename "$COMPAT_LIST")" GIT-COMMIT GIT-TAG + +# Remove temporary directory +rm -rf "$TMPDIR" + +# Compress using xz +xz -9 "$ARCHIVE_PATH" + +# Generate SHA-256 checksum (GNU vs BSD/macOS) +if command -v sha256sum >/dev/null 2>&1; then + sha256sum "$XZ_PATH" > "$SHA_PATH" +elif command -v shasum >/dev/null 2>&1; then + shasum -a 256 "$XZ_PATH" > "$SHA_PATH" +else + echo "No SHA-256 tool found (sha256sum or shasum required)" >&2 + exit 1 +fi -cd artifacts/ -xz -T0 -9 "${REV_NAME}.tar" -sha256sum "${REV_NAME}.tar.xz" > "${REV_NAME}.tar.xz.sha256sum" -cd .. diff --git a/.ci/translate.sh b/.ci/translate.sh index 55104b7c76..2a52e4161b 100755 --- a/.ci/translate.sh +++ b/.ci/translate.sh @@ -1,11 +1,12 @@ #!/bin/sh +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + for i in dist/languages/*.ts; do SRC=en_US - TARGET=`head -n1 $i | awk -F 'language="' '{split($2, a, "\""); print a[1]}'` + TARGET=$(head -n1 "$i" | awk -F 'language="' '{split($2, a, "\""); print a[1]}') + SOURCES=$(find src/yuzu -type f \( -name '*.ui' -o -name '*.cpp' -o -name '*.h' -o -name '*.plist' \)) - # requires fd - SOURCES=`fd . src/yuzu -tf -e ui -e cpp -e h -e plist` - - lupdate -source-language $SRC -target-language $TARGET $SOURCES -ts /data/code/eden/$i + lupdate -source-language $SRC -target-language "$TARGET" "$SOURCES" -ts /data/code/eden/"$i" done diff --git a/.ci/update-icons.sh b/.ci/update-icons.sh index 4feb2abd24..1ba6eff17b 100755 --- a/.ci/update-icons.sh +++ b/.ci/update-icons.sh @@ -1,21 +1,47 @@ #!/bin/sh -e -# SPDX-FileCopyrightText: 2025 eden Emulator Project +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project # SPDX-License-Identifier: GPL-3.0-or-later -which png2icns || [ which yay && yay libicns ] || exit -which magick || exit +# Check dependencies +for cmd in png2icns magick svgo; do + if ! command -v "$cmd" >/dev/null 2>&1; then + pkg="$cmd" + case "$cmd" in + png2icns) pkg="icnsutils" ;; + magick) pkg="imagemagick" ;; + esac + echo "Error: command '$cmd' not found. Install the package '$pkg'." + exit 1 + fi +done -export EDEN_SVG_ICO="dist/dev.eden_emu.eden.svg" -svgo --multipass $EDEN_SVG_ICO +EDEN_SVG_ICO="dist/dev.eden_emu.eden.svg" -magick -density 256x256 -background transparent $EDEN_SVG_ICO \ - -define icon:auto-resize -colors 256 dist/eden.ico || exit -convert -density 256x256 -resize 256x256 -background transparent $EDEN_SVG_ICO \ - dist/yuzu.bmp || exit +# Create temporary PNG file safely (and POSIX-compliant) +TMP_PNG=$(mktemp /tmp/eden-tmp-XXXXXX) +TMP_PNG="${TMP_PNG}.png" + +# Optimize SVG +svgo --multipass "$EDEN_SVG_ICO" + +# Generate ICO +magick \ + -density 256x256 -background transparent "$EDEN_SVG_ICO" \ + -define icon:auto-resize -colors 256 "dist/eden.ico" + +# Generate BMP +magick "$EDEN_SVG_ICO" -resize 256x256 -background transparent "dist/yuzu.bmp" + +# Generate PNG for ICNS +magick -size 1024x1024 -background transparent "$EDEN_SVG_ICO" "$TMP_PNG" + +# Generate ICNS +png2icns "dist/eden.icns" "$TMP_PNG" + +# Copy ICNS to Yuzu file +cp "dist/eden.icns" "dist/yuzu.icns" + +# Remove temporary PNG +rm -f "$TMP_PNG" -export TMP_PNG="dist/eden-tmp.png" -magick -size 1024x1024 -background transparent $EDEN_SVG_ICO $TMP_PNG || exit -png2icns dist/eden.icns $TMP_PNG || exit -cp dist/eden.icns dist/yuzu.icns -rm $TMP_PNG diff --git a/.ci/windows/build.sh b/.ci/windows/build.sh index a0ab69a440..80590850be 100644 --- a/.ci/windows/build.sh +++ b/.ci/windows/build.sh @@ -1,6 +1,6 @@ #!/bin/bash -ex -# SPDX-FileCopyrightText: 2025 Eden Emulator Project +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project # SPDX-License-Identifier: GPL-3.0-or-later if [ "$COMPILER" == "clang" ] @@ -17,12 +17,12 @@ fi [ -z "$WINDEPLOYQT" ] && { echo "WINDEPLOYQT environment variable required."; exit 1; } -echo $EXTRA_CMAKE_FLAGS +echo "${EXTRA_CMAKE_FLAGS[@]}" mkdir -p build && cd build cmake .. -G Ninja \ -DCMAKE_BUILD_TYPE="${BUILD_TYPE:-Release}" \ - -DENABLE_QT_TRANSLATION=ON \ + -DENABLE_QT_TRANSLATION=ON \ -DUSE_DISCORD_PRESENCE=ON \ -DYUZU_USE_BUNDLED_SDL2=ON \ -DBUILD_TESTING=OFF \ @@ -30,14 +30,14 @@ cmake .. -G Ninja \ -DDYNARMIC_TESTS=OFF \ -DYUZU_CMD=OFF \ -DYUZU_ROOM_STANDALONE=OFF \ - -DYUZU_USE_QT_MULTIMEDIA=${USE_MULTIMEDIA:-false} \ - -DYUZU_USE_QT_WEB_ENGINE=${USE_WEBENGINE:-false} \ + -DYUZU_USE_QT_MULTIMEDIA="${USE_MULTIMEDIA:-false}" \ + -DYUZU_USE_QT_WEB_ENGINE="${USE_WEBENGINE:-false}" \ -DYUZU_ENABLE_LTO=ON \ - -DCMAKE_EXE_LINKER_FLAGS=" /LTCG" \ + -DCMAKE_EXE_LINKER_FLAGS=" /LTCG" \ -DDYNARMIC_ENABLE_LTO=ON \ - -DYUZU_USE_BUNDLED_QT=${BUNDLE_QT:-false} \ - -DUSE_CCACHE=${CCACHE:-false} \ - -DENABLE_QT_UPDATE_CHECKER=${DEVEL:-true} \ + -DYUZU_USE_BUNDLED_QT="${BUNDLE_QT:-false}" \ + -DUSE_CCACHE="${CCACHE:-false}" \ + -DENABLE_QT_UPDATE_CHECKER="${DEVEL:-true}" \ "${EXTRA_CMAKE_FLAGS[@]}" \ "$@" diff --git a/.ci/windows/install-vulkan-sdk.ps1 b/.ci/windows/install-vulkan-sdk.ps1 index 4c5274d1b7..ff870bc459 100755 --- a/.ci/windows/install-vulkan-sdk.ps1 +++ b/.ci/windows/install-vulkan-sdk.ps1 @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + # SPDX-FileCopyrightText: 2023 yuzu Emulator Project # SPDX-License-Identifier: GPL-3.0-or-later @@ -36,4 +39,4 @@ echo "Finished installing Vulkan SDK $VulkanSDKVer" if ("$env:GITHUB_ACTIONS" -eq "true") { echo "VULKAN_SDK=$VULKAN_SDK" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "$VULKAN_SDK/Bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append -} \ No newline at end of file +} diff --git a/.ci/windows/package.sh b/.ci/windows/package.sh index 2d126dc5be..d1fcb695e4 100644 --- a/.ci/windows/package.sh +++ b/.ci/windows/package.sh @@ -1,3 +1,8 @@ +#!/bin/bash -e + +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + GITDATE=$(git show -s --date=short --format='%ad' | tr -d "-") GITREV=$(git show -s --format='%h') @@ -15,4 +20,4 @@ cp LICENSE* README* "$TMP_DIR"/ 7z a -tzip "$ARTIFACTS_DIR/$ZIP_NAME" "$TMP_DIR"/* -rm -rf "$TMP_DIR" \ No newline at end of file +rm -rf "$TMP_DIR" diff --git a/tools/cpm-fetch-all.sh b/tools/cpm-fetch-all.sh index 66f55df94d..7b634d3d28 100755 --- a/tools/cpm-fetch-all.sh +++ b/tools/cpm-fetch-all.sh @@ -1,6 +1,6 @@ #!/bin/bash -e -# SPDX-FileCopyrightText: 2025 Eden Emulator Project +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project # SPDX-License-Identifier: GPL-3.0-or-later # SPDX-FileCopyrightText: 2025 crueter @@ -8,4 +8,4 @@ LIBS=$(find . externals src/qt_common src/dynarmic -maxdepth 2 -name cpmfile.json -exec jq -j 'keys_unsorted | join(" ")' {} \; -printf " ") -tools/cpm-fetch.sh $LIBS \ No newline at end of file +tools/cpm-fetch.sh "$LIBS" diff --git a/tools/cpm-fetch.sh b/tools/cpm-fetch.sh index 996cf76a97..e223fd7255 100755 --- a/tools/cpm-fetch.sh +++ b/tools/cpm-fetch.sh @@ -1,6 +1,6 @@ #!/bin/bash -e -# SPDX-FileCopyrightText: 2025 Eden Emulator Project +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project # SPDX-License-Identifier: GPL-3.0-or-later # SPDX-FileCopyrightText: 2025 crueter @@ -8,7 +8,7 @@ [ -z "$CPM_SOURCE_CACHE" ] && CPM_SOURCE_CACHE=$PWD/.cache/cpm -mkdir -p $CPM_SOURCE_CACHE +mkdir -p "$CPM_SOURCE_CACHE" ROOTDIR="$PWD" @@ -25,7 +25,7 @@ download_package() { curl "$DOWNLOAD" -sS -L -o "$OUTFILE" - ACTUAL_HASH=$(${HASH_ALGO}sum "$OUTFILE" | cut -d" " -f1) + ACTUAL_HASH=$("${HASH_ALGO}"sum "$OUTFILE" | cut -d" " -f1) [ "$ACTUAL_HASH" != "$HASH" ] && echo "$FILENAME did not match expected hash; expected $HASH but got $ACTUAL_HASH" && exit 1 mkdir -p "$OUTDIR" @@ -46,10 +46,10 @@ download_package() { # 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) + DIRS=$(find . -maxdepth 1 -type d -o -type f) # thanks gnu - if [ $(wc -l <<< "$DIRS") -eq 2 ]; then + if [ "$(wc -l <<< "$DIRS")" -eq 2 ]; then SUBDIR=$(find . -maxdepth 1 -type d -not -name ".") mv "$SUBDIR"/* . mv "$SUBDIR"/.* . 2>/dev/null || true @@ -59,7 +59,7 @@ download_package() { if grep -e "patches" <<< "$JSON" > /dev/null; then PATCHES=$(jq -r '.patches | join(" ")' <<< "$JSON") for patch in $PATCHES; do - patch --binary -p1 < "$ROOTDIR"/.patch/$package/$patch + patch --binary -p1 < "$ROOTDIR"/.patch/"$package"/"$patch" done fi @@ -102,7 +102,7 @@ ci_package() { done } -for package in $@ +for package in "$@" do # prepare for cancer # TODO(crueter): Fetch json once? @@ -145,12 +145,11 @@ do fi TAG=$(jq -r ".tag" <<< "$JSON") - - TAG=$(sed "s/%VERSION%/$VERSION_REPLACE/" <<< $TAG) + TAG="${TAG//%VERSION%/$VERSION_REPLACE}" ARTIFACT=$(jq -r ".artifact" <<< "$JSON") - ARTIFACT=$(sed "s/%VERSION%/$VERSION_REPLACE/" <<< $ARTIFACT) - ARTIFACT=$(sed "s/%TAG%/$TAG/" <<< $ARTIFACT) + ARTIFACT="${ARTIFACT//%VERSION%/$VERSION_REPLACE}" + ARTIFACT="${ARTIFACT//%TAG%/$TAG}" if [ "$URL" != "null" ]; then DOWNLOAD="$URL" @@ -219,4 +218,4 @@ do download_package done -rm -rf $TMP \ No newline at end of file +rm -rf "$TMP" diff --git a/tools/cpm-hash.sh b/tools/cpm-hash.sh index da0fb395db..18aceda4b9 100755 --- a/tools/cpm-hash.sh +++ b/tools/cpm-hash.sh @@ -1,4 +1,7 @@ #!/bin/sh -SUM=`wget -q https://github.com/$1/archive/$2.zip -O - | sha512sum` +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + +SUM=$(wget -q https://github.com/"$1"/archive/"$2".zip -O - | sha512sum) echo "$SUM" | cut -d " " -f1 diff --git a/tools/reset-submodules.sh b/tools/reset-submodules.sh deleted file mode 100755 index 6fdfe0bcdb..0000000000 --- a/tools/reset-submodules.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -ex - -# SPDX-FileCopyrightText: 2024 yuzu Emulator Project -# SPDX-License-Identifier: MIT - -git submodule sync -git submodule foreach --recursive git reset --hard -git submodule update --init --recursive diff --git a/tools/url-hash.sh b/tools/url-hash.sh index a54dec8bb2..1dea887dca 100755 --- a/tools/url-hash.sh +++ b/tools/url-hash.sh @@ -1,4 +1,7 @@ #!/bin/sh -SUM=`wget -q $1 -O - | sha512sum` +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + +SUM=$(wget -q "$1" -O - | sha512sum) echo "$SUM" | cut -d " " -f1