sunshine: 0.23.1 -> 2025.118.151840

This commit is contained in:
Morgan Helton 2025-01-19 13:08:25 -06:00
parent d1431a523c
commit bbc455519f
No known key found for this signature in database
5 changed files with 1326 additions and 463 deletions

View File

@ -62,7 +62,7 @@ import ./make-test-python.nix (
moonlight.wait_for_console_text("Executing request.*pair") moonlight.wait_for_console_text("Executing request.*pair")
# respond to pairing request from sunshine # respond to pairing request from sunshine
sunshine.succeed("curl --fail --insecure -u sunshine:sunshine -d '{\"pin\": \"1234\"}' https://localhost:47990/api/pin") sunshine.succeed("curl --fail --insecure -u sunshine:sunshine -d '{\"pin\":\"1234\",\"name\":\"1234\"}' https://localhost:47990/api/pin")
# wait until pairing is complete # wait until pairing is complete
moonlight.wait_for_console_text("Executing request.*phrase=pairchallenge") moonlight.wait_for_console_text("Executing request.*phrase=pairchallenge")

View File

@ -1,120 +0,0 @@
From f4f1800f5e67ab59312ccf710695acf06fb4ae26 Mon Sep 17 00:00:00 2001
From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
Date: Mon, 1 Jul 2024 10:07:06 -0400
Subject: [PATCH] fix(upnp): support newer miniupnpc library (#2782)
Co-authored-by: Vithorio Polten <reach@vithor.io>
---
src/upnp.cpp | 30 +++++++++++++++---------------
src/upnp.h | 31 ++++++++++++++++++++++++++++++-
2 files changed, 45 insertions(+), 16 deletions(-)
diff --git a/src/upnp.cpp b/src/upnp.cpp
index f65bcb87..fcbaaeb5 100644
--- a/src/upnp.cpp
+++ b/src/upnp.cpp
@@ -19,19 +19,6 @@
using namespace std::literals;
namespace upnp {
- constexpr auto INET6_ADDRESS_STRLEN = 46;
-
- constexpr auto PORT_MAPPING_LIFETIME = 3600s;
- constexpr auto REFRESH_INTERVAL = 120s;
-
- constexpr auto IPv4 = 0;
- constexpr auto IPv6 = 1;
-
- using device_t = util::safe_ptr<UPNPDev, freeUPNPDevlist>;
-
- KITTY_USING_MOVE_T(urls_t, UPNPUrls, , {
- FreeUPNPUrls(&el);
- });
struct mapping_t {
struct {
@@ -59,6 +46,19 @@ namespace upnp {
return "Unknown status"sv;
}
+ /**
+ * This function is a wrapper around UPNP_GetValidIGD() that returns the status code. There is a pre-processor
+ * check to determine which version of the function to call based on the version of the MiniUPnPc library.
+ */
+ int
+ UPNP_GetValidIGDStatus(device_t &device, urls_t *urls, IGDdatas *data, std::array<char, INET6_ADDRESS_STRLEN> &lan_addr) {
+#if (MINIUPNPC_API_VERSION >= 18)
+ return UPNP_GetValidIGD(device.get(), &urls->el, data, lan_addr.data(), lan_addr.size(), nullptr, 0);
+#else
+ return UPNP_GetValidIGD(device.get(), &urls->el, data, lan_addr.data(), lan_addr.size());
+#endif
+ }
+
class deinit_t: public platf::deinit_t {
public:
deinit_t() {
@@ -109,7 +109,7 @@ namespace upnp {
IGDdatas data;
urls_t urls;
std::array<char, INET6_ADDRESS_STRLEN> lan_addr;
- auto status = UPNP_GetValidIGD(device.get(), &urls.el, &data, lan_addr.data(), lan_addr.size());
+ auto status = upnp::UPNP_GetValidIGDStatus(device, &urls, &data, lan_addr);
if (status != 1 && status != 2) {
BOOST_LOG(debug) << "No valid IPv6 IGD: "sv << status_string(status);
return false;
@@ -331,7 +331,7 @@ namespace upnp {
std::array<char, INET6_ADDRESS_STRLEN> lan_addr;
urls_t urls;
- auto status = UPNP_GetValidIGD(device.get(), &urls.el, &data, lan_addr.data(), lan_addr.size());
+ auto status = upnp::UPNP_GetValidIGDStatus(device, &urls, &data, lan_addr);
if (status != 1 && status != 2) {
BOOST_LOG(error) << status_string(status);
mapped = false;
diff --git a/src/upnp.h b/src/upnp.h
index 73fc4f79..4b2e3296 100644
--- a/src/upnp.h
+++ b/src/upnp.h
@@ -4,9 +4,38 @@
*/
#pragma once
+#include <miniupnpc/miniupnpc.h>
+
#include "platform/common.h"
namespace upnp {
+ constexpr auto INET6_ADDRESS_STRLEN = 46;
+ constexpr auto IPv4 = 0;
+ constexpr auto IPv6 = 1;
+ constexpr auto PORT_MAPPING_LIFETIME = 3600s;
+ constexpr auto REFRESH_INTERVAL = 120s;
+
+ using device_t = util::safe_ptr<UPNPDev, freeUPNPDevlist>;
+
+ KITTY_USING_MOVE_T(urls_t, UPNPUrls, , {
+ FreeUPNPUrls(&el);
+ });
+
+ /**
+ * @brief Get the valid IGD status.
+ * @param device The device.
+ * @param urls The URLs.
+ * @param data The IGD data.
+ * @param lan_addr The LAN address.
+ * @return The UPnP Status.
+ * @retval 0 No IGD found.
+ * @retval 1 A valid connected IGD has been found.
+ * @retval 2 A valid IGD has been found but it reported as not connected.
+ * @retval 3 An UPnP device has been found but was not recognized as an IGD.
+ */
+ int
+ UPNP_GetValidIGDStatus(device_t &device, urls_t *urls, IGDdatas *data, std::array<char, INET6_ADDRESS_STRLEN> &lan_addr);
+
[[nodiscard]] std::unique_ptr<platf::deinit_t>
start();
-}
+} // namespace upnp
--
2.45.2

View File

@ -1,191 +0,0 @@
port of https://github.com/LizardByte/Sunshine/commit/e90b71ce62b7744bb18ffc7823b1e895786ffb0a
diff --git a/src/platform/common.h b/src/platform/common.h
index 007f7ec..498becb 100644
--- a/src/platform/common.h
+++ b/src/platform/common.h
@@ -39,13 +39,13 @@ namespace boost {
namespace filesystem {
class path;
}
- namespace process {
+ namespace process::inline v1 {
class child;
class group;
template <typename Char>
class basic_environment;
typedef basic_environment<char> environment;
- } // namespace process
+ } // namespace process::inline v1
} // namespace boost
namespace video {
struct config_t;
@@ -585,8 +585,8 @@ namespace platf {
bool
needs_encoder_reenumeration();
- boost::process::child
- run_command(bool elevated, bool interactive, const std::string &cmd, boost::filesystem::path &working_dir, const boost::process::environment &env, FILE *file, std::error_code &ec, boost::process::group *group);
+ boost::process::v1::child
+ run_command(bool elevated, bool interactive, const std::string &cmd, boost::filesystem::path &working_dir, const boost::process::v1::environment &env, FILE *file, std::error_code &ec, boost::process::v1::group *group);
enum class thread_priority_e : int {
low,
diff --git a/src/platform/linux/misc.cpp b/src/platform/linux/misc.cpp
index 980c080..49a884c 100644
--- a/src/platform/linux/misc.cpp
+++ b/src/platform/linux/misc.cpp
@@ -15,7 +15,7 @@
// lib includes
#include <arpa/inet.h>
#include <boost/asio/ip/address.hpp>
-#include <boost/process.hpp>
+#include <boost/process/v1.hpp>
#include <dlfcn.h>
#include <fcntl.h>
#include <ifaddrs.h>
@@ -269,7 +269,7 @@ namespace platf {
auto working_dir = boost::filesystem::path(std::getenv("HOME"));
std::string cmd = R"(xdg-open ")" + url + R"(")";
- boost::process::environment _env = boost::this_process::environment();
+ boost::process::v1::environment _env = boost::this_process::environment();
std::error_code ec;
auto child = run_command(false, false, cmd, working_dir, _env, nullptr, ec, nullptr);
if (ec) {
diff --git a/src/platform/macos/misc.mm b/src/platform/macos/misc.mm
index 20c2247..0415d13 100644
--- a/src/platform/macos/misc.mm
+++ b/src/platform/macos/misc.mm
@@ -23,7 +23,7 @@
#include "src/platform/common.h"
#include <boost/asio/ip/address.hpp>
-#include <boost/process.hpp>
+#include <boost/process/v1.hpp>
using namespace std::literals;
namespace fs = std::filesystem;
@@ -197,7 +197,7 @@ namespace platf {
boost::filesystem::path working_dir;
std::string cmd = R"(open ")" + url + R"(")";
- boost::process::environment _env = boost::this_process::environment();
+ boost::process::v1::environment _env = boost::this_process::environment();
std::error_code ec;
auto child = run_command(false, false, cmd, working_dir, _env, nullptr, ec, nullptr);
if (ec) {
diff --git a/src/process.cpp b/src/process.cpp
index 89dc4dc..83a73ff 100644
--- a/src/process.cpp
+++ b/src/process.cpp
@@ -40,7 +40,6 @@
namespace proc {
using namespace std::literals;
- namespace bp = boost::process;
namespace pt = boost::property_tree;
proc_t proc;
@@ -68,7 +67,7 @@ namespace proc {
* @param exit_timeout The timeout to wait for the process group to gracefully exit.
*/
void
- terminate_process_group(bp::child &proc, bp::group &group, std::chrono::seconds exit_timeout) {
+ terminate_process_group(boost::process::v1::child &proc, boost::process::v1::group &group, std::chrono::seconds exit_timeout) {
if (group.valid() && platf::process_group_running((std::uintptr_t) group.native_handle())) {
if (exit_timeout.count() > 0) {
// Request processes in the group to exit gracefully
@@ -109,7 +108,7 @@ namespace proc {
}
boost::filesystem::path
- find_working_directory(const std::string &cmd, bp::environment &env) {
+ find_working_directory(const std::string &cmd, boost::process::v1::environment &env) {
// Parse the raw command string into parts to get the actual command portion
#ifdef _WIN32
auto parts = boost::program_options::split_winmain(cmd);
@@ -131,7 +130,7 @@ namespace proc {
// If the cmd path is not an absolute path, resolve it using our PATH variable
boost::filesystem::path cmd_path(parts.at(0));
if (!cmd_path.is_absolute()) {
- cmd_path = boost::process::search_path(parts.at(0));
+ cmd_path = boost::process::v1::search_path(parts.at(0));
if (cmd_path.empty()) {
BOOST_LOG(error) << "Unable to find executable ["sv << parts.at(0) << "]. Is it in your PATH?"sv;
return boost::filesystem::path();
@@ -311,8 +310,8 @@ namespace proc {
std::error_code ec;
placebo = false;
terminate_process_group(_process, _process_group, _app.exit_timeout);
- _process = bp::child();
- _process_group = bp::group();
+ _process = boost::process::v1::child();
+ _process_group = boost::process::v1::group();
for (; _app_prep_it != _app_prep_begin; --_app_prep_it) {
auto &cmd = *(_app_prep_it - 1);
@@ -413,7 +412,7 @@ namespace proc {
}
std::string
- parse_env_val(bp::native_environment &env, const std::string_view &val_raw) {
+ parse_env_val(boost::process::v1::native_environment &env, const std::string_view &val_raw) {
auto pos = std::begin(val_raw);
auto dollar = std::find(pos, std::end(val_raw), '$');
diff --git a/src/process.h b/src/process.h
index c875499..0344c1c 100644
--- a/src/process.h
+++ b/src/process.h
@@ -11,7 +11,7 @@
#include <optional>
#include <unordered_map>
-#include <boost/process.hpp>
+#include <boost/process/v1.hpp>
#include "config.h"
#include "platform/common.h"
@@ -68,7 +68,7 @@ namespace proc {
KITTY_DEFAULT_CONSTR_MOVE_THROW(proc_t)
proc_t(
- boost::process::environment &&env,
+ boost::process::v1::environment &&env,
std::vector<ctx_t> &&apps):
_app_id(0),
_env(std::move(env)),
@@ -99,7 +99,7 @@ namespace proc {
private:
int _app_id;
- boost::process::environment _env;
+ boost::process::v1::environment _env;
std::vector<ctx_t> _apps;
ctx_t _app;
std::chrono::steady_clock::time_point _app_launch_time;
@@ -107,8 +107,8 @@ namespace proc {
// If no command associated with _app_id, yet it's still running
bool placebo {};
- boost::process::child _process;
- boost::process::group _process_group;
+ boost::process::v1::child _process;
+ boost::process::v1::group _process_group;
file_t _pipe;
std::vector<cmd_t>::const_iterator _app_prep_it;
diff --git a/src/system_tray.cpp b/src/system_tray.cpp
index c34c3d7..17e1c0f 100644
--- a/src/system_tray.cpp
+++ b/src/system_tray.cpp
@@ -33,7 +33,7 @@
// lib includes
#include "tray/tray.h"
#include <boost/filesystem.hpp>
- #include <boost/process/environment.hpp>
+ #include <boost/process/v1/environment.hpp>
// local includes
#include "confighttp.h"

File diff suppressed because it is too large Load Diff

View File

@ -45,6 +45,7 @@
libappindicator, libappindicator,
libnotify, libnotify,
miniupnpc, miniupnpc,
nlohmann_json,
config, config,
cudaSupport ? config.cudaSupport, cudaSupport ? config.cudaSupport,
cudaPackages ? { }, cudaPackages ? { },
@ -54,31 +55,21 @@ let
in in
stdenv'.mkDerivation rec { stdenv'.mkDerivation rec {
pname = "sunshine"; pname = "sunshine";
version = "0.23.1"; version = "2025.118.151840";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "LizardByte"; owner = "LizardByte";
repo = "Sunshine"; repo = "Sunshine";
rev = "v${version}"; tag = "v${version}";
hash = "sha256-D5ee5m2ZTKVqZDH07nzJuFEbZBQ4xW7m4nYnJQe0EaA="; hash = "sha256-sTZUHc1385qOmy2w3fjItIidCxnWeEjAaOFxfLBB65c=";
fetchSubmodules = true; fetchSubmodules = true;
}; };
patches = [
# fix(upnp): support newer miniupnpc library (#2782)
# Manually cherry-picked on to 0.23.1.
./0001-fix-upnp-support-newer-miniupnpc-library-2782.patch
# port of https://github.com/LizardByte/Sunshine/commit/e90b71ce62b7744bb18ffc7823b1e895786ffb0a
# remove on update
./boost-186.patch
];
# build webui # build webui
ui = buildNpmPackage { ui = buildNpmPackage {
inherit src version; inherit src version;
pname = "sunshine-ui"; pname = "sunshine-ui";
npmDepsHash = "sha256-9FuMtxTwrU9UIhZXQn/tmGN0IHZBdunV0cY/EElj4bA="; npmDepsHash = "sha256-sWCmx1dMEyRyuYeeuqAjHZLVnckskgQO4saFM64s4Y4=";
# use generated package-lock.json as upstream does not provide one # use generated package-lock.json as upstream does not provide one
postPatch = '' postPatch = ''
@ -145,6 +136,7 @@ stdenv'.mkDerivation rec {
libappindicator libappindicator
libnotify libnotify
miniupnpc miniupnpc
nlohmann_json
] ]
++ lib.optionals cudaSupport [ ++ lib.optionals cudaSupport [
cudaPackages.cudatoolkit cudaPackages.cudatoolkit
@ -161,12 +153,30 @@ stdenv'.mkDerivation rec {
libglvnd libglvnd
]; ];
cmakeFlags = [ cmakeFlags =
"-Wno-dev" [
# upstream tries to use systemd and udev packages to find these directories in FHS; set the paths explicitly instead "-Wno-dev"
(lib.cmakeFeature "UDEV_RULES_INSTALL_DIR" "lib/udev/rules.d") # upstream tries to use systemd and udev packages to find these directories in FHS; set the paths explicitly instead
(lib.cmakeFeature "SYSTEMD_USER_UNIT_INSTALL_DIR" "lib/systemd/user") (lib.cmakeBool "UDEV_FOUND" true)
]; (lib.cmakeBool "SYSTEMD_FOUND" true)
(lib.cmakeFeature "UDEV_RULES_INSTALL_DIR" "lib/udev/rules.d")
(lib.cmakeFeature "SYSTEMD_USER_UNIT_INSTALL_DIR" "lib/systemd/user")
(lib.cmakeBool "BOOST_USE_STATIC" false)
(lib.cmakeBool "BUILD_DOCS" false)
(lib.cmakeFeature "SUNSHINE_PUBLISHER_NAME" "nixpkgs")
(lib.cmakeFeature "SUNSHINE_PUBLISHER_WEBSITE" "https://nixos.org")
(lib.cmakeFeature "SUNSHINE_PUBLISHER_ISSUE_URL" "https://github.com/NixOS/nixpkgs/issues")
]
++ lib.optionals (!cudaSupport) [
(lib.cmakeBool "SUNSHINE_ENABLE_CUDA" false)
];
env = {
# needed to trigger CMake version configuration
BUILD_VERSION = "${version}";
BRANCH = "master";
COMMIT = "";
};
postPatch = '' postPatch = ''
# remove upstream dependency on systemd and udev # remove upstream dependency on systemd and udev
@ -174,6 +184,10 @@ stdenv'.mkDerivation rec {
--replace-fail 'find_package(Systemd)' "" \ --replace-fail 'find_package(Systemd)' "" \
--replace-fail 'find_package(Udev)' "" --replace-fail 'find_package(Udev)' ""
# don't look for npm since we build webui separately
substituteInPlace cmake/targets/common.cmake \
--replace-fail 'find_program(NPM npm REQUIRED)' ""
substituteInPlace packaging/linux/sunshine.desktop \ substituteInPlace packaging/linux/sunshine.desktop \
--subst-var-by PROJECT_NAME 'Sunshine' \ --subst-var-by PROJECT_NAME 'Sunshine' \
--subst-var-by PROJECT_DESCRIPTION 'Self-hosted game stream host for Moonlight' \ --subst-var-by PROJECT_DESCRIPTION 'Self-hosted game stream host for Moonlight' \