structure source file

This commit is contained in:
pigeatgarlic 2022-06-24 14:53:31 +07:00
parent 70ae7a2fa9
commit 6dfd230c95
139 changed files with 50 additions and 3179 deletions

View File

@ -6,7 +6,7 @@ project(Sunshine VERSION 0.14.0
)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(SUNSHINE_SOURCE_ASSETS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src_assets")
set(SUNSHINE_SOURCE_ASSETS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/config")
if(WIN32)
# Ugly hack to compile with #include <qos2.h>
@ -79,14 +79,16 @@ if(WIN32)
set(PLATFORM_TARGET_FILES
"${CMAKE_CURRENT_BINARY_DIR}/windows.rc"
sunshine/platform/windows/publish.cpp
sunshine/platform/windows/misc.h
sunshine/platform/windows/misc.cpp
sunshine/platform/windows/input.cpp
sunshine/platform/windows/display.h
sunshine/platform/windows/display_base.cpp
sunshine/platform/windows/display_vram.cpp
sunshine/platform/windows/display_ram.cpp
sunshine/platform/windows/audio.cpp
sunshine/platform/windows/display.h
sunshine/platform/windows/misc.h
third-party/ViGEmClient/src/ViGEmClient.cpp
third-party/ViGEmClient/include/ViGEm/Client.h
third-party/ViGEmClient/include/ViGEm/Common.h
@ -158,13 +160,13 @@ elseif(APPLE)
sunshine/platform/macos/av_video.h
sunshine/platform/macos/av_video.m
sunshine/platform/macos/display.mm
sunshine/platform/macos/input.cpp
sunshine/platform/macos/microphone.mm
sunshine/platform/macos/misc.cpp
sunshine/platform/macos/misc.h
sunshine/platform/macos/nv12_zero_device.cpp
sunshine/platform/macos/nv12_zero_device.h
sunshine/platform/macos/misc.cpp
sunshine/platform/macos/input.cpp
sunshine/platform/macos/publish.cpp
sunshine/platform/macos/nv12_zero_device.h
sunshine/platform/macos/TPCircularBuffer/TPCircularBuffer.c
sunshine/platform/macos/TPCircularBuffer/TPCircularBuffer.h
${APPLE_PLIST_FILE})
@ -282,15 +284,16 @@ else()
list(APPEND PLATFORM_TARGET_FILES
sunshine/platform/linux/publish.cpp
sunshine/platform/linux/vaapi.h
sunshine/platform/linux/vaapi.cpp
sunshine/platform/linux/cuda.h
sunshine/platform/linux/graphics.h
sunshine/platform/linux/graphics.cpp
sunshine/platform/linux/misc.h
sunshine/platform/linux/misc.cpp
sunshine/platform/linux/audio.cpp
sunshine/platform/linux/input.cpp
sunshine/platform/linux/vaapi.h
sunshine/platform/linux/misc.h
sunshine/platform/linux/cuda.h
sunshine/platform/linux/graphics.h
sunshine/platform/linux/x11grab.h
sunshine/platform/linux/wayland.h
third-party/glad/src/egl.c
@ -328,37 +331,39 @@ set(SUNSHINE_TARGET_FILES
third-party/moonlight-common-c/src/Rtsp.h
third-party/moonlight-common-c/src/RtspParser.c
third-party/moonlight-common-c/src/Video.h
sunshine/upnp.cpp
sunshine/upnp.h
sunshine/cbs.cpp
sunshine/config.cpp
sunshine/main.cpp
sunshine/crypto.cpp
sunshine/nvhttp.cpp
sunshine/httpcommon.cpp
sunshine/confighttp.cpp
sunshine/rtsp.cpp
sunshine/stream.cpp
sunshine/video.cpp
sunshine/input.cpp
sunshine/audio.cpp
sunshine/process.cpp
sunshine/network.cpp
sunshine/httpcommon.h
sunshine/nvhttp.h
sunshine/main.h
sunshine/utility.h
sunshine/uuid.h
sunshine/config.h
sunshine/config.cpp
sunshine/main.cpp
sunshine/main.h
sunshine/crypto.cpp
sunshine/crypto.h
sunshine/nvhttp.cpp
sunshine/nvhttp.h
sunshine/httpcommon.cpp
sunshine/httpcommon.h
sunshine/confighttp.cpp
sunshine/confighttp.h
sunshine/rtsp.cpp
sunshine/rtsp.h
sunshine/stream.cpp
sunshine/stream.h
sunshine/video.cpp
sunshine/video.h
sunshine/input.cpp
sunshine/input.h
sunshine/audio.cpp
sunshine/audio.h
sunshine/input.h
sunshine/platform/common.h
sunshine/process.cpp
sunshine/process.h
sunshine/network.cpp
sunshine/network.h
sunshine/move_by_copy.h
sunshine/task_pool.h
@ -368,7 +373,8 @@ set(SUNSHINE_TARGET_FILES
sunshine/round_robin.h
${PLATFORM_TARGET_FILES})
set_source_files_properties(sunshine/upnp.cpp PROPERTIES COMPILE_FLAGS -Wno-pedantic)
set_source_files_properties(sunshine/upnp.cpp
PROPERTIES COMPILE_FLAGS -Wno-pedantic)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
@ -386,7 +392,8 @@ string(TOUPPER "x${CMAKE_BUILD_TYPE}" BUILD_TYPE)
if("${BUILD_TYPE}" STREQUAL "XDEBUG")
list(APPEND SUNSHINE_COMPILE_OPTIONS -O0 -ggdb3)
if(WIN32)
set_source_files_properties(sunshine/nvhttp.cpp PROPERTIES COMPILE_FLAGS -O2)
set_source_files_properties(sunshine/nvhttp.cpp
PROPERTIES COMPILE_FLAGS -O2)
endif()
else()
add_definitions(-DNDEBUG)
@ -421,7 +428,10 @@ endif()
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_ASSETS_DIR="${SUNSHINE_ASSETS_DIR}")
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_CONFIG_DIR="${SUNSHINE_CONFIG_DIR}")
add_executable(sunshine ${SUNSHINE_TARGET_FILES})
add_library(sunshinesdk STATIC ${SUNSHINE_TARGET_FILES})
target_link_libraries(sunshine ${SUNSHINE_EXTERNAL_LIBRARIES} ${EXTRA_LIBS})
target_compile_definitions(sunshine PUBLIC ${SUNSHINE_DEFINITIONS})
set_target_properties(sunshine PROPERTIES CXX_STANDARD 17
@ -429,6 +439,13 @@ set_target_properties(sunshine PROPERTIES CXX_STANDARD 17
SOVERSION ${PROJECT_VERSION_MAJOR}
)
target_link_libraries(sunshinesdk ${SUNSHINE_EXTERNAL_LIBRARIES} ${EXTRA_LIBS})
target_compile_definitions(sunshinesdk PUBLIC ${SUNSHINE_DEFINITIONS})
set_target_properties(sunshinesdk PROPERTIES CXX_STANDARD 17
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
if(NOT DEFINED CMAKE_CUDA_STANDARD)
set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
@ -436,6 +453,7 @@ endif()
if(APPLE)
target_link_options(sunshine PRIVATE LINKER:-sectcreate,__TEXT,__info_plist,${APPLE_PLIST_FILE})
target_link_options(sunshinesdk PRIVATE LINKER:-sectcreate,__TEXT,__info_plist,${APPLE_PLIST_FILE})
endif()
foreach(flag IN LISTS SUNSHINE_COMPILE_OPTIONS)
@ -443,6 +461,7 @@ foreach(flag IN LISTS SUNSHINE_COMPILE_OPTIONS)
endforeach()
target_compile_options(sunshine PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${SUNSHINE_COMPILE_OPTIONS}>;$<$<COMPILE_LANGUAGE:CUDA>:${SUNSHINE_COMPILE_OPTIONS_CUDA};-std=c++17>)
target_compile_options(sunshinesdk PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${SUNSHINE_COMPILE_OPTIONS}>;$<$<COMPILE_LANGUAGE:CUDA>:${SUNSHINE_COMPILE_OPTIONS_CUDA};-std=c++17>)
# CPACK / Packaging
@ -461,7 +480,8 @@ 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)
install(TARGETS sunshine RUNTIME DESTINATION "executable" COMPONENT application)
install(TARGETS sunshinesdk RUNTIME DESTINATION "lib" COMPONENT application)
# Adding tools
install(TARGETS dxgi-info RUNTIME DESTINATION "tools" COMPONENT dxgi)

View File

Before

Width:  |  Height:  |  Size: 998 B

After

Width:  |  Height:  |  Size: 998 B

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -1,20 +0,0 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

View File

@ -1,35 +0,0 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)
if "%1" == "" goto help
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +0,0 @@
:github_url: https://github.com/SunshineStream/Sunshine/tree/nightly/docs/DOCKER_README.md
.. Todo:: This is a planned feature. Currently no Dockerfile or image exists for Sunshine.
.. mdinclude:: ../../../DOCKER_README.md

View File

@ -1,127 +0,0 @@
:github_url: https://github.com/SunshineStream/Sunshine/tree/nightly/docs/source/about/installation.rst
Installation
============
The recommended method for running Sunshine is to use the `binaries`_ bundled with the `latest release`_.
Binaries
--------
Binaries of Sunshine are created for each release. They are available for Linux, and Windows.
Binaries can be found in the `latest release`_.
.. Todo:: Create binary package(s) for MacOS. See `here <https://github.com/SunshineStream/Sunshine/issues/61>`_.
.. Tip:: Some third party packages also exist. See
:ref:`Third Party Packages <about/third_party_packages:third party packages>`.
Docker
------
.. Todo:: Docker images of Sunshine are planned to be included in the future.
They will be available on `Dockerhub.io`_ and `ghcr.io`_.
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
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 ``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
#. Add `rpmfusion` repositories by running the following code.
.. 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
#. Download ``sunshine.rpm`` and run the following code.
.. code-block:: bash
sudo dnf install ./sunshine.rpm
.. 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
Portfile
#. Install `MacPorts <https://www.macports.org>`_
#. 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/<username>/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
-------
.. image:: https://img.shields.io/github/issues/sunshinestream/sunshine/os:windows:10?logo=github&style=for-the-badge
:alt: GitHub issues by-label
.. image:: https://img.shields.io/github/issues/sunshinestream/sunshine/os:windows:11?logo=github&style=for-the-badge
:alt: GitHub issues by-label
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
.. _ghcr.io: https://github.com/orgs/SunshineStream/packages?repo_name=sunshine

View File

@ -1 +0,0 @@
.. include:: ../../../README.rst

View File

@ -1,57 +0,0 @@
:github_url: https://github.com/SunshineStream/Sunshine/tree/nightly/docs/source/about/third_party_packages.rst
Third Party Packages
====================
.. Danger:: These packages are not maintained by SunshineStream. Use at your own risk.
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
.. image:: https://img.shields.io/aur/votes/sunshine?style=for-the-badge&logo=archlinux
:alt: AUR votes
.. image:: https://img.shields.io/aur/maintainer/sunshine?style=for-the-badge&logo=archlinux
:alt: AUR maintainer
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
Scoop
-----
.. image:: https://img.shields.io/scoop/v/sunshine?bucket=extras&style=for-the-badge
:alt: Scoop Version (extras bucket)
:target: https://scoop.sh/#/apps?s=0&d=1&o=true&q=sunshine
Legacy GitHub Repo
------------------
.. 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
.. image:: https://img.shields.io/github/release-date/loki-47-6F-64/sunshine?style=for-the-badge&logo=github
:alt: GitHub Release Date
.. image:: https://img.shields.io/github/downloads/loki-47-6F-64/sunshine/total?style=for-the-badge&logo=github
:alt: GitHub Releases

View File

@ -1,215 +0,0 @@
:github_url: https://github.com/SunshineStream/Sunshine/tree/nightly/docs/source/about/usage.rst
Usage
=====
#. See the `setup`_ section for your specific OS.
#. Run ``sunshine <directory of conf file>/sunshine.conf``.
.. Note:: You do not need to specify a config file. If no config file is entered the default location will be used.
.. Attention:: The configuration file specified will be created if it doesn't exist.
.. Tip:: If using the Linux AppImage, replace ``sunshine`` with ``./sunshine.AppImage``
#. Configure Sunshine in the web ui
The web ui is available on `https://localhost:47990 <https://localhost:47990>`_ by default. You may replace
`localhost` with your internal ip address.
.. Attention:: Ignore any warning given by your browser about "insecure website".
.. Caution:: If running for the first time, make sure to note the username and password Sunshine showed to you,
since you cannot get back later!
Add games and applications.
This can be configured in the web ui.
.. Note:: Additionally, apps can be configured manually. `src_assets/<os>/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
#. In Moonlight, you may need to add the PC manually.
#. When Moonlight request you insert the correct pin on sunshine:
- Login to the web ui
- Go to "PIN" in the Header
- Type in your PIN and press Enter, you should get a Success Message
- In Moonlight, select one of the Applications listed
Network
-------
Sunshine will be available on port 47990 by default.
.. Danger:: Do not expose port 47990, or the web ui, to the internet!
Arguments
---------
To get a list of available arguments run the following:
.. code-block:: bash
sunshine --help
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`, if this is the first time installing.
.. code-block:: bash
sudo usermod -a -G input $USER
sudo reboot now
Create `udev` rules.
.. code-block:: bash
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:
.. code-block::
[Unit]
Description=Sunshine Gamestream Server for Moonlight
[Service]
ExecStart=<see table>
[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. 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))
MacOS
^^^^^
Sunshine can only access microphones on macOS due to system limitations. To stream system audio use
`Soundflower <https://github.com/mattingalls/Soundflower>`_ or
`BlackHole <https://github.com/ExistentialAudio/BlackHole>`_ and
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 currently supported.
Configure autostart service
MacPorts
.. code-block:: bash
sudo port load Sunshine
Windows
^^^^^^^
For gamepad support, install `ViGEmBus <https://github.com/ViGEm/ViGEmBus/releases/latest>`_
Shortcuts
---------
All shortcuts start with CTRL + ALT + SHIFT, just like Moonlight
- ``CTRL + ALT + SHIFT + N`` - Hide/Unhide the cursor (This may be useful for Remote Desktop Mode for Moonlight)
- ``CTRL + ALT + SHIFT + F1/F13`` - Switch to different monitor for Streaming
Application List
----------------
- You can use Environment variables in place of values
- ``$(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"``
- ``apps`` - The list of applications
- Example application:
.. code-block:: json
{
"name":"An App",
"cmd":"command to open app",
"prep-cmd":[
{
"do":"some-command",
"undo":"undo-that-command"
}
],
"detached":[
"some-command",
"another-command"
]
}
- ``name`` - The name of the application/game
- ``output`` - The file where the output of the command is stored
- ``detached`` - A list of commands to be run and forgotten about
- ``prep-cmd`` - A list of commands to be run before/after the application
- If any of the prep-commands fail, starting the application is aborted
- ``do`` - Run before the application
- If it fails, all ``undo`` commands of the previously succeeded ``do`` commands are run
- ``undo`` - Run after the application has terminated
- This should not fail considering it is supposed to undo the ``do`` commands
- If it fails, Sunshine is terminated
- ``cmd`` - The main application
- If not specified, a process is started that sleeps indefinitely
Considerations
--------------
- When an application is started, if there is an application already running, it will be terminated.
- When the application has been shutdown, the stream shuts down as well.
- In addition to the apps listed, one app "Desktop" is hardcoded into Sunshine. It does not start an application,
instead it simply starts a stream.

View File

@ -1,35 +0,0 @@
:github_url: https://github.com/SunshineStream/Sunshine/tree/nightly/docs/source/building/build.rst
Build
=====
Sunshine binaries are built using `CMake <https://cmake.org/>`_. Cross compilation is not
supported. That means the binaries must be built on the target operating system and architecture.
Building Locally
----------------
Clone
^^^^^
Ensure `git <https://git-scm.com/>`_ is installed and run the following:
.. code-block:: bash
git clone https://github.com/sunshinestream/sunshine.git --recurse-submodules
cd sunshine && mkdir build && cd build
Compile
^^^^^^^
See the section specific to your OS.
- :ref:`Linux <building/linux:linux>`
- :ref:`MacOS <building/macos:macos>`
- :ref:`Windows <building/windows:windows>`
Remote Build
------------
It may be beneficial to build remotely in some cases. This will enable easier building on different operating systems.
#. Fork the project
#. Activate workflows
#. Trigger the `CI` workflow manually
#. Download the artifacts/binaries from the workflow run summary

View File

@ -1,302 +0,0 @@
:github_url: https://github.com/SunshineStream/Sunshine/tree/nightly/docs/source/building/linux.rst
Linux
=====
Requirements
------------
.. Danger:: Installing these dependencies may break your distribution. It is recommended to build in a virtual machine
or to use the `Dockerfile builds`_ located in the `./scripts` directory.
Debian Bullseye
^^^^^^^^^^^^^^^
End of Life: TBD
Install Requirements
.. code-block:: bash
sudo apt update && sudo apt install \
build-essential \
cmake \
git \
libavdevice-dev \
libboost-filesystem-dev \
libboost-log-dev \
libboost-thread-dev \
libcap-dev \ # KMS
libdrm-dev \ # KMS
libevdev-dev \
libpulse-dev \
libopus-dev \
libssl-dev \
libwayland-dev \ # Wayland
libx11-dev \ # X11
libxcb-shm0-dev \ # X11
libxcb-xfixes0-dev \ # X11
libxcb1-dev \ # X11
libxfixes-dev \ # X11
libxrandr-dev \ # X11
libxtst-dev \ # X11
nvidia-cuda-dev \ # Cuda, NvFBC
nvidia-cuda-toolkit \ # Cuda, NvFBC
Fedora 35
^^^^^^^^^
End of Life: TBD
Install Repositories
.. code-block:: bash
sudo dnf update && \
sudo dnf group install "Development Tools" && \
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
Install Requirements
.. code-block:: bash
sudo dnf install \
boost-devel \
boost-static.x86_64 \
cmake \
ffmpeg-devel \
gcc-c++ \
libevdev-devel \
libX11-devel \ # X11
libxcb-devel \ # X11
libXcursor-devel \ # X11
libXfixes-devel \ # X11
libXinerama-devel \ # X11
libXi-devel \ # X11
libXrandr-devel \ # X11
libXtst-devel \ # X11
mesa-libGL-devel \
openssl-devel \
opus-devel \
pulseaudio-libs-devel \
rpm-build \ # if you want to build an RPM binary package
Ubuntu 18.04
^^^^^^^^^^^^
End of Life: April 2028
Install Repositories
.. code-block:: bash
sudo apt update && sudo apt install \
software-properties-common \
&& add-apt-repository ppa:savoury1/graphics && \
add-apt-repository ppa:savoury1/multimedia && \
add-apt-repository ppa:savoury1/ffmpeg4 && \
add-apt-repository ppa:savoury1/boost-defaults-1.71 && \
add-apt-repository ppa:ubuntu-toolchain-r/test && \
Install Requirements
.. code-block:: bash
sudo apt install \
build-essential \
cmake \
gcc-10 \
git \
g++-10 \
libavdevice-dev \
libboost-filesystem1.71-dev \
libboost-log1.71-dev \
libboost-regex1.71-dev \
libboost-thread1.71-dev \
libcap-dev \ # KMS
libdrm-dev \ # KMS
libevdev-dev \
libpulse-dev \
libopus-dev \
libssl-dev \
libwayland-dev \ # Wayland
libx11-dev \ # X11
libxcb-shm0-dev \ # X11
libxcb-xfixes0-dev \ # X11
libxcb1-dev \ # X11
libxfixes-dev \ # X11
libxrandr-dev \ # X11
libxtst-dev \ # X11
wget \
Update gcc alias
.. code-block:: bash
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10
Install CuDA
.. code-block:: bash
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 ./cuda.run && chmod a+x ./cuda.run
./cuda.run --silent --toolkit --toolkitpath=/usr --no-opengl-libs --no-man-page --no-drm && rm ./cuda.run
Install CMake
.. code-block:: bash
wget https://cmake.org/files/v3.22/cmake-3.22.2-linux-x86_64.sh
mkdir /opt/cmake
sh /cmake-3.22.2-linux-x86_64.sh --prefix=/opt/cmake --skip-license
ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
cmake --version
Ubuntu 20.04
^^^^^^^^^^^^
End of Life: April 2030
Install Requirements
.. code-block:: bash
sudo apt update && sudo apt install \
build-essential \
cmake \
git \
g++-10 \
libavdevice-dev \
libboost-filesystem-dev \
libboost-log-dev \
libboost-thread-dev \
libcap-dev \ # KMS
libdrm-dev \ # KMS
libevdev-dev \
libpulse-dev \
libopus-dev \
libssl-dev \
libwayland-dev \ # Wayland
libx11-dev \ # X11
libxcb-shm0-dev \ # X11
libxcb-xfixes0-dev \ # X11
libxcb1-dev \ # X11
libxfixes-dev \ # X11
libxrandr-dev \ # X11
libxtst-dev \ # X11
wget \
Update gcc alias
.. code-block:: bash
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10
Install CuDA
.. code-block:: bash
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 ./cuda.run && chmod a+x ./cuda.run
./cuda.run --silent --toolkit --toolkitpath=/usr --no-opengl-libs --no-man-page --no-drm && rm ./cuda.run
Ubuntu 21.10
^^^^^^^^^^^^
End of Life: July 2022
Install Requirements
.. code-block:: bash
sudo apt update && sudo apt install \
build-essential \
cmake \
git \
libavdevice-dev \
libboost-filesystem-dev \
libboost-log-dev \
libboost-thread-dev \
libcap-dev \ # KMS
libdrm-dev \ # KMS
libevdev-dev \
libpulse-dev \
libopus-dev \
libssl-dev \
libwayland-dev \ # Wayland
libx11-dev \ # X11
libxcb-shm0-dev \ # X11
libxcb-xfixes0-dev \ # X11
libxcb1-dev \ # X11
libxfixes-dev \ # X11
libxrandr-dev \ # X11
libxtst-dev \ # X11
nvidia-cuda-dev \ # Cuda, NvFBC
nvidia-cuda-toolkit \ # Cuda, NvFBC
Ubuntu 22.04
^^^^^^^^^^^^
End of Life: April 2027
.. Todo:: Create Ubuntu 22.04 Dockerfile and complete this documentation.
Build
-----
.. Attention:: Ensure you are in the build directory created during the clone step earlier before continuing.
Debian based OSes
.. code-block:: bash
cmake -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 ..
Red Hat based Oses
.. code-block:: bash
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ ..
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
-----------------
You may wish to simply build sunshine from source, without bloating your OS with development files.
There are scripts located in the ``./scripts`` directory that will create docker images that have the necessary
packages. As a result, removing the development files after you're done is a single command away.
These scripts use docker under the hood, as such, they can only be used to compile the Linux version
.. Todo:: Publish the Dockerfiles to Dockerhub and ghcr.
Requirements
Install `Docker <https://docs.docker.com/engine/install/>`_
Instructions
#. :ref:`Clone <building/build:clone>`. Sunshine.
#. Select the desired Dockerfile from the ``./scripts`` directory.
Available Files:
.. code-block:: text
Dockerfile-debian
Dockerfile-fedora_33 # end of life
Dockerfile-fedora_35
Dockerfile-ubuntu_18_04
Dockerfile-ubuntu_20_04
Dockerfile-ubuntu_21_04 # end of life
Dockerfile-ubuntu_21_10
#. Execute
.. code-block:: bash
cd scripts # move to the scripts directory
./build-container.sh -f Dockerfile-<name> # create the container (replace the "<name>")
./build-sunshine.sh -p -s .. # compile and build sunshine
#. Updating
.. code-block:: bash
git pull # pull the latest changes from github
./build-sunshine.sh -p -s .. # compile and build sunshine
#. Optionally, delete the container
.. code-block:: bash
./build-container.sh -c delete
#. Install the resulting package
Debian
.. code-block:: bash
sudo apt install -f sunshine-build/sunshine.deb
Red Hat
.. code-block:: bash
sudo dnf install sunshine-build/sunshine.rpm

View File

@ -1,43 +0,0 @@
:github_url: https://github.com/SunshineStream/Sunshine/tree/nightly/docs/source/building/macos.rst
MacOS
=====
Requirements
------------
MacOS Big Sur and Xcode 12.5+
Use either `MacPorts <https://www.macports.org>`_ or `Homebrew <https://brew.sh>`_
MacPorts
""""""""
Install Requirements
.. code-block:: bash
sudo port install cmake boost ffmpeg libopus
Homebrew
""""""""
Install Requirements
.. code-block:: bash
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 .
Build
-----
.. Attention:: Ensure you are in the build directory created during the clone step earlier before continuing.
.. code-block:: bash
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 ..``

View File

@ -1,27 +0,0 @@
:github_url: https://github.com/SunshineStream/Sunshine/tree/nightly/docs/source/building/windows.rst
Windows
=======
Requirements
------------
First you need to install `MSYS2 <https://www.msys2.org>`_, then startup "MSYS2 MinGW 64-bit" and install the
following packages using:
.. 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
Build
-----
.. Attention:: Ensure you are in the build directory created during the clone step earlier before continuing.
.. 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

View File

@ -1,97 +0,0 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# standard imports
from datetime import datetime
import os
import re
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
script_dir = os.path.dirname(os.path.abspath(__file__)) # the directory of this file
source_dir = os.path.dirname(script_dir) # the source folder directory
root_dir = os.path.dirname(source_dir) # the root folder directory
# -- Project information -----------------------------------------------------
project = 'Sunshine'
copyright = f'{datetime.now ().year}, {project}'
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)
"""
To use cmake method for obtaining version instead of regex,
1. Within CMakeLists.txt add the following line without backticks:
``configure_file(docs/source/conf.py.in "${CMAKE_CURRENT_SOURCE_DIR}/docs/source/conf.py" @ONLY)``
2. Rename this file to ``conf.py.in``
3. Uncomment the next line
"""
# version = '@PROJECT_VERSION@' # use this for cmake configure_file method
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
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_copybutton', # add a copy button to code blocks
]
# Add any paths that contain templates here, relative to this directory.
# templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['toc.rst']
# Extensions to include.
source_suffix = ['.rst', '.md']
# -- Options for HTML output -------------------------------------------------
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = ['_static']
html_logo = os.path.join(root_dir, 'sunshine.png')
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'sphinx_rtd_theme'
html_theme_options = {
# 'analytics_id': 'G-XXXXXXXXXX', # Provided by Google in your dashboard
# 'analytics_anonymize_ip': False,
'logo_only': False,
'display_version': False,
'prev_next_buttons_location': 'bottom',
'style_external_links': True,
'vcs_pageview_mode': 'blob',
# 'style_nav_header_background': 'white',
# Toc options
'collapse_navigation': True,
'sticky_navigation': True,
'navigation_depth': 4,
'includehidden': True,
'titles_only': False,
}
# extension config options
autosectionlabel_prefix_document = True # Make sure the target is unique
todo_include_todos = True

