summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b710b369a61710b4ab09baf9878cd44a041e5049 (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
# Maintainer: Grey Christoforo <first name at last name dot net>

pkgname=sunshine-git
pkgver=2024.713.205505.r0.g18e7dfb
pkgrel=1
pkgdesc="Game Stream server for Moonlight, latest git"
arch=('x86_64')
url=https://github.com/LizardByte/Sunshine
license=('GPL3')
install=sunshine-git.install

depends=(
avahi
boost-libs
curl
libayatana-appindicator
libevdev
libmfx
libnotify
libpulse
libva
libvdpau
libx11
libxcb
libxfixes
libxrandr
libxtst
miniupnpc
numactl
openssl
opus
udev
)
makedepends=(
git
boost
cmake
ninja
nodejs
npm
)
optdepends=(
'cuda: NvFBC capture support'
'libcap'
'libdrm'
)

provides=(sunshine)
conflicts=(sunshine sunshine-nox)

source=(
git+https://github.com/LizardByte/Sunshine.git#branch=master
git+https://github.com/moonlight-stream/moonlight-common-c.git
git+https://gitlab.com/eidheim/Simple-Web-Server.git
git+https://github.com/LizardByte/Virtual-Gamepad-Emulation-Client.git
git+https://github.com/miniupnp/miniupnp.git
git+https://github.com/FFmpeg/nv-codec-headers.git
git+https://github.com/michaeltyson/TPCircularBuffer.git
git+https://github.com/LizardByte/build-deps.git
git+https://github.com/sleepybishop/nanors.git
git+https://github.com/cgutman/enet.git
)

sha256sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP')

pkgver() {
  cd Sunshine
  ( set -o pipefail
    git describe --long --tags --abbrev=7 | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
  )
}

prepare() {
  cd Sunshine
  rm -f third-party/ffmpeg-windows-x86_64
  rm -f third-party/ffmpeg-macos-x86_64
  rm -f third-party/ffmpeg-macos-aarch64
  rm -f third-party/ffmpeg-linux-aarch64
  git submodule init
  git config submodule.third-party/moonlight-common-c.url "${srcdir}/moonlight-common-c"
  git config submodule.third-party/Simple-Web-Server.url "${srcdir}/Simple-Web-Server"
  git config submodule.third-party/ViGEmClient.url "${srcdir}/Virtual-Gamepad-Emulation-Client"
  git config submodule.third-party/miniupnp.url "${srcdir}/miniupnp"
  git config submodule.third-party/nv-codec-headers.url "${srcdir}/nv-codec-headers"
  git config submodule.third-party/TPCircularBuffer.url "${srcdir}/TPCircularBuffer"
  git config submodule.third-party/ffmpeg-linux-x86_64.url "${srcdir}/build-deps"
  git config submodule.third-party/nanors.url "${srcdir}/nanors"
  git -c protocol.file.allow=always submodule update

  pushd third-party/moonlight-common-c
  git submodule init
  git config submodule.enet.url "${srcdir}/enet"
  git -c protocol.file.allow=always submodule update
  popd

  # OK if this patch fails, probably means it's been upstreamed
  for patch in "${source[@]}"; do
    if [[ "$patch" == *.patch ]]; then
      patch -Np1 -i "$srcdir"/"$patch" || true
    fi
  done
}

build() {
  pushd Sunshine
  npm install
  popd

  export CFLAGS="${CFLAGS/-Werror=format-security/}"
  export CXXFLAGS="${CXXFLAGS/-Werror=format-security/}"

  cmake -B build_dir -S Sunshine -W no-dev -G Ninja \
    -D CMAKE_BUILD_TYPE=None \
    -D SUNSHINE_ENABLE_CUDA=1 \
    -D SUNSHINE_ENABLE_X11=1 \
    -D CMAKE_INSTALL_PREFIX=/usr \
    -D SUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine \
    -D SUNSHINE_ASSETS_DIR="share/sunshine" \
    -D BUILD_DOCS=0 # docs require doxygen, don't want to bother

  cmake --build build_dir
}

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