diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 60b85432..32fce3f3 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,3 +6,10 @@ updates: interval: "daily" target-branch: "nightly" open-pull-requests-limit: 20 + + - package-ecosystem: "pip" + directory: "/scripts" + schedule: + interval: "daily" + target-branch: "nightly" + open-pull-requests-limit: 10 diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a020205e..18d7e89c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -13,21 +13,21 @@ jobs: name: Check Changelog runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Verify Changelog - id: verify_changelog - if: ${{ github.ref == 'refs/heads/master' || github.base_ref == 'master' }} - # base_ref for pull request check, ref for push - uses: SunshineStream/actions/verify_changelog@master - with: - token: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout + uses: actions/checkout@v3 + + - name: Verify Changelog + id: verify_changelog + if: ${{ github.ref == 'refs/heads/master' || github.base_ref == 'master' }} + # base_ref for pull request check, ref for push + uses: SunshineStream/actions/verify_changelog@master + with: + token: ${{ secrets.GITHUB_TOKEN }} outputs: next_version: ${{ steps.verify_changelog.outputs.changelog_parser_version }} next_version_bare: ${{ steps.verify_changelog.outputs.changelog_parser_version_bare }} last_version: ${{ steps.verify_changelog.outputs.latest_release_tag_name }} - release_body: ${{ steps.verify_changelog.outputs.changelog_parser_description }} + release_body: ${{ steps.verify_changelog.outputs.changelog_parser_description }} check_versions: name: Check Versions @@ -36,127 +36,218 @@ jobs: if: ${{ github.ref == 'refs/heads/master' || github.base_ref == 'master' }} # base_ref for pull request check, ref for push steps: - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v3 - - name: Check CMakeLists.txt Version - run: | - version=$(grep -o -E '^project\(Sunshine VERSION [0-9]+\.[0-9]+\.[0-9]+\)' CMakeLists.txt | grep -o -E '[0-9]+\.[0-9]+\.[0-9]+') - echo "cmakelists_version=${version}" >> $GITHUB_ENV - - name: Compare CMakeList.txt Version - if: ${{ env.cmakelists_version != needs.check_changelog.outputs.next_version_bare }} - run: | - echo CMakeLists version: "$cmakelists_version" - echo Changelog version: "${{ needs.check_changelog.outputs.next_version_bare }}" - echo Within 'CMakeLists.txt' change "project(Sunshine VERSION $cmakelists_version)" to "project(Sunshine VERSION ${{ needs.check_changelog.outputs.next_version_bare }})" - exit 1 + - name: Check CMakeLists.txt Version + run: | + version=$(grep -o -E '^project\(Sunshine VERSION [0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt | grep -o -E '[0-9]+\.[0-9]+\.[0-9]+') + echo "cmakelists_version=${version}" >> $GITHUB_ENV - build_appimage: - name: AppImage - runs-on: ubuntu-20.04 - needs: check_changelog - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Setup Dependencies AppImage - run: | - mkdir -p artifacts - - sudo apt-get update -y && \ - sudo apt-get --reinstall install -y \ - git wget gcc-10 g++-10 build-essential cmake libssl-dev libavdevice-dev libboost-thread-dev libboost-filesystem-dev libboost-log-dev libpulse-dev libopus-dev libxtst-dev libx11-dev libxrandr-dev libxfixes-dev libevdev-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev libdrm-dev libcap-dev libwayland-dev - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 - sudo wget https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux.run --progress=bar:force:noscroll -q --show-progress -O /root/cuda.run && sudo chmod a+x /root/cuda.run - sudo /root/cuda.run --silent --toolkit --toolkitpath=/usr --no-opengl-libs --no-man-page --no-drm && sudo rm /root/cuda.run - sudo add-apt-repository ppa:savoury1/graphics -y - sudo add-apt-repository ppa:savoury1/multimedia -y - sudo add-apt-repository ppa:savoury1/ffmpeg4 -y - sudo apt-get update -y - sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y - sudo apt-get install ffmpeg -y - - name: Build AppImage - run: | - CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}" - SUNSHINE_EXECUTABLE_PATH="${SUNSHINE_EXECUTABLE_PATH:-/usr/bin/sunshine}" - SUNSHINE_ASSETS_DIR="${SUNSHINE_ASSETS_DIR:-sunshine.AppImage.config}" - - SUNSHINE_ENABLE_WAYLAND=${SUNSHINE_ENABLE_WAYLAND:-ON} - SUNSHINE_ENABLE_X11=${SUNSHINE_ENABLE_X11:-ON} - SUNSHINE_ENABLE_DRM=${SUNSHINE_ENABLE_DRM:-ON} - SUNSHINE_ENABLE_CUDA=${SUNSHINE_ENABLE_CUDA:-ON} - - mkdir -p appimage-build && cd appimage-build - - cmake "-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE" "-DSUNSHINE_EXECUTABLE_PATH=$SUNSHINE_EXECUTABLE_PATH" "-DSUNSHINE_ASSETS_DIR=$SUNSHINE_ASSETS_DIR" "-DSUNSHINE_ENABLE_WAYLAND=$SUNSHINE_ENABLE_WAYLAND" "-DSUNSHINE_ENABLE_X11=$SUNSHINE_ENABLE_X11" "-DSUNSHINE_ENABLE_DRM=$SUNSHINE_ENABLE_DRM" "-DSUNSHINE_ENABLE_CUDA=$SUNSHINE_ENABLE_CUDA" "../" -DCMAKE_INSTALL_PREFIX=/usr - - make -j ${nproc} DESTDIR=AppDir - - name: Set AppImage Version - if: ${{ needs.check_changelog.outputs.next_version_bare != needs.check_changelog.outputs.latest_version }} - run: | - version=${{ needs.check_changelog.outputs.next_version_bare }} - echo "VERSION=${version}" >> $GITHUB_ENV - - name: Package AppImage - # https://docs.appimage.org/packaging-guide/index.html - run: | - mkdir -p appimage_temp && cd appimage_temp - - DESKTOP_FILE="${DESKTOP_FILE:-sunshine.desktop}" - ICON_FILE="${ICON_FILE:-sunshine.png}" - CONFIG_DIR="${CONFIG_DIR:-sunshine/sunshine.AppImage.config/}" - HOME_DIR="${HOME_DIR:-sunshine/sunshine.AppImage.home/}" - - wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage && chmod +x linuxdeploy-x86_64.AppImage - - ./linuxdeploy-x86_64.AppImage --appdir ../AppDir -e ../appimage-build/sunshine -i "../$ICON_FILE" -d "../appimage-build/$DESKTOP_FILE" -l /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0 -l /usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0 -l /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0 --output appimage - - mv sunshine*.AppImage sunshine.AppImage - mkdir sunshine && mv sunshine.AppImage sunshine/ - ./sunshine/sunshine.AppImage --appimage-portable-config - ./sunshine/sunshine.AppImage --appimage-portable-home - cp -r ../assets/* "$CONFIG_DIR" - rm -f "$CONFIG_DIR"/apps_windows.json - mkdir -p ./"$HOME_DIR"/.config/"$CONFIG_DIR" - cp ./"$CONFIG_DIR"/apps_linux.json ./"$HOME_DIR"/.config/"$CONFIG_DIR" - zip -r ./sunshine-appimage.zip ./sunshine/* - - mv sunshine-appimage.zip ../artifacts/ - - name: Verify AppImage - run: | - cd appimage_temp - wget https://github.com/TheAssassin/appimagelint/releases/download/continuous/appimagelint-x86_64.AppImage && chmod +x appimagelint-x86_64.AppImage && ./appimagelint-x86_64.AppImage ./sunshine/sunshine.AppImage - - name: Upload Artifacts - if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} - uses: actions/upload-artifact@v3 - with: - name: sunshine-appimage - path: artifacts/ - - name: Create Release - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} - uses: SunshineStream/actions/create_release@master - with: - token: ${{ secrets.GITHUB_TOKEN }} - next_version: ${{ needs.check_changelog.outputs.next_version }} - last_version: ${{ needs.check_changelog.outputs.last_version }} - release_body: ${{ needs.check_changelog.outputs.release_body }} + - name: Compare CMakeList.txt Version + if: ${{ env.cmakelists_version != needs.check_changelog.outputs.next_version_bare }} + run: | + echo CMakeLists version: "$cmakelists_version" + echo Changelog version: "${{ needs.check_changelog.outputs.next_version_bare }}" + echo Within 'CMakeLists.txt' change "project(Sunshine [VERSION $cmakelists_version]" to "project(Sunshine [VERSION ${{ needs.check_changelog.outputs.next_version_bare }}]" + exit 1 build_linux: name: Linux runs-on: ubuntu-20.04 needs: check_changelog strategy: - fail-fast: true # false to test all, true to fail entire job if any fail + fail-fast: false # false to test all, true to fail entire job if any fail matrix: - distro: [ debian, ubuntu_18_04, ubuntu_20_04, ubuntu_21_10 ] - package: [ -p ] - extension: [ deb ] - include: # package these differently - - distro: fedora_35 - package: '-p' - extension: rpm + include: # package these differently + - type: cpack + CMAKE_INSTALL_PREFIX: '' + SUNSHINE_ASSETS_DIR: '/usr/local/sunshine/assets' + SUNSHINE_CONFIG_DIR: '/usr/local/sunshine/config' + - type: appimage + CMAKE_INSTALL_PREFIX: '/usr' + SUNSHINE_ASSETS_DIR: 'sunshine.AppImage.config' + SUNSHINE_CONFIG_DIR: 'sunshine.AppImage.home' + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Setup Dependencies Linux + run: | + sudo add-apt-repository ppa:savoury1/ffmpeg4 -y + # sudo add-apt-repository ppa:savoury1/boost-defaults-1.71 -y + sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y + + sudo apt-get update -y + sudo apt-get install -y \ + build-essential \ + cmake \ + gcc-10 \ + git \ + g++-10 \ + libavdevice-dev \ + libboost-filesystem-dev \ + libboost-log-dev \ + libboost-thread-dev \ + libcap-dev \ + libdrm-dev \ + libevdev-dev \ + libpulse-dev \ + libopus-dev \ + libssl-dev \ + libwayland-dev \ + libx11-dev \ + libxcb-shm0-dev \ + libxcb-xfixes0-dev \ + libxcb1-dev \ + libxfixes-dev \ + libxrandr-dev \ + libxtst-dev \ + wget + # # Ubuntu 20.04+ packages + # libboost-filesystem-dev + # libboost-log-dev + # libboost-thread-dev + + # # Ubuntu 18.04 packages + # libboost-filesystem1.71-dev \ + # libboost-log1.71-dev \ + # libboost-regex1.71-dev \ + # libboost-thread1.71-dev \ + + # clean apt cache + sudo apt-get clean + sudo rm -rf /var/lib/apt/lists/* + + # Update gcc alias + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 + + # Install CuDA + sudo wget https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux.run --progress=bar:force:noscroll -q --show-progress -O /root/cuda.run + sudo chmod a+x /root/cuda.run + sudo /root/cuda.run --silent --toolkit --toolkitpath=/usr --no-opengl-libs --no-man-page --no-drm + sudo rm /root/cuda.run + + # # Install cmake (necessary for 18.04) + # wget https://cmake.org/files/v3.22/cmake-3.22.2-linux-x86_64.sh + # chmod +x cmake-3.22.2-linux-x86_64.sh + # mkdir /opt/cmake + # ./cmake-3.22.2-linux-x86_64.sh --prefix=/opt/cmake --skip-license + # ln --force --symbolic /opt/cmake/bin/cmake /usr/local/bin/cmake + # cmake --version + + - name: Build Linux + run: | + mkdir -p build + mkdir -p artifacts + + cd build + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{ matrix.CMAKE_INSTALL_PREFIX }} -DSUNSHINE_ASSETS_DIR=${{ matrix.SUNSHINE_ASSETS_DIR }} -DSUNSHINE_CONFIG_DIR=${{ matrix.SUNSHINE_CONFIG_DIR }} -DSUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine -DSUNSHINE_ENABLE_WAYLAND=ON -DSUNSHINE_ENABLE_X11=ON -DSUNSHINE_ENABLE_DRM=ON -DSUNSHINE_ENABLE_CUDA=ON .. + make -j ${nproc} + + - name: Package Linux - CPACK + if: ${{ matrix.type == 'cpack' }} + working-directory: build + run: | + # package + cpack -G DEB + cpack -G RPM + + # move + mv ./cpack_artifacts/Sunshine.deb ../artifacts/sunshine.deb + mv ./cpack_artifacts/Sunshine.rpm ../artifacts/sunshine.rpm + + - name: Set AppImage Version + if: ${{ matrix.type == 'appimage' && ( needs.check_changelog.outputs.next_version_bare != needs.check_changelog.outputs.latest_version ) }} + run: | + version=${{ needs.check_changelog.outputs.next_version_bare }} + echo "VERSION=${version}" >> $GITHUB_ENV + + - name: Package Linux - AppImage + if: ${{ matrix.type == 'appimage' }} + working-directory: build + run: | + # install sunshine to the DESTDIR + make install DESTDIR=AppDir + + # portable home and config + # todo - this is ugly... we should use a custom AppRun script to take care of this + mv ./AppDir${{ matrix.CMAKE_INSTALL_PREFIX }}/sunshine.AppImage.* ../artifacts/ + mkdir -p ../artifacts/${{ matrix.SUNSHINE_CONFIG_DIR }}/.config/sunshine/${{ matrix.SUNSHINE_CONFIG_DIR }} + cp ../artifacts/${{ matrix.SUNSHINE_CONFIG_DIR }}/apps.json ../artifacts/${{ matrix.SUNSHINE_CONFIG_DIR }}/.config/sunshine/${{ matrix.SUNSHINE_CONFIG_DIR }}/ + + # variables + DESKTOP_FILE="${DESKTOP_FILE:-sunshine.desktop}" + ICON_FILE="${ICON_FILE:-sunshine.png}" + + # AppImage + # https://docs.appimage.org/packaging-guide/index.html + wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage + chmod +x linuxdeploy-x86_64.AppImage + + # # https://github.com/linuxdeploy/linuxdeploy-plugin-gtk + # sudo apt-get install libgtk-3-dev librsvg2-dev -y + # wget https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh + # chmod +x linuxdeploy-plugin-gtk.sh + # export DEPLOY_GTK_VERSION=3 + + ./linuxdeploy-x86_64.AppImage \ + --appdir ./AppDir \ + --executable ./sunshine \ + --icon-file "../$ICON_FILE" \ + --desktop-file "./$DESKTOP_FILE" \ + --library /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0 \ + --library /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0 \ + --library /usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0 \ + --output appimage + # # add this argument back if using gtk plugin + # --plugin gtk \ + + # move + mv Sunshine*.AppImage ../artifacts/sunshine.AppImage + + # permissions + chmod +x ../artifacts/sunshine.AppImage + + - name: Verify AppImage + if: ${{ matrix.type == 'appimage' }} + run: | + wget https://github.com/TheAssassin/appimagelint/releases/download/continuous/appimagelint-x86_64.AppImage + chmod +x appimagelint-x86_64.AppImage + + # rm -rf ~/.cache/appimagelint/ + + ./appimagelint-x86_64.AppImage ./artifacts/sunshine.AppImage + + - name: Archive AppImage + if: ${{ matrix.type == 'appimage' }} + working-directory: artifacts + run: | + chmod +x ./sunshine.AppImage + + zip --recurse-paths --move --test ./sunshine-appimage.zip ./* + + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: sunshine-linux-${{ matrix.type }} + path: artifacts/ + + - name: Create Release + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + uses: SunshineStream/actions/create_release@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + next_version: ${{ needs.check_changelog.outputs.next_version }} + last_version: ${{ needs.check_changelog.outputs.last_version }} + release_body: ${{ needs.check_changelog.outputs.release_body }} + + build_mac: + name: MacOS + runs-on: macos-11 + needs: check_changelog steps: - name: Checkout @@ -164,29 +255,84 @@ jobs: with: submodules: recursive - - name: Setup Container - run: | - mkdir -p artifacts + # this is for the macports job + - name: Cache Artifacts + uses: actions/cache@v3 + with: + path: artifacts + key: ${{ runner.os }}-artifacts - cd scripts - sudo ./build-container.sh -c build -f Dockerfile-${{ matrix.distro }} -n sunshine-${{ matrix.distro }} - - name: Build Linux + - name: Setup Dependencies MacOS run: | - cd scripts - sudo ./build-sunshine.sh ${{ matrix.package }} -e ${{ matrix.extension }} -u -n sunshine-${{ matrix.distro }} -s .. - - name: Package Linux - if: ${{ matrix.package != '' }} + # install dependencies using homebrew + brew install boost cmake ffmpeg opus + + # fix openssl header not found + ln -sf /usr/local/opt/openssl/include/openssl /usr/local/include/openssl + + - name: Build MacOS run: | - cd scripts - sudo mv ./sunshine-${{ matrix.distro }}-build/sunshine-${{ matrix.distro }}.${{ matrix.extension }} ../artifacts/ + # variables for Portfile + owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]' ) + repo=$(echo ${GITHUB_REPOSITORY#*/} | tr '[:upper:]' '[:lower:]' ) + branch=${GITHUB_HEAD_REF} + + # check the branch variable + if [ -z "$branch" ] + then + echo "This is a PUSH event" + branch=${GITHUB_BASE_REF} + else + echo "This is a PR event" + fi + echo "Owner: ${owner}" + echo "Repo: ${repo}" + echo "Branch: ${branch}" + + mkdir build + cd build + cmake -DCMAKE_BUILD_TYPE=Release -DSUNSHINE_ASSETS_DIR=/usr/local/sunshine/assets -DSUNSHINE_CONFIG_DIR=/usr/local/sunshine/config -DGITHUB_OWNER=${owner} -DGITHUB_REPO=${repo} -DGITHUB_BRANCH=${branch} .. + make -j ${nproc} + + - name: Package MacOS + run: | + # remove cached artifacts + rm -r -f ./artifacts + mkdir artifacts + + mkdir -p artifacts + cd build + + # package + cpack -G DragNDrop + mv ./cpack_artifacts/Sunshine.dmg ../artifacts/sunshine-macos-experimental-dragndrop.dmg + + cpack -G Bundle + mv ./cpack_artifacts/Sunshine.dmg ../artifacts/sunshine-macos-experimental-bundle.dmg + + cpack -G ZIP + mv ./cpack_artifacts/Sunshine.zip ../artifacts/sunshine-macos-experimental-archive.zip + + # move + mv Portfile ../artifacts/Portfile + - name: Upload Artifacts - if: ${{ matrix.package == '-p' && ( github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' ) }} uses: actions/upload-artifact@v3 with: - name: sunshine-${{ matrix.distro }} + name: sunshine-macos path: artifacts/ + + # this step can be removed after packages are fixed + - name: Delete experimental packages + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + working-directory: artifacts + run: | + rm -f ./sunshine-macos-experimental-dragndrop.dmg + rm -f ./sunshine-macos-experimental-bundle.dmg + rm -f ./sunshine-macos-experimental-archive.zip + - name: Create Release - if: ${{ matrix.package == '-p' && github.event_name == 'push' && github.ref == 'refs/heads/master' }} + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} uses: SunshineStream/actions/create_release@master with: token: ${{ secrets.GITHUB_TOKEN }} @@ -194,6 +340,104 @@ jobs: last_version: ${{ needs.check_changelog.outputs.last_version }} release_body: ${{ needs.check_changelog.outputs.release_body }} +# build_mac_port: +# name: Macports +# runs-on: macos-11 +# needs: [check_changelog, build_mac] +# +# steps: +# - name: Cache Artifacts +# uses: actions/cache@v3 +# with: +# path: artifacts +# key: ${{ runner.os }}-artifacts +# +# - name: Setup Macports +# run : | +# # update paths for macports +# echo "/opt/local/sbin" >> $GITHUB_PATH +# echo "/opt/local/bin" >> $GITHUB_PATH +# +# # Set OpenSSL 1.1 as default +# # rm -rf /usr/local/opt/openssl +# # rm -rf /usr/local/bin/openssl +# # ln -sf /usr/local/Cellar/openssl@1.1/1.1.1o/bin/openssl /usr/local/bin/openssl +# # ln -sf /usr/local/Cellar/openssl@1.1/1.1.1o /usr/local/opt/openssl +# +# # download and extract macports +# curl -O https://distfiles.macports.org/MacPorts/MacPorts-2.7.2.tar.bz2 +# tar xf MacPorts-2.7.2.tar.bz2 +# +# # build macports +# cd MacPorts-2.7.2 +# ./configure +# make +# sudo make install +# cd ../ +# rm -rf MacPorts-2.7.2* +# +# - name: Configure Macports +# run: | +# # update sources +# sudo port -v selfupdate +# +# # use custom sources +# sudo chmod 777 /opt/local/etc/macports/sources.conf +# echo file://$(echo ~)/ports > /opt/local/etc/macports/sources.conf +# echo rsync://rsync.macports.org/macports/release/tarballs/ports.tar [default] >> /opt/local/etc/macports/sources.conf +# sudo chmod 644 /opt/local/etc/macports/sources.conf +# +# # setup custom port +# mkdir -p ~/ports/multimedia/sunshine +# +# # copy configured Portfile +# mv ./artifacts/Portfile ~/ports/multimedia/sunshine/ +# +# # remove remaining cached artifacts +# rm -r -f ./artifacts +# mkdir artifacts +# +# # index the ports +# cd ~/ports +# portindex +# +# - name: Build +# run: | +# # build port +# sudo port install sunshine \ +# || cat /opt/local/var/macports/logs/_Users_runner_ports_multimedia_sunshine/Sunshine/main.log \ +# && exit 1 +# +# # create packages +# sudo port dmg sunshine +# sudo port pkg sunshine +# +# # move +# mv $(port work sunshine)/Sunshine*.dmg ./artifacts/sunshine.dmg +# mv $(port work sunshine)/Sunshine*.ppkg ./artifacts/sunshine.pkg +# +# # testing only +# # ls ~/ports/multimedia/sunshine +# # cat ~/ports/multimedia/sunshine/Portfile +# # cat /opt/local/etc/macports/sources.conf +# # cat ~/ports/Portindex +# # port search sunshine +# +# - name: Upload Artifacts +# uses: actions/upload-artifact@v3 +# with: +# name: sunshine-macports +# path: artifacts/ +# +# - name: Create Release +# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} +# uses: SunshineStream/actions/create_release@master +# with: +# token: ${{ secrets.GITHUB_TOKEN }} +# next_version: ${{ needs.check_changelog.outputs.next_version }} +# last_version: ${{ needs.check_changelog.outputs.last_version }} +# release_body: ${{ needs.check_changelog.outputs.release_body }} + build_win: name: Windows runs-on: windows-2019 @@ -204,51 +448,55 @@ jobs: uses: actions/checkout@v3 with: submodules: recursive - - name: MSYS2 Setup + + - name: Setup Dependencies Windows uses: msys2/setup-msys2@v2 with: update: true install: >- base-devel + diffutils git - mingw-w64-x86_64-binutils - mingw-w64-x86_64-openssl - mingw-w64-x86_64-cmake - mingw-w64-x86_64-toolchain - mingw-w64-x86_64-opus - mingw-w64-x86_64-x265 - mingw-w64-x86_64-boost - git - yasm - nasm - diffutils make + mingw-w64-x86_64-binutils + mingw-w64-x86_64-boost + mingw-w64-x86_64-cmake + mingw-w64-x86_64-nsis + mingw-w64-x86_64-openssl + mingw-w64-x86_64-opus + mingw-w64-x86_64-toolchain + mingw-w64-x86_64-x265 + nasm + yasm + - name: Build Windows shell: msys2 {0} run: | - mkdir sunshine-windows-build && cd sunshine-windows-build - cmake -DCMAKE_BUILD_TYPE=Release -DSUNSHINE_ASSETS_DIR=assets -G "MinGW Makefiles" .. + mkdir build + cd build + cmake -DCMAKE_BUILD_TYPE=Release -DSUNSHINE_ASSETS_DIR=assets -DSUNSHINE_CONFIG_DIR=config -G "MinGW Makefiles" .. mingw32-make -j2 + - name: Package Windows + shell: msys2 {0} run: | - cd sunshine-windows-build - del ..\assets\apps_linux.json - 7z a sunshine-windows.zip ..\assets - 7z a sunshine-windows.zip sunshine.exe - 7z a sunshine-windows.zip tools\dxgi-info.exe - 7z a sunshine-windows.zip tools\audio-info.exe - 7z a sunshine-windows.zip tools\sunshinesvc.exe - 7z a sunshine-windows.zip ..\tools\install-service.bat - 7z a sunshine-windows.zip ..\tools\uninstall-service.bat - cd .. - mkdir artifacts - move "sunshine-windows-build\sunshine-windows.zip" "artifacts" + mkdir -p artifacts + cd build + + # package + cpack -G NSIS + cpack -G ZIP + + # move + mv ./cpack_artifacts/Sunshine.exe ../artifacts/sunshine-windows.exe + mv ./cpack_artifacts/Sunshine.zip ../artifacts/sunshine-windows.zip + - name: Upload Artifacts - if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} uses: actions/upload-artifact@v3 with: name: sunshine-windows path: artifacts/ + - name: Create Release if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} uses: SunshineStream/actions/create_release@master diff --git a/.gitignore b/.gitignore index 39afd65a..6c44c5bc 100644 --- a/.gitignore +++ b/.gitignore @@ -10,14 +10,14 @@ cmake-build* .idea # Extra FontAwesome files -/assets/web/fonts/fontawesome-free-web/css/*.css -!/assets/web/fonts/fontawesome-free-web/css/*min.css -/assets/web/fonts/fontawesome-free-web/js/ -/assets/web/fonts/fontawesome-free-web/less/ -/assets/web/fonts/fontawesome-free-web/metadata/ -/assets/web/fonts/fontawesome-free-web/scss/ -/assets/web/fonts/fontawesome-free-web/sprites/ -/assets/web/fonts/fontawesome-free-web/svgs/ +/src_assets/common/assets/web/fonts/fontawesome-free-web/css/*.css +!/src_assets/common/assets/web/fonts/fontawesome-free-web/css/*min.css +/src_assets/common/assets/web/fonts/fontawesome-free-web/js/ +/src_assets/common/assets/web/fonts/fontawesome-free-web/less/ +/src_assets/common/assets/web/fonts/fontawesome-free-web/metadata/ +/src_assets/common/assets/web/fonts/fontawesome-free-web/scss/ +/src_assets/common/assets/web/fonts/fontawesome-free-web/sprites/ +/src_assets/common/assets/web/fonts/fontawesome-free-web/svgs/ # Translations *.mo diff --git a/CMakeLists.txt b/CMakeLists.txt index 862e4f1a..5c9a135f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,12 @@ cmake_minimum_required(VERSION 3.0) -project(Sunshine VERSION 0.13.0) +project(Sunshine VERSION 0.13.0 + DESCRIPTION "Sunshine is a Gamestream host for Moonlight." + HOMEPAGE_URL "https://sunshinestream.github.io" + ) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) +set(SUNSHINE_SOURCE_ASSETS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src_assets") if(WIN32) # Ugly hack to compile with #include @@ -58,7 +62,7 @@ if(WIN32) INPUT "${CMAKE_CURRENT_BINARY_DIR}/pre-compiled.zip" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/pre-compiled) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static") - + if(NOT DEFINED SUNSHINE_PREPARED_BINARIES) set(SUNSHINE_PREPARED_BINARIES "${CMAKE_CURRENT_BINARY_DIR}/pre-compiled/windows") endif() @@ -66,8 +70,6 @@ if(WIN32) add_compile_definitions(SUNSHINE_PLATFORM="windows") add_subdirectory(tools) #This is temporary, only tools for Windows are needed, for now - list(APPEND SUNSHINE_DEFINITIONS APPS_JSON="apps_windows.json") - include_directories(third-party/ViGEmClient/include) if(NOT DEFINED SUNSHINE_ICON_PATH) @@ -126,7 +128,6 @@ if(WIN32) set_source_files_properties(third-party/ViGEmClient/src/ViGEmClient.cpp PROPERTIES COMPILE_FLAGS "-Wno-unknown-pragmas -Wno-misleading-indentation -Wno-class-memaccess") elseif(APPLE) add_compile_definitions(SUNSHINE_PLATFORM="macos") - list(APPEND SUNSHINE_DEFINITIONS APPS_JSON="apps_mac.json") link_directories(/opt/local/lib) link_directories(/usr/local/lib) ADD_DEFINITIONS(-DBOOST_LOG_DYN_LINK) @@ -147,6 +148,8 @@ elseif(APPLE) set(PLATFORM_INCLUDE_DIRS ${Boost_INCLUDE_DIR}) + set(APPLE_PLIST_FILE ${SUNSHINE_SOURCE_ASSETS_DIR}/macos/assets/Info.plist) + set(PLATFORM_TARGET_FILES sunshine/platform/macos/av_audio.h sunshine/platform/macos/av_audio.m @@ -163,10 +166,9 @@ elseif(APPLE) sunshine/platform/macos/publish.cpp sunshine/platform/macos/TPCircularBuffer/TPCircularBuffer.c sunshine/platform/macos/TPCircularBuffer/TPCircularBuffer.h - ${CMAKE_CURRENT_SOURCE_DIR}/assets/Info.plist) + ${APPLE_PLIST_FILE}) else() add_compile_definitions(SUNSHINE_PLATFORM="linux") - list(APPEND SUNSHINE_DEFINITIONS APPS_JSON="apps_linux.json") option(SUNSHINE_ENABLE_DRM "Enable KMS grab if available" ON) option(SUNSHINE_ENABLE_X11 "Enable X11 grab if available" ON) @@ -296,14 +298,14 @@ else() third-party/glad/include/KHR/khrplatform.h third-party/glad/include/glad/gl.h third-party/glad/include/glad/egl.h) - + list(APPEND PLATFORM_LIBRARIES dl evdev pulse pulse-simple ) - + include_directories( /usr/include/libevdev-1.0 third-party/nv-codec-headers/include @@ -312,9 +314,6 @@ else() if(NOT DEFINED SUNSHINE_EXECUTABLE_PATH) set(SUNSHINE_EXECUTABLE_PATH "sunshine") endif() - configure_file(gen-deb.in gen-deb @ONLY) - configure_file(gen-rpm.in gen-rpm @ONLY) - configure_file(sunshine.desktop.in sunshine.desktop @ONLY) configure_file(sunshine.service.in sunshine.service @ONLY) endif() @@ -394,15 +393,11 @@ else() endif() if(NOT SUNSHINE_ASSETS_DIR) - set(SUNSHINE_ASSETS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/assets") + set(SUNSHINE_ASSETS_DIR "${CMAKE_CURRENT_BINARY_DIR}/assets") endif() if(NOT SUNSHINE_CONFIG_DIR) - set(SUNSHINE_CONFIG_DIR "${SUNSHINE_ASSETS_DIR}") -endif() - -if(NOT SUNSHINE_DEFAULT_DIR) - set(SUNSHINE_DEFAULT_DIR "${SUNSHINE_ASSETS_DIR}") + set(SUNSHINE_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/config") endif() list(APPEND CBS_EXTERNAL_LIBRARIES @@ -425,7 +420,6 @@ endif() list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_ASSETS_DIR="${SUNSHINE_ASSETS_DIR}") list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_CONFIG_DIR="${SUNSHINE_CONFIG_DIR}") -list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_DEFAULT_DIR="${SUNSHINE_DEFAULT_DIR}") add_executable(sunshine ${SUNSHINE_TARGET_FILES}) target_link_libraries(sunshine ${SUNSHINE_EXTERNAL_LIBRARIES} ${EXTRA_LIBS}) target_compile_definitions(sunshine PUBLIC ${SUNSHINE_DEFINITIONS}) @@ -440,7 +434,7 @@ if(NOT DEFINED CMAKE_CUDA_STANDARD) endif() if(APPLE) - target_link_options(sunshine PRIVATE LINKER:-sectcreate,__TEXT,__info_plist,${CMAKE_CURRENT_SOURCE_DIR}/assets/Info.plist) + target_link_options(sunshine PRIVATE LINKER:-sectcreate,__TEXT,__info_plist,${APPLE_PLIST_FILE}) endif() foreach(flag IN LISTS SUNSHINE_COMPILE_OPTIONS) @@ -448,3 +442,153 @@ foreach(flag IN LISTS SUNSHINE_COMPILE_OPTIONS) endforeach() target_compile_options(sunshine PRIVATE $<$:${SUNSHINE_COMPILE_OPTIONS}>;$<$:${SUNSHINE_COMPILE_OPTIONS_CUDA};-std=c++17>) + +# CPACK / Packaging + +# Common options +set(CPACK_PACKAGE_NAME "SunshineStream") +set(CPACK_PACKAGE_VENDOR "SunshineStream") +set(CPACK_PACKAGE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cpack_artifacts) +set(CPACK_PACKAGE_CONTACT "https://github.com/SunshineStream/Sunshine") +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "https://github.com/SunshineStream/Sunshine") +set(CPACK_PACKAGE_DESCRIPTION ${CMAKE_PROJECT_DESCRIPTION}) +set(CPACK_PACKAGE_HOMEPAGE_URL ${CMAKE_PROJECT_HOMEPAGE_URL}) +set(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/LICENSE) +set(CPACK_PACKAGE_ICON ${PROJECT_SOURCE_DIR}/sunshine.png) +set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}") +set(CPACK_STRIP_FILES YES) + +# Platform specific options +if(WIN32) # see options at: https://cmake.org/cmake/help/latest/cpack_gen/nsis.html + install(TARGETS sunshine RUNTIME DESTINATION "." COMPONENT application) + + # Adding tools + install(TARGETS dxgi-info RUNTIME DESTINATION "tools" COMPONENT dxgi) + install(TARGETS audio-info RUNTIME DESTINATION "tools" COMPONENT audio) + install(TARGETS sunshinesvc RUNTIME DESTINATION "tools" COMPONENT sunshinesvc) + + install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}" COMPONENT assets) + install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}" COMPONENT assets) + + install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}" COMPONENT config) + install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}" COMPONENT config) + + + # set(CPACK_NSIS_MUI_HEADERIMAGE "") # TODO: image should be 150x57 bmp + + set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\sunshine.ico") + set(CPACK_NSIS_INSTALLED_ICON_NAME "${PROJECT__DIR}\\\\${PROJECT_EXE}") + set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}") # The name of the directory that will be created in C:/Program files/ + string(APPEND CPACK_NSIS_DEFINES "\n RequestExecutionLevel admin") # TODO: Not sure if this is needed but it took me a while to figure out where to put this option so I'm leaving it here + + # Sets permissions on the installed folder so that we can write in it + SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS + "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS} + ExecWait 'icacls \\\"$INSTDIR\\\" /grant:r Users:\\\(OI\\\)\\\(CI\\\)\\\(F\\\)' + ") + + # Adding an option for the start menu and PATH + set(CPACK_NSIS_MODIFY_PATH "OFF") # TODO: it asks to add it to the PATH but is not working https://gitlab.kitware.com/cmake/cmake/-/issues/15635 + set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".") + set(CPACK_NSIS_MUI_FINISHPAGE_RUN "${CMAKE_PROJECT_NAME}.exe") + set(CPACK_NSIS_INSTALLED_ICON_NAME "${CMAKE_PROJECT_NAME}.exe") # This will be shown on the installed apps Windows settings + set(CPACK_NSIS_CREATE_ICONS "CreateShortCut '\$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${CMAKE_PROJECT_NAME}.lnk' '\$INSTDIR\\\\${CMAKE_PROJECT_NAME}.exe'") + + # Checking for previous installed versions + # set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON") # TODO: doesn't work on my machine when Sunshine is already installed + + # Setting components groups and dependencies + # sunshine binary + set(CPACK_COMPONENT_APPLICATION_DISPLAY_NAME "${CMAKE_PROJECT_NAME}") + set(CPACK_COMPONENT_APPLICATION_DESCRIPTION "The main application.") + set(CPACK_COMPONENT_APPLICATION_GROUP "${CMAKE_PROJECT_NAME}") + set(CPACK_COMPONENT_APPLICATION_REQUIRED true) + set(CPACK_COMPONENT_APPLICATION_DEPENDS assets) + + # assets + set(CPACK_COMPONENT_ASSETS_DISPLAY_NAME "Assets") + set(CPACK_COMPONENT_ASSETS_DESCRIPTION "Shaders, default box art, and web ui.") + set(CPACK_COMPONENT_ASSETS_GROUP "${CMAKE_PROJECT_NAME}") + set(CPACK_COMPONENT_ASSETS_REQUIRED true) + + # config + set(CPACK_COMPONENT_CONFIG_DISPLAY_NAME "Config") + set(CPACK_COMPONENT_CONFIG_DESCRIPTION "Default config and apps.json files.") + set(CPACK_COMPONENT_CONFIG_GROUP "${CMAKE_PROJECT_NAME}") + set(CPACK_COMPONENT_CONFIG_REQUIRED true) + + # audio tool + set(CPACK_COMPONENT_AUDIO_DISPLAY_NAME "audio-info.exe") + set(CPACK_COMPONENT_AUDIO_DESCRIPTION "CLI tool that allows you to get information about sound devices.") + set(CPACK_COMPONENT_AUDIO_GROUP "Tools") + + # display tool + set(CPACK_COMPONENT_DXGI_DISPLAY_NAME "dxgi-info.exe") + set(CPACK_COMPONENT_DXGI_DESCRIPTION "CLI tool that allows you to get information about graphics cards and displays.") + set(CPACK_COMPONENT_DXGI_GROUP "Tools") + + # service tool + set(CPACK_COMPONENT_SUNSHINESVC_DISPLAY_NAME "sunshinesvc.exe") + set(CPACK_COMPONENT_SUNSHINESVC_DESCRIPTION "CLI tool that allows you to enable/disable the Sunshine service.") + set(CPACK_COMPONENT_SUNSHINESVC_GROUP "Tools") +endif() +if(UNIX) + # Installation destination dir + set(CPACK_SET_DESTDIR true) + if(NOT CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local/sunshine") + endif() + + install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}") + + install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}") +endif() +if(APPLE) # TODO: test + + set(prefix "${CMAKE_PROJECT_NAME}.app/Contents") + set(INSTALL_RUNTIME_DIR "${prefix}/MacOS") + + install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}") + + install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}") + + install(TARGETS sunshine + BUNDLE DESTINATION . COMPONENT Runtime + RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} COMPONENT Runtime) + + # TODO: bundle doesn't produce a valid .app use cpack -G DragNDrop + set(CPACK_BUNDLE_NAME "${CMAKE_PROJECT_NAME}") + set(CPACK_BUNDLE_PLIST "${APPLE_PLIST_FILE}") + set(CPACK_BUNDLE_ICON "${PROJECT_SOURCE_DIR}/sunshine.icns") + # set(CPACK_BUNDLE_STARTUP_COMMAND "${INSTALL_RUNTIME_DIR}/sunshine") + + # Portfile + configure_file(Portfile.in Portfile @ONLY) +endif() +if(UNIX AND NOT APPLE) + install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}") + + install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}") + + install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/85-sunshine-rules.rules" DESTINATION "/etc/udev/rules.d") + + install(TARGETS sunshine RUNTIME DESTINATION "/usr/bin") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service" DESTINATION "/usr/lib/systemd/user") + + # Pre and post install + set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA + "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/preinst;${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/postinst;${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/conffiles") + set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/preinst") + set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/postinst") + + # Dependencies + set(CPACK_DEB_COMPONENT_INSTALL ON) + set(CPACK_DEBIAN_PACKAGE_DEPENDS "openssl, libavdevice58, libboost-thread1.67.0 | libboost-thread1.71.0 | libboost-thread1.74.0, libboost-filesystem1.67.0 | libboost-filesystem1.71.0 | libboost-filesystem1.74.0, libboost-log1.67.0 | libboost-log1.71.0 | libboost-log1.74.0, libpulse0, libopus0, libxcb-shm0, libxcb-xfixes0, libxtst6, libevdev2, libdrm2, libcap2") + set(CPACK_RPM_PACKAGE_REQUIRES "openssl >= 1.1, libavdevice >= 4.3, boost-thread >= 1.67.0, boost-filesystem >= 1.67.0, boost-log >= 1.67.0, pulseaudio-libs >= 10.0, libopusenc >= 0.2.1, libxcb >= 1.13, libXtst >= 1.2.3, libevdev >= 1.5.6, libdrm >= 2.4.97, libcap >= 2.22") + set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF) # This should automatically figure out dependencies, doesn't work with the current config + + # AppImage desktop file + configure_file(sunshine.desktop.in sunshine.desktop @ONLY) +endif() + +include(CPack) diff --git a/Portfile b/Portfile deleted file mode 100644 index ea751ca8..00000000 --- a/Portfile +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 - -PortSystem 1.0 -PortGroup cmake 1.1 -PortGroup github 1.0 -PortGroup boost 1.0 - -github.setup abusse sunshine macos-dev -version 20220224 - -categories multimedia -platforms darwin -license GPL-2 -maintainers {outlook.com:anselm.busse} - -fetch.type git -post-fetch { - system -W ${worksrcpath} "${git.cmd} submodule update --init --recursive" -} - -description Sunshine is a Gamestream host for Moonlight -long_description Sunshine is a Gamestream host for Moonlight - -homepage https://github.com/SunshineStream/Sunshine - -depends_lib port:avahi port:ffmpeg port:libopus - - -boost.version 1.76 - -configure.args -DBOOST_ROOT=[boost::install_area] \ - -DSUNSHINE_ASSETS_DIR=${prefix}/etc/sunshine - -cmake.out_of_source yes - -destroot { - xinstall -d -m 755 ${destroot}${prefix}/etc/${name} - xinstall ${worksrcpath}/assets/apps_mac.json ${destroot}${prefix}/etc/${name} - xinstall ${worksrcpath}/assets/box.png ${destroot}${prefix}/etc/${name} - xinstall ${worksrcpath}/assets/sunshine.conf ${destroot}${prefix}/etc/${name} - - xinstall -d -m 755 ${destroot}${prefix}/etc/${name}/web - xinstall {*}[glob ${worksrcpath}/assets/web/*.html] ${destroot}${prefix}/etc/${name}/web - xinstall -d -m 755 ${destroot}${prefix}/etc/${name}/web/third_party - xinstall {*}[glob ${worksrcpath}/assets/web/third_party/*] ${destroot}${prefix}/etc/${name}/web/third_party - - xinstall ${workpath}/build/${name} ${destroot}${prefix}/bin -} diff --git a/Portfile.in b/Portfile.in new file mode 100644 index 00000000..36a7d476 --- /dev/null +++ b/Portfile.in @@ -0,0 +1,75 @@ +# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 + +PortSystem 1.0 +PortGroup cmake 1.1 +PortGroup github 1.0 +PortGroup boost 1.0 + +# bump revision when changes are made to this file +revision 1 + +github.setup @GITHUB_OWNER@ @GITHUB_REPO@ @GITHUB_BRANCH@ +name @PROJECT_NAME@ +version @PROJECT_VERSION@ +categories multimedia emulators games +platforms darwin +license GPL-3 +maintainers {@SunshineStream sunshinestream} +description @PROJECT_DESCRIPTION@ +long_description {*}${description} +homepage @PROJECT_HOMEPAGE_URL@ +master_sites https://github.com/@GITHUB_OWNER@/@GITHUB_REPO@/releases + +fetch.type git +post-fetch { + system -W ${worksrcpath} "${git.cmd} submodule update --init --recursive" +} + +depends_lib port:avahi \ + port:ffmpeg \ + port:libopus + +boost.version 1.76 + +configure.args -DBOOST_ROOT=[boost::install_area] \ + -DSUNSHINE_ASSETS_DIR=${prefix}/etc/sunshine/assets \ + -DSUNSHINE_CONFIG_DIR=${prefix}/etc/sunshine/config + +cmake.out_of_source yes + +startupitem.create yes +startupitem.executable "${prefix}/bin/{$name}" +startupitem.location LaunchDaemons +startupitem.name ${name} +startupitem.netchange yes + +# is this actually necessary? this should all be handled by CMakeLists +destroot { + # install assets + xinstall -d -m 755 ${destroot}${prefix}/etc/${name}/assets + xinstall {*}[glob ${worksrcpath}/src_assets/common/assets/*.*] ${destroot}${prefix}/etc/${name}/assets + xinstall {*}[glob ${worksrcpath}/src_assets/macos/assets/*.*] ${destroot}${prefix}/etc/${name}/assets + + # install web assets + xinstall -d -m 755 ${destroot}${prefix}/etc/${name}/assets/web/fonts/fontawesome-free-web/css + xinstall -d -m 755 ${destroot}${prefix}/etc/${name}/assets/web/fonts/fontawesome-free-web/webfonts + xinstall {*}[glob ${worksrcpath}/src_assets/common/assets/web/*.*] ${destroot}${prefix}/etc/${name}/assets/web + xinstall {*}[glob ${worksrcpath}/src_assets/common/assets/web/fonts/fontawesome-free-web/*.*] ${destroot}${prefix}/etc/${name}/assets/web/fonts/fontawesome-free-web + xinstall {*}[glob ${worksrcpath}/src_assets/common/assets/web/fonts/fontawesome-free-web/css/*.*] ${destroot}${prefix}/etc/${name}/assets/web/fonts/fontawesome-free-web/css + xinstall {*}[glob ${worksrcpath}/src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/*.*] ${destroot}${prefix}/etc/${name}/assets/web/fonts/fontawesome-free-web/webfonts + xinstall -d -m 755 ${destroot}${prefix}/etc/${name}/assets/web/images + xinstall -d -m 755 ${destroot}${prefix}/etc/${name}/assets/web/third_party + xinstall {*}[glob ${worksrcpath}/src_assets/common/assets/web/images/*.*] ${destroot}${prefix}/etc/${name}/assets/web/images + xinstall {*}[glob ${worksrcpath}/src_assets/common/assets/web/third_party/*.*] ${destroot}${prefix}/etc/${name}/assets/web/third_party + + xinstall -d -m 755 ${destroot}${prefix}/etc/${name}/config + + # install sunshine.conf + xinstall {*}[glob ${worksrcpath}/src_assets/common/config/*.*] ${destroot}${prefix}/etc/${name}/config + + # install apps.json + xinstall {*}[glob ${worksrcpath}/src_assets/macos/config/*.*] ${destroot}${prefix}/etc/${name}/config + + # install the binary + xinstall ${workpath}/build/${name} ${destroot}${prefix}/bin +} diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 7fb08089..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,44 +0,0 @@ -services: - - docker - -environment: - matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - DOCKERFILE: Dockerfile-ubuntu_20_04 - - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - DOCKERFILE: Dockerfile-ubuntu_21_04 - - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - DOCKERFILE: Dockerfile-debian - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - BUILD_TYPE: Release - -install: - - cmd: C:\msys64\usr\bin\bash -lc "pacman --needed --noconfirm -S mingw-w64-x86_64-binutils mingw-w64-x86_64-openssl mingw-w64-x86_64-cmake mingw-w64-x86_64-toolchain mingw-w64-x86_64-opus mingw-w64-x86_64-x265 mingw-w64-x86_64-boost git yasm nasm diffutils make" - -before_build: - - cmd: git submodule update --init --recursive - - cmd: mkdir build - - cmd: cd build - - sh: cd scripts - - sh: ./build-container.sh -f $DOCKERFILE - -build_script: - - cmd: set OLDPATH=%PATH% - - cmd: set PATH=C:\msys64\mingw64\bin - - cmd: cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSUNSHINE_ASSETS_DIR=assets -G "MinGW Makefiles" .. - - cmd: mingw32-make -j2 - - cmd: set PATH=%OLDPATH% - - sh: ./build-sunshine.sh -pu - -after_build: - - cmd: Del ..\assets\apps_linux.json - - cmd: 7z a Sunshine-Windows.zip ..\assets - - cmd: 7z a Sunshine-Windows.zip sunshine.exe - - cmd: 7z a Sunshine-Windows.zip tools\dxgi-info.exe - - cmd: 7z a Sunshine-Windows.zip tools\audio-info.exe - - cmd: 7z a Sunshine-Windows.zip tools\sunshinesvc.exe - - cmd: 7z a Sunshine-Windows.zip ..\tools\install-service.bat - - cmd: 7z a Sunshine-Windows.zip ..\tools\uninstall-service.bat - - cmd: appveyor PushArtifact Sunshine-Windows.zip - - sh: appveyor PushArtifact sunshine-build/sunshine.deb - diff --git a/assets/85-sunshine-rules.rules b/assets/85-sunshine-rules.rules deleted file mode 100644 index 46a78a4a..00000000 --- a/assets/85-sunshine-rules.rules +++ /dev/null @@ -1 +0,0 @@ -KERNEL=="uinput", GROUP="input", MODE="0660" \ No newline at end of file diff --git a/docs/source/about/advanced_usage.rst b/docs/source/about/advanced_usage.rst index 4f427dcb..61c9e60f 100644 --- a/docs/source/about/advanced_usage.rst +++ b/docs/source/about/advanced_usage.rst @@ -6,9 +6,12 @@ Sunshine will work with the default settings for most users. In some cases you m Configuration ------------- -The default location for the configuration file is ``./assets/sunshine.conf``. You can use another location if you +The default location for the configuration file is listed below. You can use another location if you choose, by passing in the full configuration file path as the first argument when you start Sunshine. +The default location of the ``apps.json`` is the same as the configuration file. You can use a custom +location by modifying the configuration file. + **Default File Location** .. table:: @@ -17,9 +20,10 @@ choose, by passing in the full configuration file path as the first argument whe ======= =========== Value Description ======= =========== - Linux ./assets/sunshine.conf - MacOS /opt/local/etc/sunshine.conf - Windows ./assets/sunshine.conf + Docker /config/ + Linux /usr/local/sunshine/config/ + MacOS /usr/local/sunshine/config/ + Windows ./config/ ======= =========== Example @@ -1051,7 +1055,7 @@ Description by Moonlight. Default - OS dependent + OS and package dependent Example .. code-block:: text diff --git a/docs/source/about/installation.rst b/docs/source/about/installation.rst index d2b9d877..2176206a 100644 --- a/docs/source/about/installation.rst +++ b/docs/source/about/installation.rst @@ -21,53 +21,92 @@ Docker Linux ----- +Follow the instructions for your preferred package type below. AppImage ^^^^^^^^ .. image:: https://img.shields.io/github/issues/sunshinestream/sunshine/pkg:appimage?logo=github&style=for-the-badge :alt: GitHub issues by-label -#. Download and extract `sunshine-appimage.zip` +The current known compatibility of the AppImage is shown below. + + - [✖] Debian oldstable (buster) + - [✔] Debian stable (bullseye) + - [✔] Debian testing (bookworm) + - [✔] Debian unstable (sid) + - [✔] Ubuntu jammy + - [✔] Ubuntu impish + - [✔] Ubuntu focal + - [✖] Ubuntu bionic + - [✖] Ubuntu xenial + - [✖] Ubuntu trusty + - [✖] CentOS 7 + +#. Download and extract ``sunshine-appimage.zip`` to your home directory. Debian Packages ^^^^^^^^^^^^^^^ .. image:: https://img.shields.io/github/issues/sunshinestream/sunshine/os:linux:debian?logo=github&style=for-the-badge :alt: GitHub issues by-label -#. Download the corresponding `.deb` file, e.g. ``sunshine-ubuntu_20_04.deb`` -#. ``sudo apt install -f ``, e.g. ``sudo apt install -f ./sunshine-ubuntu_20_04.deb`` +#. Download ``sunshine.deb`` and run the following code. + + .. code-block:: bash + + sudo apt install -f ./sunshine.deb + +.. Tip:: You can double click the deb file to see details about the package and begin installation. Red Hat Packages ^^^^^^^^^^^^^^^^ .. image:: https://img.shields.io/github/issues/sunshinestream/sunshine/os:linux:fedora?logo=github&style=for-the-badge :alt: GitHub issues by-label -#. Download the corresponding `.rpm` file, e.g. ``sunshine-fedora_35.rpm`` -#. ``sudo dnf install ``, e.g. ``sudo dnf install ./sunshine-fedora_35.rpm`` +#. Add `rpmfusion` repositories by running the following code. -.. Hint:: If this is the first time installing. + .. code-block:: bash - .. code-block:: bash + sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \ + https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm - sudo usermod -a -G input $USER - sudo reboot now +#. Download ``sunshine.rpm`` and run the following code. -.. Tip:: Optionally, run Sunshine in the background. + .. code-block:: bash - .. code-block:: bash + sudo dnf install ./sunshine.rpm - systemctl --user start sunshine +.. Tip:: You can double click the rpm file to see details about the package and begin installation. MacOS ----- .. image:: https://img.shields.io/github/issues/sunshinestream/sunshine/os:macos?logo=github&style=for-the-badge :alt: GitHub issues by-label -#. Install `MacPorts `_ -#. Download the `Portfile `_ from this repository to - ``/tmp`` -#. In a terminal run ``cd /tmp && sudo port install`` -#. The first time you start Sunshine, you will be asked to grant access to screen recording and your microphone. +Portfile + #. Install `MacPorts `_ + #. Update the Macports sources. + + .. code-block:: bash + + sudo nano /opt/local/etc/macports/sources.conf + + Add this line, replacing your username, below the line that starts with ``rsync``. + + file://Users//ports + + ``Ctrl+x``, then ``Y`` to exit and save changes. + + #. Download the ``Portfile`` to ``~/Downloads`` and run the following code. + + .. code-block:: bash + + mkdir -p ~/ports/multimedia/sunshine + mv ~/Downlaods/Portfile ~/ports/multimedia/sunshine + cd ~/ports + portindex + sudo port install sunshine + + #. The first time you start Sunshine, you will be asked to grant access to screen recording and your microphone. Windows ------- @@ -77,7 +116,11 @@ Windows .. image:: https://img.shields.io/github/issues/sunshinestream/sunshine/os:windows:11?logo=github&style=for-the-badge :alt: GitHub issues by-label -#. Download and extract ``sunshine-windows.zip`` +Installed option: + #. Download and install ``sunshine-windows.exe`` + +Standalone option: + #. Download and extract ``sunshine-windows.zip`` .. _latest release: https://github.com/SunshineStream/Sunshine/releases/latest .. _Dockerhub.io: https://hub.docker.com/repository/docker/sunshinestream/sunshine diff --git a/docs/source/about/third_party_packages.rst b/docs/source/about/third_party_packages.rst index 6069258a..5b63a496 100644 --- a/docs/source/about/third_party_packages.rst +++ b/docs/source/about/third_party_packages.rst @@ -10,6 +10,7 @@ AUR (Arch Linux User Repository) .. image:: https://img.shields.io/aur/version/sunshine?style=for-the-badge&logo=archlinux :alt: AUR version + :target: https://aur.archlinux.org/packages/sunshine .. image:: https://img.shields.io/aur/last-modified/sunshine?style=for-the-badge&logo=archlinux :alt: AUR last modified @@ -20,38 +21,31 @@ AUR (Arch Linux User Repository) .. image:: https://img.shields.io/aur/maintainer/sunshine?style=for-the-badge&logo=archlinux :alt: AUR maintainer -.. image:: https://img.shields.io/static/v1?label=maintainer&message=hadogenes&color=blue&style=for-the-badge&logo=github - :alt: GitHub Maintainer - :target: https://github.com/hadogenes - Chocolatey ---------- .. image:: https://img.shields.io/chocolatey/v/Sunshine?style=for-the-badge&logo=chocolatey :alt: Chocolatey Version + :target: https://community.chocolatey.org/packages/sunshine .. image:: https://img.shields.io/chocolatey/dt/sunshine?style=for-the-badge&logo=chocolatey :alt: Chocolatey -.. image:: https://img.shields.io/static/v1?label=maintainer&message=AeliusSaionji&color=blue&style=for-the-badge&logo=github - :alt: GitHub Maintainer - :target: https://github.com/AeliusSaionji - Scoop ----- .. image:: https://img.shields.io/scoop/v/sunshine?bucket=extras&style=for-the-badge :alt: Scoop Version (extras bucket) - -.. image:: https://img.shields.io/static/v1?label=maintainer&message=sitiom&color=blue&style=for-the-badge&logo=github - :alt: GitHub Maintainer - :target: https://github.com/sitiom - + :target: https://scoop.sh/#/apps?s=0&d=1&o=true&q=sunshine Legacy GitHub Repo ------------------ -.. Attention:: This repo is no longer maintained. Thank you to Loki for bringing this amazing project to life! +.. Attention:: This repo is not maintained. Thank you to Loki for bringing this amazing project to life! + +.. image:: https://img.shields.io/static/v1?label=repo&message=loki-47-6F-64/sunshine&color=blue&style=for-the-badge&logo=github + :alt: GitHub Maintainer + :target: https://github.com/loki-47-6F-64/sunshine/releases .. image:: https://img.shields.io/github/last-commit/loki-47-6F-64/sunshine?style=for-the-badge&logo=github :alt: GitHub last commit @@ -61,7 +55,3 @@ Legacy GitHub Repo .. image:: https://img.shields.io/github/downloads/loki-47-6F-64/sunshine/total?style=for-the-badge&logo=github :alt: GitHub Releases - -.. image:: https://img.shields.io/static/v1?label=maintainer&message=loki-47-6F-64&color=blue&style=for-the-badge&logo=github - :alt: GitHub Maintainer - :target: https://github.com/loki-47-6F-64 diff --git a/docs/source/about/usage.rst b/docs/source/about/usage.rst index 4bb81bc5..79d285f9 100644 --- a/docs/source/about/usage.rst +++ b/docs/source/about/usage.rst @@ -23,8 +23,9 @@ Usage Add games and applications. This can be configured in the web ui. - .. Note:: Additionally, apps can be configured manually. `assets/apps_.json` is an example of a list of - applications that are started just before running a stream. + .. Note:: Additionally, apps can be configured manually. `src_assets//config/apps.json` is an example of a + list of applications that are started just before running a stream. This is the directory within the GitHub + repo. .. Attention:: Application list is not fully supported on MacOS @@ -55,20 +56,26 @@ Setup Linux ^^^^^ +The deb and rpm packages handle these steps automatically. The AppImage does not, third party packages may not as well. + Sunshine needs access to `uinput` to create mouse and gamepad events. -Add user to group `input`. +Add user to group `input`, if this is the first time installing. .. code-block:: bash - usermod -a -G input $USER + sudo usermod -a -G input $USER + sudo reboot now Create `udev` rules. .. code-block:: bash - nano /etc/udev/rules.d/85-sunshine-input.rules + sudo nano /etc/udev/rules.d/85-sunshine-input.rules - Input the following contents: - ``KERNEL=="uinput", GROUP="input", MODE="0660"`` + Input the following contents. + + .. code-block:: + + KERNEL=="uinput", GROUP="input", MODE="0660", OPTIONS+="static_node=uinput" Save the file and exit: @@ -76,18 +83,54 @@ Create `udev` rules. #. ``Y`` to save modifications. Configure autostart service - `path/to/build/dir/sunshine.service` is used to start sunshine in the background. To use it, do the following: + - filename: ``~/.config/systemd/user/sunshine.service`` + - contents: - #. Copy it to the users systemd: ``cp sunshine.service ~/.config/systemd/user/`` - #. Starting + .. code-block:: - - One time: ``systemctl --user start sunshine`` - - Always on boot: ``systemctl --user enable sunshine`` + [Unit] + Description=Sunshine Gamestream Server for Moonlight + + [Service] + ExecStart= + + [Install] + WantedBy=graphical-session.target + + .. table:: + :widths: auto + + ======== =================== =============== + package ExecStart Auto Configured + ======== =================== =============== + deb /usr/bin/sunshine ✔ + rpm /usr/bin/sunshine ✔ + AppImage ~/sunshine.AppImage ✖ + ======== =================== =============== + + Start once + .. code-block:: bash + + systemctl --user start sunshine + + Start on boot + .. code-block:: bash + + systemctl --user enable sunshine Additional Setup for KMS - .. Note:: ``cap_sys_admin`` may as well be root, except you don't need to be root to run it. + .. Note:: ``cap_sys_admin`` may as well be root, except you don't need to be root to run it. It is necessary to + allow Sunshine to use KMS. - It is necessary to allow Sunshine to use KMS: ``sudo setcap cap_sys_admin+p sunshine`` + Enable + .. code-block:: bash + + sudo setcap cap_sys_admin+p $(readlink -f $(which sunshine)) + + Disable + .. code-block:: bash + + sudo setcap -r $(readlink -f $(which sunshine)) MacOS ^^^^^ @@ -98,7 +141,14 @@ select their sink as audio device in `sunshine.conf`. .. Note:: Command Keys are not forwarded by Moonlight. Right Option-Key is mapped to CMD-Key. -.. Caution:: Gamepads are not supported. +.. Caution:: Gamepads are not currently supported. + +Configure autostart service + + MacPorts + .. code-block:: bash + + sudo port load Sunshine Windows ^^^^^^^ @@ -114,7 +164,7 @@ All shortcuts start with CTRL + ALT + SHIFT, just like Moonlight Application List ---------------- - You can use Environment variables in place of values -- ``$(HOME)` will be replaced by the value of ``$HOME`` +- ``$(HOME)`` will be replaced by the value of ``$HOME`` - ``$$`` will be replaced by ``$``, e.g. ``$$(HOME)`` will be replaced by ``$(HOME)`` - ``env`` - Adds or overwrites Environment variables for the commands/applications run by Sunshine - ``"Variable name":"Variable value"`` diff --git a/docs/source/building/linux.rst b/docs/source/building/linux.rst index a6e7eefb..475e0c66 100644 --- a/docs/source/building/linux.rst +++ b/docs/source/building/linux.rst @@ -239,6 +239,8 @@ Finally .. code-block:: bash make -j ${nproc} + cpack -G DEB # optionally, create a deb package + cpack -G RPM # optionally, create a rpm package Dockerfile Builds ----------------- diff --git a/docs/source/building/macos.rst b/docs/source/building/macos.rst index 97a58a23..51ae6b15 100644 --- a/docs/source/building/macos.rst +++ b/docs/source/building/macos.rst @@ -14,14 +14,14 @@ MacPorts Install Requirements .. code-block:: bash - sudo port install cmake boost libopus ffmpeg + sudo port install cmake boost ffmpeg libopus Homebrew """""""" Install Requirements .. code-block:: bash - brew install boost cmake ffmpeg libopusenc + brew install boost cmake ffmpeg opus # if there are issues with an SSL header that is not found: cd /usr/local/include ln -s ../opt/openssl/include/openssl . @@ -35,6 +35,8 @@ Build cmake .. make -j ${nproc} + cpack -G DragNDrop # optionally, create a MacOS dmg package + If cmake fails complaining to find Boost, try to set the path explicitly. ``cmake -DBOOST_ROOT=[boost path] ..``, e.g., ``cmake -DBOOST_ROOT=/opt/local/libexec/boost/1.76 ..`` diff --git a/docs/source/building/windows.rst b/docs/source/building/windows.rst index 36cea881..7708da49 100644 --- a/docs/source/building/windows.rst +++ b/docs/source/building/windows.rst @@ -8,7 +8,7 @@ Requirements First you need to install `MSYS2 `_, then startup "MSYS2 MinGW 64-bit" and install the following packages using: -.. code-block:: batch +.. code-block:: bash pacman -S mingw-w64-x86_64-binutils mingw-w64-x86_64-openssl mingw-w64-x86_64-cmake mingw-w64-x86_64-toolchain mingw-w64-x86_64-opus mingw-w64-x86_64-x265 mingw-w64-x86_64-boost git mingw-w64-x86_64-make cmake make gcc @@ -16,7 +16,12 @@ Build ----- .. Attention:: Ensure you are in the build directory created during the clone step earlier before continuing. - .. code-block:: batch + .. code-block:: bash cmake -G"Unix Makefiles" .. + cmake -G"MinGW Makefiles" .. # alternatively + mingw32-make + + cpack -G NSIS # optionally, create a windows installer + cpack -G ZIP # optionally, create a windows standalone package diff --git a/docs/source/conf.py b/docs/source/conf.py index 86b7b805..f4873f15 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -27,7 +27,7 @@ author = 'ReenigneArcher' # The full version, including alpha/beta/rc tags with open(os.path.join(root_dir, 'CMakeLists.txt'), 'r') as f: - version = re.search(r"project\(Sunshine VERSION ((\d+)\.(\d+)\.(\d+))\)", str(f.read())).group(1) + version = re.search(r"project\(Sunshine VERSION ((\d+)\.(\d+)\.(\d+))", str(f.read())).group(1) """ To use cmake method for obtaining version instead of regex, 1. Within CMakeLists.txt add the following line without backticks: @@ -46,7 +46,8 @@ extensions = [ 'm2r2', # enable markdown files 'sphinx.ext.autosectionlabel', 'sphinx.ext.todo', # enable to-do sections - 'sphinx.ext.viewcode' # add links to view source code + 'sphinx.ext.viewcode', # add links to view source code + 'sphinx_copybutton', # add a copy button to code blocks ] # Add any paths that contain templates here, relative to this directory. diff --git a/docs/source/toc.rst b/docs/source/toc.rst index 9c0989ee..efafa92b 100644 --- a/docs/source/toc.rst +++ b/docs/source/toc.rst @@ -9,6 +9,15 @@ about/usage about/advanced_usage +.. toctree:: + :maxdepth: 2 + :caption: Troubleshooting + + troubleshooting/general + troubleshooting/linux + troubleshooting/macos + troubleshooting/windows + .. toctree:: :maxdepth: 2 :caption: Build diff --git a/docs/source/troubleshooting/general.rst b/docs/source/troubleshooting/general.rst new file mode 100644 index 00000000..322327cc --- /dev/null +++ b/docs/source/troubleshooting/general.rst @@ -0,0 +1,13 @@ +:github_url: https://github.com/SunshineStream/Sunshine/tree/nightly/docs/source/troubleshooting/general.rst + +General +======= +If you forgot your credentials to the web UI, try this. + + .. code-block:: bash + + sunshine -creds + +Can't access the web UI? + + #. Check firefall rules. diff --git a/docs/source/troubleshooting/linux.rst b/docs/source/troubleshooting/linux.rst new file mode 100644 index 00000000..71e9eac0 --- /dev/null +++ b/docs/source/troubleshooting/linux.rst @@ -0,0 +1,9 @@ +:github_url: https://github.com/SunshineStream/Sunshine/tree/nightly/docs/source/troubleshooting/linux.rst + +Linux +===== +If screencasting fails with Wayland, you may need to run the following to force screencasting with X11. + + .. code-block:: bash + + sudo setcap -r $(readlink -f $(which sunshine)) diff --git a/docs/source/troubleshooting/macos.rst b/docs/source/troubleshooting/macos.rst new file mode 100644 index 00000000..18ea9361 --- /dev/null +++ b/docs/source/troubleshooting/macos.rst @@ -0,0 +1,14 @@ +:github_url: https://github.com/SunshineStream/Sunshine/tree/nightly/docs/source/troubleshooting/macos.rst + +MacOS +===== +If you get this error: + + ``Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that + org.freedesktop.dbus-session.plist is loaded!`` + + Try this. + + .. code-block:: bash + + launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist diff --git a/docs/source/troubleshooting/windows.rst b/docs/source/troubleshooting/windows.rst new file mode 100644 index 00000000..461bce0a --- /dev/null +++ b/docs/source/troubleshooting/windows.rst @@ -0,0 +1,7 @@ +:github_url: https://github.com/SunshineStream/Sunshine/tree/nightly/docs/source/troubleshooting/windows.rst + +Windows +======= +No gamepad is detected. + + #. Verify that you've installed `ViGEmBus `_. diff --git a/gen-deb.in b/gen-deb.in deleted file mode 100755 index 25ca3609..00000000 --- a/gen-deb.in +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/sh - -if [ ! "@SUNSHINE_UNDEFINED_VARIABLE@" = "" ]; then - echo "Please run gen-deb generated by cmake inside the build directory" - exit 1 -fi - -if [ -d package-deb ]; then - echo "package-deb already exists: It will be replaced" - rm -rf package-deb -fi - -export DEBIAN=@CMAKE_CURRENT_BINARY_DIR@/package-deb/sunshine/DEBIAN -export RULES=@CMAKE_CURRENT_BINARY_DIR@/package-deb/sunshine/etc/udev/rules.d -export BIN=@CMAKE_CURRENT_BINARY_DIR@/package-deb/sunshine/usr/bin -export SERVICE=@CMAKE_CURRENT_BINARY_DIR@/package-deb/sunshine/usr/lib/systemd/user -export ASSETS=@CMAKE_CURRENT_BINARY_DIR@/package-deb/sunshine/etc/sunshine - -mkdir -p $DEBIAN -mkdir -p $RULES -mkdir -p $BIN -mkdir -p $ASSETS/shaders -mkdir -p $SERVICE - -if [ ! -f sunshine ]; then - echo "Error: Can't find sunshine" - exit 1 -fi - -cat << 'EOF' > $DEBIAN/conffiles -/etc/sunshine/sunshine.conf -/etc/sunshine/apps_linux.json -EOF - -cat << 'EOF' > $DEBIAN/control -Package: sunshine -Architecture: amd64 -Maintainer: @loki -Priority: optional -Version: @PROJECT_VERSION@ -Depends: libssl1.1, libavdevice58, libboost-thread1.67.0 | libboost-thread1.71.0 | libboost-thread1.74.0, libboost-filesystem1.67.0 | libboost-filesystem1.71.0 | libboost-filesystem1.74.0, libboost-log1.67.0 | libboost-log1.71.0 | libboost-log1.74.0, libpulse0, libopus0, libxcb-shm0, libxcb-xfixes0, libxtst6, libevdev2, libdrm2, libcap2 -Description: Gamestream host for Moonlight -EOF - -cat << 'EOF' > $DEBIAN/preinst -#Store backup for old config files to prevent it from being overwritten -if [ -f /etc/sunshine/sunshine.conf ]; then - cp /etc/sunshine/sunshine.conf /etc/sunshine/sunshine.conf.old -fi - -if [ -f /etc/sunshine/apps_linux.json ]; then - cp /etc/sunshine/apps_linux.json /etc/sunshine/apps_linux.json.old -fi -EOF - -cat << 'EOF' > $DEBIAN/postinst -#!/bin/sh - -export GROUP_INPUT=input - -if [ -f /etc/group ]; then - if ! grep -q $GROUP_INPUT /etc/group; then - echo "Creating group $GROUP_INPUT" - - groupadd $GROUP_INPUT - fi -else - echo "Warning: /etc/group not found" -fi - -if [ -f /etc/sunshine/sunshine.conf.old ]; then - echo "Restoring old sunshine.conf" - mv /etc/sunshine/sunshine.conf.old /etc/sunshine/sunshine.conf -fi - -if [ -f /etc/sunshine/apps_linux.json.old ]; then - echo "Restoring old apps_linux.json" - mv /etc/sunshine/apps_linux.json.old /etc/sunshine/apps_linux.json -fi - -# Update permissions on config files for Web Manager -if [ -f /etc/sunshine/apps_linux.json ]; then - echo "chmod 666 /etc/sunshine/apps_linux.json" - chmod 666 /etc/sunshine/apps_linux.json -fi - -if [ -f /etc/sunshine/sunshine.conf ]; then - echo "chmod 666 /etc/sunshine/sunshine.conf" - chmod 666 /etc/sunshine/sunshine.conf -fi - -# Ensure Sunshine can grab images from KMS -path_to_setcap=$(which setcap) -if [ -x "$path_to_setcap" ] ; then - echo "$path_to_setcap cap_sys_admin+p /usr/bin/sunshine" - $path_to_setcap cap_sys_admin+p /usr/bin/sunshine -fi -EOF - -cat << 'EOF' > $RULES/85-sunshine-rules.rules -KERNEL=="uinput", GROUP="input", MODE="0660" -EOF - -cp sunshine $BIN/sunshine -cp @CMAKE_CURRENT_SOURCE_DIR@/assets/apps_linux.json $ASSETS/apps_linux.json -cp @CMAKE_CURRENT_SOURCE_DIR@/assets/sunshine.conf $ASSETS/sunshine.conf -cp @CMAKE_CURRENT_BINARY_DIR@/sunshine.service $SERVICE/sunshine.service -cp -r @CMAKE_CURRENT_SOURCE_DIR@/assets/web $ASSETS/web -cp -r @CMAKE_CURRENT_SOURCE_DIR@/assets/shaders/opengl $ASSETS/shaders/opengl - -chmod 755 $DEBIAN/postinst -chmod 755 $DEBIAN/preinst -chmod 755 $BIN/sunshine -chmod 644 $RULES/85-sunshine-rules.rules -chmod 666 $ASSETS/apps_linux.json -chmod 666 $ASSETS/sunshine.conf - -cd package-deb -if fakeroot dpkg-deb --build sunshine; then - echo "generated debian package: @CMAKE_CURRENT_BINARY_DIR@/package-deb/sunshine.deb" -fi -cd .. - diff --git a/gen-rpm.in b/gen-rpm.in deleted file mode 100755 index 792a3895..00000000 --- a/gen-rpm.in +++ /dev/null @@ -1,179 +0,0 @@ -#!/bin/sh - -# Export filepaths -export BUILDDIR=@CMAKE_CURRENT_SOURCE_DIR@/build -export BUILDROOT=~/rpmbuild/ -export RPMSRC=~/rpmbuild/SOURCES -export RPMSPEC=~/rpmbuild/SPECS -export RPMBUILD=~/rpmbuild/BUILD - -# Check for Docker switch -if [ "$1" == "-d" ]; then - export DOCKERSTATUS=TRUE -else - export DOCKERSTATUS=FALSE -fi - -# Check if user's rpmbuild folder is there, if so, temoprairly rename it. -if [ -d ~/rpmbuild ]; then - echo "Backing up rpmbuild" - ~/rpmbuild ~/rpmbuild.bkp - export RPMBUILDEXISTS=TRUE -else - export RPMBUILDEXISTS=FALSE -fi - -# Create rpmbuild folder structure -mkdir ~/rpmbuild -mkdir ~/rpmbuild/BUILD -mkdir ~/rpmbuild/BUILDROOT -mkdir ~/rpmbuild/RPMS -mkdir ~/rpmbuild/SOURCES -mkdir ~/rpmbuild/SPECS -mkdir ~/rpmbuild/SRPMS - -# Create sunshine .spec file with preinstall and postinstall scripts -cat << 'EOF' > $RPMSPEC/sunshine.spec -Name: sunshine -Version: @PROJECT_VERSION@ -Release: 1%{?dist} -Summary: An NVIDIA Gamestream-compatible hosting server -BuildArch: x86_64 - -License: GPLv3 -URL: https://github.com/SunshineStream/Sunshine -Source0: sunshine-@PROJECT_VERSION@_bin.tar.gz - -Requires: systemd ffmpeg rpmfusion-free-release - -%description -An NVIDIA Gamestream-compatible hosting server - -%pre -#!/bin/sh - -# Sunshine Pre-Install Script -# Store backup for old config files to prevent it from being overwritten -if [ -f /etc/sunshine/sunshine.conf ]; then - cp /etc/sunshine/sunshine.conf /etc/sunshine/sunshine.conf.old -fi - -if [ -f /etc/sunshine/apps_linux.json ]; then - cp /etc/sunshine/apps_linux.json /etc/sunshine/apps_linux.json.old -fi - -%post -#!/bin/sh - -# Sunshine Post-Install Script -export GROUP_INPUT=input - -if [ -f /etc/group ]; then - if ! grep -q $GROUP_INPUT /etc/group; then - echo "Creating group $GROUP_INPUT" - - groupadd $GROUP_INPUT - fi -else - echo "Warning: /etc/group not found" -fi - -if [ -f /etc/sunshine/sunshine.conf.old ]; then - echo "Restoring old sunshine.conf" - mv /etc/sunshine/sunshine.conf.old /etc/sunshine/sunshine.conf -fi - -if [ -f /etc/sunshine/apps_linux.json.old ]; then - echo "Restoring old apps_linux.json" - mv /etc/sunshine/apps_linux.json.old /etc/sunshine/apps_linux.json -fi - -# Update permissions on config files for Web Manager -if [ -f /etc/sunshine/apps_linux.json ]; then - echo "chmod 666 /etc/sunshine/apps_linux.json" - chmod 666 /etc/sunshine/apps_linux.json -fi - -if [ -f /etc/sunshine/sunshine.conf ]; then - echo "chmod 666 /etc/sunshine/sunshine.conf" - chmod 666 /etc/sunshine/sunshine.conf -fi - -# Ensure Sunshine can grab images from KMS -path_to_setcap=$(which setcap) -if [ -x "$path_to_setcap" ] ; then - echo "$path_to_setcap cap_sys_admin+p /usr/bin/sunshine" - $path_to_setcap cap_sys_admin+p /usr/bin/sunshine -fi - -%prep -%setup -q - -%install -rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT/%{_bindir} -mkdir -p $RPM_BUILD_ROOT/etc/sunshine -mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/user -mkdir -p $RPM_BUILD_ROOT/usr/share/applications -mkdir -p $RPM_BUILD_ROOT/etc/udev/rules.d - -cp sunshine $RPM_BUILD_ROOT/%{_bindir}/sunshine -cp sunshine.conf $RPM_BUILD_ROOT/etc/sunshine/sunshine.conf -cp apps_linux.json $RPM_BUILD_ROOT/etc/sunshine/apps_linux.json -cp sunshine.service $RPM_BUILD_ROOT/usr/lib/systemd/user/sunshine.service -cp sunshine.desktop $RPM_BUILD_ROOT/usr/share/applications/sunshine.desktop -cp 85-sunshine-rules.rules $RPM_BUILD_ROOT/etc/udev/rules.d/85-sunshine-rules.rules - -%clean -rm -rf $RPM_BUILD_ROOT - -%files -%{_bindir}/sunshine -/usr/lib/systemd/user/sunshine.service -/etc/sunshine/sunshine.conf -/etc/sunshine/apps_linux.json -/usr/share/applications/sunshine.desktop -/etc/udev/rules.d/85-sunshine-rules.rules - -%changelog -* Sat Mar 12 2022 h <65380846+thatsysadmin@users.noreply.github.com> -- Initial packaging of Sunshine. -EOF - -# Copy over sunshine binary and supplemental files into rpmbuild/BUILD/ -mkdir genrpm -mkdir genrpm/sunshine-@PROJECT_VERSION@ -cp sunshine-@PROJECT_VERSION@ genrpm/sunshine-@PROJECT_VERSION@/sunshine -cp sunshine.service genrpm/sunshine-@PROJECT_VERSION@/sunshine.service -cp sunshine.desktop genrpm/sunshine-@PROJECT_VERSION@/sunshine.desktop -cp @CMAKE_CURRENT_SOURCE_DIR@/assets/sunshine.conf genrpm/sunshine-@PROJECT_VERSION@/sunshine.conf -cp @CMAKE_CURRENT_SOURCE_DIR@/assets/apps_linux.json genrpm/sunshine-@PROJECT_VERSION@/apps_linux.json -cp @CMAKE_CURRENT_SOURCE_DIR@/assets/85-sunshine-rules.rules genrpm/sunshine-@PROJECT_VERSION@/85-sunshine-rules.rules -cd genrpm - -# tarball everything as if it was a source file for rpmbuild -tar --create --file sunshine-@PROJECT_VERSION@_bin.tar.gz sunshine-@PROJECT_VERSION@/ -cp sunshine-@PROJECT_VERSION@_bin.tar.gz ~/rpmbuild/SOURCES - -# Use rpmbuild to build the RPM package. -rpmbuild -bb $RPMSPEC/sunshine.spec - -# Check if running in a CT -if [ "$DOCKERSTATUS" == "FALSE" ]; then - # Move the completed RPM into the cmake build folder - mv ~/rpmbuild/RPMS/x86_64/sunshine-@PROJECT_VERSION@-1.fc*.x86_64.rpm @CMAKE_CURRENT_BINARY_DIR@/ - echo "Moving completed RPM package into CMake build folder." -elif [ "$DOCKERSTATUS" == "TRUE" ]; then - # Move into pickup location - mkdir -p /root/sunshine-build/package-rpm/ - mv ~/rpmbuild/RPMS/x86_64/sunshine-@PROJECT_VERSION@-1.fc*.x86_64.rpm /root/sunshine-build/package-rpm/sunshine.rpm - echo "Moving completed RPM package for pickup." -fi - -# Clean up; delete the rpmbuild folder we created and move back the original one -if [ "$RPMBUILDEXISTS" == "TRUE" ]; then - echo "Removing and replacing original rpmbuild folder." - rm -rf ~/rpmbuild - mv ~/rpmbuild.bkp ~/rpmbuild -fi -exit 0 diff --git a/scripts/requirements.txt b/scripts/requirements.txt index c089efd9..73eefbe1 100644 --- a/scripts/requirements.txt +++ b/scripts/requirements.txt @@ -1,4 +1,5 @@ Babel==2.9.1 m2r2==0.3.2 Sphinx==4.5.0 +sphinx-copybutton==0.5.0 sphinx-rtd-theme==1.0.0 diff --git a/assets/box.png b/src_assets/common/assets/box.png similarity index 100% rename from assets/box.png rename to src_assets/common/assets/box.png diff --git a/assets/steam.png b/src_assets/common/assets/steam.png similarity index 100% rename from assets/steam.png rename to src_assets/common/assets/steam.png diff --git a/assets/web/apps.html b/src_assets/common/assets/web/apps.html similarity index 100% rename from assets/web/apps.html rename to src_assets/common/assets/web/apps.html diff --git a/assets/web/clients.html b/src_assets/common/assets/web/clients.html similarity index 100% rename from assets/web/clients.html rename to src_assets/common/assets/web/clients.html diff --git a/assets/web/config.html b/src_assets/common/assets/web/config.html similarity index 100% rename from assets/web/config.html rename to src_assets/common/assets/web/config.html diff --git a/assets/web/fonts/fontawesome-free-web/LICENSE.txt b/src_assets/common/assets/web/fonts/fontawesome-free-web/LICENSE.txt similarity index 100% rename from assets/web/fonts/fontawesome-free-web/LICENSE.txt rename to src_assets/common/assets/web/fonts/fontawesome-free-web/LICENSE.txt diff --git a/assets/web/fonts/fontawesome-free-web/attribution.js b/src_assets/common/assets/web/fonts/fontawesome-free-web/attribution.js similarity index 100% rename from assets/web/fonts/fontawesome-free-web/attribution.js rename to src_assets/common/assets/web/fonts/fontawesome-free-web/attribution.js diff --git a/assets/web/fonts/fontawesome-free-web/css/all.min.css b/src_assets/common/assets/web/fonts/fontawesome-free-web/css/all.min.css similarity index 100% rename from assets/web/fonts/fontawesome-free-web/css/all.min.css rename to src_assets/common/assets/web/fonts/fontawesome-free-web/css/all.min.css diff --git a/assets/web/fonts/fontawesome-free-web/css/brands.min.css b/src_assets/common/assets/web/fonts/fontawesome-free-web/css/brands.min.css similarity index 100% rename from assets/web/fonts/fontawesome-free-web/css/brands.min.css rename to src_assets/common/assets/web/fonts/fontawesome-free-web/css/brands.min.css diff --git a/assets/web/fonts/fontawesome-free-web/css/fontawesome.min.css b/src_assets/common/assets/web/fonts/fontawesome-free-web/css/fontawesome.min.css similarity index 100% rename from assets/web/fonts/fontawesome-free-web/css/fontawesome.min.css rename to src_assets/common/assets/web/fonts/fontawesome-free-web/css/fontawesome.min.css diff --git a/assets/web/fonts/fontawesome-free-web/css/regular.min.css b/src_assets/common/assets/web/fonts/fontawesome-free-web/css/regular.min.css similarity index 100% rename from assets/web/fonts/fontawesome-free-web/css/regular.min.css rename to src_assets/common/assets/web/fonts/fontawesome-free-web/css/regular.min.css diff --git a/assets/web/fonts/fontawesome-free-web/css/solid.min.css b/src_assets/common/assets/web/fonts/fontawesome-free-web/css/solid.min.css similarity index 100% rename from assets/web/fonts/fontawesome-free-web/css/solid.min.css rename to src_assets/common/assets/web/fonts/fontawesome-free-web/css/solid.min.css diff --git a/assets/web/fonts/fontawesome-free-web/css/svg-with-js.min.css b/src_assets/common/assets/web/fonts/fontawesome-free-web/css/svg-with-js.min.css similarity index 100% rename from assets/web/fonts/fontawesome-free-web/css/svg-with-js.min.css rename to src_assets/common/assets/web/fonts/fontawesome-free-web/css/svg-with-js.min.css diff --git a/assets/web/fonts/fontawesome-free-web/css/v4-shims.min.css b/src_assets/common/assets/web/fonts/fontawesome-free-web/css/v4-shims.min.css similarity index 100% rename from assets/web/fonts/fontawesome-free-web/css/v4-shims.min.css rename to src_assets/common/assets/web/fonts/fontawesome-free-web/css/v4-shims.min.css diff --git a/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.eot b/src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.eot similarity index 100% rename from assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.eot rename to src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.eot diff --git a/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.svg b/src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.svg similarity index 100% rename from assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.svg rename to src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.svg diff --git a/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.ttf b/src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.ttf similarity index 100% rename from assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.ttf rename to src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.ttf diff --git a/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff b/src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff similarity index 100% rename from assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff rename to src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff diff --git a/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff2 b/src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff2 similarity index 100% rename from assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff2 rename to src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-brands-400.woff2 diff --git a/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.eot b/src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.eot similarity index 100% rename from assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.eot rename to src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.eot diff --git a/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.svg b/src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.svg similarity index 100% rename from assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.svg rename to src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.svg diff --git a/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.ttf b/src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.ttf similarity index 100% rename from assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.ttf rename to src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.ttf diff --git a/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff b/src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff similarity index 100% rename from assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff rename to src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff diff --git a/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff2 b/src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff2 similarity index 100% rename from assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff2 rename to src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-regular-400.woff2 diff --git a/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.eot b/src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.eot similarity index 100% rename from assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.eot rename to src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.eot diff --git a/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.svg b/src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.svg similarity index 100% rename from assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.svg rename to src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.svg diff --git a/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.ttf b/src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.ttf similarity index 100% rename from assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.ttf rename to src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.ttf diff --git a/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff b/src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff similarity index 100% rename from assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff rename to src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff diff --git a/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff2 b/src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff2 similarity index 100% rename from assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff2 rename to src_assets/common/assets/web/fonts/fontawesome-free-web/webfonts/fa-solid-900.woff2 diff --git a/assets/web/header-no-nav.html b/src_assets/common/assets/web/header-no-nav.html similarity index 100% rename from assets/web/header-no-nav.html rename to src_assets/common/assets/web/header-no-nav.html diff --git a/assets/web/header.html b/src_assets/common/assets/web/header.html similarity index 100% rename from assets/web/header.html rename to src_assets/common/assets/web/header.html diff --git a/assets/web/images/favicon.ico b/src_assets/common/assets/web/images/favicon.ico similarity index 100% rename from assets/web/images/favicon.ico rename to src_assets/common/assets/web/images/favicon.ico diff --git a/assets/web/images/logo-sunshine-45.png b/src_assets/common/assets/web/images/logo-sunshine-45.png similarity index 100% rename from assets/web/images/logo-sunshine-45.png rename to src_assets/common/assets/web/images/logo-sunshine-45.png diff --git a/assets/web/index.html b/src_assets/common/assets/web/index.html similarity index 100% rename from assets/web/index.html rename to src_assets/common/assets/web/index.html diff --git a/assets/web/password.html b/src_assets/common/assets/web/password.html similarity index 100% rename from assets/web/password.html rename to src_assets/common/assets/web/password.html diff --git a/assets/web/pin.html b/src_assets/common/assets/web/pin.html similarity index 100% rename from assets/web/pin.html rename to src_assets/common/assets/web/pin.html diff --git a/assets/web/third_party/bootstrap.bundle.min.js b/src_assets/common/assets/web/third_party/bootstrap.bundle.min.js similarity index 100% rename from assets/web/third_party/bootstrap.bundle.min.js rename to src_assets/common/assets/web/third_party/bootstrap.bundle.min.js diff --git a/assets/web/third_party/bootstrap.min.css b/src_assets/common/assets/web/third_party/bootstrap.min.css similarity index 100% rename from assets/web/third_party/bootstrap.min.css rename to src_assets/common/assets/web/third_party/bootstrap.min.css diff --git a/assets/web/third_party/vue.js b/src_assets/common/assets/web/third_party/vue.js similarity index 100% rename from assets/web/third_party/vue.js rename to src_assets/common/assets/web/third_party/vue.js diff --git a/assets/web/troubleshooting.html b/src_assets/common/assets/web/troubleshooting.html similarity index 100% rename from assets/web/troubleshooting.html rename to src_assets/common/assets/web/troubleshooting.html diff --git a/assets/web/welcome.html b/src_assets/common/assets/web/welcome.html similarity index 100% rename from assets/web/welcome.html rename to src_assets/common/assets/web/welcome.html diff --git a/assets/sunshine.conf b/src_assets/common/config/sunshine.conf similarity index 99% rename from assets/sunshine.conf rename to src_assets/common/config/sunshine.conf index 509ff52a..04d51c2a 100644 --- a/assets/sunshine.conf +++ b/src_assets/common/config/sunshine.conf @@ -1 +1 @@ -# See our documentation at https://sunshinestream.readthedocs.io/en/latest/about/advanced_usage.html +# See our documentation at https://sunshinestream.readthedocs.io/en/latest/about/advanced_usage.html diff --git a/assets/shaders/opengl/ConvertUV.frag b/src_assets/linux/assets/shaders/opengl/ConvertUV.frag similarity index 96% rename from assets/shaders/opengl/ConvertUV.frag rename to src_assets/linux/assets/shaders/opengl/ConvertUV.frag index 416e1e8b..4bd08287 100644 --- a/assets/shaders/opengl/ConvertUV.frag +++ b/src_assets/linux/assets/shaders/opengl/ConvertUV.frag @@ -1,35 +1,35 @@ -#version 300 es - -#ifdef GL_ES -precision lowp float; -#endif - -uniform sampler2D image; - -layout(shared) uniform ColorMatrix { - vec4 color_vec_y; - vec4 color_vec_u; - vec4 color_vec_v; - vec2 range_y; - vec2 range_uv; -}; - -in vec3 uuv; -layout(location = 0) out vec2 color; - -//-------------------------------------------------------------------------------------- -// Pixel Shader -//-------------------------------------------------------------------------------------- -void main() { - vec3 rgb_left = texture(image, uuv.xz).rgb; - vec3 rgb_right = texture(image, uuv.yz).rgb; - vec3 rgb = (rgb_left + rgb_right) * 0.5; - - float u = dot(color_vec_u.xyz, rgb) + color_vec_u.w; - float v = dot(color_vec_v.xyz, rgb) + color_vec_v.w; - - u = u * range_uv.x + range_uv.y; - v = v * range_uv.x + range_uv.y; - - color = vec2(u, v * 224.0f / 256.0f + 0.0625); +#version 300 es + +#ifdef GL_ES +precision lowp float; +#endif + +uniform sampler2D image; + +layout(shared) uniform ColorMatrix { + vec4 color_vec_y; + vec4 color_vec_u; + vec4 color_vec_v; + vec2 range_y; + vec2 range_uv; +}; + +in vec3 uuv; +layout(location = 0) out vec2 color; + +//-------------------------------------------------------------------------------------- +// Pixel Shader +//-------------------------------------------------------------------------------------- +void main() { + vec3 rgb_left = texture(image, uuv.xz).rgb; + vec3 rgb_right = texture(image, uuv.yz).rgb; + vec3 rgb = (rgb_left + rgb_right) * 0.5; + + float u = dot(color_vec_u.xyz, rgb) + color_vec_u.w; + float v = dot(color_vec_v.xyz, rgb) + color_vec_v.w; + + u = u * range_uv.x + range_uv.y; + v = v * range_uv.x + range_uv.y; + + color = vec2(u, v * 224.0f / 256.0f + 0.0625); } \ No newline at end of file diff --git a/assets/shaders/opengl/ConvertUV.vert b/src_assets/linux/assets/shaders/opengl/ConvertUV.vert similarity index 95% rename from assets/shaders/opengl/ConvertUV.vert rename to src_assets/linux/assets/shaders/opengl/ConvertUV.vert index a71fe58d..70c14f4c 100644 --- a/assets/shaders/opengl/ConvertUV.vert +++ b/src_assets/linux/assets/shaders/opengl/ConvertUV.vert @@ -1,27 +1,27 @@ -#version 300 es - -#ifdef GL_ES -precision mediump float; -#endif - -uniform float width_i; - -out vec3 uuv; -//-------------------------------------------------------------------------------------- -// Vertex Shader -//-------------------------------------------------------------------------------------- -void main() -{ - float idHigh = float(gl_VertexID >> 1); - float idLow = float(gl_VertexID & int(1)); - - float x = idHigh * 4.0 - 1.0; - float y = idLow * 4.0 - 1.0; - - float u_right = idHigh * 2.0; - float u_left = u_right - width_i; - float v = idLow * 2.0; - - uuv = vec3(u_left, u_right, v); - gl_Position = vec4(x, y, 0.0, 1.0); +#version 300 es + +#ifdef GL_ES +precision mediump float; +#endif + +uniform float width_i; + +out vec3 uuv; +//-------------------------------------------------------------------------------------- +// Vertex Shader +//-------------------------------------------------------------------------------------- +void main() +{ + float idHigh = float(gl_VertexID >> 1); + float idLow = float(gl_VertexID & int(1)); + + float x = idHigh * 4.0 - 1.0; + float y = idLow * 4.0 - 1.0; + + float u_right = idHigh * 2.0; + float u_left = u_right - width_i; + float v = idLow * 2.0; + + uuv = vec3(u_left, u_right, v); + gl_Position = vec4(x, y, 0.0, 1.0); } \ No newline at end of file diff --git a/assets/shaders/opengl/ConvertY.frag b/src_assets/linux/assets/shaders/opengl/ConvertY.frag similarity index 94% rename from assets/shaders/opengl/ConvertY.frag rename to src_assets/linux/assets/shaders/opengl/ConvertY.frag index 564fa25a..dfd5774e 100644 --- a/assets/shaders/opengl/ConvertY.frag +++ b/src_assets/linux/assets/shaders/opengl/ConvertY.frag @@ -1,26 +1,26 @@ -#version 300 es - -#ifdef GL_ES -precision lowp float; -#endif - -uniform sampler2D image; - -layout(shared) uniform ColorMatrix { - vec4 color_vec_y; - vec4 color_vec_u; - vec4 color_vec_v; - vec2 range_y; - vec2 range_uv; -}; - -in vec2 tex; -layout(location = 0) out float color; - -void main() -{ - vec3 rgb = texture(image, tex).rgb; - float y = dot(color_vec_y.xyz, rgb); - - color = y * range_y.x + range_y.y; +#version 300 es + +#ifdef GL_ES +precision lowp float; +#endif + +uniform sampler2D image; + +layout(shared) uniform ColorMatrix { + vec4 color_vec_y; + vec4 color_vec_u; + vec4 color_vec_v; + vec2 range_y; + vec2 range_uv; +}; + +in vec2 tex; +layout(location = 0) out float color; + +void main() +{ + vec3 rgb = texture(image, tex).rgb; + float y = dot(color_vec_y.xyz, rgb); + + color = y * range_y.x + range_y.y; } \ No newline at end of file diff --git a/assets/shaders/opengl/Scene.frag b/src_assets/linux/assets/shaders/opengl/Scene.frag similarity index 93% rename from assets/shaders/opengl/Scene.frag rename to src_assets/linux/assets/shaders/opengl/Scene.frag index 6375f1fd..ee4b36b9 100644 --- a/assets/shaders/opengl/Scene.frag +++ b/src_assets/linux/assets/shaders/opengl/Scene.frag @@ -1,14 +1,14 @@ -#version 300 es - -#ifdef GL_ES -precision lowp float; -#endif - -uniform sampler2D image; - -in vec2 tex; -layout(location = 0) out vec4 color; -void main() -{ - color = texture(image, tex); +#version 300 es + +#ifdef GL_ES +precision lowp float; +#endif + +uniform sampler2D image; + +in vec2 tex; +layout(location = 0) out vec4 color; +void main() +{ + color = texture(image, tex); } \ No newline at end of file diff --git a/assets/shaders/opengl/Scene.vert b/src_assets/linux/assets/shaders/opengl/Scene.vert similarity index 94% rename from assets/shaders/opengl/Scene.vert rename to src_assets/linux/assets/shaders/opengl/Scene.vert index 258878f4..24c16bef 100644 --- a/assets/shaders/opengl/Scene.vert +++ b/src_assets/linux/assets/shaders/opengl/Scene.vert @@ -1,22 +1,22 @@ -#version 300 es - -#ifdef GL_ES -precision mediump float; -#endif - -out vec2 tex; - -void main() -{ - float idHigh = float(gl_VertexID >> 1); - float idLow = float(gl_VertexID & int(1)); - - float x = idHigh * 4.0 - 1.0; - float y = idLow * 4.0 - 1.0; - - float u = idHigh * 2.0; - float v = idLow * 2.0; - - gl_Position = vec4(x, y, 0.0, 1.0); - tex = vec2(u, v); +#version 300 es + +#ifdef GL_ES +precision mediump float; +#endif + +out vec2 tex; + +void main() +{ + float idHigh = float(gl_VertexID >> 1); + float idLow = float(gl_VertexID & int(1)); + + float x = idHigh * 4.0 - 1.0; + float y = idLow * 4.0 - 1.0; + + float u = idHigh * 2.0; + float v = idLow * 2.0; + + gl_Position = vec4(x, y, 0.0, 1.0); + tex = vec2(u, v); } \ No newline at end of file diff --git a/assets/apps_linux.json b/src_assets/linux/config/apps.json similarity index 100% rename from assets/apps_linux.json rename to src_assets/linux/config/apps.json diff --git a/src_assets/linux/misc/85-sunshine-rules.rules b/src_assets/linux/misc/85-sunshine-rules.rules new file mode 100644 index 00000000..a1ee7cd0 --- /dev/null +++ b/src_assets/linux/misc/85-sunshine-rules.rules @@ -0,0 +1 @@ +KERNEL=="uinput", GROUP="input", MODE="0660", OPTIONS+="static_node=uinput" \ No newline at end of file diff --git a/src_assets/linux/misc/conffiles b/src_assets/linux/misc/conffiles new file mode 100644 index 00000000..4a35822b --- /dev/null +++ b/src_assets/linux/misc/conffiles @@ -0,0 +1,2 @@ +/usr/local/sunshine/config/sunshine.conf +/usr/local/sunshine/config/apps.json diff --git a/src_assets/linux/misc/postinst b/src_assets/linux/misc/postinst new file mode 100644 index 00000000..a42d3ca5 --- /dev/null +++ b/src_assets/linux/misc/postinst @@ -0,0 +1,41 @@ +#!/bin/sh + +export GROUP_INPUT=input + +if [ -f /etc/group ]; then + if ! grep -q $GROUP_INPUT /etc/group; then + echo "Creating group $GROUP_INPUT" + + groupadd $GROUP_INPUT + fi +else + echo "Warning: /etc/group not found" +fi + +if [ -f /usr/local/sunshine/config/sunshine.conf.old ]; then + echo "Restoring old sunshine.conf" + mv /usr/local/sunshine/config/sunshine.conf.old /usr/local/sunshine/config/sunshine.conf +fi + +if [ -f /usr/local/sunshine/config/apps.json.old ]; then + echo "Restoring old apps.json" + mv /usr/local/sunshine/config/apps.json.old /usr/local/sunshine/config/apps.json +fi + +# Update permissions on config files for Web Manager +if [ -f /usr/local/sunshine/config/apps.json ]; then + echo "chmod 666 /etc/sunshine/apps.json" + chmod 666 /usr/local/sunshine/config/apps.json +fi + +if [ -f /usr/local/sunshine/config/sunshine.conf ]; then + echo "chmod 666 /etc/sunshine/sunshine.conf" + chmod 666 /usr/local/sunshine/config/sunshine.conf +fi + +# Ensure Sunshine can grab images from KMS +path_to_setcap=$(which setcap) +if [ -x "$path_to_setcap" ] ; then + echo "$path_to_setcap cap_sys_admin+p /usr/bin/sunshine" + $path_to_setcap cap_sys_admin+p $(readlink -f /usr/bin/sunshine) +fi diff --git a/src_assets/linux/misc/preinst b/src_assets/linux/misc/preinst new file mode 100644 index 00000000..0522b5d6 --- /dev/null +++ b/src_assets/linux/misc/preinst @@ -0,0 +1,9 @@ +#!/bin/sh +#Store backup for old config files to prevent it from being overwritten +if [ -f /usr/local/sunshine/config/sunshine.conf ]; then + cp /usr/local/sunshine/config/sunshine.conf /usr/local/sunshine/config/sunshine.conf.old +fi + +if [ -f /usr/local/sunshine/config/apps.json ]; then + cp /usr/local/sunshine/config/apps.json /usr/local/sunshine/config/apps.json.old +fi diff --git a/assets/info.plist b/src_assets/macos/assets/Info.plist similarity index 100% rename from assets/info.plist rename to src_assets/macos/assets/Info.plist diff --git a/assets/apps_mac.json b/src_assets/macos/config/apps.json similarity index 100% rename from assets/apps_mac.json rename to src_assets/macos/config/apps.json diff --git a/assets/shaders/directx/ConvertUVPS.hlsl b/src_assets/windows/assets/shaders/directx/ConvertUVPS.hlsl similarity index 96% rename from assets/shaders/directx/ConvertUVPS.hlsl rename to src_assets/windows/assets/shaders/directx/ConvertUVPS.hlsl index 2b72cddf..f9bf69df 100644 --- a/assets/shaders/directx/ConvertUVPS.hlsl +++ b/src_assets/windows/assets/shaders/directx/ConvertUVPS.hlsl @@ -1,33 +1,33 @@ -Texture2D image : register(t0); - -SamplerState def_sampler : register(s0); - -struct FragTexWide { - float3 uuv : TEXCOORD0; -}; - -cbuffer ColorMatrix : register(b0) { - float4 color_vec_y; - float4 color_vec_u; - float4 color_vec_v; - float2 range_y; - float2 range_uv; -}; - -//-------------------------------------------------------------------------------------- -// Pixel Shader -//-------------------------------------------------------------------------------------- -float2 main_ps(FragTexWide input) : SV_Target -{ - float3 rgb_left = image.Sample(def_sampler, input.uuv.xz).rgb; - float3 rgb_right = image.Sample(def_sampler, input.uuv.yz).rgb; - float3 rgb = (rgb_left + rgb_right) * 0.5; - - float u = dot(color_vec_u.xyz, rgb) + color_vec_u.w; - float v = dot(color_vec_v.xyz, rgb) + color_vec_v.w; - - u = u * range_uv.x + range_uv.y; - v = v * range_uv.x + range_uv.y; - - return float2(u, v * 224.0f/256.0f + 0.0625); +Texture2D image : register(t0); + +SamplerState def_sampler : register(s0); + +struct FragTexWide { + float3 uuv : TEXCOORD0; +}; + +cbuffer ColorMatrix : register(b0) { + float4 color_vec_y; + float4 color_vec_u; + float4 color_vec_v; + float2 range_y; + float2 range_uv; +}; + +//-------------------------------------------------------------------------------------- +// Pixel Shader +//-------------------------------------------------------------------------------------- +float2 main_ps(FragTexWide input) : SV_Target +{ + float3 rgb_left = image.Sample(def_sampler, input.uuv.xz).rgb; + float3 rgb_right = image.Sample(def_sampler, input.uuv.yz).rgb; + float3 rgb = (rgb_left + rgb_right) * 0.5; + + float u = dot(color_vec_u.xyz, rgb) + color_vec_u.w; + float v = dot(color_vec_v.xyz, rgb) + color_vec_v.w; + + u = u * range_uv.x + range_uv.y; + v = v * range_uv.x + range_uv.y; + + return float2(u, v * 224.0f/256.0f + 0.0625); } \ No newline at end of file diff --git a/assets/shaders/directx/ConvertUVVS.hlsl b/src_assets/windows/assets/shaders/directx/ConvertUVVS.hlsl similarity index 96% rename from assets/shaders/directx/ConvertUVVS.hlsl rename to src_assets/windows/assets/shaders/directx/ConvertUVVS.hlsl index 66d97d43..77ff38d7 100644 --- a/assets/shaders/directx/ConvertUVVS.hlsl +++ b/src_assets/windows/assets/shaders/directx/ConvertUVVS.hlsl @@ -1,29 +1,29 @@ -struct VertTexPosWide { - float3 uuv : TEXCOORD; - float4 pos : SV_POSITION; -}; - -cbuffer info : register(b0) { - float width_i; -}; - -//-------------------------------------------------------------------------------------- -// Vertex Shader -//-------------------------------------------------------------------------------------- -VertTexPosWide main_vs(uint vI : SV_VERTEXID) -{ - float idHigh = float(vI >> 1); - float idLow = float(vI & uint(1)); - - float x = idHigh * 4.0 - 1.0; - float y = idLow * 4.0 - 1.0; - - float u_right = idHigh * 2.0; - float u_left = u_right - width_i; - float v = 1.0 - idLow * 2.0; - - VertTexPosWide vert_out; - vert_out.uuv = float3(u_left, u_right, v); - vert_out.pos = float4(x, y, 0.0, 1.0); - return vert_out; +struct VertTexPosWide { + float3 uuv : TEXCOORD; + float4 pos : SV_POSITION; +}; + +cbuffer info : register(b0) { + float width_i; +}; + +//-------------------------------------------------------------------------------------- +// Vertex Shader +//-------------------------------------------------------------------------------------- +VertTexPosWide main_vs(uint vI : SV_VERTEXID) +{ + float idHigh = float(vI >> 1); + float idLow = float(vI & uint(1)); + + float x = idHigh * 4.0 - 1.0; + float y = idLow * 4.0 - 1.0; + + float u_right = idHigh * 2.0; + float u_left = u_right - width_i; + float v = 1.0 - idLow * 2.0; + + VertTexPosWide vert_out; + vert_out.uuv = float3(u_left, u_right, v); + vert_out.pos = float4(x, y, 0.0, 1.0); + return vert_out; } \ No newline at end of file diff --git a/assets/shaders/directx/ConvertYPS.hlsl b/src_assets/windows/assets/shaders/directx/ConvertYPS.hlsl similarity index 95% rename from assets/shaders/directx/ConvertYPS.hlsl rename to src_assets/windows/assets/shaders/directx/ConvertYPS.hlsl index 386133c8..c38d19c8 100644 --- a/assets/shaders/directx/ConvertYPS.hlsl +++ b/src_assets/windows/assets/shaders/directx/ConvertYPS.hlsl @@ -1,25 +1,25 @@ -Texture2D image : register(t0); - -SamplerState def_sampler : register(s0); - -cbuffer ColorMatrix : register(b0) { - float4 color_vec_y; - float4 color_vec_u; - float4 color_vec_v; - float2 range_y; - float2 range_uv; -}; - -struct PS_INPUT -{ - float4 pos : SV_POSITION; - float2 tex : TEXCOORD; -}; - -float main_ps(PS_INPUT frag_in) : SV_Target -{ - float3 rgb = image.Sample(def_sampler, frag_in.tex, 0).rgb; - float y = dot(color_vec_y.xyz, rgb); - - return y * range_y.x + range_y.y; +Texture2D image : register(t0); + +SamplerState def_sampler : register(s0); + +cbuffer ColorMatrix : register(b0) { + float4 color_vec_y; + float4 color_vec_u; + float4 color_vec_v; + float2 range_y; + float2 range_uv; +}; + +struct PS_INPUT +{ + float4 pos : SV_POSITION; + float2 tex : TEXCOORD; +}; + +float main_ps(PS_INPUT frag_in) : SV_Target +{ + float3 rgb = image.Sample(def_sampler, frag_in.tex, 0).rgb; + float y = dot(color_vec_y.xyz, rgb); + + return y * range_y.x + range_y.y; } \ No newline at end of file diff --git a/assets/shaders/directx/ScenePS.hlsl b/src_assets/windows/assets/shaders/directx/ScenePS.hlsl similarity index 95% rename from assets/shaders/directx/ScenePS.hlsl rename to src_assets/windows/assets/shaders/directx/ScenePS.hlsl index aa601231..53a9bc8d 100644 --- a/assets/shaders/directx/ScenePS.hlsl +++ b/src_assets/windows/assets/shaders/directx/ScenePS.hlsl @@ -1,14 +1,14 @@ -Texture2D image : register(t0); - -SamplerState def_sampler : register(s0); - -struct PS_INPUT -{ - float4 pos : SV_POSITION; - float2 tex : TEXCOORD; -}; - -float4 main_ps(PS_INPUT frag_in) : SV_Target -{ - return image.Sample(def_sampler, frag_in.tex, 0); +Texture2D image : register(t0); + +SamplerState def_sampler : register(s0); + +struct PS_INPUT +{ + float4 pos : SV_POSITION; + float2 tex : TEXCOORD; +}; + +float4 main_ps(PS_INPUT frag_in) : SV_Target +{ + return image.Sample(def_sampler, frag_in.tex, 0); } \ No newline at end of file diff --git a/assets/shaders/directx/SceneVS.hlsl b/src_assets/windows/assets/shaders/directx/SceneVS.hlsl similarity index 95% rename from assets/shaders/directx/SceneVS.hlsl rename to src_assets/windows/assets/shaders/directx/SceneVS.hlsl index 51319ddb..3afaffc6 100644 --- a/assets/shaders/directx/SceneVS.hlsl +++ b/src_assets/windows/assets/shaders/directx/SceneVS.hlsl @@ -1,22 +1,22 @@ -struct PS_INPUT -{ - float4 pos : SV_POSITION; - float2 tex : TEXCOORD; -}; - -PS_INPUT main_vs(uint vI : SV_VERTEXID) -{ - float idHigh = float(vI >> 1); - float idLow = float(vI & uint(1)); - - float x = idHigh * 4.0 - 1.0; - float y = idLow * 4.0 - 1.0; - - float u = idHigh * 2.0; - float v = 1.0 - idLow * 2.0; - - PS_INPUT vert_out; - vert_out.pos = float4(x, y, 0.0, 1.0); - vert_out.tex = float2(u, v); - return vert_out; +struct PS_INPUT +{ + float4 pos : SV_POSITION; + float2 tex : TEXCOORD; +}; + +PS_INPUT main_vs(uint vI : SV_VERTEXID) +{ + float idHigh = float(vI >> 1); + float idLow = float(vI & uint(1)); + + float x = idHigh * 4.0 - 1.0; + float y = idLow * 4.0 - 1.0; + + float u = idHigh * 2.0; + float v = 1.0 - idLow * 2.0; + + PS_INPUT vert_out; + vert_out.pos = float4(x, y, 0.0, 1.0); + vert_out.tex = float2(u, v); + return vert_out; } \ No newline at end of file diff --git a/assets/apps_windows.json b/src_assets/windows/config/apps.json similarity index 100% rename from assets/apps_windows.json rename to src_assets/windows/config/apps.json diff --git a/sunshine.desktop.in b/sunshine.desktop.in index 195bade3..a345e5dc 100644 --- a/sunshine.desktop.in +++ b/sunshine.desktop.in @@ -1,9 +1,9 @@ [Desktop Entry] Type=Application -Name=sunshine +Name=@PROJECT_NAME@ Exec=sunshine Version=1.0 -Comment=Host for Moonlight Streaming Client +Comment=@PROJECT_DESCRIPTION@ Icon=sunshine Categories=Utility; Terminal=true diff --git a/sunshine.icns b/sunshine.icns new file mode 100644 index 00000000..0420582b Binary files /dev/null and b/sunshine.icns differ diff --git a/sunshine.service.in b/sunshine.service.in index c0c38289..157b3a4d 100644 --- a/sunshine.service.in +++ b/sunshine.service.in @@ -1,5 +1,5 @@ [Unit] -Description=Sunshine Gamestream Server for Moonlight +Description=@PROJECT_DESCRIPTION@ [Service] ExecStart=@SUNSHINE_EXECUTABLE_PATH@ diff --git a/sunshine/config.cpp b/sunshine/config.cpp index 6aaeb305..6dd3c1b2 100644 --- a/sunshine/config.cpp +++ b/sunshine/config.cpp @@ -20,7 +20,7 @@ using namespace std::literals; #define PRIVATE_KEY_FILE CA_DIR "/cakey.pem" #define CERTIFICATE_FILE CA_DIR "/cacert.pem" -#define APPS_JSON_PATH SUNSHINE_CONFIG_DIR "/" APPS_JSON +#define APPS_JSON_PATH SUNSHINE_CONFIG_DIR "/apps.json" namespace config { namespace nv { @@ -695,7 +695,7 @@ int apply_flags(const char *line) { void apply_config(std::unordered_map &&vars) { if(!fs::exists(stream.file_apps.c_str())) { - fs::copy_file(SUNSHINE_DEFAULT_DIR "/" APPS_JSON, stream.file_apps); + fs::copy_file(SUNSHINE_CONFIG_DIR "/apps.json", stream.file_apps); } for(auto &[name, val] : vars) { @@ -906,7 +906,7 @@ int parse(int argc, char *argv[]) { } if(!fs::exists(sunshine.config_file)) { - fs::copy_file(SUNSHINE_DEFAULT_DIR "/sunshine.conf", sunshine.config_file); + fs::copy_file(SUNSHINE_CONFIG_DIR "/sunshine.conf", sunshine.config_file); } auto vars = parse_config(read_file(sunshine.config_file.c_str()));