View File

@ -1,32 +0,0 @@
:github_url: https://github.com/SunshineStream/Sunshine/tree/nightly/docs/source/contributing/contributing.rst
Contributing
============
#. Fork the repo on GitHub
#. Create a new branch for the feature you are adding or the issue you are fixing
.. Tip:: Base the new branch off the `nightly` branch. It will make your life easier when you submit the PR!
#. Make changes, push commits, etc.
#. Files should contain an empty line at the end.
#. Document your code!
#. Test your code!
#. When ready create a PR to this repo on the `nightly` branch.
.. Hint:: If you accidentally make your PR against a different branch, a bot will comment letting you know it's on
the wrong branch. Don't worry. You can edit the PR to change the target branch. There is no reason to close the
PR!
.. Note:: Draft PRs are also welcome as you work through issues. The benefit of creating a draft PR is that an
automated build can run in a github runner.
.. Attention:: Do not expect partially complete PRs to be merged. These topics will be considered before merging.
- Does the code follows the style guidelines of this project?
.. Tip:: Look at examples of existing code in the project!
- Is the code well commented?
- Were documentation blocks updated for new or modified components?
.. Note:: Developers and maintainers will attempt to assist with challenging issues.

View File

@ -1,84 +0,0 @@
:github_url: https://github.com/SunshineStream/Sunshine/tree/nightly/docs/source/contributing/localization.rst
Localization
============
Sunshine is being localized into various languages. The default language is `en` (English) and is highlighted green.
.. image:: https://img.shields.io/badge/dynamic/json?color=blue&label=de&style=for-the-badge&query=%24.progress.0.data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-15178612-503956.json
.. image:: https://img.shields.io/badge/dynamic/json?color=green&label=en&style=for-the-badge&query=%24.progress.1.data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-15178612-503956.json
.. image:: https://img.shields.io/badge/dynamic/json?color=blue&label=en-GB&style=for-the-badge&query=%24.progress.2.data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-15178612-503956.json
.. image:: https://img.shields.io/badge/dynamic/json?color=blue&label=en-US&style=for-the-badge&query=%24.progress.3.data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-15178612-503956.json
.. image:: https://img.shields.io/badge/dynamic/json?color=blue&label=es-ES&style=for-the-badge&query=%24.progress.4.data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-15178612-503956.json
.. image:: https://img.shields.io/badge/dynamic/json?color=blue&label=fr&style=for-the-badge&query=%24.progress.5.data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-15178612-503956.json
.. image:: https://img.shields.io/badge/dynamic/json?color=blue&label=it&style=for-the-badge&query=%24.progress.6.data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-15178612-503956.json
.. image:: https://img.shields.io/badge/dynamic/json?color=blue&label=ru&style=for-the-badge&query=%24.progress.7.data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-15178612-503956.json
Graph
.. image:: https://badges.awesome-crowdin.com/translation-15178612-503956.png
CrowdIn
-------
The translations occur on
`CrowdIn <https://crowdin.com/project/sunshinestream>`_. Feel free to contribute to localization there.
Only elements of the API are planned to be translated.
.. Attention:: The rest API has not yet been implemented.
Translations Basics
- The brand names `SunshineStream` and `Sunshine` should never be translated.
- Other brand names should never be translated.
Examples:
- AMD
- Nvidia
CrowdIn Integration
How does it work?
When a change is made to sunshine source code, a workflow generates new translation templates
that get pushed to CrowdIn automatically.
When translations are updated on CrowdIn, a push gets made to the `l10n_nightly` branch and a PR is made against the
`nightly` branch. Once PR is merged, all updated translations are part of the project and will be included in the
next release.
Extraction
----------
There should be minimal cases where strings need to be extracted from source code; however it may be necessary in some
situations. For example if a system tray icon is added it should be localized as it is user interfacing.
- Wrap the string to be extracted in a function as shown.
.. code-block:: cpp
#include <boost/locale.hpp>
boost::locale::translate("Hello world!")
.. Tip:: More examples can be found in the documentation for
`boost locale <https://www.boost.org/doc/libs/1_70_0/libs/locale/doc/html/messages_formatting.html>`_.
.. Warning:: This is for information only. Contributors should never include manually updated template files, or
manually compiled language files in Pull Requests.
Strings are automatically extracted from the code to the `locale/sunshine.po` template file. The generated file is
used by CrowdIn to generate language specific template files. The file is generated using the
`.github/workflows/localize.yml` workflow and is run on any push event into the `nightly` branch. Jobs are only run if
any of the following paths are modified.
.. code-block:: yaml
- 'sunshine/**'
When testing locally it may be desirable to manually extract, initialize, update, and compile strings. Python is
required for this, along with the python dependencies in the `./scripts/requirements.txt` file. Additionally,
`xgettext <https://www.gnu.org/software/gettext/>`_ must be installed.
Extract, initialize, and update
.. code-block:: bash
python ./scripts/_locale.py --extract --init --update
Compile
.. code-block:: bash
python ./scripts/_locale.py --compile

