diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index c96ec16d..25157730 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,11 +1,8 @@ blank_issues_enabled: false contact_links: - - name: AUR Package Issue - url: https://aur.archlinux.org/packages/sunshine - about: AUR Package Issues should be discussed on the AUR - name: Github Discussions url: https://github.com/SunshineStream/Sunshine/discussions about: General discussion, support, feature requests and more! - name: Discord support - url: https://discord.com/invite/CGg5JxN + url: https://sunshinestream.github.io/discord_join about: Ask question about Sunshine in Discord diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 2562d68d..f8c1c8d9 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -52,6 +52,100 @@ jobs: 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_aur: + name: Linux AUR + runs-on: ubuntu-latest + needs: check_changelog + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup Dependencies Linux AUR + run: | + sudo apt-get update -y + sudo apt-get install -y \ + cmake + + - name: Configure PKGBUILD files + run: | + # variables for manifest + echo "aur_publish=false" >> $GITHUB_ENV + aur_pkg=sunshine-dev + sub_version="" + conflicts="'sunshine'" + provides="'sunshine'" + + branch=${GITHUB_HEAD_REF} + + # check the branch variable + if [ -z "$branch" ] + then + echo "This is a PUSH event" + commit=${{ github.sha }} + clone_url=${{ github.event.repository.clone_url }} + + if [[ ${{ github.ref == 'refs/heads/master' }} ]]; then + aur_pkg=sunshine-git + # conflicts="" + # provides="" + + echo "aur_publish=true" >> $GITHUB_ENV + elif [[ ${{ github.ref == 'refs/heads/nightly' }} ]]; then + aur_pkg=sunshine-nightly + sub_version=".r${commit}" + fi + else + echo "This is a PR event" + commit=${{ github.event.pull_request.head.sha }} + clone_url=${{ github.event.pull_request.head.repo.clone_url }} + + sub_version=".r${commit}" + fi + echo "Commit: ${commit}" + echo "Clone URL: ${clone_url}" + + echo "aur_pkg=${aur_pkg}" >> $GITHUB_ENV + + mkdir -p artifacts + mkdir -p build + + cd build + cmake -DSUNSHINE_CONFIGURE_AUR=ON -DSUNSHINE_AUR_PKG=${aur_pkg} -DSUNSHINE_SUB_VERSION=${sub_version} -DSUNSHINE_AUR_CONFLICTS=${conflicts} -DSUNSHINE_AUR_PROVIDES=${provides} -DGITHUB_CLONE_URL=${clone_url} -DGITHUB_COMMIT=${commit} -DSUNSHINE_CONFIGURE_ONLY=ON .. + cd .. + + mv ./build/PKGBUILD ./artifacts/ + + - name: Validate package + uses: hapakaien/archlinux-package-action@v2 + with: + path: artifacts + flags: '--syncdeps --noconfirm' + namcap: true + srcinfo: true + aur: true # workaround mirror problem + + - name: Upload Artifacts + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: sunshine-linux-aur + path: artifacts/ + + - name: Publish AUR package + if: ${{ env.aur_publish == 'true' }} + uses: KSXGitHub/github-actions-deploy-aur@v2.3.0 + with: + pkgname: ${{ env.aur_pkg }} + pkgbuild: ./artifacts/PKGBUILD + assets: | + ./artifacts/* + commit_username: ${{ secrets.AUR_USERNAME }} + commit_email: ${{ secrets.AUR_EMAIL }} + ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} + commit_message: Release ${{ needs.check_changelog.outputs.next_version }} + allow_empty_commits: false + build_linux_flatpak: name: Linux Flatpak runs-on: ubuntu-18.04 diff --git a/CMakeLists.txt b/CMakeLists.txt index d37fc1fd..02ddfadb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,12 +6,15 @@ project(Sunshine VERSION 0.14.0 ) option(SUNSHINE_CONFIGURE_APPIMAGE "Configure files required for AppImage." OFF) +option(SUNSHINE_CONFIGURE_AUR "Configure files required for AUR." OFF) option(SUNSHINE_CONFIGURE_FLATPAK "Configure files required for Flatpak." OFF) option(SUNSHINE_CONFIGURE_PORTFILE "Configure MacOS Portfile." OFF) option(SUNSHINE_CONFIGURE_ONLY "Configure special files only, then exit." OFF) if(${SUNSHINE_CONFIGURE_APPIMAGE}) configure_file(packaging/linux/sunshine.desktop sunshine.desktop @ONLY) +elseif(${SUNSHINE_CONFIGURE_AUR}) + configure_file(packaging/linux/aur/PKGBUILD PKGBUILD @ONLY) elseif(${SUNSHINE_CONFIGURE_FLATPAK}) configure_file(packaging/linux/flatpak/com.github.sunshinestream.sunshine.yml com.github.sunshinestream.sunshine.yml @ONLY) elseif(${SUNSHINE_CONFIGURE_PORTFILE}) @@ -591,7 +594,7 @@ if(UNIX AND NOT APPLE) 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(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/85-sunshine.rules" DESTINATION "${CMAKE_INSTALL_LIBDIR}/udev/rules.d") install(TARGETS sunshine RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service" DESTINATION "${CMAKE_INSTALL_LIBDIR}/systemd/user") diff --git a/README.rst b/README.rst index 24d0c161..bc2e01e0 100644 --- a/README.rst +++ b/README.rst @@ -60,6 +60,10 @@ Downloads :alt: GitHub Releases :target: https://github.com/SunshineStream/Sunshine/releases/latest +.. image:: https://img.shields.io/badge/dynamic/json?color=blue&label=AUR&style=for-the-badge&query=$.results.0.NumVotes&url=https%3A%2F%2Fgithub.com%2FSunshineStream%2Fservice-repo%2Freleases%2Fdownload%2Fdaily%2Faur_sunshine-git.json&logo=archlinux + :alt: AUR votes + :target: https://aur.archlinux.org/packages/sunshine-git + .. comment image:: https://img.shields.io/docker/pulls/sunshinestream/sunshine?style=for-the-badge&logo=docker :alt: Docker diff --git a/docs/source/about/advanced_usage.rst b/docs/source/about/advanced_usage.rst index e0903223..3aefa0ea 100644 --- a/docs/source/about/advanced_usage.rst +++ b/docs/source/about/advanced_usage.rst @@ -17,14 +17,16 @@ location by modifying the configuration file. .. table:: :widths: auto - ======= =========== - Value Description - ======= =========== - Docker /config/ - Linux /usr/local/sunshine/config/ - MacOS /usr/local/sunshine/config/ - Windows ./config/ - ======= =========== + ========= =========== + Value Description + ========= =========== + Docker /config/ + Linux-aur /usr/share/sunshine/config/ + Linux-deb /usr/local/sunshine/config/ + Linux-rpm /usr/local/sunshine/config/ + MacOS /usr/local/sunshine/config/ + Windows ./config/ + ========= =========== Example .. code-block:: bash diff --git a/docs/source/about/installation.rst b/docs/source/about/installation.rst index 9973b820..6609b429 100644 --- a/docs/source/about/installation.rst +++ b/docs/source/about/installation.rst @@ -44,6 +44,16 @@ According to AppImageLint the AppImage can run on the following distros. #. Download ``sunshine-appimage.zip`` and extract the contents to your home directory. +AUR Package +^^^^^^^^^^^ +#. Open terminal and run the following code. + + .. code-block:: bash + + git clone https://aur.archlinux.org/sunshine-git.git + cd sunshine-git + makepkg -fi + Debian Package ^^^^^^^^^^^^^^ .. image:: https://img.shields.io/github/issues/sunshinestream/sunshine/pkg:deb?logo=github&style=for-the-badge diff --git a/docs/source/about/third_party_packages.rst b/docs/source/about/third_party_packages.rst index 7877e09c..99c7e96c 100644 --- a/docs/source/about/third_party_packages.rst +++ b/docs/source/about/third_party_packages.rst @@ -8,17 +8,14 @@ Third Party Packages AUR (Arch Linux User Repository) -------------------------------- -.. image:: https://img.shields.io/aur/version/sunshine?style=for-the-badge&logo=archlinux +.. image:: https://img.shields.io/badge/dynamic/json?color=orange&label=AUR&style=for-the-badge&prefix=v&query=$.results.0.Version&url=https%3A%2F%2Fgithub.com%2FSunshineStream%2Fservice-repo%2Freleases%2Fdownload%2Fdaily%2Faur_sunshine.json&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 - -.. image:: https://img.shields.io/aur/votes/sunshine?style=for-the-badge&logo=archlinux +.. image:: https://img.shields.io/badge/dynamic/json?color=yellowgreen&label=votes&style=for-the-badge&query=$.results.0.NumVotes&url=https%3A%2F%2Fgithub.com%2FSunshineStream%2Fservice-repo%2Freleases%2Fdownload%2Fdaily%2Faur_sunshine.json&logo=archlinux :alt: AUR votes -.. image:: https://img.shields.io/aur/maintainer/sunshine?style=for-the-badge&logo=archlinux +.. image:: https://img.shields.io/badge/dynamic/json?color=blue&label=maintainer&style=for-the-badge&query=$.results.0.Maintainer&url=https%3A%2F%2Fgithub.com%2FSunshineStream%2Fservice-repo%2Freleases%2Fdownload%2Fdaily%2Faur_sunshine.json&logo=archlinux :alt: AUR maintainer Chocolatey diff --git a/docs/source/about/usage.rst b/docs/source/about/usage.rst index 8ae0287c..a591cca5 100644 --- a/docs/source/about/usage.rst +++ b/docs/source/about/usage.rst @@ -68,7 +68,7 @@ Sunshine needs access to `uinput` to create mouse and gamepad events. #. Create `udev` rules. .. code-block:: bash - sudo nano /etc/udev/rules.d/85-sunshine-input.rules + sudo nano /etc/udev/rules.d/85-sunshine.rules Input the following contents. @@ -102,6 +102,7 @@ Sunshine needs access to `uinput` to create mouse and gamepad events. ======== ============================================== =============== package ExecStart Auto Configured ======== ============================================== =============== + aur /usr/bin/sunshine ✔ deb /usr/bin/sunshine ✔ rpm /usr/bin/sunshine ✔ AppImage ~/sunshine.AppImage ✖ diff --git a/packaging/linux/aur/PKGBUILD b/packaging/linux/aur/PKGBUILD new file mode 100644 index 00000000..be0e38fe --- /dev/null +++ b/packaging/linux/aur/PKGBUILD @@ -0,0 +1,55 @@ +# Edit on github: https://github.com/SunshineStream/Sunshine/tree/nightly/packaging/linux/aur/PKGBUILD +# Reference: https://wiki.archlinux.org/title/PKGBUILD + +pkgname=@SUNSHINE_AUR_PKG@ +pkgver=@PROJECT_VERSION@@SUNSHINE_SUB_VERSION@ +pkgrel=1 +pkgdesc="@PROJECT_DESCRIPTION@" +arch=('x86_64' 'i686') +url=@PROJECT_HOMEPAGE_URL@ +license=('GPL3') + +depends=('avahi' 'boost-libs' 'ffmpeg4.4' 'libevdev' 'libpulse' 'libx11' 'libxcb' 'libxfixes' 'libxrandr' 'libxtst' 'openssl' 'opus' 'udev') +makedepends=('boost' 'cmake' 'git' 'make') +optdepends=('cuda' 'libcap' 'libdrm') + +provides=(@SUNSHINE_AUR_PROVIDES@) +conflicts=(@SUNSHINE_AUR_CONFLICTS@) + +source=("$pkgname::git+@GITHUB_CLONE_URL@#commit=@GITHUB_COMMIT@") +sha256sums=('SKIP') + +prepare() { + cd "$pkgname" + git submodule update --recursive --init +} + +build() { + export CFLAGS="${CFLAGS/-Werror=format-security/}" + export CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" + + cmake \ + -S "$pkgname" \ + -B build \ + -Wno-dev \ + -D SUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine \ + -D CMAKE_INSTALL_PREFIX="/usr" \ + -D SUNSHINE_ASSETS_DIR="share/sunshine/assets" \ + -D SUNSHINE_CONFIG_DIR="share/sunshine/config" \ + -D LIBAVCODEC_INCLUDE_DIR=/usr/include/ffmpeg4.4 \ + -D LIBAVCODEC_LIBRARIES=/usr/lib/ffmpeg4.4/libavcodec.so \ + -D LIBAVDEVICE_INCLUDE_DIR=/usr/include/ffmpeg4.4 \ + -D LIBAVDEVICE_LIBRARIES=/usr/lib/ffmpeg4.4/libavdevice.so \ + -D LIBAVFORMAT_INCLUDE_DIR=/usr/include/ffmpeg4.4 \ + -D LIBAVFORMAT_LIBRARIES=/usr/lib/ffmpeg4.4/libavformat.so \ + -D LIBAVUTIL_INCLUDE_DIR=/usr/include/ffmpeg4.4 \ + -D LIBAVUTIL_LIBRARIES=/usr/lib/ffmpeg4.4/libavutil.so \ + -D LIBSWSCALE_INCLUDE_DIR=/usr/include/ffmpeg4.4 \ + -D LIBSWSCALE_LIBRARIES=/usr/lib/ffmpeg4.4/libswscale.so + + make -C build +} + +package() { + make -C build install DESTDIR="$pkgdir" +} diff --git a/src_assets/linux/misc/85-sunshine-rules.rules b/src_assets/linux/misc/85-sunshine.rules similarity index 100% rename from src_assets/linux/misc/85-sunshine-rules.rules rename to src_assets/linux/misc/85-sunshine.rules