diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index bca1b8f..d30b977 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -179,9 +179,6 @@ jobs: if: always() && needs.check-version.outputs.should_build == 'true' runs-on: ${{ matrix.os }} timeout-minutes: 120 - env: - CPM_SOURCE_CACHE: ${{ github.workspace }}/.cpm-cache - strategy: fail-fast: false matrix: @@ -190,25 +187,28 @@ jobs: os: ubuntu-latest artifact_name: "Artifacts_x86_64" script_suffix: "" - arch_arg: "" + build_arg: "" - name: "Citron Build (Optimized x86_64)" os: ubuntu-latest artifact_name: "Artifacts_v3" script_suffix: "_v3" - arch_arg: "--arch v3" + build_arg: "v3" - name: "Citron Build (aarch64)" os: ubuntu-24.04-arm artifact_name: "Artifacts_aarch64" script_suffix: "" - arch_arg: "" + build_arg: "" + + container: ghcr.io/pkgforge-dev/archlinux:latest steps: - - name: Checkout CI Scripts - uses: actions/checkout@v4 - with: - persist-credentials: false + - name: Install Git + run: pacman -Syu --noconfirm --needed git - - name: Clone Citron Source + - name: Checkout Workflow Scripts + uses: actions/checkout@v4 + + - name: Clone Citron Source Code shell: bash run: | CLONE_REPO="${{ needs.check-version.outputs.head_repo }}" @@ -216,9 +216,10 @@ jobs: EXPECTED_HASH="${{ needs.check-version.outputs.new_hash_full }}" if [ -z "$CLONE_REPO" ] || [[ "$CLONE_REPO" != *"/"* ]]; then CLONE_REPO="${{ env.UPSTREAM_REPO }}"; fi if [ -z "$BRANCH_NAME" ]; then BRANCH_NAME="main"; fi + echo "Cloning from $CLONE_REPO (branch: $BRANCH_NAME)..." - git clone --depth 1 -b "$BRANCH_NAME" "https://github.com/${CLONE_REPO}.git" citron - cd citron + git clone --recurse-submodules --shallow-submodules --depth 1 -b "$BRANCH_NAME" "https://github.com/${CLONE_REPO}.git" emulator + cd emulator ACTUAL_HASH=$(git rev-parse HEAD) echo "Checked out ${CLONE_REPO}@${BRANCH_NAME}: ${ACTUAL_HASH}" if [ -n "$EXPECTED_HASH" ] && [ "$ACTUAL_HASH" != "$EXPECTED_HASH" ]; then @@ -226,54 +227,51 @@ jobs: exit 1 fi - - name: Set Git Safe Directory - working-directory: ./citron + - name: Prepare Build Environment + run: | + mv get-dependencies.sh emulator/ + mv build-citron.sh emulator/ + mv package-citron.sh emulator/ + + - name: Add Git Safe Directory + working-directory: ./emulator run: git config --global --add safe.directory "$PWD" - - name: Cache CPM Sources - uses: actions/cache@v4 - with: - path: ${{ github.workspace }}/.cpm-cache - key: cpm-linux-${{ runner.os }}-${{ matrix.os }}-${{ hashFiles('citron/CMakeModules/dependencies.cmake') }} - restore-keys: | - cpm-linux-${{ runner.os }}-${{ matrix.os }}- + - name: Install dependencies + working-directory: ./emulator + run: chmod +x ./get-dependencies.sh && ./get-dependencies.sh - - name: Setup Build Environment - working-directory: ./citron - run: | - chmod +x ./build-citron-linux.sh - ./build-citron-linux.sh setup - - - name: Compute Version - id: version - working-directory: ./citron - run: | - GIT_SHA="$(git rev-parse --short HEAD)" - PR_NUMBER="${{ needs.check-version.outputs.pr_number }}" - if [ -n "$PR_NUMBER" ]; then - echo "app_version=PR-${PR_NUMBER}-${GIT_SHA}" >> $GITHUB_OUTPUT - else - echo "app_version=${GIT_SHA}" >> $GITHUB_OUTPUT - fi - echo "sha=${GIT_SHA}" >> $GITHUB_OUTPUT - - - name: Build Citron - working-directory: ./citron - env: - APP_VERSION: ${{ steps.version.outputs.app_version }} - ARCH_SUFFIX: ${{ matrix.script_suffix }} - DEVEL: "true" + - name: Build Citron from source + working-directory: ./emulator run: | NPROC_VAL=$(nproc --all) JOBS_VAL=$((NPROC_VAL > 4 ? 4 : NPROC_VAL)) - JOBS=${JOBS_VAL} ./build-citron-linux.sh use --pgo none --lto full ${{ matrix.arch_arg }} + chmod +x ./build-citron.sh + JOBS=${JOBS_VAL} DEVEL=true ./build-citron.sh ${{ matrix.build_arg }} + + - name: Package AppImage with Correct Name + working-directory: ./emulator + run: | + GIT_SHA=$(git rev-parse --short HEAD) + PR_NUMBER="${{ needs.check-version.outputs.pr_number }}" + BRANCH_NAME="${{ needs.check-version.outputs.branch_name }}" + SAFE_BRANCH=$(printf '%s' "$BRANCH_NAME" | tr '/ ' '--' | tr -cd 'A-Za-z0-9._-') + if [ -n "$PR_NUMBER" ]; then + export APP_VERSION="PR-${PR_NUMBER}-${GIT_SHA}" + else + export APP_VERSION="${SAFE_BRANCH:-main}-${GIT_SHA}" + fi + export VERSION="${APP_VERSION}" + export ARCH_SUFFIX="${{ matrix.script_suffix }}" + export DEVEL="true" + chmod +x ./package-citron.sh + ./package-citron.sh - name: Upload Artifacts uses: actions/upload-artifact@v4 with: name: ${{ matrix.artifact_name }} - path: citron/build/use-nopgo/AppImage/ - + path: emulator/dist/ comment-end: name: Comment End @@ -303,7 +301,7 @@ jobs: gh api -X DELETE "repos/${UPSTREAM}/issues/comments/${DUPLICATE_ID}" >/dev/null 2>&1 || true fi done - + if [ -n "$COMMENT_ID" ]; then LOG_URL="https://github.com/${REPO}/actions/runs/${RUN_ID}" COMMIT_LINK="[\`${HASH_SHORT}\`](https://github.com/${HEAD_REPO}/commit/${HASH_FULL})" diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..9f1c57e --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,69 @@ +# Maintainer: Collecting + +# The '-git' suffix signifies this is a bleeding-edge build from the git repo +pkgname=citron-git +pkgver=0.1.r0.g1a2b3c4 # This will be replaced by the pkgver() function +pkgrel=1 +pkgdesc="A Nintendo Switch emulator" +arch=('x86_64' 'aarch64') +url="https://citron-emu.org/" +license=('GPL2') + +# Dependencies needed to run the emulator +depends=( + 'boost-libs' 'enet' 'fmt' 'ffmpeg' 'gamemode' 'glslang' 'hicolor-icon-theme' + 'libdecor' 'libxkbcommon-x11' 'mbedtls2' 'nlohmann-json' 'qt6-base' + 'qt6-multimedia' 'sdl2' 'vulkan-icd-loader' +) + +# Dependencies needed only to build the emulator from source +makedepends=( + 'boost' 'catch2' 'cmake' 'git' 'ninja' 'nasm' 'qt6-tools' 'vulkan-headers' +) + +# This points to the source code repository +source=("git+https://git.citron-emu.org/citron/emulator.git") +sha256sums=('SKIP') + +# This function automatically generates a version string based on the latest git commit +pkgver() { + cd "$pkgname" + git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' +} + +# This function runs before the build and is used to apply patches +prepare() { + cd "$pkgname" + # Apply compatibility patches for newer Boost versions + find . -type f \( -name '*.cpp' -o -name '*.h' \) | xargs sed -i 's/\bboost::asio::io_service\b/boost::asio::io_context/g' + find . -type f \( -name '*.cpp' -o -name '*.h' \) | xargs sed -i 's/\bboost::asio::io_service::strand\b/boost::asio::strand/g' + find . -type f \( -name '*.cpp' -o -name '*.h' \) | xargs sed -i 's|#include *|#include |g' + find . -type f \( -name '*.cpp' -o -name '*.h' \) | xargs sed -i 's/\bboost::process::async_pipe\b/boost::process::v1::async_pipe/g' +} + +# This function contains the build commands +build() { + cd "$pkgname" + # makepkg sets CFLAGS and CXXFLAGS, so we don't need to specify arch flags + cmake -B build -S . -GNinja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCITRON_USE_BUNDLED_VCPKG=OFF \ + -DCITRON_USE_BUNDLED_QT=OFF \ + -DUSE_SYSTEM_QT=ON \ + -DCITRON_USE_BUNDLED_FFMPEG=OFF \ + -DCITRON_USE_BUNDLED_SDL2=OFF \ + -DCITRON_TESTS=OFF \ + -DCITRON_CHECK_SUBMODULES=OFF \ + -DCITRON_ENABLE_LTO=ON \ + -DCITRON_USE_QT_MULTIMEDIA=ON \ + -DENABLE_QT_TRANSLATION=ON + + ninja -C build +} + +# This function installs the built files into a temporary directory +package() { + cd "$pkgname" + DESTDIR="$pkgdir/" ninja -C build install +} diff --git a/README.md b/README.md index 612d7c7..25182e2 100644 --- a/README.md +++ b/README.md @@ -1,53 +1,78 @@ -# πŸ‹ Citron Neo PR Builds +# πŸ‹ The Official Citron-CI -[![Build Citron Neo (Android)](https://github.com/citron-neo/CI/actions/workflows/build-android.yml/badge.svg)](https://github.com/citron-neo/CI/actions/workflows/build-android.yml) [![Build Citron Neo (Windows)](https://github.com/citron-neo/CI/actions/workflows/build-windows.yml/badge.svg)](https://github.com/citron-neo/CI/actions/workflows/build-windows.yml) [![Build Citron Neo (Linux)](https://github.com/citron-neo/CI/actions/workflows/build-linux.yml/badge.svg)](https://github.com/citron-neo/CI/actions/workflows/build-linux.yml) [![Build Citron Neo (macOS)](https://github.com/citron-neo/CI/actions/workflows/build-macos.yml/badge.svg)](https://github.com/citron-neo/CI/actions/workflows/build-macos.yml) +[![GitHub Downloads](https://img.shields.io/github/downloads/citron-neo/CI/total?logo=github&label=GitHub%20Downloads)](https://github.com/citron-neo/CI/releases/latest) +[![Build Citron (Android)](https://github.com/citron-neo/CI/actions/workflows/build-android.yml/badge.svg)](https://github.com/citron-neo/CI/actions/workflows/build-android.yml) +[![Build Citron (Windows)](https://github.com/citron-neo/CI/actions/workflows/build-windows.yml/badge.svg)](https://github.com/citron-neo/CI/actions/workflows/build-windows.yml) +[![Build Citron (Linux)](https://github.com/citron-neo/CI/actions/workflows/build-linux.yml/badge.svg)](https://github.com/citron-neo/CI/actions/workflows/build-linux.yml) +[![Build Citron (macOS)](https://github.com/citron-neo/CI/actions/workflows/build-macos.yml/badge.svg)](https://github.com/citron-neo/CI/actions/workflows/build-macos.yml) + +## Star History + + + + + + Star History Chart + + --- -This repository builds **on-demand test artifacts for open pull requests** against the Citron Neo emulator β€” it does **not** produce the project's Nightly or Stable releases. For those, see [citron-neo/CI](https://github.com/citron-neo/CI). - -Each platform workflow (Windows, Linux, Android, macOS) is triggered manually via `workflow_dispatch`, taking a target branch, a PR number, and a head repo as input. This lets a reviewer or contributor build a specific PR's branch β€” from any fork β€” without waiting for it to merge. - -Once a build is requested, this repository: - -- Builds the requested commit for the chosen platform. -- Posts (or updates) a single results comment on the corresponding pull request in [citron-neo/emulator](https://github.com/citron-neo/emulator), with a table tracking each platform's status (`Pending` β†’ `Building...` β†’ `Success`/`Failed`) and a direct download link to the artifact, powered by [nightly.link](https://nightly.link). -- Skips rebuilding a commit that's already been built successfully for that platform, to avoid duplicate work on repeated dispatches. +This repository makes Nightly builds for **x86_64** (Standard), **x86_64_v3** (CPU's that are from 2013+) & **aarch64** on Linux, and also Windows, Android & macOS builds! These builds are all produced @ 12 AM UTC every single day. Would you like to submit a compatibility report for the emulator? You can do so here: -- [Submit Compatibility Report](https://github.com/citron-neo/Citron-Compatability) +* [Submit Compatibility Report](https://github.com/CollectingW/Citron-Compatability) --- Direct links for other information you may need can also be found below: -- [Latest Commits Can Be Found Here](https://github.com/citron-neo/emulator/commits/main) -- [citron-neo/CI β€” Nightly & Stable Releases](https://github.com/citron-neo/CI) -- [citron-neo/emulator β€” Open Pull Requests](https://github.com/citron-neo/emulator/pulls) +* [Latest Commits Can Be Found Here](https://github.com/citron-neo/emulator/commits/main) + +* [Latest Android Nightly Release](https://github.com/citron-neo/CI/releases/tag/nightly-android) + +* [Latest Linux Nightly Release](https://github.com/citron-neo/CI/releases/tag/nightly-linux) + +* [Latest Windows Nightly Release](https://github.com/citron-neo/CI/releases/tag/nightly-windows) + +* [Latest macOS Nightly Release](https://github.com/citron-neo/CI/releases/tag/nightly-macos) --- # READ THIS IF YOU HAVE ISSUES -If you are on wayland (specially GNOME wayland) and get freezes or crashes, you are likely affected by this issue that affects all Qt6 apps: [citron-neo/CI#50](https://github.com/citron-neo/CI/pull/50) +If you are on wayland (specially GNOME wayland) and get freezes or crashes, you are likely affected by this issue that affects all Qt6 apps: https://github.com/citron-neo/CI/issues/50 To fix it simply set the env variable `QT_QPA_PLATFORM=xcb` -**Also, are you looking for AppImages of other emulators? Check:** [AnyLinux-AppImages](https://pkgforge-dev.github.io/Anylinux-AppImages/) +**Also, are you looking for AppImages of other emulators? Check:** [AnyLinux-AppImages](https://pkgforge-dev.github.io/Anylinux-AppImages/) ---- +---- -Linux AppImage builds are made using [sharun](https://github.com/VHSgunzo/sharun), which makes it extremely easy to turn any binary into a portable package without using containers or similar tricks. +AppImage made using [sharun](https://github.com/VHSgunzo/sharun), which makes it extremely easy to turn any binary into a portable package without using containers or similar tricks. **These AppImages bundle everything and should work on any Linux distro, even on musl based ones.** -A `tar.zst` portable archive of the same build is also produced alongside the AppImage, for users who prefer an install-free tarball over the AppImage format. +It is possible that the AppImages may fail to work with appimagelauncher, we recommend these alternatives instead: -These AppImages work without fuse2 as they can use fuse3 instead; they can also work without fuse at all thanks to the [uruntime](https://github.com/VHSgunzo/uruntime). +* [AM](https://github.com/ivan-hc/AM) `am -i citron` or `appman -i citron` + +* [dbin](https://github.com/xplshn/dbin) `dbin install citron.appimage` + +* [soar](https://github.com/pkgforge/soar) `soar install citron` + +These AppImages works without fuse2 as it can use fuse3 instead, it can also work without fuse at all thanks to the [uruntime](https://github.com/VHSgunzo/uruntime) + +
+ raison d'Γͺtre + Inspiration Image + +
+ +**The following information above and the creation of the AppImages Citron currently creates & distributes derives from Pkgforges previous work. You can find their repository here: https://github.com/pkgforge-dev/Citron-AppImage** --- -Thank-you for being a part of & using Citron Neo, we value all members of the community whom help shape the emulator into what it is today! - -- The Citron Neo Team +Thank-you for being apart of & using Citron, we value all members of the community whom help shape the emulator into what it is today! +- The Citron Team diff --git a/build-citron.sh b/build-citron.sh new file mode 100644 index 0000000..2ccbe94 --- /dev/null +++ b/build-citron.sh @@ -0,0 +1,92 @@ +#!/bin/sh +set -ex + +# --- Architecture and Compiler Flag Setup --- +ARCH="${ARCH:-$(uname -m)}" + +if [ "$1" = 'v3' ] && [ "$ARCH" = 'x86_64' ]; then + ARCH_FLAGS="-march=x86-64-v3 -O3 -USuccess -UNone -fuse-ld=lld" +elif [ "$ARCH" = 'x86_64' ]; then + ARCH_FLAGS="-march=x86-64 -mtune=generic -O3 -USuccess -UNone -fuse-ld=lld" +else + ARCH_FLAGS="-march=armv8-a -mtune=generic -O3 -USuccess -UNone -fuse-ld=lld" +fi + +# --- Source Code Checkout and Versioning --- +if [ -d ".git" ]; then + echo "Already in a git repository, using current directory." +else + git clone --recurse-submodules --shallow-submodules --depth 1 "https://github.com/citron-neo/emulator.git" ./citron + cd ./citron +fi + +if [ "$DEVEL" = 'true' ]; then + CITRON_TAG="$(git rev-parse --short HEAD)" + VERSION="$CITRON_TAG" +else + CITRON_TAG=$(git describe --tags) + git checkout "$CITRON_TAG" + VERSION="$(echo "$CITRON_TAG" | awk -F'-' '{print $1}')" +fi + +# --- Apply Necessary Source Code Patches for Compatibility --- +find . -type f \( -name '*.cpp' -o -name '*.h' \) | xargs sed -i 's/\bboost::asio::io_service\b/boost::asio::io_context/g' +find . -type f \( -name '*.cpp' -o -name '*.h' \) | xargs sed -i 's/\bboost::asio::io_service::strand\b/boost::asio::strand/g' +find . -type f \( -name '*.cpp' -o -name '*.h' \) | xargs sed -i 's|#include *|#include |g' +find . -type f \( -name '*.cpp' -o -name '*.h' \) | xargs sed -i 's/\bboost::process::async_pipe\b/boost::process::v1::async_pipe/g' +sed -i '/sse2neon/d' ./src/video_core/CMakeLists.txt +sed -i 's/cmake_minimum_required(VERSION 2.8)/cmake_minimum_required(VERSION 3.5)/' externals/xbyak/CMakeLists.txt + +# --- Find Qt6 Private Headers --- +HEADER_PATH=$(pacman -Ql qt6-base | grep 'qpa/qplatformnativeinterface.h$' | awk '{print $2}') +if [ -z "$HEADER_PATH" ]; then + echo "ERROR: Could not find qplatformnativeinterface.h path." >&2 + exit 1 +fi +QT_PRIVATE_INCLUDE_DIR=$(dirname "$(dirname "$HEADER_PATH")") +CXX_FLAGS_EXTRA="-I${QT_PRIVATE_INCLUDE_DIR}" + +# --- Build Process --- +JOBS=$(nproc --all) + +mkdir build && cd build + +# Configure the build using CMake +cmake .. -GNinja \ + -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \ + -DCITRON_USE_BUNDLED_VCPKG=OFF \ + -DCITRON_USE_BUNDLED_QT=OFF \ + -DUSE_SYSTEM_QT=ON \ + -DENABLE_QT6=ON \ + -DCITRON_USE_BUNDLED_FFMPEG=OFF \ + -DCITRON_USE_BUNDLED_SDL2=ON \ + -DCITRON_USE_EXTERNAL_SDL2=OFF \ + -DCITRON_TESTS=OFF \ + -DCITRON_CHECK_SUBMODULES=OFF \ + -DCITRON_USE_LLVM_DEMANGLE=OFF \ + -DCITRON_ENABLE_LTO=ON \ + -DCITRON_USE_QT_MULTIMEDIA=ON \ + -DCITRON_USE_QT_WEB_ENGINE=OFF \ + -DENABLE_QT_TRANSLATION=ON \ + -DUSE_DISCORD_PRESENCE=ON \ + -DENABLE_WEB_SERVICE=ON \ + -DENABLE_OPENSSL=ON \ + -DBUNDLE_SPEEX=ON \ + -DCITRON_USE_FASTER_LD=OFF \ + -DCITRON_USE_EXTERNAL_Vulkan_HEADERS=ON \ + -DCITRON_USE_EXTERNAL_VULKAN_UTILITY_LIBRARIES=ON \ + -DCITRON_USE_AUTO_UPDATER=ON \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_CXX_FLAGS="$ARCH_FLAGS -Wno-error -w ${CXX_FLAGS_EXTRA}" \ + -DCMAKE_C_FLAGS="$ARCH_FLAGS" \ + -DCMAKE_SYSTEM_PROCESSOR="$(uname -m)" \ + -DCITRON_BUILD_TYPE=Release \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 + +# Compile and install the project +ninja -j${JOBS} +sudo ninja install + +# --- Output Version Info --- +echo "$VERSION" >~/version diff --git a/get-dependencies.sh b/get-dependencies.sh new file mode 100644 index 0000000..ea371d9 --- /dev/null +++ b/get-dependencies.sh @@ -0,0 +1,56 @@ +#!/bin/sh + +set -ex +ARCH="$(uname -m)" + +pacman -Syu --noconfirm --needed \ + base-devel \ + boost \ + boost-libs \ + catch2 \ + clang \ + cmake \ + curl \ + enet \ + fmt \ + ffmpeg \ + gamemode \ + gcc \ + git \ + glslang \ + glu \ + hidapi \ + libdecor \ + libvpx \ + libxi \ + libxkbcommon-x11 \ + libxss \ + lld \ + llvm \ + mesa \ + nasm \ + ninja \ + nlohmann-json \ + numactl \ + openal \ + patchelf \ + pulseaudio \ + pulseaudio-alsa \ + qt6-base \ + qt6-networkauth \ + qt6-multimedia \ + qt6-tools \ + qt6-wayland \ + qt6-translations \ + sdl2 \ + unzip \ + vulkan-headers \ + vulkan-mesa-layers \ + wget \ + xcb-util-cursor \ + xcb-util-image \ + xcb-util-renderutil \ + xcb-util-wm \ + xorg-server-xvfb \ + zip \ + zsync diff --git a/package-citron.sh b/package-citron.sh new file mode 100644 index 0000000..e8588f8 --- /dev/null +++ b/package-citron.sh @@ -0,0 +1,72 @@ +#!/bin/sh +set -ex +ARCH="${ARCH:-$(uname -m)}" + +# The VERSION is now passed as an environment variable from the workflow +if [ -z "$APP_VERSION" ]; then + echo "Error: APP_VERSION environment variable is not set." + exit 1 +fi + +# Construct unique names for the AppImage and tarball based on the build matrix. +OUTNAME_BASE="citron_nightly-${APP_VERSION}-linux-${ARCH}${ARCH_SUFFIX}" +export OUTNAME_APPIMAGE="${OUTNAME_BASE}.AppImage" +export OUTNAME_TAR="${OUTNAME_BASE}.tar.zst" + +URUNTIME="https://raw.githubusercontent.com/pkgforge-dev/Anylinux-AppImages/refs/heads/main/useful-tools/uruntime2appimage.sh" +SHARUN="https://raw.githubusercontent.com/pkgforge-dev/Anylinux-AppImages/refs/heads/main/useful-tools/quick-sharun.sh" + +export DESKTOP=/usr/share/applications/org.citron_emu.citron.desktop +export ICON=/usr/share/icons/hicolor/scalable/apps/org.citron_emu.citron.svg +export DEPLOY_OPENGL=1 +export DEPLOY_VULKAN=1 +export DEPLOY_PIPEWIRE=1 + +wget --retry-connrefused --tries=30 "$SHARUN" -O ./quick-sharun +chmod +x ./quick-sharun + +./quick-sharun /usr/bin/citron* /usr/lib/libgamemode.so* /usr/lib/libpulse.so* + +echo "Copying Qt translation files..." + +mkdir -p ./AppDir/usr/share/qt6 + +cp -r /usr/share/qt6/translations ./AppDir/usr/share/qt6/ + +if [ "$DEVEL" = 'true' ]; then + sed -i 's|Name=citron|Name=citron nightly|' ./AppDir/*.desktop +fi + +echo 'SHARUN_ALLOW_SYS_VK_ICD=1' > ./AppDir/.env + + +echo "Creating tar.zst archive..." + +(cd AppDir && tar -c --zstd -f ../"$OUTNAME_TAR" usr) +echo "Successfully created $OUTNAME_TAR" + + +wget --retry-connrefused --tries=30 "$URUNTIME" -O ./uruntime2appimage +chmod +x ./uruntime2appimage + +# Run the AppImage creation tool and capture its output to a variable. +BUILD_OUTPUT=$(./uruntime2appimage) + +# Print the captured output to the logs for debugging purposes. +echo "$BUILD_OUTPUT" + +# Automatically find the AppImage path from the output, strip any ANSI color codes, +# and then use basename to get just the filename. +SOURCE_APPIMAGE=$(basename "$(echo "$BUILD_OUTPUT" | grep "All done! AppImage at:" | awk '{print $NF}' | sed 's/\x1b\[[0-9;]*m//g')") + +echo "Discovered source AppImage: ${SOURCE_APPIMAGE}" +echo "Renaming to final suffixed name: ${OUTNAME_APPIMAGE}..." + +# Now, use the dynamically discovered and cleaned filename for the move operations. +mv -v "${SOURCE_APPIMAGE}" "${OUTNAME_APPIMAGE}" +mv -v "${SOURCE_APPIMAGE}.zsync" "${OUTNAME_APPIMAGE}.zsync" + +mkdir -p ./dist + +mv -v ./*.AppImage* ./dist +mv -v ./*.tar.zst ./dist