View File

@ -1,42 +0,0 @@
:github_url: https://github.com/RetroArcher/RetroArcher/tree/nightly/docs/source/contributing/testing.rst
Testing
=======
Clang Format
------------
Source code is tested against the `.clang-format` file for linting errors. The workflow file responsible for clang
format testing is `.github/workflows/clang.yml`.
Test clang-format locally.
.. Todo:: This documentation needs to be improved.
.. code-block:: bash
clang-format ...
Sphinx
------
Sunshine uses `Sphinx <https://www.sphinx-doc.org/en/master/>`_ for documentation building. Sphinx is included
in the `./scripts/requirements.txt` file. Python is required to build sphinx docs. Installation and setup of python
will not be covered here.
The config file for Sphinx is `docs/source/conf.py`. This is already included in the repo and should not be modified.
Test with Sphinx
.. code-block:: bash
cd docs
make html
Alternatively
.. code-block:: bash
cd docs
sphinx-build -b html source build
Unit Testing
------------
.. Todo:: Sunshine does not currently have any unit tests. If you would like to help us improve please get in contact
with us, or make a PR with suggested changes.

View File

@ -1,7 +0,0 @@
:github_url: https://github.com/SunshineStream/Sunshine/tree/nightly/docs/source/index.rst
SunshineStream has this documentation hosted on `Read the Docs <http://sunshinestream.readthedocs.io/>`_.
Table of Contents
=================
.. include:: toc.rst

