build(linux): add homebrew support (#2667)
This commit is contained in:
6
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
6
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
@@ -95,18 +95,18 @@ body:
|
|||||||
- Linux - deb
|
- Linux - deb
|
||||||
- Linux - Docker
|
- Linux - Docker
|
||||||
- Linux - flatpak
|
- Linux - flatpak
|
||||||
|
- Linux - Homebrew
|
||||||
- Linux - nixpkgs (Third Party)
|
- Linux - nixpkgs (Third Party)
|
||||||
- Linux - PKGBUILD
|
- Linux - PKGBUILD
|
||||||
- Linux - pkg.tar.zst
|
- Linux - pkg.tar.zst
|
||||||
- Linux - rpm
|
- Linux - rpm
|
||||||
- Linux - solus (Third Party)
|
- macOS - Homebrew
|
||||||
- macOS - dmg
|
|
||||||
- macOS - Portfile
|
- macOS - Portfile
|
||||||
- Windows - Chocolatey (Third Party)
|
- Windows - Chocolatey (Third Party)
|
||||||
- Windows - installer
|
- Windows - installer
|
||||||
- Windows - portable
|
- Windows - portable
|
||||||
- Windows - Scoop (Third Party)
|
- Windows - Scoop (Third Party)
|
||||||
- Windows - Winget (Third Party)
|
- Windows - Winget
|
||||||
- other (not listed)
|
- other (not listed)
|
||||||
- other (self built)
|
- other (self built)
|
||||||
- other (fork of this repo)
|
- other (fork of this repo)
|
||||||
|
|||||||
32
.github/workflows/CI.yml
vendored
32
.github/workflows/CI.yml
vendored
@@ -482,7 +482,7 @@ jobs:
|
|||||||
tag: ${{ needs.setup_release.outputs.release_tag }}
|
tag: ${{ needs.setup_release.outputs.release_tag }}
|
||||||
token: ${{ secrets.GH_BOT_TOKEN }}
|
token: ${{ secrets.GH_BOT_TOKEN }}
|
||||||
|
|
||||||
build_mac_brew:
|
build_homebrew:
|
||||||
needs: [setup_release]
|
needs: [setup_release]
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false # false to test all, true to fail entire job if any fail
|
fail-fast: false # false to test all, true to fail entire job if any fail
|
||||||
@@ -491,21 +491,21 @@ jobs:
|
|||||||
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
|
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
|
||||||
# while GitHub has larger macOS runners, they are not available for our repos :(
|
# while GitHub has larger macOS runners, they are not available for our repos :(
|
||||||
- os_version: "12"
|
- os_version: "12"
|
||||||
release: true
|
os_name: "macos"
|
||||||
- os_version: "13"
|
- os_version: "13"
|
||||||
|
os_name: "macos"
|
||||||
- os_version: "14"
|
- os_version: "14"
|
||||||
name: Homebrew (macOS-${{ matrix.os_version }})
|
os_name: "macos"
|
||||||
runs-on: macos-${{ matrix.os_version }}
|
- os_version: "latest"
|
||||||
|
os_name: "ubuntu"
|
||||||
|
release: true
|
||||||
|
name: Homebrew (${{ matrix.os_name }}-${{ matrix.os_version }})
|
||||||
|
runs-on: ${{ matrix.os_name }}-${{ matrix.os_version }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Dependencies Homebrew
|
|
||||||
run: |
|
|
||||||
# install dependencies using homebrew
|
|
||||||
brew install cmake
|
|
||||||
|
|
||||||
- name: Configure formula
|
- name: Configure formula
|
||||||
run: |
|
run: |
|
||||||
# variables for formula
|
# variables for formula
|
||||||
@@ -556,8 +556,20 @@ jobs:
|
|||||||
name: sunshine-homebrew
|
name: sunshine-homebrew
|
||||||
path: homebrew/
|
path: homebrew/
|
||||||
|
|
||||||
|
- name: Setup Xvfb
|
||||||
|
if: ${{ runner.os == 'Linux' }}
|
||||||
|
run: |
|
||||||
|
sudo apt-get update -y
|
||||||
|
sudo apt-get install -y \
|
||||||
|
xvfb
|
||||||
|
|
||||||
|
export DISPLAY=:1
|
||||||
|
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
|
||||||
|
|
||||||
|
echo "DISPLAY=${DISPLAY}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Validate Homebrew Formula
|
- name: Validate Homebrew Formula
|
||||||
uses: LizardByte/homebrew-release-action@v2024.609.4731
|
uses: LizardByte/homebrew-release-action@v2024.612.21058
|
||||||
with:
|
with:
|
||||||
formula_file: ${{ github.workspace }}/homebrew/sunshine.rb
|
formula_file: ${{ github.workspace }}/homebrew/sunshine.rb
|
||||||
git_email: ${{ secrets.GH_BOT_EMAIL }}
|
git_email: ${{ secrets.GH_BOT_EMAIL }}
|
||||||
|
|||||||
@@ -117,14 +117,42 @@ elseif(NOT LIBDRM_FOUND)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# evdev
|
# evdev
|
||||||
pkg_check_modules(PC_EVDEV libevdev REQUIRED)
|
pkg_check_modules(PC_EVDEV libevdev)
|
||||||
find_path(EVDEV_INCLUDE_DIR libevdev/libevdev.h
|
if(PC_EVDEV_FOUND)
|
||||||
HINTS ${PC_EVDEV_INCLUDE_DIRS} ${PC_EVDEV_INCLUDEDIR})
|
find_path(EVDEV_INCLUDE_DIR libevdev/libevdev.h
|
||||||
find_library(EVDEV_LIBRARY
|
HINTS ${PC_EVDEV_INCLUDE_DIRS} ${PC_EVDEV_INCLUDEDIR})
|
||||||
NAMES evdev libevdev)
|
find_library(EVDEV_LIBRARY
|
||||||
|
NAMES evdev libevdev)
|
||||||
|
else()
|
||||||
|
include(ExternalProject)
|
||||||
|
|
||||||
|
set(LIBEVDEV_VERSION libevdev-1.13.2)
|
||||||
|
|
||||||
|
ExternalProject_Add(libevdev
|
||||||
|
URL http://www.freedesktop.org/software/libevdev/${LIBEVDEV_VERSION}.tar.xz
|
||||||
|
PREFIX ${LIBEVDEV_VERSION}
|
||||||
|
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
|
||||||
|
BUILD_COMMAND "make"
|
||||||
|
INSTALL_COMMAND ""
|
||||||
|
)
|
||||||
|
|
||||||
|
ExternalProject_Get_Property(libevdev SOURCE_DIR)
|
||||||
|
message(STATUS "libevdev source dir: ${SOURCE_DIR}")
|
||||||
|
set(EVDEV_INCLUDE_DIR "${SOURCE_DIR}")
|
||||||
|
|
||||||
|
ExternalProject_Get_Property(libevdev BINARY_DIR)
|
||||||
|
message(STATUS "libevdev binary dir: ${BINARY_DIR}")
|
||||||
|
set(EVDEV_LIBRARY "${BINARY_DIR}/libevdev/.libs/libevdev.a")
|
||||||
|
|
||||||
|
# compile libevdev before sunshine
|
||||||
|
set(SUNSHINE_TARGET_DEPENDENCIES ${SUNSHINE_TARGET_DEPENDENCIES} libevdev)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(EVDEV_INCLUDE_DIR AND EVDEV_LIBRARY)
|
if(EVDEV_INCLUDE_DIR AND EVDEV_LIBRARY)
|
||||||
include_directories(SYSTEM ${EVDEV_INCLUDE_DIR})
|
include_directories(SYSTEM ${EVDEV_INCLUDE_DIR})
|
||||||
list(APPEND PLATFORM_LIBRARIES ${EVDEV_LIBRARY})
|
list(APPEND PLATFORM_LIBRARIES ${EVDEV_LIBRARY})
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Couldn't find or fetch libevdev")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# vaapi
|
# vaapi
|
||||||
@@ -226,7 +254,7 @@ else()
|
|||||||
message(STATUS "Tray icon disabled")
|
message(STATUS "Tray icon disabled")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (${SUNSHINE_TRAY} EQUAL 0 AND SUNSHINE_REQUIRE_TRAY)
|
if(${SUNSHINE_ENABLE_TRAY} AND ${SUNSHINE_TRAY} EQUAL 0 AND SUNSHINE_REQUIRE_TRAY)
|
||||||
message(FATAL_ERROR "Tray icon is required")
|
message(FATAL_ERROR "Tray icon is required")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -253,5 +281,4 @@ list(APPEND PLATFORM_LIBRARIES
|
|||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
SYSTEM
|
SYSTEM
|
||||||
"${CMAKE_SOURCE_DIR}/third-party/nv-codec-headers/include"
|
|
||||||
"${CMAKE_SOURCE_DIR}/third-party/glad/include")
|
"${CMAKE_SOURCE_DIR}/third-party/glad/include")
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ if(NOT DEFINED FFMPEG_PREPARED_BINARIES)
|
|||||||
set(FFMPEG_PLATFORM_LIBRARIES mfplat ole32 strmiids mfuuid vpl)
|
set(FFMPEG_PLATFORM_LIBRARIES mfplat ole32 strmiids mfuuid vpl)
|
||||||
elseif(UNIX AND NOT APPLE)
|
elseif(UNIX AND NOT APPLE)
|
||||||
set(FFMPEG_PLATFORM_LIBRARIES numa va va-drm va-x11 vdpau X11)
|
set(FFMPEG_PLATFORM_LIBRARIES numa va va-drm va-x11 vdpau X11)
|
||||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
# TODO: remove mfx, it's not used and deprecated
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND NOT SUNSHINE_BUILD_HOMEBREW)
|
||||||
list(APPEND FFMPEG_PLATFORM_LIBRARIES mfx)
|
list(APPEND FFMPEG_PLATFORM_LIBRARIES mfx)
|
||||||
set(CPACK_DEB_PLATFORM_PACKAGE_DEPENDS "libmfx1,")
|
set(CPACK_DEB_PLATFORM_PACKAGE_DEPENDS "libmfx1,")
|
||||||
set(CPACK_RPM_PLATFORM_PACKAGE_REQUIRES "intel-mediasdk >= 22.3.0,")
|
set(CPACK_RPM_PLATFORM_PACKAGE_REQUIRES "intel-mediasdk >= 22.3.0,")
|
||||||
|
|||||||
@@ -20,14 +20,13 @@ option(CUDA_INHERIT_COMPILE_OPTIONS
|
|||||||
your IDE throws errors about unknown flags after running cmake." ON)
|
your IDE throws errors about unknown flags after running cmake." ON)
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
# technically, the homebrew build could be on linux as well... no idea if it would actually work
|
|
||||||
option(SUNSHINE_BUILD_HOMEBREW
|
option(SUNSHINE_BUILD_HOMEBREW
|
||||||
"Enable a Homebrew build." OFF)
|
"Enable a Homebrew build." OFF)
|
||||||
|
option(SUNSHINE_CONFIGURE_HOMEBREW
|
||||||
|
"Configure Homebrew formula. Recommended to use with SUNSHINE_CONFIGURE_ONLY" OFF)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
option(SUNSHINE_CONFIGURE_HOMEBREW
|
|
||||||
"Configure macOS Homebrew formula. Recommended to use with SUNSHINE_CONFIGURE_ONLY" OFF)
|
|
||||||
option(SUNSHINE_CONFIGURE_PORTFILE
|
option(SUNSHINE_CONFIGURE_PORTFILE
|
||||||
"Configure macOS Portfile. Recommended to use with SUNSHINE_CONFIGURE_ONLY" OFF)
|
"Configure macOS Portfile. Recommended to use with SUNSHINE_CONFIGURE_ONLY" OFF)
|
||||||
option(SUNSHINE_PACKAGE_MACOS
|
option(SUNSHINE_PACKAGE_MACOS
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
if (APPLE)
|
if(UNIX)
|
||||||
|
if(${SUNSHINE_CONFIGURE_HOMEBREW})
|
||||||
|
configure_file(packaging/sunshine.rb sunshine.rb @ONLY)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
if(${SUNSHINE_CONFIGURE_PORTFILE})
|
if(${SUNSHINE_CONFIGURE_PORTFILE})
|
||||||
configure_file(packaging/macos/Portfile Portfile @ONLY)
|
configure_file(packaging/macos/Portfile Portfile @ONLY)
|
||||||
endif()
|
endif()
|
||||||
if(${SUNSHINE_CONFIGURE_HOMEBREW})
|
elseif(UNIX)
|
||||||
configure_file(packaging/macos/sunshine.rb sunshine.rb @ONLY)
|
|
||||||
endif()
|
|
||||||
elseif (UNIX)
|
|
||||||
# configure the .desktop file
|
# configure the .desktop file
|
||||||
if(${SUNSHINE_BUILD_APPIMAGE})
|
if(${SUNSHINE_BUILD_APPIMAGE})
|
||||||
configure_file(packaging/linux/AppImage/sunshine.desktop sunshine.desktop @ONLY)
|
configure_file(packaging/linux/AppImage/sunshine.desktop sunshine.desktop @ONLY)
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
# this file will also load platform specific macros
|
# this file will also load platform specific macros
|
||||||
|
|
||||||
add_executable(sunshine ${SUNSHINE_TARGET_FILES})
|
add_executable(sunshine ${SUNSHINE_TARGET_FILES})
|
||||||
|
foreach(dep ${SUNSHINE_TARGET_DEPENDENCIES})
|
||||||
|
add_dependencies(sunshine ${dep}) # compile these before sunshine
|
||||||
|
endforeach()
|
||||||
|
|
||||||
# platform specific target definitions
|
# platform specific target definitions
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
|||||||
@@ -168,6 +168,18 @@ Install
|
|||||||
flatpak run --command=remove-additional-install.sh dev.lizardbyte.sunshine
|
flatpak run --command=remove-additional-install.sh dev.lizardbyte.sunshine
|
||||||
flatpak uninstall --delete-data dev.lizardbyte.sunshine
|
flatpak uninstall --delete-data dev.lizardbyte.sunshine
|
||||||
|
|
||||||
|
.. tab:: Homebrew
|
||||||
|
|
||||||
|
.. important:: The Homebrew package is experimental.
|
||||||
|
|
||||||
|
#. Install `Homebrew <https://docs.brew.sh/Installation>`__
|
||||||
|
#. Update the Homebrew sources and install Sunshine.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
brew tap LizardByte/homebrew
|
||||||
|
brew install sunshine
|
||||||
|
|
||||||
.. tab:: RPM Package
|
.. tab:: RPM Package
|
||||||
|
|
||||||
#. Add `rpmfusion` repositories by running the following code.
|
#. Add `rpmfusion` repositories by running the following code.
|
||||||
|
|||||||
@@ -9,6 +9,18 @@ class @PROJECT_NAME@ < Formula
|
|||||||
license all_of: ["GPL-3.0-only"]
|
license all_of: ["GPL-3.0-only"]
|
||||||
head "@GITHUB_CLONE_URL@", branch: "@GITHUB_DEFAULT_BRANCH@"
|
head "@GITHUB_CLONE_URL@", branch: "@GITHUB_DEFAULT_BRANCH@"
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
depends_on "boost" => :build
|
depends_on "boost" => :build
|
||||||
depends_on "cmake" => :build
|
depends_on "cmake" => :build
|
||||||
depends_on "node" => :build
|
depends_on "node" => :build
|
||||||
@@ -18,6 +30,26 @@ class @PROJECT_NAME@ < Formula
|
|||||||
depends_on "openssl"
|
depends_on "openssl"
|
||||||
depends_on "opus"
|
depends_on "opus"
|
||||||
|
|
||||||
|
on_linux do
|
||||||
|
depends_on "libcap"
|
||||||
|
depends_on "libdrm"
|
||||||
|
depends_on "libnotify"
|
||||||
|
depends_on "libva"
|
||||||
|
depends_on "libvdpau"
|
||||||
|
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
|
def install
|
||||||
ENV["BRANCH"] = "@GITHUB_BRANCH@"
|
ENV["BRANCH"] = "@GITHUB_BRANCH@"
|
||||||
ENV["BUILD_VERSION"] = "@BUILD_VERSION@"
|
ENV["BUILD_VERSION"] = "@BUILD_VERSION@"
|
||||||
@@ -26,18 +58,23 @@ class @PROJECT_NAME@ < Formula
|
|||||||
args = %W[
|
args = %W[
|
||||||
-DBUILD_WERROR=ON
|
-DBUILD_WERROR=ON
|
||||||
-DCMAKE_INSTALL_PREFIX=#{prefix}
|
-DCMAKE_INSTALL_PREFIX=#{prefix}
|
||||||
|
-DHOMEBREW_ALLOW_FETCHCONTENT=ON
|
||||||
-DOPENSSL_ROOT_DIR=#{Formula["openssl"].opt_prefix}
|
-DOPENSSL_ROOT_DIR=#{Formula["openssl"].opt_prefix}
|
||||||
-DSUNSHINE_ASSETS_DIR=sunshine/assets
|
-DSUNSHINE_ASSETS_DIR=sunshine/assets
|
||||||
-DSUNSHINE_BUILD_HOMEBREW=ON
|
-DSUNSHINE_BUILD_HOMEBREW=ON
|
||||||
|
-DSUNSHINE_ENABLE_TRAY=OFF
|
||||||
-DTESTS_ENABLE_PYTHON_TESTS=OFF
|
-DTESTS_ENABLE_PYTHON_TESTS=OFF
|
||||||
]
|
]
|
||||||
system "cmake", "-S", ".", "-B", "build", *std_cmake_args, *args
|
system "cmake", "-S", ".", "-B", "build", *std_cmake_args, *args
|
||||||
|
|
||||||
cd "build" do
|
cd "build" do
|
||||||
system "make", "-j"
|
system "make"
|
||||||
system "make", "install"
|
system "make", "install"
|
||||||
|
|
||||||
bin.install "tests/test_sunshine"
|
bin.install "tests/test_sunshine"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
bin.install "src_assets/linux/misc/postinst" if OS.linux?
|
||||||
end
|
end
|
||||||
|
|
||||||
service do
|
service do
|
||||||
@@ -45,17 +82,30 @@ class @PROJECT_NAME@ < Formula
|
|||||||
end
|
end
|
||||||
|
|
||||||
def caveats
|
def caveats
|
||||||
<<~EOS
|
caveats_message = <<~EOS
|
||||||
Thanks for installing @PROJECT_NAME@!
|
Thanks for installing @PROJECT_NAME@!
|
||||||
|
|
||||||
To get started, review the documentation at:
|
To get started, review the documentation at:
|
||||||
https://docs.lizardbyte.dev/projects/sunshine/en/latest/
|
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
|
EOS
|
||||||
|
|
||||||
|
if OS.linux?
|
||||||
|
caveats_message += <<~EOS
|
||||||
|
ATTENTION: To complete installation, you must run the following command:
|
||||||
|
`sudo #{bin}/postinst`
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
|
||||||
|
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
|
end
|
||||||
|
|
||||||
test do
|
test do
|
||||||
@@ -107,6 +107,11 @@ list(REMOVE_ITEM SUNSHINE_SOURCES ${CMAKE_SOURCE_DIR}/src/main.cpp)
|
|||||||
add_executable(${PROJECT_NAME}
|
add_executable(${PROJECT_NAME}
|
||||||
${TEST_SOURCES}
|
${TEST_SOURCES}
|
||||||
${SUNSHINE_SOURCES})
|
${SUNSHINE_SOURCES})
|
||||||
|
|
||||||
|
foreach(dep ${SUNSHINE_TARGET_DEPENDENCIES})
|
||||||
|
add_dependencies(${PROJECT_NAME} ${dep}) # compile these before sunshine
|
||||||
|
endforeach()
|
||||||
|
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20)
|
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20)
|
||||||
target_link_libraries(${PROJECT_NAME}
|
target_link_libraries(${PROJECT_NAME}
|
||||||
${SUNSHINE_EXTERNAL_LIBRARIES}
|
${SUNSHINE_EXTERNAL_LIBRARIES}
|
||||||
|
|||||||
Reference in New Issue
Block a user