diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..d0886eaa9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,339 @@ +--- +name: CI + +on: + pull_request: + branches: [master] + types: [opened, synchronize, reopened] + push: + branches: [master] + schedule: + - cron: "45 23 * * 0" # weekly build of master (Sunday 11:45pm) + +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: true + +jobs: + build_win: + name: Windows + runs-on: windows-2022 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install Qt x64 + uses: jdpurcell/install-qt-action@v5 + with: + arch: win64_msvc2022_64 + dir: ${{ github.workspace }}\x64\ + host: windows + target: desktop + version: '6.8.3' + use-naqt: true + + - name: Gather metadata + run: | + Add-Content $env:GITHUB_PATH "$($env:QT_ROOT_DIR)\bin" + echo ("VERSION=" + (Get-Content app/version.txt)) >> $env:GITHUB_ENV + Get-Content -Path "app\deploy\windows\Moonlight.rc" | ForEach-Object { $_ -replace "__GITHUB_REF_NAME__", $($env:GITHUB_REF_NAME) } | Set-Content -Path "app\deploy\windows\Moonlight.rc.tmp" + Get-Content -Path "app\deploy\windows\Moonlight.rc.tmp" | ForEach-Object { $_ -replace "__GITHUB_SHA__", $($env:GITHUB_SHA) } | Set-Content -Path "app\deploy\windows\Moonlight.rc" + Remove-Item -Path "app\deploy\windows\Moonlight.rc.tmp" + + - name: Build Windows x64 + shell: pwsh + run: | + scripts\build-arch.bat Release x64 + mkdir artifacts + Copy-Item "build\installer-x64-release\MoonlightPortable-x64-$($env:VERSION).zip" -Destination "artifacts\MoonlightPortable-x64.zip" + Copy-Item "build\symbols-x64-Release\MoonlightDebuggingSymbols-x64-$($env:VERSION).zip" -Destination "artifacts\MoonlightDebuggingSymbols-x64.zip" + Get-ChildItem -Path "artifacts" -Recurse + + - name: Install Qt arm64 + uses: jdpurcell/install-qt-action@v5 + with: + arch: win64_msvc2022_arm64_cross_compiled + dir: ${{ github.workspace }}\arm64\ + host: windows + target: desktop + version: '6.8.3' + use-naqt: true + + - name: Build Windows arm64 + shell: pwsh + run: | + Copy-Item "scripts\build_arm64\qmake.bat" -Destination "$($env:QT_ROOT_DIR)\bin" + Copy-Item "scripts\build_arm64\qtpaths.bat" -Destination "$($env:QT_ROOT_DIR)\bin" + Copy-Item "scripts\build_arm64\target_qt.conf" -Destination "$($env:QT_ROOT_DIR)\bin" + Add-Content $env:GITHUB_PATH "$($env:QT_ROOT_DIR)\bin" + scripts\build-arch.bat Release arm64 + Copy-Item "build\installer-arm64-release\MoonlightPortable-arm64-$($env:VERSION).zip" -Destination "artifacts\MoonlightPortable-arm64.zip" + Copy-Item "build\symbols-arm64-Release\MoonlightDebuggingSymbols-arm64-$($env:VERSION).zip" -Destination "artifacts\MoonlightDebuggingSymbols-arm64.zip" + Get-ChildItem -Path "artifacts" -Recurse + + - name: Build universal binary + shell: pwsh + run: | + scripts\generate-bundle.bat Release + Copy-Item "build\installer-release\MoonlightSetup-$($env:VERSION).exe" -Destination "artifacts\MoonlightSetup.exe" + Get-ChildItem -Path "artifacts" -Recurse + + # This is the only way to generate separate artifacts without using a job matrix + - name: Upload Artifacts (Installer) + uses: actions/upload-artifact@v4 + with: + name: MoonlightSetup.exe + path: artifacts/MoonlightSetup.exe + compression-level: 0 + + - name: Upload Artifacts (Portable x64) + uses: actions/upload-artifact@v4 + with: + name: MoonlightPortable-x64.zip + path: artifacts/MoonlightPortable-x64.zip + compression-level: 0 + + - name: Upload Artifacts (Portable arm64) + uses: actions/upload-artifact@v4 + with: + name: MoonlightPortable-arm64.zip + path: artifacts/MoonlightPortable-arm64.zip + compression-level: 0 + + - name: Upload Artifacts (Debug symbols) + uses: actions/upload-artifact@v4 + with: + name: MoonlightDebuggingSymbols + path: | + artifacts/MoonlightDebuggingSymbols-x64.zip + artifacts/MoonlightPortable-arm64.zip + compression-level: 0 + +### + + build_macos: + name: macOS + runs-on: macos-15 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install Qt + uses: jdpurcell/install-qt-action@v5 + with: + arch: clang_64 + host: mac + target: desktop + version: '6.8.3' + + - name: Install Node + run: | + brew install node + npm install --global create-dmg + + - name: Gather Metadata + run: | + echo "VERSION=$(cat app/version.txt)" >> $GITHUB_ENV + + - name: Build macOS universal binary + shell: bash + run: | + echo "${QT_ROOT_DIR}/bin" >> $GITHUB_PATH + scripts/generate-dmg.sh Release + mkdir artifacts + mv build/installer-Release/Moonlight\ ${VERSION}.dmg artifacts/Moonlight.dmg + ls -lR artifacts + + - name: Upload Artifacts + uses: actions/upload-artifact@v4 + with: + name: Moonlight.dmg + path: artifacts/Moonlight.dmg + compression-level: 0 + +### + + build_linux: + name: Linux x86_64 + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + qtversion: + - '5.15.2' + - '6.8.3' + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Setup local env and metadata + run: | + mkdir -p $HOME/local/{bin,include,lib} + echo "$HOME/local/bin" >> $GITHUB_PATH + echo "PKG_CONFIG_PATH=$HOME/local/lib/pkgconfig:$HOME/local/lib/x86_64-linux-gnu/pkgconfig" >> $GITHUB_ENV + echo "VERSION=$(cat app/version.txt)" >> $GITHUB_ENV + echo "UBUNTU_RELEASE=$(lsb_release -rs)" >> $GITHUB_ENV + + # This may still install various Qt packages, but the later install step will override them + - name: Install packaged deps + run: | + wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add - + if [[ $UBUNTU_RELEASE == "20.04" ]]; then + sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-1.3.280-focal.list https://packages.lunarg.com/vulkan/1.3.280/lunarg-vulkan-1.3.280-focal.list + else + sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-1.3.280-jammy.list https://packages.lunarg.com/vulkan/1.3.280/lunarg-vulkan-1.3.280-jammy.list + fi + sudo apt update || true + sudo apt install -y \ + python3-pip nasm libgbm-dev libdrm-dev libfreetype6-dev libasound2-dev \ + libdbus-1-dev libegl1-mesa-dev libgl1-mesa-dev libgles2-mesa-dev libglu1-mesa-dev \ + libibus-1.0-dev libpulse-dev libudev-dev libx11-dev libxcursor-dev libxext-dev \ + libxi-dev libxinerama-dev libxkbcommon-dev libxrandr-dev libxss-dev libxt-dev \ + libxv-dev libxxf86vm-dev libxcb-dri3-dev libx11-xcb-dev libwayland-dev wayland-protocols \ + libopus-dev libvdpau-dev vulkan-sdk + sudo pip3 install meson + + if [[ $UBUNTU_RELEASE == "22.04" ]]; then + Needed for AppImage + sudo apt install libfuse2 + fi + + # Try to load cached builds of custom built deps + - name: Check for cached dependencies + id: cache-deps + uses: actions/cache/restore@v4 + with: + key: build_linux-deps-${{ matrix.qtversion }}-${{ hashFiles('.github/workflows/ci.yml', 'app/deploy/linux/**') }} + path: '/home/runner/local/**' + + # XXX switch this to `--revision $SHA --depth 1` when git 2.49 is available + - name: Build SDL2 + env: + SDL2_REV: 86fd4ed83cdcf71fef6a57766b126e88f923acd3 + if: ${{ steps.cache-deps.outputs.cache-hit != 'true' }} + run: | + git clone https://github.com/libsdl-org/SDL.git SDL2 + cd SDL2 + git checkout $SDL2_REV + ./autogen.sh + ./configure --prefix=$HOME/local + make -j$(nproc) + make install + cd .. + + - name: Build SDL2_TTF + env: + SDL2_TTF_VER: 2.22.0 + if: ${{ steps.cache-deps.outputs.cache-hit != 'true' }} + run: | + wget -q https://github.com/libsdl-org/SDL_ttf/releases/download/release-$SDL2_TTF_VER/SDL2_ttf-$SDL2_TTF_VER.tar.gz + tar -xf SDL2_ttf-$SDL2_TTF_VER.tar.gz + cd SDL2_ttf-$SDL2_TTF_VER + ./configure --prefix=$HOME/local + make -j$(nproc) + make install + cd .. + + - name: Build libva + env: + LIBVA_VER: 2.22.0 + if: ${{ steps.cache-deps.outputs.cache-hit != 'true' }} + run: | + git clone --branch $LIBVA_VER --depth 1 https://github.com/intel/libva.git + cd libva + ./autogen.sh + ./configure --prefix=$HOME/local --enable-x11 --enable-wayland + make -j$(nproc) + make install + cd .. + + - name: Build dav1d + env: + DAV1D_VER: 1.5.0 + if: ${{ steps.cache-deps.outputs.cache-hit != 'true' }} + run: | + git clone --branch $DAV1D_VER --depth 1 https://code.videolan.org/videolan/dav1d.git + cd dav1d + meson setup build --prefix=$HOME/local -Ddefault_library=static -Dbuildtype=release -Denable_tools=false -Denable_tests=false + ninja -C build + ninja install -C build + cd .. + + - name: Build libplacebo + env: + LIBPLACEBO_VER: v7.349.0 + if: ${{ steps.cache-deps.outputs.cache-hit != 'true' }} + run: | + git clone --branch $LIBPLACEBO_VER --depth 1 https://code.videolan.org/videolan/libplacebo.git + cd libplacebo + git apply ../app/deploy/linux/appimage/*.patch + git submodule update --init --recursive + meson setup build --prefix=$HOME/local -Dvulkan=enabled -Dopengl=disabled -Ddemos=false + ninja -C build + ninja install -C build + cd .. + + # XXX switch this to `--revision $SHA --depth 1` when git 2.49 is available + - name: Build ffmpeg + env: + FFMPEG_REV: 87ccf995cb855f0baced9916928b7b48d8b6ed9d + if: ${{ steps.cache-deps.outputs.cache-hit != 'true' }} + run: | + git clone https://github.com/FFmpeg/FFmpeg.git FFmpeg + cd FFmpeg + git checkout $FFMPEG_REV + ./configure --prefix=$HOME/local --enable-pic --disable-static --enable-shared --disable-all --enable-avcodec \ + --enable-avformat --enable-swscale --enable-decoder=h264 --enable-decoder=hevc --enable-decoder=av1 \ + --enable-hwaccel=h264_vaapi --enable-hwaccel=hevc_vaapi --enable-hwaccel=av1_vaapi --enable-hwaccel=h264_vdpau \ + --enable-hwaccel=hevc_vdpau --enable-hwaccel=av1_vdpau --enable-libdrm --enable-hwaccel=h264_vulkan \ + --enable-hwaccel=hevc_vulkan --enable-hwaccel=av1_vulkan --enable-libdav1d --enable-decoder=libdav1d + make -j$(nproc) + make install + cd .. + + - name: Save cached dependencies + uses: actions/cache/save@v4 + if: ${{ steps.cache-deps.outputs.cache-hit != 'true' }} + with: + key: build_linux-deps-${{ matrix.qtversion }}-${{ hashFiles('.github/workflows/ci.yml', 'app/deploy/linux/**') }} + path: '/home/runner/local/**' + + - name: Install Qt ${{ matrix.qtversion }} + uses: jdpurcell/install-qt-action@v5 + with: + aqtversion: '==3.1.*' + arch: ${{ matrix.qtversion == '5.15.2' && 'gcc_64' || 'linux_gcc_64' }} + host: linux + target: desktop + version: '${{ matrix.qtversion }}' + modules: qtwaylandcompositor + + - name: Install linuxdeployqt + run: | + wget -qO $HOME/local/bin/linuxdeployqt https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage + chmod a+x $HOME/local/bin/linuxdeployqt + + # The Install Qt action clobbers our lib paths so we need to set them again + - name: Fixup environment + run: | + echo "PKG_CONFIG_PATH=$HOME/local/lib/pkgconfig:$HOME/local/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=$HOME/local/lib:$HOME/local/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH" >> $GITHUB_ENV + + - name: Build Moonlight Linux + run: | + scripts/build-appimage.sh + mkdir artifacts + mv build/installer-release/Moonlight-${VERSION}-x86_64.AppImage artifacts/Moonlight-qt${{ matrix.qtversion }}-x86_64.AppImage + ls -lR artifacts + + - name: Upload Artifacts + uses: actions/upload-artifact@v4 + with: + name: Moonlight-qt${{ matrix.qtversion }}-x86_64.AppImage + path: artifacts/Moonlight-qt${{ matrix.qtversion }}-x86_64.AppImage + compression-level: 0 diff --git a/app/app.pro b/app/app.pro index 52a2f2471..7f6b40fb0 100644 --- a/app/app.pro +++ b/app/app.pro @@ -561,6 +561,7 @@ unix:!macx: { } win32 { RC_ICONS = moonlight.ico + RC_FILE = deploy/windows/Moonlight.rc QMAKE_TARGET_COMPANY = Moonlight Game Streaming Project QMAKE_TARGET_DESCRIPTION = Moonlight Game Streaming Client QMAKE_TARGET_PRODUCT = Moonlight diff --git a/app/deploy/linux/com.moonlight_stream.Moonlight.appdata.xml b/app/deploy/linux/com.moonlight_stream.Moonlight.appdata.xml index 482bc4389..f98b19d20 100644 --- a/app/deploy/linux/com.moonlight_stream.Moonlight.appdata.xml +++ b/app/deploy/linux/com.moonlight_stream.Moonlight.appdata.xml @@ -831,4 +831,9 @@ + + + __GITHUB_REF_NAME__ + __GITHUB_SHA__ + diff --git a/app/deploy/windows/Moonlight.rc b/app/deploy/windows/Moonlight.rc new file mode 100644 index 000000000..a24bf42ee --- /dev/null +++ b/app/deploy/windows/Moonlight.rc @@ -0,0 +1,38 @@ +#include + +IDI_ICON1 ICON "moonlight.ico" + +1 TYPELIB "Moonlight.rc" + +1 VERSIONINFO + FILEVERSION 6,1,0,0 + PRODUCTVERSION 6,1,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE VFT_APP + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "Comments", "https://github.com/moonlight-stream/moonlight-qt\0" + VALUE "CompanyName", "Moonlight Game Streaming Project\0" + VALUE "FileDescription", "__GITHUB_REF_NAME__/__GITHUB_SHA__\0" + VALUE "FileVersion", "6.1.0.0\0" + VALUE "LegalCopyright", "License: GNU GPLv3\0" + VALUE "OriginalFilename", "Moonlight.exe\0" + VALUE "ProductName", "Moonlight\0" + VALUE "ProductVersion", "6.1.0.0\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END diff --git a/app/deploy/windows/moonlight.ico b/app/deploy/windows/moonlight.ico new file mode 100644 index 000000000..07e9c300c Binary files /dev/null and b/app/deploy/windows/moonlight.ico differ diff --git a/appveyor.yml b/appveyor.yml index 1e50dd578..ad6018237 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,68 +1,27 @@ version: 0.0.0.{build} +# Steam Link only builds on Ubuntu 16.04, and Github Actions runners don't go that far back. +# All other builds are now in .github/workflows/ci.yml + clone_depth: 1 environment: - matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 - QTDIR: C:\Qt\6.8 - - APPVEYOR_BUILD_WORKER_IMAGE: macOS-Sonoma - BUILD_TARGET: macos - QTDIR: Qt/6.6 + matrix: [] - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu1604 BUILD_TARGET: steamlink - - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - BUILD_TARGET: linux - FFMPEG_CONFIGURE_ARGS: --enable-pic --disable-static --enable-shared --disable-all --enable-avcodec --enable-avformat --enable-swscale --enable-decoder=h264 --enable-decoder=hevc --enable-decoder=av1 --enable-hwaccel=h264_vaapi --enable-hwaccel=hevc_vaapi --enable-hwaccel=av1_vaapi --enable-hwaccel=h264_vdpau --enable-hwaccel=hevc_vdpau --enable-hwaccel=av1_vdpau --enable-libdrm --enable-hwaccel=h264_vulkan --enable-hwaccel=hevc_vulkan --enable-hwaccel=av1_vulkan --enable-libdav1d --enable-decoder=libdav1d install: - - cmd: 'copy /y scripts\appveyor\qmake.bat %QTDIR%\msvc2022_arm64\bin\' - - cmd: 'copy /y scripts\appveyor\qtpaths.bat %QTDIR%\msvc2022_arm64\bin\' - - cmd: 'copy /y scripts\appveyor\target_qt.conf %QTDIR%\msvc2022_arm64\bin\' - - sh: '[ "$BUILD_TARGET" != macos ] || nvm use node' - - sh: '[ "$BUILD_TARGET" != macos ] || npm install --global create-dmg' - sh: '[ "$BUILD_TARGET" != steamlink ] || sudo apt install -y libc6:i386 libstdc++6:i386' - sh: '[ "$BUILD_TARGET" != steamlink ] || git clone --depth=1 https://github.com/ValveSoftware/steamlink-sdk.git $HOME/steamlink-sdk' - - sh: '[ "$BUILD_TARGET" != linux ] || sudo add-apt-repository ppa:beineri/opt-qt-5.15.4-focal || true' - - sh: '[ "$BUILD_TARGET" != linux ] || wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -' - - sh: '[ "$BUILD_TARGET" != linux ] || sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-1.3.280-focal.list https://packages.lunarg.com/vulkan/1.3.280/lunarg-vulkan-1.3.280-focal.list' - - sh: '[ "$BUILD_TARGET" != linux ] || sudo apt update || true' - - sh: '[ "$BUILD_TARGET" != linux ] || sudo apt install -y qt515base qt515quickcontrols2 qt515svg qt515wayland python3-pip nasm libgbm-dev libdrm-dev libfreetype6-dev libasound2-dev libdbus-1-dev libegl1-mesa-dev libgl1-mesa-dev libgles2-mesa-dev libglu1-mesa-dev libibus-1.0-dev libpulse-dev libudev-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxkbcommon-dev libxrandr-dev libxss-dev libxt-dev libxv-dev libxxf86vm-dev libxcb-dri3-dev libx11-xcb-dev wayland-protocols libopus-dev libvdpau-dev vulkan-sdk' - - sh: '[ "$BUILD_TARGET" != linux ] || sudo pip3 install meson' - - sh: 'if [[ "$BUILD_TARGET" = linux ]]; then export SDL2_REV=86fd4ed83cdcf71fef6a57766b126e88f923acd3 && git clone https://github.com/libsdl-org/SDL.git SDL2 && cd SDL2 && git checkout $SDL2_REV && ./configure && make -j$(nproc) && sudo make install && cd ..; fi' - - sh: 'if [[ "$BUILD_TARGET" = linux ]]; then export SDL2_TTF_VER=2.22.0 && wget https://github.com/libsdl-org/SDL_ttf/releases/download/release-$SDL2_TTF_VER/SDL2_ttf-$SDL2_TTF_VER.tar.gz && tar -xf SDL2_ttf-$SDL2_TTF_VER.tar.gz && cd SDL2_ttf-$SDL2_TTF_VER && ./configure && make -j$(nproc) && sudo make install && cd ..; fi' - - sh: 'if [[ "$BUILD_TARGET" = linux ]]; then export LIBVA_VER=2.22.0 && git clone --branch $LIBVA_VER --depth 1 https://github.com/intel/libva.git && cd libva && ./autogen.sh && ./configure --enable-x11 --enable-wayland && make -j$(nproc) && sudo make install && cd ..; fi' - - sh: 'if [[ "$BUILD_TARGET" = linux ]]; then export DAV1D_VER=1.5.0 && git clone --branch $DAV1D_VER --depth 1 https://code.videolan.org/videolan/dav1d.git && cd dav1d && meson setup build -Ddefault_library=static -Dbuildtype=release -Denable_tools=false -Denable_tests=false && ninja -C build && sudo ninja install -C build && sudo ldconfig && cd ..; fi' - - sh: 'if [[ "$BUILD_TARGET" = linux ]]; then export LIBPLACEBO_REV=v7.349.0 && git clone https://code.videolan.org/videolan/libplacebo.git && cd libplacebo && git checkout $LIBPLACEBO_REV && git apply ../app/deploy/linux/appimage/*.patch && git submodule update --init --recursive && meson setup build -Dvulkan=enabled -Dopengl=disabled -Ddemos=false && ninja -C build && sudo ninja install -C build && sudo ldconfig && cd ..; fi' - - sh: 'if [[ "$BUILD_TARGET" = linux ]]; then export FFMPEG_REV=87ccf995cb855f0baced9916928b7b48d8b6ed9d && git clone https://github.com/FFmpeg/FFmpeg.git FFmpeg && cd FFmpeg && git checkout $FFMPEG_REV && ./configure $FFMPEG_CONFIGURE_ARGS && make -j$(nproc) && sudo make install && sudo ldconfig && cd ..; fi' - - sh: 'if [[ "$BUILD_TARGET" = linux ]]; then mkdir $HOME/bin && wget -O $HOME/bin/linuxdeployqt https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage && chmod a+x $HOME/bin/linuxdeployqt; fi' before_build: - - 'git -c submodule.libs.update=none submodule update --init --recursive' - - cmd: 'git submodule update --init --recursive' - - sh: '[ "$BUILD_TARGET" = linux ] || git submodule update --init --recursive' - - cmd: 'set OLDPATH=%PATH%' - - cmd: 'set /p VERSION=&2 + echo "$1" exit 1 } @@ -16,6 +16,13 @@ VERSION=`cat $SOURCE_ROOT/app/version.txt` command -v qmake >/dev/null 2>&1 || fail "Unable to find 'qmake' in your PATH!" command -v linuxdeployqt >/dev/null 2>&1 || fail "Unable to find 'linuxdeployqt' in your PATH!" +echo "MOONLIGHT BUILD ENVIRONMENT" +qmake --version +echo "QT_ROOT_DIR=$QT_ROOT_DIR" +echo "PATH=$PATH" +echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" +echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" + echo Cleaning output directories rm -rf $BUILD_FOLDER rm -rf $DEPLOY_FOLDER @@ -47,9 +54,18 @@ pushd $BUILD_FOLDER make install || fail "Make install failed!" popd +echo Updating metadata +perl -pi -e 's/__GITHUB_REF_NAME__/$ENV{GITHUB_REF_NAME}/' $DEPLOY_FOLDER/usr/share/metainfo/com.moonlight_stream.Moonlight.appdata.xml +perl -pi -e 's/__GITHUB_SHA__/$ENV{GITHUB_SHA}/' $DEPLOY_FOLDER/usr/share/metainfo/com.moonlight_stream.Moonlight.appdata.xml + echo Creating AppImage pushd $INSTALLER_FOLDER -VERSION=$VERSION linuxdeployqt $DEPLOY_FOLDER/usr/share/applications/com.moonlight_stream.Moonlight.desktop -qmldir=$SOURCE_ROOT/app/gui -appimage || fail "linuxdeployqt failed!" +VERSION=$VERSION \ + linuxdeployqt \ + $DEPLOY_FOLDER/usr/share/applications/com.moonlight_stream.Moonlight.desktop \ + -qmldir=$SOURCE_ROOT/app/gui \ + -appimage \ + -exclude-libs=libqsqlmimer || fail "linuxdeployqt failed!" popd -echo Build successful \ No newline at end of file +echo Build successful diff --git a/scripts/build-arch.bat b/scripts/build-arch.bat index 329eb7d3f..1c4a99bdc 100644 --- a/scripts/build-arch.bat +++ b/scripts/build-arch.bat @@ -4,6 +4,7 @@ setlocal enableDelayedExpansion rem Run from Qt command prompt with working directory set to root of repo set BUILD_CONFIG=%1 +set BUILD_ARCH=%2 rem Convert to lower case for windeployqt if /I "%BUILD_CONFIG%"=="debug" ( @@ -57,7 +58,7 @@ set QT_PATH=%QT_PATH:\qmake.bat=% set QT_PATH=%QT_PATH:\qmake.cmd=% echo QT_PATH=%QT_PATH% -if not x%QT_PATH:_arm64=%==x%QT_PATH% ( +if /I "%BUILD_ARCH%"=="arm64" ( set ARCH=arm64 rem Replace the _arm64 suffix with _64 to get the x64 bin path @@ -72,18 +73,8 @@ if not x%QT_PATH:_arm64=%==x%QT_PATH% ( set WINDEPLOYQT_CMD=!HOSTBIN_PATH!\windeployqt.exe --qtpaths %QT_PATH%\qtpaths.bat ) ) else ( - if not x%QT_PATH:_64=%==x%QT_PATH% ( - set ARCH=x64 - set WINDEPLOYQT_CMD=windeployqt.exe - ) else ( - if not x%QT_PATH:msvc=%==x%QT_PATH% ( - set ARCH=x86 - set WINDEPLOYQT_CMD=windeployqt.exe - ) else ( - echo Unable to determine Qt architecture - goto Error - ) - ) + set ARCH=x64 + set WINDEPLOYQT_CMD=windeployqt.exe ) echo Detected target architecture: %ARCH% @@ -126,7 +117,7 @@ rmdir /s /q %DEPLOY_FOLDER% rmdir /s /q %BUILD_FOLDER% rmdir /s /q %INSTALLER_FOLDER% rmdir /s /q %SYMBOLS_FOLDER% -mkdir %BUILD_ROOT% +if not exist %BUILD_ROOT% mkdir %BUILD_ROOT% mkdir %DEPLOY_FOLDER% mkdir %BUILD_FOLDER% mkdir %INSTALLER_FOLDER% diff --git a/scripts/build_arm64/qmake.bat b/scripts/build_arm64/qmake.bat new file mode 100644 index 000000000..16fd3ba59 --- /dev/null +++ b/scripts/build_arm64/qmake.bat @@ -0,0 +1,2 @@ +@echo off +%QT_ROOT_DIR%\..\msvc2022_64\bin\qmake.exe -qtconf "%~dp0\target_qt.conf" %* diff --git a/scripts/build_arm64/qtpaths.bat b/scripts/build_arm64/qtpaths.bat new file mode 100644 index 000000000..395fad55e --- /dev/null +++ b/scripts/build_arm64/qtpaths.bat @@ -0,0 +1,2 @@ +@echo off +%QT_ROOT_DIR%\..\msvc2022_64\bin\qtpaths.exe -qtconf "%~dp0\target_qt.conf" %* diff --git a/scripts/appveyor/target_qt.conf b/scripts/build_arm64/target_qt.conf similarity index 87% rename from scripts/appveyor/target_qt.conf rename to scripts/build_arm64/target_qt.conf index eb396a409..bd86bbfb2 100644 --- a/scripts/appveyor/target_qt.conf +++ b/scripts/build_arm64/target_qt.conf @@ -1,5 +1,3 @@ -[DevicePaths] -Prefix=C:/Qt/Qt-6.8 [Paths] Prefix=../ Documentation=./doc @@ -25,4 +23,4 @@ SysrootifyPrefix=false TargetSpec=win32-arm64-msvc HostSpec= Documentation=../../Docs/Qt-6.8 -Examples=../../Examples/Qt-6.8 \ No newline at end of file +Examples=../../Examples/Qt-6.8 diff --git a/scripts/generate-dmg.sh b/scripts/generate-dmg.sh index 12cacf972..9addb8263 100755 --- a/scripts/generate-dmg.sh +++ b/scripts/generate-dmg.sh @@ -46,7 +46,7 @@ popd echo Saving dSYM file pushd $BUILD_FOLDER dsymutil app/Moonlight.app/Contents/MacOS/Moonlight -o Moonlight-$VERSION.dsym || fail "dSYM creation failed!" -cp -R Moonlight-$VERSION.dsym $INSTALLER_FOLDER || fail "dSYM copy failed!" +cp -Rv Moonlight-$VERSION.dsym $INSTALLER_FOLDER || fail "dSYM copy failed!" popd echo Creating app bundle @@ -58,6 +58,10 @@ macdeployqt $BUILD_FOLDER/app/Moonlight.app $EXTRA_ARGS -qmldir=$SOURCE_ROOT/app echo Removing dSYM files from app bundle find $BUILD_FOLDER/app/Moonlight.app/ -name '*.dSYM' | xargs rm -rf +echo Add build metadata +defaults write $BUILD_FOLDER/app/Moonlight.app/Contents/Info GitBranch $GITHUB_REF_NAME +defaults write $BUILD_FOLDER/app/Moonlight.app/Contents/Info GitSha $GITHUB_SHA + if [ "$SIGNING_IDENTITY" != "" ]; then echo Signing app bundle codesign --force --deep --options runtime --timestamp --sign "$SIGNING_IDENTITY" $BUILD_FOLDER/app/Moonlight.app || fail "Signing failed!" @@ -77,11 +81,13 @@ fi if [ "$NOTARY_KEYCHAIN_PROFILE" != "" ]; then echo Uploading to App Notary service - xcrun notarytool submit --keychain-profile "$NOTARY_KEYCHAIN_PROFILE" --wait $INSTALLER_FOLDER/Moonlight\ $VERSION.dmg || fail "Notary submission failed" + xcrun notarytool submit --keychain-profile "$NOTARY_KEYCHAIN_PROFILE" --wait $INSTALLER_FOLDER/Moonlight-$VERSION.dmg || fail "Notary submission failed" echo Stapling notary ticket to DMG - xcrun stapler staple -v $INSTALLER_FOLDER/Moonlight\ $VERSION.dmg || fail "Notary ticket stapling failed!" + xcrun stapler staple -v $INSTALLER_FOLDER/Moonlight-$VERSION.dmg || fail "Notary ticket stapling failed!" fi -mv $INSTALLER_FOLDER/Moonlight\ $VERSION.dmg $INSTALLER_FOLDER/Moonlight-$VERSION.dmg -echo Build successful \ No newline at end of file +mv -v $INSTALLER_FOLDER/Moonlight-$VERSION.dmg $INSTALLER_FOLDER/Moonlight-$VERSION.dmg + +ls -lR $INSTALLER_FOLDER +echo Build successful