View File

@ -1,36 +0,0 @@
.. toctree::
:maxdepth: 2
:caption: About
about/overview
about/installation
about/docker
about/third_party_packages
about/usage
about/advanced_usage
.. toctree::
:maxdepth: 2
:caption: Troubleshooting
troubleshooting/general
troubleshooting/linux
troubleshooting/macos
troubleshooting/windows
.. toctree::
:maxdepth: 2
:caption: Build
building/build
building/linux
building/macos
building/windows
.. toctree::
:maxdepth: 2
:caption: Contributing
contributing/contributing
contributing/localization
contributing/testing

View File

@ -1,13 +0,0 @@
: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 <new username> <new password>
Can't access the web UI?
#. Check firefall rules.

View File

@ -1,9 +0,0 @@
: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))

View File

@ -1,14 +0,0 @@
: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

View File

@ -1,7 +0,0 @@
: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 <https://github.com/ViGEm/ViGEmBus/releases/latest>`_.

View File

@ -1,40 +0,0 @@
FROM debian:bullseye AS sunshine-debian
# Debian Bullseye end of life is TBD
ARG DEBIAN_FRONTEND=noninteractive
ARG TZ="Europe/London"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN echo deb http://deb.debian.org/debian/ bullseye main contrib non-free | tee /etc/apt/sources.list.d/non-free.list
RUN apt-get update -y && \
apt-get install -y \
build-essential \
cmake \
git \
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 \
nvidia-cuda-dev \
nvidia-cuda-toolkit \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Entrypoint
COPY build-private.sh /root/build.sh
ENTRYPOINT ["/root/build.sh", "-deb"]

