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.404.171304
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
Source99: get-sources.sh
%include %{_sourcedir}/node_modules.spec.inc
BuildRequires: boost-devel >= 1.86.0
BuildRequires: cmake >= 3.20
BuildRequires: doxygen
BuildRequires: fdupes
BuildRequires: firewall-macros
BuildRequires: firewalld
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: git-core
BuildRequires: graphviz
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(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
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
%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
%post -n %{name}-firewalld
%firewalld_reload
%postun -n %{name}-firewalld
%firewalld_reload
%files
%license LICENSE
%doc NOTICE README.md README.SUSE
%caps(cap_sys_admin+p) %{_bindir}/%{name}
%{_userunitdir}/%{name}.service
%{_datadir}/applications/%{name}.desktop
%{_datadir}/applications/%{name}_terminal.desktop
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%{_datadir}/icons/hicolor/scalable/status/%{name}-{locked,pausing,playing,tray}.svg
%{_datadir}/metainfo/%{name}.appdata.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