File sunshine.spec of Package sunshine
#
# spec file for package sunshine
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: sunshine
Version: 2025.731.125037
Release: 0
Summary: Server for the Moonlight game streaming client
License: GPL-3.0-only
URL: https://github.com/LizardByte/sunshine
Source0: %{name}-%{version}.tar.gz
Source1: %{name}.firewalld
Source2: %{name}-webui.firewalld
Source3: package-lock.json
Source4: node_modules.spec.inc
Source5: README.SUSE
Source10: boost_process_v1.hpp
%include %{_sourcedir}/node_modules.spec.inc
Patch0: fix-sunshine.desktop.patch
#Patch1: notification-callback-fallback.patch
BuildRequires: boost-devel >= 1.88.0
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: cmake >= 3.20
BuildRequires: doxygen
BuildRequires: fdupes
BuildRequires: firewall-macros
BuildRequires: firewalld
BuildRequires: icu
BuildRequires: ninja
BuildRequires: graphviz
BuildRequires: git
BuildRequires: hicolor-icon-theme
BuildRequires: libboost_filesystem-devel
BuildRequires: libboost_headers-devel
BuildRequires: libboost_locale-devel
BuildRequires: libboost_log-devel
BuildRequires: libboost_program_options-devel
BuildRequires: libboost_system-devel
BuildRequires: libboost_thread-devel
BuildRequires: local-npm-registry
BuildRequires: patchelf
BuildRequires: pkgconfig
BuildRequires: pkgconfig(ayatana-appindicator3-0.1)
BuildRequires: pkgconfig(gbm)
BuildRequires: pkgconfig(gl)
BuildRequires: pkgconfig(libcap)
BuildRequires: pkgconfig(libcurl)
BuildRequires: pkgconfig(libdrm)
BuildRequires: pkgconfig(libevdev)
BuildRequires: pkgconfig(libnotify)
BuildRequires: pkgconfig(libpulse)
BuildRequires: pkgconfig(libva)
BuildRequires: pkgconfig(miniupnpc)
BuildRequires: pkgconfig(nlohmann_json)
BuildRequires: pkgconfig(numa)
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(opus)
BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(udev)
BuildRequires: pkgconfig(vdpau)
BuildRequires: pkgconfig(wayland-protocols)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(xcb)
BuildRequires: pkgconfig(xfixes)
BuildRequires: pkgconfig(xinerama)
BuildRequires: pkgconfig(xrandr)
BuildRequires: pkgconfig(xtst)
Provides: bundled(libinputtino)
ExclusiveArch: aarch64 x86_64
%description
Sunshine is a self-hosted game stream host for Moonlight. It has low
latency, cloud gaming server capabilities with support for hardware
encoding on AMD, Intel, and Nvidia GPUs. Software encoding is also
available. You can connect to Sunshine from any Moonlight client on a
variety of devices. A web UI is provided for configuration and client
pairing.
%package firewalld
Summary: Firewalld service for %{name}
Supplements: (%{name} and firewalld)
BuildArch: noarch
%description firewalld
%{summary}.
%prep
%autosetup -p1
cp %{SOURCE5} .
local-npm-registry %{_sourcedir} install --include=prod --include=dev --include=optional --include=peer
sed -i 's|project(Sunshine VERSION 0.0.0|project(Sunshine VERSION %{version}|g' CMakeLists.txt
sed -i '/^set(BOOST_VERSION "1\.87\.0")$/s//set(BOOST_VERSION "1.88.0")/' cmake/dependencies/Boost_Sunshine.cmake
# Begin - boost 1.88 errors
sed -E 's&<boost/process.hpp>&"%{SOURCE10}"&' \
-i ./src/platform/common.h
sed -E 's&(namespace bp = boost::process);&\1::v1;&' \
-i ./src/platform/linux/misc.cpp
sed -E 's&<boost/process/v1.hpp>&"%{SOURCE10}"&' \
-i ./src/platform/linux/misc.cpp \
./src/process.h
# End - boost 1.88 errors
%build
export BUILD_VERSION=%{version}
%cmake \
-DBOOST_USE_STATIC=OFF \
-DBUILD_DOCS=OFF \
-DBUILD_TESTS=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DSUNSHINE_ASSETS_DIR=share/%{name} \
-DSUNSHINE_ENABLE_CUDA=OFF \
-DSUNSHINE_ENABLE_DRM=ON \
-DSUNSHINE_ENABLE_TRAY=ON \
-DSUNSHINE_ENABLE_VAAPI=ON \
-DSUNSHINE_ENABLE_WAYLAND=ON \
-DSUNSHINE_ENABLE_X11=ON \
-DSUNSHINE_EXECUTABLE_PATH=%{_bindir}/%{name} \
-DSUNSHINE_REQUIRE_TRAY=ON \
-DSUNSHINE_SYSTEM_WAYLAND_PROTOCOLS=ON \
-DTESTS_ENABLE_PYTHON_TESTS=ON
%cmake_build
%install
%cmake_install
mv %{buildroot}%{_bindir}/%{name}-%{version} %{buildroot}%{_bindir}/%{name}
install -Dm0644 %{SOURCE1} %{buildroot}%{_prefix}/lib/firewalld/services/%{name}.xml
install -Dm0644 %{SOURCE2} %{buildroot}%{_prefix}/lib/firewalld/services/%{name}-webui.xml
%fdupes %{buildroot}
install -d %{buildroot}%{_libdir}/%{name}
install -Dm 755 %{_builddir}/%{name}-%{version}/build/third-party/inputtino/liblibinputtino.so.0.1 %{buildroot}%{_libdir}/libinputtino.so.0.1
# fix libname of inputtino
patchelf --replace-needed liblibinputtino.so.0.1 libinputtino.so.0.1 %{buildroot}%{_bindir}/%{name}
patchelf --set-soname libinputtino.so.0.1 %{buildroot}%{_libdir}/libinputtino.so.0.1
# we added a soversion to libdisplaydevice, so we need to change the requirement
patchelf --replace-needed liblibdisplaydevice_common.so libdisplaydevice_common.so.0.0.0 %{buildroot}%{_bindir}/%{name}
%ldconfig_scriptlets
%check
%post -n %{name}-firewalld
%firewalld_reload
%postun -n %{name}-firewalld
%firewalld_reload
%files
%license LICENSE
%doc NOTICE README.md README.SUSE
# NOTE: %caps(cap_sys_admin+p) Capabilities required for sunshine are not set here due to openSUSE policy.
# Please request entry in /usr/share/permissions/permissions via security team if needed.
%{_bindir}/%{name}
%{_userunitdir}/%{name}.service
%{_datadir}/applications/dev.lizardbyte.app.Sunshine.desktop
%{_datadir}/applications/dev.lizardbyte.app.Sunshine.terminal.desktop
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%{_datadir}/icons/hicolor/scalable/status/%{name}-{locked,pausing,playing,tray}.svg
%{_datadir}/metainfo/dev.lizardbyte.app.Sunshine.metainfo.xml
%{_datadir}/%{name}
%{_udevrulesdir}/60-%{name}.rules
%{_libdir}/libinputtino.so.0.1
%files firewalld
%{_prefix}/lib/firewalld/services/%{name}.xml
%{_prefix}/lib/firewalld/services/%{name}-webui.xml
%changelog