View File

@ -1,32 +0,0 @@
FROM fedora:33 AS sunshine-fedora_33
# Fedora 33 end of life is November 2021
# This file remains for reference only
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN dnf -y update && \
dnf -y group install "Development Tools" && \
dnf -y 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 && \
dnf -y install \
boost-devel \
boost-static.x86_64 \
cmake \
ffmpeg-devel \
libevdev-devel \
libxcb-devel \
libX11-devel \
libXfixes-devel \
libXrandr-devel \
libXtst-devel \
openssl-devel \
opus-devel \
pulseaudio-libs-devel \
libcap-devel \
libdrm-devel \
rpm-build \
&& dnf clean all \
&& rm -rf /var/cache/yum
# Entrypoint
COPY build-private.sh /root/build.sh
ENTRYPOINT ["/root/build.sh", "-rpm"]

View File

@ -1,36 +0,0 @@
FROM fedora:35 AS sunshine-fedora_35
# Fedora 35 end of life is TBD
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN dnf -y update && \
dnf -y group install "Development Tools" && \
dnf -y 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 && \
dnf -y install \
boost-devel \
boost-static.x86_64 \
cmake \
ffmpeg-devel \
gcc-c++ \
libevdev-devel \
libX11-devel \
libxcb-devel \
libXcursor-devel \
libXfixes-devel \
libXinerama-devel \
libXi-devel \
libXrandr-devel \
libXtst-devel \
mesa-libGL-devel \
openssl-devel \
opus-devel \
pulseaudio-libs-devel \
libcap-devel \
libdrm-devel \
rpm-build \
&& dnf clean all \
&& rm -rf /var/cache/yum
# Entrypoint
COPY build-private.sh /root/build.sh
ENTRYPOINT ["/root/build.sh", "-rpm"]

