summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: cf3deade6ef8ebbd2b80d34825bd23c7719153ad (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
# vim:ts=2:sw=2:expandtab
# Maintainer: peelz <peelz.dev+arch@gmail.com>

_commit="a99ba5b6812f65ef8ca0d93ac4729e1deeb25171"
pkgbase="xrizer"
pkgname=(
  "xrizer"
  "xrizer-common"
  "lib32-xrizer"
)
pkgver="0.5"
pkgrel="1"
pkgdesc="Reimplementation of OpenVR, translating calls to OpenXR"
arch=("x86_64")
url="https://github.com/Supreeeme/xrizer"
license=("GPL-3.0-or-later")
makedepends=(
  "git"
  "rust"
  "lib32-rust-libs"
  "cmake"
  "libx11"
  "libxcb"
  "wayland"
  "clang"
  "shaderc"
)
source=(
  "xrizer::git+${url}.git#commit=${_commit}"
  "openvrpaths.vrpath"
)
sha256sums=(
  "SKIP"
  "SKIP"
)
options=("!lto")

prepare() {
  cd "${srcdir}/xrizer"
  export RUSTUP_TOOLCHAIN=stable
  # XXX: ideally a PKGBUILD should never mess with a user's environment,
  # but considering that many people have rust installed via rustup,
  # we have to make an exception to this rule (I don't want people
  # complaining about the package failing to build).
  # This should have no effect if built in a chroot.
  if command -v rustup >/dev/null 2>&1; then
    rustup target add x86_64-unknown-linux-gnu
    rustup target add i686-unknown-linux-gnu
  fi
  cargo fetch --locked --target x86_64-unknown-linux-gnu
  cargo fetch --locked --target i686-unknown-linux-gnu
}

build() {
  cd "${srcdir}/xrizer"
  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target
  cargo build --frozen --release --target x86_64-unknown-linux-gnu
  cargo build --frozen --release --target i686-unknown-linux-gnu
}

package_xrizer-common() {
  pkgdesc+=" (common files)"
  provides=("xrizer-common")
  conflicts=("xrizer-common")

  install -Dm644 \
    "${srcdir}/openvrpaths.vrpath" \
    "${pkgdir}/opt/xrizer/openvrpaths.vrpath"
  install -Dm644 \
    /dev/null \
    "${pkgdir}/opt/xrizer/bin/version.txt"
}

package_xrizer() {
  depends=(
    "xrizer-common"
    "glibc"
    "gcc-libs"
  )
  provides=("xrizer")
  conflicts=("xrizer")

  install -Dm755 \
    "${srcdir}/xrizer/target/x86_64-unknown-linux-gnu/release/libxrizer.so" \
    "${pkgdir}/opt/xrizer/bin/linux64/vrclient.so"
}

package_lib32-xrizer() {
  pkgdesc+=" (32-bit)"
  depends=(
    "xrizer-common"
    "lib32-glibc"
    "lib32-gcc-libs"
  )
  provides=("lib32-xrizer")
  conflicts=("lib32-xrizer")

  install -Dm755 \
    "${srcdir}/xrizer/target/i686-unknown-linux-gnu/release/libxrizer.so" \
    "${pkgdir}/opt/xrizer/bin/vrclient.so"
}