summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e708c0118a2f65807fccfef40c77544dede06307 (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
147
148
149
150
151
152
153
154
155
156
157
158
159
# vim:ts=2:sw=2:expandtab
# Maintainer: peelz <peelz.dev+arch@gmail.com>

_commit="81a46c2ea50ef7699a338795352ee8addece19fe"
_solarxr_commit="5d572629c94f895574162225ec69443705ce35af"
_flatbuffers_commit="203241ed3275625c8a25c4a1e7b86e3c0289c488"
_openvr_commit="91825305130f446f82054c1ec3d416321ace0072"
_pkgname="slimevr-server"
pkgbase="${_pkgname}"
pkgname=(
  "slimevr-server"
  "slimevr-gui"
  "slimevr-bindings-provider"
)
pkgver="20.1.0"
pkgrel="2"
pkgdesc="Server for SlimeVR Full Body Tracking System"
arch=("x86_64")
url="https://github.com/SlimeVR/SlimeVR-Server"
license=("MIT" "Apache-2.0")
makedepends=(
  "git"
  "java-runtime-headless-openjdk=17"
  "pnpm"
  "npm"
  "asar"
  "electron"
  "cmake"
  "ninja"
)
depends=()
source=(
  "slimevr-server::git+${url}.git#commit=${_commit}"
  "flatbuffers::git+https://github.com/google/flatbuffers.git#commit=${_flatbuffers_commit}"
  "openvr::git+https://github.com/ValveSoftware/openvr.git#commit=${_openvr_commit}"
  "solarxr-protocol::git+https://github.com/SlimeVR/SolarXR-Protocol.git#commit=${_solarxr_commit}"
  "slimevr-gui-bin"
  "slimevr-server-bin"
  "slimevr-server.service"
  "slimevr.desktop"
  "argv-patch.js"
)
sha512sums=(
  "SKIP"
  "SKIP"
  "SKIP"
  "SKIP"
  "SKIP"
  "SKIP"
  "SKIP"
  "SKIP"
  "SKIP"
)
options+=(!lto)

prepare() {
  (
    cd "${srcdir}/slimevr-server"
    git config submodule.solarxr-protocol.url "${srcdir}/solarxr-protocol"
    git config submodule.svr-bindings-provider/openvr.url "${srcdir}/openvr"
    git -c protocol.allow=never -c protocol.file.allow=always submodule update --recursive
    git -C solarxr-protocol config submodule.flatbuffers.url "${srcdir}/flatbuffers"
    git -c protocol.allow=never -c protocol.file.allow=always submodule update --recursive
  )
}

build() {
  cd "${srcdir}/slimevr-server"

  (
    pnpm install
    cd gui
    pnpm build
    pnpm package --dir \
      -c.electronDist="/usr/lib/electron" \
      -c.electronVersion="$(cat /usr/lib/electron/version)"
  )

  (
    export JAVA_HOME=/usr/lib/jvm/java-17-openjdk
    ./gradlew shadowJar
  )

  (
    cd bindings-provider
    cmake . -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
    cmake --build build
  )
}

package_slimevr-gui() {
  depends+=(
    "electron"
    "nodejs"
  )
  pkgdesc="GUI for SlimeVR Full Body Tracking System"

  install -Dm755 \
    "${srcdir}/slimevr-gui-bin" \
    "${pkgdir}/usr/bin/slimevr"

  install -Dm644 \
    "${srcdir}/slimevr-server/gui/electron/resources/icons/icon.svg" \
    "${pkgdir}/usr/share/icons/hicolor/scalable/apps/slimevr.svg"

  install -Dm644 \
    "${srcdir}/slimevr.desktop" \
    -t "${pkgdir}/usr/share/applications"

  install -Dm644 \
    "${srcdir}/argv-patch.js" \
    -t "${pkgdir}/usr/lib/slimevr"

  install -dm755 "${pkgdir}/usr/lib/slimevr"
  asar extract \
    "${srcdir}/slimevr-server/gui/dist/artifacts/linux/linux-unpacked/resources/app.asar" \
    "${pkgdir}/usr/lib/slimevr"
}

package_slimevr-server() {
  depends+=(
    "java-runtime-headless-openjdk=17"
  )
  pkgdesc="Server for SlimeVR Full Body Tracking System"

  install -Dm755 \
    "${srcdir}/slimevr-server-bin" \
    "${pkgdir}/usr/bin/slimevr-server"

  install -Dm644 \
    "${srcdir}/slimevr-server.service" \
    -t "${pkgdir}/usr/lib/systemd/user"

  install -Dm644 \
    "${srcdir}/slimevr-server/LICENSE-MIT" \
    "${srcdir}/slimevr-server/LICENSE-APACHE" \
    -t "${pkgdir}/usr/share/licenses/${_pkgname}"

  install -Dm644 \
    "${srcdir}/slimevr-server/gui/electron/resources/69-slimevr-devices.rules" \
    -t "${pkgdir}/usr/lib/udev/rules.d"

  install -Dm644 \
    "${srcdir}/slimevr-server/server/desktop/build/libs/slimevr.jar" \
    -t "${pkgdir}/usr/share/slimevr"
}

package_slimevr-bindings-provider() {
  depends+=(
    "gcc-libs"
    "glibc"
    "openvr"
  )
  pkgdesc="Utility application for binding common SlimeVR calibration actions to SteamVR controller actions"

  install -Dm755 \
    "${srcdir}/slimevr-server/bindings-provider/build/slimevr-bindings-provider" \
    -t "${pkgdir}/usr/bin"
}