View File

@ -1,63 +0,0 @@
FROM ubuntu:18.04 AS sunshine-ubuntu_18_04
# Ubuntu 18.04 end of life is April 2028
ARG DEBIAN_FRONTEND=noninteractive
ARG TZ="Europe/London"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update -y && \
apt-get install -y \
software-properties-common \
&& add-apt-repository ppa:savoury1/graphics && \
add-apt-repository ppa:savoury1/multimedia && \
add-apt-repository ppa:savoury1/ffmpeg4 && \
add-apt-repository ppa:savoury1/boost-defaults-1.71 && \
add-apt-repository ppa:ubuntu-toolchain-r/test && \
apt-get update -y && \
apt-get install -y \
build-essential \
cmake \
gcc-10 \
git \
g++-10 \
libavdevice-dev \
libboost-filesystem1.71-dev \
libboost-log1.71-dev \
libboost-regex1.71-dev \
libboost-thread1.71-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 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Update gcc alias
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10
# Install CuDA
RUN 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 && chmod a+x /root/cuda.run
RUN /root/cuda.run --silent --toolkit --toolkitpath=/usr --no-opengl-libs --no-man-page --no-drm && rm /root/cuda.run
# Install cmake
ADD https://cmake.org/files/v3.22/cmake-3.22.2-linux-x86_64.sh /cmake-3.22.2-linux-x86_64.sh
RUN mkdir /opt/cmake
RUN sh /cmake-3.22.2-linux-x86_64.sh --prefix=/opt/cmake --skip-license
RUN ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
RUN cmake --version
# Entrypoint
COPY build-private.sh /root/build.sh
ENTRYPOINT ["/root/build.sh", "-deb"]

