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

pkgbase="xrizer-git"
pkgname=(
  "xrizer-git"
  "xrizer-common-git"
  "lib32-xrizer-git"
)
pkgver="0.3.r34.gbb7e2e5"
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"
  "openvrpaths.vrpath"
)
sha256sums=(
  "SKIP"
  "SKIP"
)
options=("!lto")

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

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-git() {
  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-git() {
  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-git() {
  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"
}