summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 24dd217c84afa1056933b5bac9a9d20df08f5a17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# Maintainer: Margot Prego <mopigames@proton.me>

: "${_run_unit_tests:=false}"
: "${_use_cuda:=detect}"

pkgname=helios-git
pkgver=0.6.1.r0.g4e1139e
pkgrel=1
pkgdesc='Game stream host for Selene and Moonlight OS (development version)'
arch=('x86_64' 'aarch64')
url='https://github.com/moonlight-os/helios'
license=('GPL-3.0-only')
install=helios.install

depends=(
  'avahi' 'boost-libs' 'curl' 'gcc-libs' 'libayatana-appindicator' 'libcap'
  'libdrm' 'libevdev' 'libmfx' 'libnotify' 'libpulse' 'libva' 'libx11'
  'libxcb' 'libxfixes' 'libxrandr' 'libxtst' 'miniupnpc' 'msquic' 'numactl'
  'open-iscsi' 'openssl' 'opus' 'systemd-libs' 'udev' 'usbip' 'wayland' 'which'
)
makedepends=(
  'appstream' 'appstream-glib' 'boost' 'cmake' 'desktop-file-utils' 'git'
  'ninja' 'nlohmann-json' 'nodejs' 'npm'
)
checkdepends=('xorg-server-xvfb')
optdepends=(
  'cuda: Nvidia GPU encoding support'
  'libva-mesa-driver: AMD GPU encoding support'
  'sway: Isolated virtual displays on Linux hosts without an existing Sway session'
)
provides=('helios')
conflicts=('helios' 'helios-bin')

source=(
  'helios::git+https://github.com/moonlight-os/helios.git'
  'simple-web-server::git+https://github.com/ClassicOldSong/Simple-Web-Server.git'
  'enet::git+https://github.com/cgutman/enet.git'
  'googletest::git+https://github.com/google/googletest.git'
  'inputtino::git+https://github.com/games-on-whales/inputtino.git'
  'libdisplaydevice::git+https://github.com/LizardByte/libdisplaydevice.git'
  'lunaris::git+https://github.com/moonlight-os/lunaris.git'
  'nanors::git+https://github.com/sleepybishop/nanors.git'
  'nv-codec-headers::git+https://github.com/FFmpeg/nv-codec-headers.git'
  'tray::git+https://github.com/LizardByte/tray.git'
  'wayland-protocols::git+https://gitlab.freedesktop.org/wayland/wayland-protocols.git'
  'wlr-protocols::git+https://gitlab.freedesktop.org/wlroots/wlr-protocols.git'
)
sha256sums=('SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP'
            'SKIP' 'SKIP' 'SKIP' 'SKIP')
source_x86_64=('ffmpeg-bundle::https://github.com/LizardByte/build-deps/releases/download/v2026.516.30821/Linux-x86_64-ffmpeg.tar.gz')
sha256sums_x86_64=('c32319fcc2867befe8ff3ae26b4d3a58378c3a9c1bfef9029c9969321c3bc6ec')
source_aarch64=('ffmpeg-bundle::https://github.com/LizardByte/build-deps/releases/download/v2026.516.30821/Linux-aarch64-ffmpeg.tar.gz')
sha256sums_aarch64=('10b6c9440ba6178ec3b944f6c6f697253497cad5196d23a2d32d335daae0062e')

if [[ "${_use_cuda::1}" == 'd' ]] && pacman -Qi cuda &>/dev/null; then
  _use_cuda=true
fi