View File

@ -1,46 +0,0 @@
FROM ubuntu:20.04 AS sunshine-ubuntu_20_04
# Ubuntu 20.04 end of life is April 2030
ARG DEBIAN_FRONTEND=noninteractive
ARG TZ="Europe/London"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update -y && \
apt-get install -y \
build-essential \
cmake \
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 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Update gcc alias
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10
# Install CuDA
RUN 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 && chmod a+x /root/cuda.run
RUN /root/cuda.run --silent --toolkit --toolkitpath=/usr --no-opengl-libs --no-man-page --no-drm && rm /root/cuda.run
# Entrypoint
COPY build-private.sh /root/build.sh
ENTRYPOINT ["/root/build.sh", "-deb"]

View File

@ -1,40 +0,0 @@
FROM ubuntu:21.04 AS sunshine-ubuntu_21_04
# Ubuntu 21.04 end of life is January 2022
# This file remains for reference only
ARG DEBIAN_FRONTEND=noninteractive
ARG TZ="Europe/London"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update -y && \
apt-get install -y \
build-essential \
cmake \
git \
libavdevice-dev \
libboost-thread-dev \
libboost-filesystem-dev \
libboost-log-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 \
nvidia-cuda-dev \
nvidia-cuda-toolkit \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Entrypoint
COPY build-private.sh /root/build.sh
ENTRYPOINT ["/root/build.sh", "-deb"]

View File

@ -1,39 +0,0 @@
FROM ubuntu:21.10 AS sunshine-ubuntu_21_10
# Ubuntu 21.10 end of life is July 2022
ARG DEBIAN_FRONTEND=noninteractive
ARG TZ="Europe/London"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update -y && \
apt-get install -y \
build-essential \
cmake \
git \
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 \
nvidia-cuda-dev \
nvidia-cuda-toolkit \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Entrypoint
COPY build-private.sh /root/build.sh
ENTRYPOINT ["/root/build.sh", "-deb"]

View File

@ -1,170 +0,0 @@
"""
..
_locale.py
Functions related to building, initializing, updating, and compiling localization translations.
Borrowed from RetroArcher.
"""
# standard imports
import argparse
import datetime
import os
import subprocess
project_name = 'Sunshine'
project_owner = 'SunshineStream'
script_dir = os.path.dirname(os.path.abspath(__file__))
root_dir = os.path.dirname(script_dir)
locale_dir = os.path.join(root_dir, 'locale')
project_dir = os.path.join(root_dir, project_name.lower())
year = datetime.datetime.now().year
# retroarcher target locales
target_locales = [
'de', # Deutsch
'en', # English
'en_GB', # English (United Kingdom)
'en_US', # English (United States)
'es', # español
'fr', # français
'it', # italiano
'ru', # русский
]
def x_extract():
"""Executes `xgettext extraction` in subprocess."""
pot_filepath = os.path.join(locale_dir, f'{project_name.lower()}.po')
commands = [
'xgettext',
'--keyword=translate:1,1t',
'--keyword=translate:1c,2,2t',
'--keyword=translate:1,2,3t',
'--keyword=translate:1c,2,3,4t',
'--keyword=gettext:1',
'--keyword=pgettext:1c,2',
'--keyword=ngettext:1,2',
'--keyword=npgettext:1c,2,3',
f'--default-domain={project_name.lower()}',
f'--output={pot_filepath}',
'--language=C++',
'--boost',
'--from-code=utf-8',
'-F',
f'--msgid-bugs-address=github.com/{project_owner.lower()}/{project_name.lower()}',
f'--copyright-holder={project_owner}',
f'--package-name={project_name}',
'--package-version=v0'
]
extensions = ['cpp', 'h', 'm', 'mm']
# find input files
for root, dirs, files in os.walk(project_dir, topdown=True):
for name in files:
filename = os.path.join(root, name)
extension = filename.rsplit('.', 1)[-1]
if extension in extensions: # append input files
commands.append(filename)
print(commands)
subprocess.check_output(args=commands, cwd=root_dir)
try:
# fix header
body = ""
with open(file=pot_filepath, mode='r') as file:
for line in file.readlines():
if line != '"Language: \\n"\n': # do not include this line
if line == '# SOME DESCRIPTIVE TITLE.\n':
body += f'# Translations template for {project_name}.\n'
elif line.startswith('#') and 'YEAR' in line:
body += line.replace('YEAR', str(year))
elif line.startswith('#') and 'PACKAGE' in line:
body += line.replace('PACKAGE', project_name)
else:
body += line
# rewrite pot file with updated header
with open(file=pot_filepath, mode='w+') as file:
file.write(body)
except FileNotFoundError:
pass
def babel_init(locale_code: str):
"""Executes `pybabel init` in subprocess.
:param locale_code: str - locale code
"""
commands = [
'pybabel',
'init',
'-i', os.path.join(locale_dir, f'{project_name.lower()}.po'),
'-d', locale_dir,
'-D', project_name.lower(),
'-l', locale_code
]
print(commands)
subprocess.check_output(args=commands, cwd=root_dir)
def babel_update():
"""Executes `pybabel update` in subprocess."""
commands = [
'pybabel',
'update',
'-i', os.path.join(locale_dir, f'{project_name.lower()}.po'),
'-d', locale_dir,
'-D', project_name.lower(),
'--update-header-comment'
]
print(commands)
subprocess.check_output(args=commands, cwd=root_dir)
def babel_compile():
"""Executes `pybabel compile` in subprocess."""
commands = [
'pybabel',
'compile',
'-d', locale_dir,
'-D', project_name.lower()
]
print(commands)
subprocess.check_output(args=commands, cwd=root_dir)
if __name__ == '__main__':
# Set up and gather command line arguments
parser = argparse.ArgumentParser(
description='Script helps update locale translations. Translations must be done manually.')
parser.add_argument('--extract', action='store_true', help='Extract messages from c++ files.')
parser.add_argument('--init', action='store_true', help='Initialize any new locales specified in target locales.')
parser.add_argument('--update', action='store_true', help='Update existing locales.')
parser.add_argument('--compile', action='store_true', help='Compile translated locales.')
args = parser.parse_args()
if args.extract:
x_extract()
if args.init:
for locale_id in target_locales:
if not os.path.isdir(os.path.join(locale_dir, locale_id)):
babel_init(locale_code=locale_id)
if args.update:
babel_update()
if args.compile:
babel_compile()

