From b989d33f03e4a22d2745e439b131eb9dff89ad3c Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Mon, 18 Sep 2023 18:14:53 -0400 Subject: [PATCH] ci: fix linux tray (#1650) --- .codeql-prebuild-cpp.sh | 3 +- .github/workflows/CI.yml | 10 +- cmake/compile_definitions/linux.cmake | 16 ++- cmake/prep/options.cmake | 1 + docker/debian-bookworm.dockerfile | 2 + docker/debian-bullseye.dockerfile | 2 + docker/fedora-37.dockerfile | 1 + docker/fedora-38.dockerfile | 1 + docker/ubuntu-20.04.dockerfile | 3 +- docker/ubuntu-22.04.dockerfile | 3 +- docs/source/building/linux.rst | 7 +- packaging/linux/Arch/PKGBUILD | 27 ++++- .../linux/flatpak/dev.lizardbyte.sunshine.yml | 102 ++++++++++++++++++ third-party/tray | 2 +- 14 files changed, 170 insertions(+), 10 deletions(-) diff --git a/.codeql-prebuild-cpp.sh b/.codeql-prebuild-cpp.sh index b4461a201b9..ba4e4016e0e 100644 --- a/.codeql-prebuild-cpp.sh +++ b/.codeql-prebuild-cpp.sh @@ -5,7 +5,7 @@ sudo apt-get install -y \ build-essential \ gcc-10 \ g++-10 \ - libappindicator3-dev \ + libayatana-appindicator3-dev \ libavdevice-dev \ libboost-filesystem-dev \ libboost-locale-dev \ @@ -16,6 +16,7 @@ sudo apt-get install -y \ libdrm-dev \ libevdev-dev \ libmfx-dev \ + libnotify-dev \ libnuma-dev \ libopus-dev \ libpulse-dev \ diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 290a978ab0a..542f9f9719d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -170,6 +170,12 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Checkout Flathub Shared Modules + uses: actions/checkout@v4 + with: + repository: flathub/shared-modules + path: build/shared-modules + - name: Setup Dependencies Linux Flatpak run: | PLATFORM_VERSION=22.08 @@ -186,6 +192,7 @@ jobs: org.freedesktop.Platform/${{ matrix.arch }}/${PLATFORM_VERSION} \ org.freedesktop.Sdk/${{ matrix.arch }}/${PLATFORM_VERSION} \ org.freedesktop.Sdk.Extension.node18/${{ matrix.arch }}/${PLATFORM_VERSION} \ + org.freedesktop.Sdk.Extension.vala/${{ matrix.arch }}/${PLATFORM_VERSION} \ " - name: Cache Flatpak build @@ -337,13 +344,14 @@ jobs: build-essential \ gcc-10 \ g++-10 \ - libappindicator3-dev \ + libayatana-appindicator3-dev \ libavdevice-dev \ libcap-dev \ libcurl4-openssl-dev \ libdrm-dev \ libevdev-dev \ libmfx-dev \ + libnotify-dev \ libnuma-dev \ libopus-dev \ libpulse-dev \ diff --git a/cmake/compile_definitions/linux.cmake b/cmake/compile_definitions/linux.cmake index c88b62b2beb..4f414745a03 100644 --- a/cmake/compile_definitions/linux.cmake +++ b/cmake/compile_definitions/linux.cmake @@ -156,13 +156,20 @@ endif() # tray icon if(${SUNSHINE_ENABLE_TRAY}) pkg_check_modules(APPINDICATOR appindicator3-0.1) - if(NOT APPINDICATOR_FOUND) + if(APPINDICATOR_FOUND) + list(APPEND SUNSHINE_DEFINITIONS TRAY_LEGACY_APPINDICATOR=1) + else() pkg_check_modules(APPINDICATOR ayatana-appindicator3-0.1) + if(APPINDICATOR_FOUND) + list(APPEND SUNSHINE_DEFINITIONS TRAY_AYATANA_APPINDICATOR=1) + endif () endif() pkg_check_modules(LIBNOTIFY libnotify) if(NOT APPINDICATOR_FOUND OR NOT LIBNOTIFY_FOUND) - message(WARNING "Missing appindicator, disabling tray icon") set(SUNSHINE_TRAY 0) + message(WARNING "Missing appindicator or libnotify, disabling tray icon") + message(STATUS "APPINDICATOR_FOUND: ${APPINDICATOR_FOUND}") + message(STATUS "LIBNOTIFY_FOUND: ${LIBNOTIFY_FOUND}") else() include_directories(SYSTEM ${APPINDICATOR_INCLUDE_DIRS} ${LIBNOTIFY_INCLUDE_DIRS}) link_directories(${APPINDICATOR_LIBRARY_DIRS} ${LIBNOTIFY_LIBRARY_DIRS}) @@ -172,6 +179,11 @@ if(${SUNSHINE_ENABLE_TRAY}) endif() else() set(SUNSHINE_TRAY 0) + message(STATUS "Tray icon disabled") +endif() + +if (${SUNSHINE_TRAY} EQUAL 0 AND SUNSHINE_REQUIRE_TRAY) + message(FATAL_ERROR "Tray icon is required") endif() list(APPEND PLATFORM_TARGET_FILES diff --git a/cmake/prep/options.cmake b/cmake/prep/options.cmake index 4cb2ef117b6..1a216d263c8 100644 --- a/cmake/prep/options.cmake +++ b/cmake/prep/options.cmake @@ -2,6 +2,7 @@ option(SUNSHINE_CONFIGURE_ONLY "Configure special files only, then exit." OFF) option(SUNSHINE_ENABLE_TRAY "Enable system tray icon. This option will be ignored on macOS." ON) +option(SUNSHINE_REQUIRE_TRAY "Require system tray icon. Fail the build if tray requirements are not met." ON) if(APPLE) option(SUNSHINE_CONFIGURE_PORTFILE diff --git a/docker/debian-bookworm.dockerfile b/docker/debian-bookworm.dockerfile index f8ccc23d215..1172d35a5e9 100644 --- a/docker/debian-bookworm.dockerfile +++ b/docker/debian-bookworm.dockerfile @@ -34,6 +34,7 @@ apt-get install -y --no-install-recommends \ cmake=3.25.* \ git \ libavdevice-dev \ + libayatana-appindicator3-dev \ libboost-filesystem-dev=1.74.* \ libboost-locale-dev=1.74.* \ libboost-log-dev=1.74.* \ @@ -42,6 +43,7 @@ apt-get install -y --no-install-recommends \ libcurl4-openssl-dev \ libdrm-dev \ libevdev-dev \ + libnotify-dev \ libnuma-dev \ libopus-dev \ libpulse-dev \ diff --git a/docker/debian-bullseye.dockerfile b/docker/debian-bullseye.dockerfile index 0ba3fdf0ce5..6d7ebdd30af 100644 --- a/docker/debian-bullseye.dockerfile +++ b/docker/debian-bullseye.dockerfile @@ -34,6 +34,7 @@ apt-get install -y --no-install-recommends \ cmake=3.18.* \ git \ libavdevice-dev \ + libayatana-appindicator3-dev \ libboost-filesystem-dev=1.74.* \ libboost-locale-dev=1.74.* \ libboost-log-dev=1.74.* \ @@ -42,6 +43,7 @@ apt-get install -y --no-install-recommends \ libcurl4-openssl-dev \ libdrm-dev \ libevdev-dev \ + libnotify-dev \ libnuma-dev \ libopus-dev \ libpulse-dev \ diff --git a/docker/fedora-37.dockerfile b/docker/fedora-37.dockerfile index 5a94623caf8..c6aa0593a6b 100644 --- a/docker/fedora-37.dockerfile +++ b/docker/fedora-37.dockerfile @@ -40,6 +40,7 @@ dnf -y install \ libcurl-devel \ libdrm-devel \ libevdev-devel \ + libnotify-devel \ libva-devel \ libvdpau-devel \ libX11-devel \ diff --git a/docker/fedora-38.dockerfile b/docker/fedora-38.dockerfile index 8df4207c635..2245ba9b9aa 100644 --- a/docker/fedora-38.dockerfile +++ b/docker/fedora-38.dockerfile @@ -40,6 +40,7 @@ dnf -y install \ libcurl-devel \ libdrm-devel \ libevdev-devel \ + libnotify-devel \ libva-devel \ libvdpau-devel \ libX11-devel \ diff --git a/docker/ubuntu-20.04.dockerfile b/docker/ubuntu-20.04.dockerfile index 1dfb69ccf0e..5634d48e0c0 100644 --- a/docker/ubuntu-20.04.dockerfile +++ b/docker/ubuntu-20.04.dockerfile @@ -34,7 +34,7 @@ apt-get install -y --no-install-recommends \ gcc-10=10.5.* \ g++-10=10.5.* \ git \ - libappindicator3-dev \ + libayatana-appindicator3-dev \ libavdevice-dev \ libboost-filesystem-dev=1.71.* \ libboost-locale-dev=1.71.* \ @@ -44,6 +44,7 @@ apt-get install -y --no-install-recommends \ libcurl4-openssl-dev \ libdrm-dev \ libevdev-dev \ + libnotify-dev \ libnuma-dev \ libopus-dev \ libpulse-dev \ diff --git a/docker/ubuntu-22.04.dockerfile b/docker/ubuntu-22.04.dockerfile index f007f26725f..c9c6b70db89 100644 --- a/docker/ubuntu-22.04.dockerfile +++ b/docker/ubuntu-22.04.dockerfile @@ -33,7 +33,7 @@ apt-get install -y --no-install-recommends \ build-essential \ cmake=3.22.* \ git \ - libappindicator3-dev \ + libayatana-appindicator3-dev \ libavdevice-dev \ libboost-filesystem-dev=1.74.* \ libboost-locale-dev=1.74.* \ @@ -43,6 +43,7 @@ apt-get install -y --no-install-recommends \ libcurl4-openssl-dev \ libdrm-dev \ libevdev-dev \ + libnotify-dev \ libnuma-dev \ libopus-dev \ libpulse-dev \ diff --git a/docs/source/building/linux.rst b/docs/source/building/linux.rst index 3099cda4375..82a3ed17462 100644 --- a/docs/source/building/linux.rst +++ b/docs/source/building/linux.rst @@ -16,6 +16,7 @@ Install Requirements build-essential \ cmake \ libavdevice-dev \ + libayatana-appindicator3-dev \ libboost-filesystem-dev \ libboost-locale-dev \ libboost-log-dev \ @@ -25,6 +26,7 @@ Install Requirements libdrm-dev \ # KMS libevdev-dev \ libmfx-dev \ # x86_64 only + libnotify-dev \ libnuma-dev \ libopus-dev \ libpulse-dev \ @@ -63,6 +65,7 @@ Install Requirements libcurl-devel \ libdrm-devel \ libevdev-devel \ + libnotify-devel \ libva-devel \ libvdpau-devel \ libX11-devel \ # X11 @@ -94,7 +97,7 @@ Install Requirements build-essential \ cmake \ g++-10 \ - libappindicator3-dev \ + libayatana-appindicator3-dev \ libavdevice-dev \ libboost-filesystem-dev \ libboost-locale-dev \ @@ -104,6 +107,7 @@ Install Requirements libdrm-dev \ # KMS libevdev-dev \ libmfx-dev \ # x86_64 only + libnotify-dev \ libnuma-dev \ libopus-dev \ libpulse-dev \ @@ -152,6 +156,7 @@ Install Requirements libdrm-dev \ # KMS libevdev-dev \ libmfx-dev \ # x86_64 only + libnotify-dev \ libnuma-dev \ libopus-dev \ libpulse-dev \ diff --git a/packaging/linux/Arch/PKGBUILD b/packaging/linux/Arch/PKGBUILD index e078c0cc09a..11b699823b0 100644 --- a/packaging/linux/Arch/PKGBUILD +++ b/packaging/linux/Arch/PKGBUILD @@ -9,8 +9,31 @@ arch=('x86_64' 'aarch64') url=@PROJECT_HOMEPAGE_URL@ license=('GPL3') -depends=('avahi' 'boost-libs' 'curl' 'libappindicator-gtk3' 'libevdev' 'libmfx' 'libpulse' 'libva' 'libvdpau' 'libx11' 'libxcb' 'libxfixes' 'libxrandr' 'libxtst' 'numactl' 'openssl' 'opus' 'udev') -makedepends=('boost' 'cmake' 'git' 'make' 'nodejs' 'npm') +depends=('avahi' + 'boost-libs' + 'curl' + 'libayatana-appindicator' + 'libevdev' + 'libmfx' + 'libnotify' + 'libpulse' + 'libva' + 'libvdpau' + 'libx11' + 'libxcb' + 'libxfixes' + 'libxrandr' + 'libxtst' + 'numactl' + 'openssl' + 'opus' + 'udev') +makedepends=('boost' + 'cmake' + 'git' + 'make' + 'nodejs' + 'npm') optdepends=('cuda: NvFBC capture support' 'libcap' 'libdrm') diff --git a/packaging/linux/flatpak/dev.lizardbyte.sunshine.yml b/packaging/linux/flatpak/dev.lizardbyte.sunshine.yml index 4528e7def9a..be1ae8adbf2 100644 --- a/packaging/linux/flatpak/dev.lizardbyte.sunshine.yml +++ b/packaging/linux/flatpak/dev.lizardbyte.sunshine.yml @@ -5,6 +5,7 @@ runtime-version: "22.08" sdk: org.freedesktop.Sdk sdk-extensions: - org.freedesktop.Sdk.Extension.node18 + - org.freedesktop.Sdk.Extension.vala command: sunshine separate-locales: false finish-args: @@ -27,6 +28,10 @@ cleanup: - /lib/*.a - /share/man +build-options: + append-path: /usr/lib/sdk/vala/bin + prepend-ld-library-path: /usr/lib/sdk/vala/lib + modules: - name: boost disabled: false @@ -88,6 +93,79 @@ modules: - for n in $(cat patches/series); do if [[ $n != "#"* ]]; then patch -Np1 -i "patches/$n" -d .; fi; done - autoreconf -ivf + # yamllint disable-line rule:line-length + # https://github.com/flathub/org.localsend.localsend_app/blob/7465669c22a2a4fc35e707e1e4e7e882772adc0e/org.localsend.localsend_app.yml#L27-L106 + # https://github.com/flathub/app.vup.Vup/blob/8c5073c7c5b8f24805013abc85a0860ca2439396/app.vup.Vup.yaml#L30-L78 + - name: libayatana-appindicator + buildsystem: cmake-ninja + config-opts: + - -DENABLE_BINDINGS_MONO=NO + - -DENABLE_BINDINGS_VALA=NO + modules: + - shared-modules/intltool/intltool-0.51.json + - name: libdbusmenu-gtk3 # Dependency of libayatana-appindicator + buildsystem: autotools + build-options: + cflags: -Wno-error + env: + HAVE_VALGRIND_FALSE: '#' + HAVE_VALGRIND_TRUE: '' + config-opts: + - --with-gtk=3 + - --disable-dumper + - --disable-static + - --disable-tests + - --disable-gtk-doc + - --enable-introspection=no + - --disable-vala + sources: + - type: archive + url: https://launchpad.net/libdbusmenu/16.04/16.04.0/+download/libdbusmenu-16.04.0.tar.gz + sha256: b9cc4a2acd74509435892823607d966d424bd9ad5d0b00938f27240a1bfa878a + cleanup: + - /include + - /libexec + - /lib/pkgconfig + - /lib/*.la + - /share/doc + - /share/libdbusmenu + - /share/gtk-doc + - /share/gir-1.0 + - name: ayatana-ido + buildsystem: cmake-ninja + sources: + - type: git + url: https://github.com/AyatanaIndicators/ayatana-ido.git + tag: 0.10.1 + commit: 13402a2cc4616b4b5f4244413599e635fcfc1401 + x-checker-data: + type: anitya + project-id: 18445 + tag-template: $version + stable-only: true + - name: libayatana-indicator + buildsystem: cmake-ninja + sources: + - type: git + url: https://github.com/AyatanaIndicators/libayatana-indicator.git + tag: 0.9.3 + commit: a62e8ca13040554a8fc2536ce7e6aa888c5729d9 + x-checker-data: + type: anitya + project-id: 18447 + tag-template: $version + stable-only: true + sources: + - type: git + url: https://github.com/AyatanaIndicators/libayatana-appindicator.git + tag: 0.5.92 + commit: d214fe3e7a6b1ba8faea68d70586310b34dc643c + x-checker-data: + type: anitya + project-id: 18446 + tag-template: $version + stable-only: true + - name: libevdev disabled: false buildsystem: meson @@ -107,6 +185,30 @@ modules: commands: - for n in $(cat patches/series); do if [[ $n != "#"* ]]; then patch -Np1 -i "patches/$n" -d .; fi; done + - name: libnotify + buildsystem: meson + config-opts: + - -Dtests=false + - -Dintrospection=disabled + - -Dman=false + - -Dgtk_doc=false + - -Ddocbook_docs=disabled + sources: + - type: archive + url: https://download.gnome.org/sources/libnotify/0.8/libnotify-0.8.2.tar.xz + sha256: c5f4ed3d1f86e5b118c76415aacb861873ed3e6f0c6b3181b828cf584fc5c616 + x-checker-data: + type: gnome + name: libnotify + stable-only: true + - type: archive + url: https://download.gnome.org/sources/gnome-common/3.18/gnome-common-3.18.0.tar.xz + sha256: 22569e370ae755e04527b76328befc4c73b62bfd4a572499fde116b8318af8cf + x-checker-data: + type: gnome + name: gnome-common + stable-only: true + - name: intel-mediasdk disabled: false buildsystem: cmake diff --git a/third-party/tray b/third-party/tray index 2921d9628e1..0b1aa15dbc7 160000 --- a/third-party/tray +++ b/third-party/tray @@ -1 +1 @@ -Subproject commit 2921d9628e150c29f6e9f2ad86fd48b842aad5ca +Subproject commit 0b1aa15dbc7bdfaeb2c3a7551e0117f603fa4d0f