diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 5e1deb32905..6414c4b2588 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -601,12 +601,14 @@ jobs: branch="${{ github.ref_name }}" commit=${{ github.sha }} default_branch="${{ github.event.repository.default_branch }}" + is_pr=OFF else echo "This is a PR event" clone_url=${{ github.event.pull_request.head.repo.clone_url }} branch="${{ github.event.pull_request.head.ref }}" commit=${{ github.event.pull_request.head.sha }} default_branch="${{ github.event.pull_request.head.repo.default_branch }}" + is_pr=ON fi echo "Branch: ${branch}" echo "Clone URL: ${clone_url}" @@ -620,6 +622,7 @@ jobs: -DGITHUB_CLONE_URL="${clone_url}" \ -DGITHUB_DEFAULT_BRANCH="${default_branch}" \ -DSUNSHINE_CONFIGURE_HOMEBREW=ON \ + -DSUNSHINE_HOMEBREW_PR=is_pr \ -DSUNSHINE_CONFIGURE_ONLY=ON \ .. cd .. diff --git a/cmake/prep/special_package_configuration.cmake b/cmake/prep/special_package_configuration.cmake index 17e724c90d0..a9731b6ec7c 100644 --- a/cmake/prep/special_package_configuration.cmake +++ b/cmake/prep/special_package_configuration.cmake @@ -3,7 +3,11 @@ if (APPLE) configure_file(packaging/macos/Portfile Portfile @ONLY) endif() if(${SUNSHINE_CONFIGURE_HOMEBREW}) - configure_file(packaging/macos/sunshine.rb sunshine.rb @ONLY) + if(${SUNSHINE_HOMEBREW_PR}) + configure_file(packaging/macos/sunshine_pr.rb sunshine.rb @ONLY) + else() + configure_file(packaging/macos/sunshine.rb sunshine.rb @ONLY) + endif() endif() elseif (UNIX) # configure the .desktop file diff --git a/packaging/macos/sunshine_pr.rb b/packaging/macos/sunshine_pr.rb new file mode 100644 index 00000000000..8cc3b88c061 --- /dev/null +++ b/packaging/macos/sunshine_pr.rb @@ -0,0 +1,68 @@ +require "language/node" + +class @PROJECT_NAME@ < Formula + desc "@PROJECT_DESCRIPTION@" + homepage "@PROJECT_HOMEPAGE_URL@" + url "@GITHUB_CLONE_URL@", branch: "@GITHUB_BRANCH@" + version "@PROJECT_VERSION@" + license all_of: ["GPL-3.0-only"] + head "@GITHUB_CLONE_URL@", branch: "@GITHUB_DEFAULT_BRANCH@" + + depends_on "boost" => :build + depends_on "cmake" => :build + depends_on "node" => :build + depends_on "pkg-config" => :build + depends_on "curl" + depends_on "miniupnpc" + depends_on "openssl" + depends_on "opus" + + def install + ENV["BRANCH"] = "@GITHUB_BRANCH@" + ENV["BUILD_VERSION"] = "@BUILD_VERSION@" + ENV["COMMIT"] = "@GITHUB_COMMIT@" + + args = %W[ + -DBUILD_WERROR=ON + -DCMAKE_INSTALL_PREFIX=#{prefix} + -DOPENSSL_ROOT_DIR=#{Formula["openssl"].opt_prefix} + -DSUNSHINE_ASSETS_DIR=sunshine/assets + -DSUNSHINE_BUILD_HOMEBREW=ON + -DTESTS_ENABLE_PYTHON_TESTS=OFF + ] + system "cmake", "-S", ".", "-B", "build", *std_cmake_args, *args + + cd "build" do + system "make", "-j" + system "make", "install" + bin.install "tests/test_sunshine" + end + end + + service do + run [opt_bin/"sunshine", "~/.config/sunshine/sunshine.conf"] + end + + def caveats + <<~EOS + Thanks for installing @PROJECT_NAME@! + + To get started, review the documentation at: + https://docs.lizardbyte.dev/projects/sunshine/en/latest/ + + 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 + + test do + # test that the binary runs at all + 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" + end +end