View File

@ -1,179 +0,0 @@
#!/bin/bash -e
set -e
usage() {
echo "Usage: $0 [OPTIONS]"
echo " -c: command --> default [build]"
echo " | delete --> Delete the container, Dockerfile isn't mandatory"
echo " | build --> Build the container, Dockerfile is mandatory"
echo " | compile --> Builds the container, then compiles it. Dockerfile is mandatory"
echo ""
echo " -s: path: The path to the source for compilation"
echo " -n: name: Docker container name --> default [sunshine]"
echo " --> all: Build/Compile/Delete all available docker containers"
echo " -f: Dockerfile: The name of the docker file"
}
# Attempt to turn relative paths into absolute paths
absolute_path() {
RELATIVE_PATH=$1
if which realpath >/dev/null 2>/dev/null
then
RELATIVE_PATH=$(realpath $RELATIVE_PATH)
else
echo "Warning: realpath is not installed on your system, ensure [$1] is absolute"
fi
RETURN=$RELATIVE_PATH
}
CONTAINER_NAME=sunshine
COMMAND=BUILD
build_container() {
CONTAINER_NAME=$1
DOCKER_FILE=$2
if [ ! -f "$DOCKER_FILE" ]
then
echo "Error: $DOCKER_FILE doesn't exist"
exit 7
fi
echo "docker build . -t $CONTAINER_NAME -f $DOCKER_FILE"
docker build . -t "$CONTAINER_NAME" -f "$DOCKER_FILE"
}
delete() {
CONTAINER_NAME_UPPER=$(echo "$CONTAINER_NAME" | tr '[:lower:]' '[:upper:]')
if [ "$CONTAINER_NAME_UPPER" = "ALL" ]
then
shopt -s nullglob
for file in $(find . -maxdepth 1 -iname "Dockerfile-*" -type f)
do
CURRENT_CONTAINER="sunshine-$(echo $file | cut -c 14-)"
if docker inspect "$CURRENT_CONTAINER" > /dev/null 2> /dev/null
then
echo "docker rmi $CURRENT_CONTAINER"
docker rmi "$CURRENT_CONTAINER"
fi
done
shopt -u nullglob #revert nullglob back to it's normal default state
else
if docker inspect "$CONTAINER_NAME" > /dev/null 2> /dev/null
then
echo "docker rmi $CONTAINER_NAME"
docker rmi $CONTAINER_NAME
fi
fi
}
build() {
CONTAINER_NAME_UPPER=$(echo "$CONTAINER_NAME" | tr '[:lower:]' '[:upper:]')
if [ "$CONTAINER_NAME_UPPER" = "ALL" ]
then
shopt -s nullglob
for file in $(find . -maxdepth 1 -iname "Dockerfile-*" -type f)
do
CURRENT_CONTAINER="sunshine-$(echo $file | cut -c 14-)"
build_container "$CURRENT_CONTAINER" "$file"
done
shopt -u nullglob #revert nullglob back to it's normal default state
else
if [[ -z "$DOCKER_FILE" ]]
then
echo "Error: if container name isn't equal to 'all', you need to specify the Dockerfile"
exit 6
fi
build_container "$CONTAINER_NAME" "$DOCKER_FILE"
fi
}
abort() {
echo "$1"
exit 10
}
compile() {
CONTAINER_NAME_UPPER=$(echo "$CONTAINER_NAME" | tr '[:lower:]' '[:upper:]')
if [ "$CONTAINER_NAME_UPPER" = "ALL" ]
then
shopt -s nullglob
# If any docker container doesn't exist, we cannot compile all of them
for file in $(find . -maxdepth 1 -iname "Dockerfile-*" -type f)
do
CURRENT_CONTAINER="sunshine-$(echo $file | cut -c 14-)"
# If container doesn't exist --> abort.
docker inspect "$CURRENT_CONTAINER" > /dev/null 2> /dev/null || abort "Error: container image [$CURRENT_CONTAINER] doesn't exist"
done
for file in $(find . -maxdepth 1 -iname "Dockerfile-*" -type f)
do
CURRENT_CONTAINER="sunshine-$(echo $file | cut -c 14-)"
echo "$PWD/build-sunshine.sh -p -n $CURRENT_CONTAINER $SUNSHINE_SOURCES"
"$PWD/build-sunshine.sh" -p -n "$CURRENT_CONTAINER" $SUNSHINE_SOURCES
done
shopt -u nullglob #revert nullglob back to it's normal default state
else
# If container exists
if docker inspect "$CONTAINER_NAME" > /dev/null 2> /dev/null
then
echo "$PWD/build-sunshine.sh -p -n $CONTAINER_NAME $SUNSHINE_SOURCES"
"$PWD/build-sunshine.sh" -p -n "$CONTAINER_NAME" $SUNSHINE_SOURCES
else
echo "Error: container image [$CONTAINER_NAME] doesn't exist"
exit 9
fi
fi
}
while getopts ":c:hn:f:s:" arg; do
case ${arg} in
s)
SUNSHINE_SOURCES="-s $OPTARG"
;;
c)
COMMAND=$(echo $OPTARG | tr '[:lower:]' '[:upper:]')
;;
n)
echo "Container name: $OPTARG"
CONTAINER_NAME="$OPTARG"
;;
f)
echo "Using Dockerfile [$OPTARG]"
DOCKER_FILE="$OPTARG"
;;
h)
usage
exit 0
;;
esac
done
echo "$0 set to $(echo $COMMAND | tr '[:upper:]' '[:lower:]')"
if [ "$COMMAND" = "BUILD" ]
then
echo "Start building..."
delete
build
echo "Done."
elif [ "$COMMAND" = "COMPILE" ]
then
echo "Start compiling..."
compile
echo "Done."
elif [ "$COMMAND" = "DELETE" ]
then
echo "Start deleting..."
delete
echo "Done."
else
echo "Unknown command [$(echo $COMMAND | tr '[:upper:]' '[:lower:]')]"
exit 4
fi

Some files were not shown because too many files have changed in this diff Show More