generated from LizardByte/template-base
-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update LizardByte/Sunshine to 26566cc04db12c5bc7434e480cffa025ed838bce
- Loading branch information
1 parent
0ed8a30
commit 2919939
Showing
1 changed file
with
110 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,162 @@ | ||
require "language/node" | ||
|
||
class Sunshine < Formula | ||
# conflicts_with "sunshine", because: "sunshine and sunshine-beta cannot be installed at the same time" | ||
desc "Self-hosted game stream host for Moonlight" | ||
homepage "https://app.lizardbyte.dev/Sunshine" | ||
url "https://github.com/LizardByte/Sunshine.git", | ||
tag: "v0.23.1" | ||
version "0.23.1" | ||
tag: "v2025.118.151840" | ||
version "2025.118.151840" | ||
license all_of: ["GPL-3.0-only"] | ||
head "https://github.com/LizardByte/Sunshine.git", branch: "nightly" | ||
head "https://github.com/LizardByte/Sunshine.git", branch: "master" | ||
|
||
# https://docs.brew.sh/Brew-Livecheck#githublatest-strategy-block | ||
livecheck do | ||
url :stable | ||
regex(/^v?(\d+\.\d+\.\d+)$/i) | ||
strategy :github_latest do |json, regex| | ||
match = json["tag_name"]&.match(regex) | ||
next if match.blank? | ||
|
||
match[1] | ||
end | ||
end | ||
|
||
option "with-docs", "Enable docs" | ||
option "with-static-boost", "Enable static link of Boost libraries" | ||
option "without-static-boost", "Disable static link of Boost libraries" # default option | ||
|
||
depends_on "boost" => :build | ||
depends_on "cmake" => :build | ||
depends_on "doxygen" => :build | ||
depends_on "graphviz" => :build | ||
depends_on "node" => :build | ||
depends_on "pkg-config" => :build | ||
depends_on "curl" | ||
depends_on "miniupnpc" | ||
depends_on "openssl" | ||
depends_on "opus" | ||
depends_on "boost" => :recommended | ||
depends_on "icu4c" => :recommended | ||
|
||
on_linux do | ||
depends_on "avahi" | ||
depends_on "libcap" | ||
depends_on "libdrm" | ||
depends_on "libnotify" | ||
depends_on "libva" | ||
depends_on "libx11" | ||
depends_on "libxcb" | ||
depends_on "libxcursor" | ||
depends_on "libxfixes" | ||
depends_on "libxi" | ||
depends_on "libxinerama" | ||
depends_on "libxrandr" | ||
depends_on "libxtst" | ||
depends_on "numactl" | ||
depends_on "pulseaudio" | ||
depends_on "systemd" | ||
depends_on "wayland" | ||
end | ||
|
||
def install | ||
ENV["BRANCH"] = "master" | ||
ENV["BUILD_VERSION"] = "v0.23.1" | ||
ENV["COMMIT"] = "8b21db64fb8e8ffb9c24a412dbc66b7410699211" | ||
ENV["BUILD_VERSION"] = "v2025.118.151840" | ||
ENV["COMMIT"] = "26566cc04db12c5bc7434e480cffa025ed838bce" | ||
|
||
args = %W[ | ||
-DBUILD_WERROR=ON | ||
-DCMAKE_INSTALL_PREFIX=#{prefix} | ||
-DHOMEBREW_ALLOW_FETCHCONTENT=ON | ||
-DOPENSSL_ROOT_DIR=#{Formula["openssl"].opt_prefix} | ||
-DSUNSHINE_ASSETS_DIR=sunshine/assets | ||
-DSUNSHINE_BUILD_HOMEBREW=ON | ||
-DTESTS_ENABLE_PYTHON_TESTS=OFF | ||
-DSUNSHINE_ENABLE_TRAY=OFF | ||
-DSUNSHINE_PUBLISHER_NAME='LizardByte' | ||
-DSUNSHINE_PUBLISHER_WEBSITE='https://app.lizardbyte.dev' | ||
-DSUNSHINE_PUBLISHER_ISSUE_URL='https://app.lizardbyte.dev/support' | ||
] | ||
|
||
if build.with? "docs" | ||
ohai "Building docs: enabled" | ||
args << "-DBUILD_DOCS=ON" | ||
else | ||
ohai "Building docs: disabled" | ||
args << "-DBUILD_DOCS=OFF" | ||
end | ||
|
||
if build.without? "static-boost" | ||
args << "-DBOOST_USE_STATIC=OFF" | ||
ohai "Disabled statically linking Boost libraries" | ||
else | ||
args << "-DBOOST_USE_STATIC=ON" | ||
ohai "Enabled statically linking Boost libraries" | ||
|
||
unless Formula["icu4c"].any_version_installed? | ||
odie <<~EOS | ||
icu4c must be installed to link against static Boost libraries, | ||
either install icu4c or use brew install sunshine --with-static-boost instead | ||
EOS | ||
end | ||
ENV.append "CXXFLAGS", "-I#{Formula["icu4c"].opt_include}" | ||
icu4c_lib_path = Formula["icu4c"].opt_lib.to_s | ||
ENV.append "LDFLAGS", "-L#{icu4c_lib_path}" | ||
ENV["LIBRARY_PATH"] = icu4c_lib_path | ||
ohai "Linking against ICU libraries at: #{icu4c_lib_path}" | ||
end | ||
|
||
args << "-DCUDA_FAIL_ON_MISSING=OFF" if OS.linux? | ||
|
||
system "cmake", "-S", ".", "-B", "build", *std_cmake_args, *args | ||
|
||
cd "build" do | ||
system "make", "-j" | ||
system "make" | ||
system "make", "install" | ||
|
||
bin.install "tests/test_sunshine" | ||
end | ||
|
||
# codesign the binary on intel macs | ||
system "codesign", "-s", "-", "--force", "--deep", bin/"sunshine" if OS.mac? && Hardware::CPU.intel? | ||
|
||
bin.install "src_assets/linux/misc/postinst" if OS.linux? | ||
end | ||
|
||
service do | ||
run [opt_bin/"sunshine", "~/.config/sunshine/sunshine.conf"] | ||
end | ||
|
||
def caveats | ||
<<~EOS | ||
caveats_message = <<~EOS | ||
Thanks for installing Sunshine! | ||
To get started, review the documentation at: | ||
https://docs.lizardbyte.dev/projects/sunshine/en/latest/ | ||
https://docs.lizardbyte.dev/projects/sunshine | ||
EOS | ||
|
||
Sunshine can only access microphones on macOS due to system limitations. | ||
To stream system audio use "Soundflower" or "BlackHole". | ||
if OS.linux? | ||
caveats_message += <<~EOS | ||
ATTENTION: To complete installation, you must run the following command: | ||
`sudo #{bin}/postinst` | ||
EOS | ||
end | ||
|
||
Gamepads are not currently supported on macOS. | ||
EOS | ||
if OS.mac? | ||
caveats_message += <<~EOS | ||
Sunshine can only access microphones on macOS due to system limitations. | ||
To stream system audio use "Soundflower" or "BlackHole". | ||
Gamepads are not currently supported on macOS. | ||
EOS | ||
end | ||
|
||
caveats_message | ||
end | ||
|
||
test do | ||
# test that the binary runs at all | ||
system "#{bin}/sunshine", "--version" | ||
system bin/"sunshine", "--version" | ||
|
||
# run the test suite | ||
# cannot build tests with python tests because homebrew destroys the source directory | ||
system "#{bin}/test_sunshine", "--gtest_color=yes" | ||
system bin/"test_sunshine", "--gtest_color=yes" | ||
end | ||
end |