pkgver() {
  git -C helios describe --long --tags --abbrev=7 | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  cd helios
  git submodule init
  git config submodule.third-party/Simple-Web-Server.url "$srcdir/simple-web-server"
  git config submodule.third-party/googletest.url "$srcdir/googletest"
  git config submodule.third-party/inputtino.url "$srcdir/inputtino"
  git config submodule.third-party/libdisplaydevice.url "$srcdir/libdisplaydevice"
  git config submodule.third-party/moonlight-common-c.url "$srcdir/lunaris"
  git config submodule.third-party/nanors.url "$srcdir/nanors"
  git config submodule.third-party/nv-codec-headers.url "$srcdir/nv-codec-headers"
  git config submodule.third-party/tray.url "$srcdir/tray"
  git config submodule.third-party/wayland-protocols.url "$srcdir/wayland-protocols"
  git config submodule.third-party/wlr-protocols.url "$srcdir/wlr-protocols"
  git -c protocol.file.allow=always submodule update \
    third-party/Simple-Web-Server \
    third-party/googletest third-party/inputtino third-party/libdisplaydevice \
    third-party/moonlight-common-c third-party/nanors \
    third-party/nv-codec-headers third-party/tray \
    third-party/wayland-protocols third-party/wlr-protocols

  git -C third-party/moonlight-common-c submodule init
  git -C third-party/moonlight-common-c config submodule.enet.url "$srcdir/enet"
  git -C third-party/moonlight-common-c config submodule.nanors.url "$srcdir/nanors"
  git -C third-party/moonlight-common-c -c protocol.file.allow=always \
    submodule update enet nanors
  sed -i 's/find_package(Boost CONFIG ${BOOST_VERSION} EXACT COMPONENTS ${BOOST_COMPONENTS})/find_package(Boost CONFIG ${BOOST_VERSION} COMPONENTS ${BOOST_COMPONENTS})/' \
    cmake/dependencies/Boost_Helios.cmake
  sed -i '/^[[:space:]]*system$/d' cmake/dependencies/Boost_Helios.cmake
  sed -i \
    -e 's/find_package(Boost 1.53.0 COMPONENTS system REQUIRED)/find_package(Boost 1.53.0 REQUIRED)/' \
    -e 's/Boost::boost Boost::system/Boost::boost/' \
    third-party/Simple-Web-Server/CMakeLists.txt
}

build() {
  local current_version current_commit
  current_version="$(pkgver)"
  current_commit="$(git -C helios rev-parse HEAD)"
  export BRANCH=main
  export BUILD_VERSION="$current_version"
  export COMMIT="$current_commit"
  export CFLAGS="${CFLAGS/-Werror=format-security/}"
  export CXXFLAGS="${CXXFLAGS/-Werror=format-security/}"

  local cmake_options=(
    -S helios -B build -G Ninja -Wno-dev
    -D BOOST_USE_STATIC=OFF
    -D BUILD_DOCS=OFF
    -D BUILD_TESTS="$_run_unit_tests"
    -D BUILD_WERROR=ON
    -D CMAKE_BUILD_TYPE=None
    -D CMAKE_INSTALL_PREFIX=/usr
    -D CUDA_FAIL_ON_MISSING=OFF
    -D ENABLE_MLOS_QUIC=ON
    -D FFMPEG_PREPARED_BINARIES="$srcdir/ffmpeg"
    -D SUNSHINE_ASSETS_DIR=share/helios
    -D SUNSHINE_EXECUTABLE_PATH=/usr/bin/helios
    -D SUNSHINE_PUBLISHER_ISSUE_URL=https://github.com/moonlight-os/helios/issues
    -D SUNSHINE_PUBLISHER_NAME=AUR
    -D SUNSHINE_PUBLISHER_WEBSITE=https://aur.archlinux.org/packages/helios-git
  )

  if [[ "${_use_cuda::1}" != 't' ]]; then
    cmake_options+=(-D SUNSHINE_ENABLE_CUDA=OFF)
  fi

  cmake "${cmake_options[@]}"
  appstreamcli validate --no-net build/dev.mopigames.Helios.metainfo.xml
  appstream-util validate build/dev.mopigames.Helios.metainfo.xml
  desktop-file-validate build/dev.mopigames.Helios.desktop
  desktop-file-validate build/dev.mopigames.Helios.terminal.desktop
  cmake --build build
}

check() {
  build/helios --version
  if [[ "${_run_unit_tests::1}" == 't' ]]; then
    xvfb-run -a build/tests/test_helios --gtest_color=yes
  fi
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}