commit 8bc93f69ac46d52c3187739e6e2c736bd1260b70 Author: Andrea Pappacoda Date: Fri Sep 23 13:40:53 2022 +0200 Import Upstream version 0-1176+ds diff --git a/.ci/scripts/clang/docker.sh b/.ci/scripts/clang/docker.sh new file mode 100755 index 0000000..792ef4a --- /dev/null +++ b/.ci/scripts/clang/docker.sh @@ -0,0 +1,29 @@ +#!/bin/bash -ex + +# SPDX-FileCopyrightText: 2021 yuzu Emulator Project +# SPDX-License-Identifier: GPL-2.0-or-later + +# Exit on error, rather than continuing with the rest of the script. +set -e + +ccache -s + +mkdir build || true && cd build +cmake .. \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_COMPILER=/usr/lib/ccache/clang++ \ + -DCMAKE_C_COMPILER=/usr/lib/ccache/clang \ + -DCMAKE_INSTALL_PREFIX="/usr" \ + -DDISPLAY_VERSION=$1 \ + -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON \ + -DENABLE_QT_TRANSLATION=ON \ + -DUSE_DISCORD_PRESENCE=ON \ + -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} \ + -GNinja + +ninja + +ccache -s + +ctest -VV -C Release + diff --git a/.ci/scripts/clang/exec.sh b/.ci/scripts/clang/exec.sh new file mode 100644 index 0000000..664fce5 --- /dev/null +++ b/.ci/scripts/clang/exec.sh @@ -0,0 +1,11 @@ +#!/bin/bash -ex + +# SPDX-FileCopyrightText: 2021 yuzu Emulator Project +# SPDX-License-Identifier: GPL-2.0-or-later + +mkdir -p "ccache" || true +chmod a+x ./.ci/scripts/clang/docker.sh +# the UID for the container yuzu user is 1027 +sudo chown -R 1027 ./ +docker run -e ENABLE_COMPATIBILITY_REPORTING -e CCACHE_DIR=/yuzu/ccache -v "$(pwd):/yuzu" -w /yuzu yuzuemu/build-environments:linux-fresh /bin/bash /yuzu/.ci/scripts/clang/docker.sh "$1" +sudo chown -R $UID ./ diff --git a/.ci/scripts/clang/upload.sh b/.ci/scripts/clang/upload.sh new file mode 100755 index 0000000..0b4b3e3 --- /dev/null +++ b/.ci/scripts/clang/upload.sh @@ -0,0 +1,23 @@ +#!/bin/bash -ex + +# SPDX-FileCopyrightText: 2021 yuzu Emulator Project +# SPDX-License-Identifier: GPL-2.0-or-later + +. .ci/scripts/common/pre-upload.sh + +REV_NAME="yuzu-linux-${GITDATE}-${GITREV}" +ARCHIVE_NAME="${REV_NAME}.tar.xz" +COMPRESSION_FLAGS="-cJvf" + +if [ "${RELEASE_NAME}" = "mainline" ]; then + DIR_NAME="${REV_NAME}" +else + DIR_NAME="${REV_NAME}_${RELEASE_NAME}" +fi + +mkdir "$DIR_NAME" + +cp build/bin/yuzu-cmd "$DIR_NAME" +cp build/bin/yuzu "$DIR_NAME" + +. .ci/scripts/common/post-upload.sh diff --git a/.ci/scripts/common/post-upload.sh b/.ci/scripts/common/post-upload.sh new file mode 100644 index 0000000..0930b7a --- /dev/null +++ b/.ci/scripts/common/post-upload.sh @@ -0,0 +1,20 @@ +#!/bin/bash -ex + +# SPDX-FileCopyrightText: 2019 yuzu Emulator Project +# SPDX-License-Identifier: GPL-2.0-or-later + +# Copy documentation +cp LICENSE.txt "$DIR_NAME" +cp README.md "$DIR_NAME" + +if [[ -z "${NO_SOURCE_PACK}" ]]; then + git clone --depth 1 file://$(readlink -e .) ${REV_NAME}-source + tar -cJvf "${REV_NAME}-source.tar.xz" ${REV_NAME}-source + cp -v "${REV_NAME}-source.tar.xz" "$DIR_NAME" + cp -v "${REV_NAME}-source.tar.xz" "${ARTIFACTS_DIR}/" +fi + +tar $COMPRESSION_FLAGS "$ARCHIVE_NAME" "$DIR_NAME" + +# move the compiled archive into the artifacts directory to be uploaded by travis releases +mv "$ARCHIVE_NAME" "${ARTIFACTS_DIR}/" diff --git a/.ci/scripts/common/pre-upload.sh b/.ci/scripts/common/pre-upload.sh new file mode 100644 index 0000000..705362a --- /dev/null +++ b/.ci/scripts/common/pre-upload.sh @@ -0,0 +1,10 @@ +#!/bin/bash -ex + +# SPDX-FileCopyrightText: 2019 yuzu Emulator Project +# SPDX-License-Identifier: GPL-2.0-or-later + +GITDATE="`git show -s --date=short --format='%ad' | sed 's/-//g'`" +GITREV="`git show -s --format='%h'`" +ARTIFACTS_DIR="artifacts" + +mkdir -p "${ARTIFACTS_DIR}/" diff --git a/.ci/scripts/format/docker.sh b/.ci/scripts/format/docker.sh new file mode 100644 index 0000000..a0f7a61 --- /dev/null +++ b/.ci/scripts/format/docker.sh @@ -0,0 +1,9 @@ +#!/bin/bash -ex + +# SPDX-FileCopyrightText: 2019 yuzu Emulator Project +# SPDX-License-Identifier: GPL-2.0-or-later + +# Run clang-format +cd /yuzu +chmod a+x ./.ci/scripts/format/script.sh +./.ci/scripts/format/script.sh diff --git a/.ci/scripts/format/exec.sh b/.ci/scripts/format/exec.sh new file mode 100644 index 0000000..40ab41a --- /dev/null +++ b/.ci/scripts/format/exec.sh @@ -0,0 +1,10 @@ +#!/bin/bash -ex + +# SPDX-FileCopyrightText: 2019 yuzu Emulator Project +# SPDX-License-Identifier: GPL-2.0-or-later + +chmod a+x ./.ci/scripts/format/docker.sh +# the UID for the container yuzu user is 1027 +sudo chown -R 1027 ./ +docker run -v "$(pwd):/yuzu" -w /yuzu yuzuemu/build-environments:linux-clang-format /bin/bash -ex /yuzu/.ci/scripts/format/docker.sh +sudo chown -R $UID ./ diff --git a/.ci/scripts/format/script.sh b/.ci/scripts/format/script.sh new file mode 100644 index 0000000..119abae --- /dev/null +++ b/.ci/scripts/format/script.sh @@ -0,0 +1,40 @@ +#!/bin/bash -ex + +# SPDX-FileCopyrightText: 2019 yuzu Emulator Project +# SPDX-License-Identifier: GPL-2.0-or-later + +if grep -nrI '\s$' src *.yml *.txt *.md Doxyfile .gitignore .gitmodules .ci* dist/*.desktop \ + dist/*.svg dist/*.xml; then + echo Trailing whitespace found, aborting + exit 1 +fi + +# Default clang-format points to default 3.5 version one +CLANG_FORMAT=clang-format-12 +$CLANG_FORMAT --version + +if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then + # Get list of every file modified in this pull request + files_to_lint="$(git diff --name-only --diff-filter=ACMRTUXB $TRAVIS_COMMIT_RANGE | grep '^src/[^.]*[.]\(cpp\|h\)$' || true)" +else + # Check everything for branch pushes + files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h')" +fi + +# Turn off tracing for this because it's too verbose +set +x + +for f in $files_to_lint; do + d=$(diff -u "$f" <($CLANG_FORMAT "$f") || true) + if ! [ -z "$d" ]; then + echo "!!! $f not compliant to coding style, here is the fix:" + echo "$d" + fail=1 + fi +done + +set -x + +if [ "$fail" = 1 ]; then + exit 1 +fi diff --git a/.ci/scripts/linux/docker.sh b/.ci/scripts/linux/docker.sh new file mode 100755 index 0000000..e85dba0 --- /dev/null +++ b/.ci/scripts/linux/docker.sh @@ -0,0 +1,65 @@ +#!/bin/bash -ex + +# SPDX-FileCopyrightText: 2019 yuzu Emulator Project +# SPDX-License-Identifier: GPL-2.0-or-later + +# Exit on error, rather than continuing with the rest of the script. +set -e + +ccache -s + +mkdir build || true && cd build +cmake .. \ + -DBoost_USE_STATIC_LIBS=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++ \ + -DCMAKE_C_COMPILER=/usr/lib/ccache/gcc \ + -DCMAKE_INSTALL_PREFIX="/usr" \ + -DDISPLAY_VERSION=$1 \ + -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON \ + -DENABLE_QT_TRANSLATION=ON \ + -DUSE_DISCORD_PRESENCE=ON \ + -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} \ + -DYUZU_USE_BUNDLED_FFMPEG=ON \ + -GNinja + +ninja + +ccache -s + +ctest -VV -C Release + +DESTDIR="$PWD/AppDir" ninja install +rm -vf AppDir/usr/bin/yuzu-cmd AppDir/usr/bin/yuzu-tester + +# Download tools needed to build an AppImage +wget -nc https://github.com/yuzu-emu/ext-linux-bin/raw/main/appimage/linuxdeploy-x86_64.AppImage +wget -nc https://github.com/yuzu-emu/ext-linux-bin/raw/main/appimage/linuxdeploy-plugin-qt-x86_64.AppImage +wget -nc https://raw.githubusercontent.com/yuzu-emu/AppImageKit-checkrt/old/AppRun.sh +wget -nc https://github.com/yuzu-emu/ext-linux-bin/raw/main/appimage/exec-x86_64.so +# Set executable bit +chmod 755 \ + AppRun.sh \ + exec-x86_64.so \ + linuxdeploy-x86_64.AppImage \ + linuxdeploy-plugin-qt-x86_64.AppImage + +# Workaround for https://github.com/AppImage/AppImageKit/issues/828 +export APPIMAGE_EXTRACT_AND_RUN=1 + +mkdir -p AppDir/usr/optional +mkdir -p AppDir/usr/optional/libstdc++ +mkdir -p AppDir/usr/optional/libgcc_s + +# Deploy yuzu's needed dependencies +./linuxdeploy-x86_64.AppImage --appdir AppDir --plugin qt + +# Workaround for libQt5MultimediaGstTools indirectly requiring libwayland-client and breaking Vulkan usage on end-user systems +find AppDir -type f -regex '.*libwayland-client\.so.*' -delete -print + +# Workaround for building yuzu with GCC 10 but also trying to distribute it to Ubuntu 18.04 et al. +# See https://github.com/darealshinji/AppImageKit-checkrt +cp exec-x86_64.so AppDir/usr/optional/exec.so +cp AppRun.sh AppDir/AppRun +cp --dereference /usr/lib/x86_64-linux-gnu/libstdc++.so.6 AppDir/usr/optional/libstdc++/libstdc++.so.6 +cp --dereference /lib/x86_64-linux-gnu/libgcc_s.so.1 AppDir/usr/optional/libgcc_s/libgcc_s.so.1 diff --git a/.ci/scripts/linux/exec.sh b/.ci/scripts/linux/exec.sh new file mode 100644 index 0000000..fa3d78c --- /dev/null +++ b/.ci/scripts/linux/exec.sh @@ -0,0 +1,16 @@ +#!/bin/bash -ex + +# SPDX-FileCopyrightText: 2019 yuzu Emulator Project +# SPDX-License-Identifier: GPL-2.0-or-later + +mkdir -p "ccache" || true +chmod a+x ./.ci/scripts/linux/docker.sh +# the UID for the container yuzu user is 1027 +sudo chown -R 1027 ./ + +# The environment variables listed below: +# AZURECIREPO TITLEBARFORMATIDLE TITLEBARFORMATRUNNING DISPLAYVERSION +# are requested in src/common/CMakeLists.txt and appear to be provided somewhere in Azure DevOps + +docker run -e AZURECIREPO -e TITLEBARFORMATIDLE -e TITLEBARFORMATRUNNING -e DISPLAYVERSION -e ENABLE_COMPATIBILITY_REPORTING -e CCACHE_DIR=/yuzu/ccache -v "$(pwd):/yuzu" -w /yuzu yuzuemu/build-environments:linux-fresh /bin/bash /yuzu/.ci/scripts/linux/docker.sh "$1" +sudo chown -R $UID ./ diff --git a/.ci/scripts/linux/upload.sh b/.ci/scripts/linux/upload.sh new file mode 100755 index 0000000..e0f3364 --- /dev/null +++ b/.ci/scripts/linux/upload.sh @@ -0,0 +1,62 @@ +#!/bin/bash -ex + +# SPDX-FileCopyrightText: 2019 yuzu Emulator Project +# SPDX-License-Identifier: GPL-2.0-or-later + +. .ci/scripts/common/pre-upload.sh + +APPIMAGE_NAME="yuzu-${RELEASE_NAME}-${GITDATE}-${GITREV}.AppImage" +BASE_NAME="yuzu-linux" +REV_NAME="${BASE_NAME}-${GITDATE}-${GITREV}" +ARCHIVE_NAME="${REV_NAME}.tar.xz" +COMPRESSION_FLAGS="-cJvf" + +if [ "${RELEASE_NAME}" = "mainline" ] || [ "${RELEASE_NAME}" = "early-access" ]; then + DIR_NAME="${BASE_NAME}-${RELEASE_NAME}" +else + DIR_NAME="${REV_NAME}-${RELEASE_NAME}" +fi + +mkdir "$DIR_NAME" + +cp build/bin/yuzu-cmd "$DIR_NAME" +if [ "${RELEASE_NAME}" != "early-access" ] && [ "${RELEASE_NAME}" != "mainline" ]; then + cp build/bin/yuzu "$DIR_NAME" +fi + +# Build an AppImage +cd build + +wget -nc https://github.com/yuzu-emu/ext-linux-bin/raw/main/appimage/appimagetool-x86_64.AppImage +chmod 755 appimagetool-x86_64.AppImage + +# if FUSE is not available, then fallback to extract and run +if ! ./appimagetool-x86_64.AppImage --version; then + export APPIMAGE_EXTRACT_AND_RUN=1 +fi + +# Don't let AppImageLauncher ask to integrate EA +if [ "${RELEASE_NAME}" = "mainline" ] || [ "${RELEASE_NAME}" = "early-access" ]; then + echo "X-AppImage-Integrate=false" >> AppDir/org.yuzu_emu.yuzu.desktop +fi + +if [ "${RELEASE_NAME}" = "mainline" ]; then + # Generate update information if releasing to mainline + ./appimagetool-x86_64.AppImage -u "gh-releases-zsync|yuzu-emu|yuzu-${RELEASE_NAME}|latest|yuzu-*.AppImage.zsync" AppDir "${APPIMAGE_NAME}" +else + ./appimagetool-x86_64.AppImage AppDir "${APPIMAGE_NAME}" +fi +cd .. + +# Copy the AppImage and update info to the artifacts directory and avoid compressing it +cp "build/${APPIMAGE_NAME}" "${ARTIFACTS_DIR}/" +if [ -f "build/${APPIMAGE_NAME}.zsync" ]; then + cp "build/${APPIMAGE_NAME}.zsync" "${ARTIFACTS_DIR}/" +fi + +# Copy the AppImage to the general release directory and remove git revision info +if [ "${RELEASE_NAME}" = "mainline" ] || [ "${RELEASE_NAME}" = "early-access" ]; then + cp "build/${APPIMAGE_NAME}" "${DIR_NAME}/yuzu-${RELEASE_NAME}.AppImage" +fi + +. .ci/scripts/common/post-upload.sh diff --git a/.ci/scripts/merge/apply-patches-by-label-private.py b/.ci/scripts/merge/apply-patches-by-label-private.py new file mode 100644 index 0000000..c640c4c --- /dev/null +++ b/.ci/scripts/merge/apply-patches-by-label-private.py @@ -0,0 +1,48 @@ +# SPDX-FileCopyrightText: 2019 yuzu Emulator Project +# SPDX-License-Identifier: GPL-2.0-or-later + +# Download all pull requests as patches that match a specific label +# Usage: python download-patches-by-label.py