From 1cf0360520f10765823c5fadd7cc2135028f238e Mon Sep 17 00:00:00 2001
From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
Date: Wed, 15 Jun 2022 21:50:02 -0400
Subject: [PATCH 1/5] Initial flatpak packaging
- adds `com.github.sunshinestream.sunshine.yml`
- moves and renames `sunshine.desktop`
- moves and renames `Portfile`
- adds cmake options for configuration only
Co-Authored-By: istori1 <107304850+istori1@users.noreply.github.com>
---
.github/workflows/CI.yml | 83 ++++++-
CMakeLists.txt | 19 +-
.../com.github.sunshinestream.sunshine.yml | 212 ++++++++++++++++++
.../linux/sunshine.desktop | 0
Portfile.in => packaging/macos/Portfile | 0
5 files changed, 306 insertions(+), 8 deletions(-)
create mode 100644 packaging/linux/flatpak/com.github.sunshinestream.sunshine.yml
rename sunshine.desktop.in => packaging/linux/sunshine.desktop (100%)
rename Portfile.in => packaging/macos/Portfile (100%)
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index 18d7e89c..8d9e7ad5 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -52,6 +52,82 @@ 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_flatpak:
+ name: Linux Flatpak
+ runs-on: ubuntu-18.04
+ needs: check_changelog
+
+ steps:
+ - name: Maximize build space
+ uses: easimon/maximize-build-space@master
+ with:
+ root-reserve-mb: 2048
+ swap-size-mb: 8192
+ remove-dotnet: 'true'
+ remove-android: 'true'
+ remove-haskell: 'true'
+
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: Setup Dependencies Linux Flatpak
+ run: |
+ sudo add-apt-repository ppa:flatpak/stable -y
+ sudo apt-get update -y
+ sudo apt-get install -y \
+ cmake \
+ flatpak \
+ flatpak-builder
+ sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
+ sudo flatpak install flathub org.freedesktop.Platform//21.08 org.freedesktop.Sdk//21.08 -y
+
+ - name: Configure Flatpak Manifest
+ run: |
+ # variables for manifest
+ 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 -p build
+ mkdir -p artifacts
+
+ cd build
+ cmake -DGITHUB_OWNER=${owner} -DGITHUB_REPO=${repo} -DGITHUB_BRANCH=${branch} -DSUNSHINE_CONFIGURE_FLATPAK=ON -DSUNSHINE_CONFIGURE_ONLY=ON ..
+
+ - name: Build Linux Flatpak
+ working-directory: build
+ run: |
+ sudo flatpak-builder build-dir com.github.sunshinestream.sunshine.yml
+ sudo flatpak-builder --repo=repo --force-clean build-dir com.github.sunshinestream.sunshine.yml
+ sudo flatpak build-bundle ./repo ../artifacts/sunshine.flatpak com.github.sunshinestream.sunshine
+
+ - name: Upload Artifacts
+ uses: actions/upload-artifact@v3
+ with:
+ name: sunshine-linux-flatpak
+ 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_linux:
name: Linux
runs-on: ubuntu-20.04
@@ -64,16 +140,19 @@ jobs:
CMAKE_INSTALL_PREFIX: ''
SUNSHINE_ASSETS_DIR: '/usr/local/sunshine/assets'
SUNSHINE_CONFIG_DIR: '/usr/local/sunshine/config'
+ EXTRA_ARGS: ''
- type: appimage
CMAKE_INSTALL_PREFIX: '/usr'
SUNSHINE_ASSETS_DIR: 'sunshine.AppImage.config'
SUNSHINE_CONFIG_DIR: 'sunshine.AppImage.home'
+ EXTRA_ARGS: '-DSUNSHINE_CONFIGURE_APPIMAGE=ON'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
+
- name: Setup Dependencies Linux
run: |
sudo add-apt-repository ppa:savoury1/ffmpeg4 -y
@@ -144,7 +223,7 @@ jobs:
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 ..
+ 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 ${{ matrix.EXTRA_ARGS }} ..
make -j ${nproc}
- name: Package Linux - CPACK
@@ -291,7 +370,7 @@ jobs:
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} ..
+ 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} -DSUNSHINE_CONFIGURE_PORTFILE=ON ..
make -j ${nproc}
- name: Package MacOS
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 44f24e7d..72386de6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,19 @@ project(Sunshine VERSION 0.14.0
HOMEPAGE_URL "https://sunshinestream.github.io"
)
+if(${SUNSHINE_CONFIGURE_APPIMAGE})
+ configure_file(packaging/linux/sunshine.desktop sunshine.desktop @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})
+ configure_file(packaging/macos/Portfile Portfile @ONLY)
+endif()
+
+# return if configure only is set
+if(${SUNSHINE_CONFIGURE_ONLY})
+ return()
+endif()
+
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(SUNSHINE_SOURCE_ASSETS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src_assets")
@@ -562,9 +575,6 @@ if(APPLE) # TODO: test
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}")
@@ -587,9 +597,6 @@ if(UNIX AND NOT APPLE)
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/packaging/linux/flatpak/com.github.sunshinestream.sunshine.yml b/packaging/linux/flatpak/com.github.sunshinestream.sunshine.yml
new file mode 100644
index 00000000..228d14d5
--- /dev/null
+++ b/packaging/linux/flatpak/com.github.sunshinestream.sunshine.yml
@@ -0,0 +1,212 @@
+app-id: com.github.sunshinestream.sunshine
+runtime: org.freedesktop.Platform
+runtime-version: "21.08"
+sdk: org.freedesktop.Sdk
+command: sunshine
+separate-locales: false
+finish-args:
+ - --share=ipc
+ - --socket=x11
+ - --socket=wayland
+ - --socket=pulseaudio
+ - --share=network
+ - --device=all
+ - --persist=.
+ - --system-talk-name=org.freedesktop.Avahi
+ - --env=PULSE_PROP_media.category=Manager
+
+cleanup:
+ - /include
+ - /lib/cmake
+ - /lib/pkgconfig
+ - /lib/*.la
+ - /lib/*.a
+ - /share
+
+modules:
+# - name: cuda
+# buildsystem: simple
+# only-arches:
+# - x86_64
+# - aarch64
+# cleanup:
+# - '*'
+# build-commands:
+# - chmod u+x ./cuda.run
+# - ./cuda.run --silent --toolkit --toolkitpath=/app --no-opengl-libs --no-man-page --no-drm
+# - rm ./cuda.run
+# - rm -r /app/nsight-systems-2021.3.2
+# sources:
+# - type: file
+# only-arches:
+# - x86_64
+# url: https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux.run
+# sha256: bbd87ca0e913f837454a796367473513cddef555082e4d86ed9a38659cc81f0a
+# dest-filename: cuda.run
+# - type: file
+# only-arches:
+# - aarch64
+# url: https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux_sbsa.run
+# sha256: f2c4a52e06329606c8dfb7c5ea3f4cb4c0b28f9d3fdffeeb734fcc98daf580d8
+# dest-filename: cuda.run
+
+ - name: boost
+ buildsystem: simple
+ build-commands:
+ - ./bootstrap.sh --prefix=/app --with-libraries=system,thread,log
+ - ./b2 install variant=release link=static,shared runtime-link=shared cxxflags="$CXXFLAGS" linkflags="$LDFLAGS" -j $FLATPAK_BUILDER_N_JOBS
+ sources:
+ - type: archive
+ url: https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.bz2
+ sha256: 475d589d51a7f8b3ba2ba4eda022b170e562ca3b760ee922c146b6c65856ef39
+
+ - name: ffmpeg
+ config-opts:
+ - --enable-gpl
+ - --disable-static
+ - --enable-shared
+ - --disable-doc
+ - --disable-programs
+ - --disable-decoders
+ - --enable-libfontconfig
+ - --enable-libfreetype
+ - --enable-libopus
+ - --enable-libvorbis
+ - --enable-libvpx
+ - --enable-libx264
+ - --enable-libx265
+ - --enable-nvenc
+ - --enable-encoder=h264_v4l2m2m
+ - --enable-encoder=hevc_v4l2m2m
+ # - --enable-nonfree
+ # - --enable-cuda-nvcc
+ # - --enable-libnpp
+ # - --extra-cflags=-I/app/include
+ # - --extra-ldflags=-L/app/lib64
+ cleanup:
+ - /share/ffmpeg/examples
+ sources:
+ - type: archive
+ url: https://ffmpeg.org/releases/ffmpeg-4.4.2.tar.xz
+ sha256: af419a7f88adbc56c758ab19b4c708afbcae15ef09606b82b855291f6a6faa93
+ modules:
+ - name: vmaf
+ buildsystem: meson
+ subdir: libvmaf
+ cleanup:
+ - /bin
+ sources:
+ - type: archive
+ url: https://github.com/Netflix/vmaf/archive/refs/tags/v2.3.1.tar.gz
+ sha256: 8d60b1ddab043ada25ff11ced821da6e0c37fd7730dd81c24f1fc12be7293ef2
+ - name: x264
+ config-opts:
+ - --disable-cli
+ - --enable-shared
+ sources:
+ - type: archive
+ url: https://code.videolan.org/videolan/x264/-/archive/stable/x264-stable.tar.bz2
+ sha256: 8fedb184045722d8cc39353099373a5b7350171d0964d01fff8eced21b959b29
+ - name: x265
+ buildsystem: cmake-ninja
+ builddir: true
+ subdir: source
+ config-opts:
+ - -DCMAKE_BUILD_TYPE=RelWithDebInfo
+ - -DENABLE_CLI=OFF
+ sources:
+ - type: archive
+ url: https://bitbucket.org/multicoreware/x265_git/downloads/x265_3.5.tar.gz
+ sha256: e70a3335cacacbba0b3a20ec6fecd6783932288ebc8163ad74bcc9606477cae8
+ - name: nv-codec-headers
+ no-autogen: true
+ make-install-args:
+ - PREFIX=/app
+ cleanup:
+ - '*'
+ sources:
+ - type: archive
+ url: https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n11.1.5.1.tar.gz
+ sha256: d095fbd56aa93772471a323be0ebe65504a0f43f06c76a30b6d25da77b06ae9c
+
+ - name: avahi
+ cleanup:
+ - /bin
+ - /lib/avahi
+ - /share/applications/*.desktop
+ - /share/avahi
+ config-opts:
+ - --with-distro=none
+ - --disable-gobject
+ - --disable-introspection
+ - --disable-qt3
+ - --disable-qt4
+ - --disable-qt5
+ - --disable-gtk
+ - --disable-core-docs
+ - --disable-manpages
+ - --disable-libdaemon
+ - --disable-python
+ - --disable-pygobject
+ - --disable-mono
+ - --disable-monodoc
+ - --disable-autoipd
+ - --disable-doxygen-doc
+ - --disable-doxygen-dot
+ - --disable-doxygen-xml
+ - --disable-doxygen-html
+ - --disable-manpages
+ - --disable-xmltoman
+ sources:
+ - type: archive
+ url: https://avahi.org/download/avahi-0.8.tar.gz
+ sha256: 060309d7a333d38d951bc27598c677af1796934dbd98e1024e7ad8de798fedda
+ modules:
+ - name: libevent
+ cleanup:
+ - /bin
+ sources:
+ - type: archive
+ url: https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz
+ sha256: 92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb
+
+ - name: libevdev
+ buildsystem: meson
+ cleanup:
+ - /bin
+ sources:
+ - type: archive
+ url: https://www.freedesktop.org/software/libevdev/libevdev-1.12.1.tar.xz
+ sha256: 1dbba41bc516d3ca7abc0da5b862efe3ea8a7018fa6e9b97ce9d39401b22426c
+ modules:
+ - name: libcheck
+ buildsystem: cmake
+ cleanup:
+ - /bin
+ sources:
+ - type: archive
+ url: https://github.com/libcheck/check/archive/refs/tags/0.15.2.tar.gz
+ sha256: 998d355294bb94072f40584272cf4424571c396c631620ce463f6ea97aa67d2e
+
+ - name: sunshine
+ buildsystem: cmake
+ no-make-install: false
+ build-options:
+ cxxflags: -I/app/include/libevdev-1.0
+ config-opts:
+ - -DCMAKE_BUILD_TYPE=Release
+ - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/app/bin
+ - -DCMAKE_INSTALL_PREFIX=''
+ - -DSUNSHINE_CONFIG_DIR=/app/config
+ - -DSUNSHINE_ASSETS_DIR=/app/assets
+ - -DSUNSHINE_EXECUTABLE_PATH=/app/bin/sunshine
+ - -DSUNSHINE_ENABLE_WAYLAND=ON
+ - -DSUNSHINE_ENABLE_X11=ON
+ - -DSUNSHINE_ENABLE_DRM=ON
+ - -DSUNSHINE_ENABLE_CUDA=ON
+ post-install:
+ - cp -f ./src_assets/linux/misc/85-sunshine-rules.rules /etc/udev/rules.d/
+ sources:
+ - type: git
+ url: https://github.com/@GITHUB_OWNER@/@GITHUB_REPO@.git
+ branch: @GITHUB_BRANCH@
diff --git a/sunshine.desktop.in b/packaging/linux/sunshine.desktop
similarity index 100%
rename from sunshine.desktop.in
rename to packaging/linux/sunshine.desktop
diff --git a/Portfile.in b/packaging/macos/Portfile
similarity index 100%
rename from Portfile.in
rename to packaging/macos/Portfile
From bd51a7d5fa7059863774b910fa39cd2d9327be1e Mon Sep 17 00:00:00 2001
From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
Date: Fri, 17 Jun 2022 15:30:56 -0400
Subject: [PATCH 2/5] Refactor assets and config directories
---
.github/workflows/CI.yml | 8 ++++----
CMakeLists.txt | 7 +++++++
.../linux/flatpak/com.github.sunshinestream.sunshine.yml | 6 +++---
3 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index 8d9e7ad5..a4d67abe 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -137,9 +137,9 @@ jobs:
matrix:
include: # package these differently
- type: cpack
- CMAKE_INSTALL_PREFIX: ''
- SUNSHINE_ASSETS_DIR: '/usr/local/sunshine/assets'
- SUNSHINE_CONFIG_DIR: '/usr/local/sunshine/config'
+ CMAKE_INSTALL_PREFIX: '/usr/local/sunshine'
+ SUNSHINE_ASSETS_DIR: 'assets'
+ SUNSHINE_CONFIG_DIR: 'config'
EXTRA_ARGS: ''
- type: appimage
CMAKE_INSTALL_PREFIX: '/usr'
@@ -370,7 +370,7 @@ jobs:
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} -DSUNSHINE_CONFIGURE_PORTFILE=ON ..
+ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/sunshine -DSUNSHINE_ASSETS_DIR=assets -DSUNSHINE_CONFIG_DIR=config -DGITHUB_OWNER=${owner} -DGITHUB_REPO=${repo} -DGITHUB_BRANCH=${branch} -DSUNSHINE_CONFIGURE_PORTFILE=ON ..
make -j ${nproc}
- name: Package MacOS
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 72386de6..0e083567 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -414,6 +414,13 @@ if(NOT SUNSHINE_CONFIG_DIR)
set(SUNSHINE_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/config")
endif()
+if(CMAKE_INSTALL_PREFIX)
+ if(NOT ${SUNSHINE_CONFIGURE_APPIMAGE})
+ set(SUNSHINE_ASSETS_DIR "${CMAKE_INSTALL_PREFIX}/${SUNSHINE_ASSETS_DIR}")
+ set(SUNSHINE_CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/${SUNSHINE_CONFIG_DIR}")
+ endif()
+endif()
+
list(APPEND CBS_EXTERNAL_LIBRARIES
cbs)
diff --git a/packaging/linux/flatpak/com.github.sunshinestream.sunshine.yml b/packaging/linux/flatpak/com.github.sunshinestream.sunshine.yml
index 228d14d5..7d6b92fe 100644
--- a/packaging/linux/flatpak/com.github.sunshinestream.sunshine.yml
+++ b/packaging/linux/flatpak/com.github.sunshinestream.sunshine.yml
@@ -196,9 +196,9 @@ modules:
config-opts:
- -DCMAKE_BUILD_TYPE=Release
- -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/app/bin
- - -DCMAKE_INSTALL_PREFIX=''
- - -DSUNSHINE_CONFIG_DIR=/app/config
- - -DSUNSHINE_ASSETS_DIR=/app/assets
+ - -DCMAKE_INSTALL_PREFIX='/app'
+ - -DSUNSHINE_ASSETS_DIR=assets
+ - -DSUNSHINE_CONFIG_DIR=config
- -DSUNSHINE_EXECUTABLE_PATH=/app/bin/sunshine
- -DSUNSHINE_ENABLE_WAYLAND=ON
- -DSUNSHINE_ENABLE_X11=ON
From 2a13697fefe4e4ec3d68e6d137d0a98b56d0de1a Mon Sep 17 00:00:00 2001
From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
Date: Fri, 17 Jun 2022 16:30:59 -0400
Subject: [PATCH 3/5] Replace hardcoded paths for unix and...
- Add cache for flatpak job
Co-Authored-By: istori1 <107304850+istori1@users.noreply.github.com>
---
.github/workflows/CI.yml | 14 ++++++++++----
CMakeLists.txt | 19 +++++++++++--------
.../com.github.sunshinestream.sunshine.yml | 6 ++----
3 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index a4d67abe..34d1c7c3 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -67,6 +67,12 @@ jobs:
remove-android: 'true'
remove-haskell: 'true'
+ - name: Cache flatpak-builder
+ uses: actions/cache@v3
+ with:
+ path: ./build/.flatpak-builder
+ key: ${{ runner.os }}-flatpak-builder
+
- name: Checkout
uses: actions/checkout@v3
@@ -137,9 +143,9 @@ jobs:
matrix:
include: # package these differently
- type: cpack
- CMAKE_INSTALL_PREFIX: '/usr/local/sunshine'
- SUNSHINE_ASSETS_DIR: 'assets'
- SUNSHINE_CONFIG_DIR: 'config'
+ CMAKE_INSTALL_PREFIX: '/usr'
+ SUNSHINE_ASSETS_DIR: 'local/sunshine/assets'
+ SUNSHINE_CONFIG_DIR: 'local/sunshine/config'
EXTRA_ARGS: ''
- type: appimage
CMAKE_INSTALL_PREFIX: '/usr'
@@ -370,7 +376,7 @@ jobs:
mkdir build
cd build
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/sunshine -DSUNSHINE_ASSETS_DIR=assets -DSUNSHINE_CONFIG_DIR=config -DGITHUB_OWNER=${owner} -DGITHUB_REPO=${repo} -DGITHUB_BRANCH=${branch} -DSUNSHINE_CONFIGURE_PORTFILE=ON ..
+ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DSUNSHINE_ASSETS_DIR=local/sunshine/assets -DSUNSHINE_CONFIG_DIR=local/sunshine/config -DGITHUB_OWNER=${owner} -DGITHUB_REPO=${repo} -DGITHUB_BRANCH=${branch} -DSUNSHINE_CONFIGURE_PORTFILE=ON ..
make -j ${nproc}
- name: Package MacOS
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0e083567..d37fc1fd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,11 @@ project(Sunshine VERSION 0.14.0
HOMEPAGE_URL "https://sunshinestream.github.io"
)
+option(SUNSHINE_CONFIGURE_APPIMAGE "Configure files required for AppImage." 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_FLATPAK})
@@ -414,11 +419,9 @@ if(NOT SUNSHINE_CONFIG_DIR)
set(SUNSHINE_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/config")
endif()
-if(CMAKE_INSTALL_PREFIX)
- if(NOT ${SUNSHINE_CONFIGURE_APPIMAGE})
- set(SUNSHINE_ASSETS_DIR "${CMAKE_INSTALL_PREFIX}/${SUNSHINE_ASSETS_DIR}")
- set(SUNSHINE_CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/${SUNSHINE_CONFIG_DIR}")
- endif()
+if(UNIX AND CMAKE_INSTALL_PREFIX AND NOT ${SUNSHINE_CONFIGURE_APPIMAGE})
+ set(SUNSHINE_ASSETS_DIR "${CMAKE_INSTALL_PREFIX}/${SUNSHINE_ASSETS_DIR}")
+ set(SUNSHINE_CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/${SUNSHINE_CONFIG_DIR}")
endif()
list(APPEND CBS_EXTERNAL_LIBRARIES
@@ -435,7 +438,7 @@ list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
${OPENSSL_LIBRARIES}
${PLATFORM_LIBRARIES})
-if (NOT WIN32)
+if(NOT WIN32)
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES Boost::log)
endif()
@@ -590,8 +593,8 @@ if(UNIX AND NOT APPLE)
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")
+ install(TARGETS sunshine RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service" DESTINATION "${CMAKE_INSTALL_LIBDIR}/systemd/user")
# Pre and post install
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
diff --git a/packaging/linux/flatpak/com.github.sunshinestream.sunshine.yml b/packaging/linux/flatpak/com.github.sunshinestream.sunshine.yml
index 7d6b92fe..08e47999 100644
--- a/packaging/linux/flatpak/com.github.sunshinestream.sunshine.yml
+++ b/packaging/linux/flatpak/com.github.sunshinestream.sunshine.yml
@@ -191,11 +191,11 @@ modules:
- name: sunshine
buildsystem: cmake
no-make-install: false
+ builddir: true
build-options:
- cxxflags: -I/app/include/libevdev-1.0
+ cxxflags: -I${C_INCLUDE_PATH}/libevdev-1.0
config-opts:
- -DCMAKE_BUILD_TYPE=Release
- - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/app/bin
- -DCMAKE_INSTALL_PREFIX='/app'
- -DSUNSHINE_ASSETS_DIR=assets
- -DSUNSHINE_CONFIG_DIR=config
@@ -204,8 +204,6 @@ modules:
- -DSUNSHINE_ENABLE_X11=ON
- -DSUNSHINE_ENABLE_DRM=ON
- -DSUNSHINE_ENABLE_CUDA=ON
- post-install:
- - cp -f ./src_assets/linux/misc/85-sunshine-rules.rules /etc/udev/rules.d/
sources:
- type: git
url: https://github.com/@GITHUB_OWNER@/@GITHUB_REPO@.git
From 850926019436dcf21e8526db0adad3f1b5d75000 Mon Sep 17 00:00:00 2001
From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
Date: Fri, 17 Jun 2022 19:04:43 -0400
Subject: [PATCH 4/5] Fix branch for PUSH events
- This partially fixes #194
---
.github/workflows/CI.yml | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index 34d1c7c3..b25b7353 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -93,24 +93,30 @@ jobs:
owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]' )
repo=$(echo ${GITHUB_REPOSITORY#*/} | tr '[:upper:]' '[:lower:]' )
branch=${GITHUB_HEAD_REF}
+ commit=${{ github.event.pull_request.head.sha }}
# check the branch variable
if [ -z "$branch" ]
then
echo "This is a PUSH event"
- branch=${GITHUB_BASE_REF}
+ branch=branch=${{ github.ref_name }}
+ commit=${{ github.sha }}
else
echo "This is a PR event"
fi
echo "Owner: ${owner}"
echo "Repo: ${repo}"
echo "Branch: ${branch}"
+ echo "Commit: ${commit}"
mkdir -p build
mkdir -p artifacts
cd build
cmake -DGITHUB_OWNER=${owner} -DGITHUB_REPO=${repo} -DGITHUB_BRANCH=${branch} -DSUNSHINE_CONFIGURE_FLATPAK=ON -DSUNSHINE_CONFIGURE_ONLY=ON ..
+
+ # add the commit
+ echo " commit: ${commit}" >> ./com.github.sunshinestream.sunshine.yml
- name: Build Linux Flatpak
working-directory: build
@@ -361,18 +367,21 @@ jobs:
owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]' )
repo=$(echo ${GITHUB_REPOSITORY#*/} | tr '[:upper:]' '[:lower:]' )
branch=${GITHUB_HEAD_REF}
+ commit=${{ github.event.pull_request.head.sha }}
# check the branch variable
if [ -z "$branch" ]
then
echo "This is a PUSH event"
- branch=${GITHUB_BASE_REF}
+ branch=branch=${{ github.ref_name }}
+ commit=${{ github.sha }}
else
echo "This is a PR event"
fi
echo "Owner: ${owner}"
echo "Repo: ${repo}"
echo "Branch: ${branch}"
+ echo "Commit: ${commit}"
mkdir build
cd build
From 840013ec78bc670ca9d4b1b9da747a6f8265d671 Mon Sep 17 00:00:00 2001
From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
Date: Fri, 17 Jun 2022 20:05:51 -0400
Subject: [PATCH 5/5] Update documentation for Flatpak
---
.github/workflows/CI.yml | 2 +-
README.rst | 1 +
docs/source/about/installation.rst | 36 +++++++--
docs/source/about/usage.rst | 121 +++++++++++++++--------------
docs/source/index.rst | 2 -
5 files changed, 93 insertions(+), 69 deletions(-)
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index b25b7353..2562d68d 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -70,7 +70,7 @@ jobs:
- name: Cache flatpak-builder
uses: actions/cache@v3
with:
- path: ./build/.flatpak-builder
+ path: ./build/.flatpak-builder/build
key: ${{ runner.os }}-flatpak-builder
- name: Checkout
diff --git a/README.rst b/README.rst
index 8fb29b6b..24d0c161 100644
--- a/README.rst
+++ b/README.rst
@@ -2,6 +2,7 @@
Overview
========
+SunshineStream has the full documentation hosted on `Read the Docs `_.
About
-----
diff --git a/docs/source/about/installation.rst b/docs/source/about/installation.rst
index 2176206a..9973b820 100644
--- a/docs/source/about/installation.rst
+++ b/docs/source/about/installation.rst
@@ -28,7 +28,7 @@ AppImage
.. image:: https://img.shields.io/github/issues/sunshinestream/sunshine/pkg:appimage?logo=github&style=for-the-badge
:alt: GitHub issues by-label
-The current known compatibility of the AppImage is shown below.
+According to AppImageLint the AppImage can run on the following distros.
- [✖] Debian oldstable (buster)
- [✔] Debian stable (bullseye)
@@ -42,11 +42,11 @@ The current known compatibility of the AppImage is shown below.
- [✖] Ubuntu trusty
- [✖] CentOS 7
-#. Download and extract ``sunshine-appimage.zip`` to your home directory.
+#. Download ``sunshine-appimage.zip`` and extract the contents to your home directory.
-Debian Packages
-^^^^^^^^^^^^^^^
-.. image:: https://img.shields.io/github/issues/sunshinestream/sunshine/os:linux:debian?logo=github&style=for-the-badge
+Debian Package
+^^^^^^^^^^^^^^
+.. image:: https://img.shields.io/github/issues/sunshinestream/sunshine/pkg:deb?logo=github&style=for-the-badge
:alt: GitHub issues by-label
#. Download ``sunshine.deb`` and run the following code.
@@ -57,9 +57,29 @@ Debian Packages
.. 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
+Flatpak Package
+^^^^^^^^^^^^^^^
+.. image:: https://img.shields.io/github/issues/sunshinestream/sunshine/pkg:flatpak?logo=github&style=for-the-badge
+ :alt: GitHub issues by-label
+
+.. Todo:: This package needs to have CUDA added.
+
+#. Install `Flatpak `_ as required.
+#. Download ``sunshine.flatpak`` and run the following code.
+
+ System level (recommended)
+ .. code-block:: bash
+
+ flatpak install --system sunshine.flatpak
+
+ User level
+ .. code-block:: bash
+
+ flatpak install --user sunshine.flatpak
+
+RPM Package
+^^^^^^^^^^^
+.. image:: https://img.shields.io/github/issues/sunshinestream/sunshine/pkg:rpm?logo=github&style=for-the-badge
:alt: GitHub issues by-label
#. Add `rpmfusion` repositories by running the following code.
diff --git a/docs/source/about/usage.rst b/docs/source/about/usage.rst
index 79d285f9..8ae0287c 100644
--- a/docs/source/about/usage.rst
+++ b/docs/source/about/usage.rst
@@ -33,7 +33,7 @@ Usage
#. When Moonlight request you insert the correct pin on sunshine:
- Login to the web ui
- - Go to "PIN" in the Header
+ - Go to "PIN" in the Navbar
- Type in your PIN and press Enter, you should get a Success Message
- In Moonlight, select one of the Applications listed
@@ -60,77 +60,82 @@ The deb and rpm packages handle these steps automatically. The AppImage does not
Sunshine needs access to `uinput` to create mouse and gamepad events.
-Add user to group `input`, if this is the first time installing.
- .. code-block:: bash
+#. Add user to group `input`, if this is the first time installing.
+ .. code-block:: bash
- sudo usermod -a -G input $USER
- sudo reboot now
+ sudo usermod -a -G input $USER
-Create `udev` rules.
- .. code-block:: bash
+#. Create `udev` rules.
+ .. code-block:: bash
- sudo nano /etc/udev/rules.d/85-sunshine-input.rules
+ sudo nano /etc/udev/rules.d/85-sunshine-input.rules
- Input the following contents.
-
- .. code-block::
-
- KERNEL=="uinput", GROUP="input", MODE="0660", OPTIONS+="static_node=uinput"
-
- Save the file and exit:
-
- #. ``CTRL+X`` to start exit.
- #. ``Y`` to save modifications.
-
-Configure autostart service
- - filename: ``~/.config/systemd/user/sunshine.service``
- - contents:
+ Input the following contents.
.. code-block::
- [Unit]
- Description=Sunshine Gamestream Server for Moonlight
+ KERNEL=="uinput", GROUP="input", MODE="0660", OPTIONS+="static_node=uinput"
- [Service]
- ExecStart=
+ Save the file and exit:
- [Install]
- WantedBy=graphical-session.target
+ #. ``CTRL+X`` to start exit.
+ #. ``Y`` to save modifications.
- .. table::
- :widths: auto
+#. Optionally, configure autostart service
+ - filename: ``~/.config/systemd/user/sunshine.service``
+ - contents:
- ======== =================== ===============
- package ExecStart Auto Configured
- ======== =================== ===============
- deb /usr/bin/sunshine ✔
- rpm /usr/bin/sunshine ✔
- AppImage ~/sunshine.AppImage ✖
- ======== =================== ===============
+ .. code-block::
- Start once
+ [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 ✖
+ Flatpak flatpak run com.github.sunshinestream.sunshine ✖
+ ======== ============================================== ===============
+
+ 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. It is necessary to
+ allow Sunshine to use KMS.
+
+ 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))
+
+#. Reboot
.. 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. It is necessary to
- allow Sunshine to use KMS.
-
- 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))
+ sudo reboot now
MacOS
^^^^^
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 5384c8e2..aaa2663c 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -1,7 +1,5 @@
:github_url: https://github.com/SunshineStream/Sunshine/tree/nightly/docs/source/index.rst
-SunshineStream has this documentation hosted on `Read the Docs `_.
-
Table of Contents
=================
.. include:: toc.rst