reims-vgpu-git
LOW
maintainer Tseshongfeeshur
0 votes
scanned 2026-10-18 03:20:54.674149
Why flagged
Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.
Triggered rules
Low
Few votes, recently uploaded
zero_votes_recent
Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.
PKGBUILD
1
# Maintainer: Ryan & Claude <i@ryanyuan.top>
2
#
3
# Packaging of scripts/install-ctl.sh (Linux x86-64 path) from upstream:
4
# https://github.com/steelbrain/reims-vgpu
5
#
6
# What the script puts in $HOME, this package puts in the system, tracked by pacman:
7
# reims-ctl -> /usr/lib/reims-ctl/bin/reims-ctl, started through /usr/bin/reims-ctl
8
# (a wrapper that sets REIMS_CTL_QEMU to the packaged QEMU)
9
# QEMU fork -> /usr/lib/reims-ctl/qemu (self-contained prefix, no clash with `qemu`)
10
# reims-util -> /usr/lib/reims-ctl/bin/reims-util, linked from /usr/bin
11
#
12
# Build in a clean chroot if you can (pkgctl build / extra-x86_64-build): QEMU's configure
13
# enables whatever optional libraries it finds, so a clean chroot keeps `depends` exact.
14
15
pkgname=reims-vgpu-git
16
pkgver=r3260.86d49219
17
pkgrel=1
18
pkgdesc='Virtual GPU for macOS guests on QEMU/KVM: reims-ctl, patched QEMU and reims-util'
19
arch=(x86_64)
20
url='https://github.com/steelbrain/reims-vgpu'
21
# reims-vgpu itself; the QEMU fork keeps QEMU's own licenses (COPYING is installed too)
22
license=('GPL-2.0-or-later OR LGPL-3.0-or-later' 'GPL-2.0-only')
23
depends=(
24
# QEMU runtime
25
glib2 pixman libslirp zlib pipewire libpulse alsa-lib
26
# graphics (SDL3 is built statically into the library and opens these at run time)
27
vulkan-icd-loader libdrm mesa libxkbcommon wayland libdecor dbus systemd-libs
28
libx11 libxext libxrandr libxcursor libxi libxfixes libxss libxtst
29
)
30
makedepends=(git rustup python ninja pkgconf flex bison bzip2 cmake clang lld binutils dtc)
31
optdepends=(
32
'vulkan-radeon: Vulkan driver for AMD GPUs'
33
'nvidia-utils: Vulkan driver for NVIDIA GPUs'
34
'vulkan-intel: Vulkan driver for Intel GPUs'
35
)
36
provides=(reims-vgpu reims-ctl reims-util)
37
conflicts=(reims-vgpu reims-ctl)
38
options=(!lto !debug)
39
install=$pkgname.install
40
41
_util_url=https://github.com/steelbrain/reims-util.git
42
_qemu_url=https://github.com/steelbrain/qemu-reims-vgpu.git
43
_qemu_prefix=/usr/lib/reims-ctl/qemu
44
45
source=("reims-vgpu::git+https://github.com/steelbrain/reims-vgpu.git"
46
"qemu-reims-vgpu::git+${_qemu_url}"
47
"reims-util::git+${_util_url}")
48
sha256sums=(SKIP SKIP SKIP)
49
50
# The Rust channel rust-toolchain.toml pins. RUSTUP_TOOLCHAIN overrides that file, so rustup
51
# installs just this channel (minimal profile), not the file's components or macOS targets.
52
_rust_channel() {
53
sed -n 's/^channel *= *"\([^"]*\)".*/\1/p' "$srcdir/reims-vgpu/rust-toolchain.toml"
54
}
55
56
# The reims-util commit reims-ctl installs (crates/reims-ctl/src/reims_util.rs): following it
57
# keeps this package in step with upstream, with no pin of our own to go stale.
58
_util_rev() {
59
sed -n 's/^pub const REV: &str = "\([0-9a-f]\{40\}\)";.*/\1/p' \
60
"$srcdir/reims-vgpu/crates/reims-ctl/src/reims_util.rs"
61
}
62
63
# Cargo's download cache stays in $srcdir, not in ~/.cargo.
64
_env() {
65
export CARGO_HOME="$srcdir/cargo-home"
66
export RUSTUP_TOOLCHAIN="$(_rust_channel)"
67
}
68
69
pkgver() {
70
cd "$srcdir/reims-vgpu"
71
printf 'r%s.%s' "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
72
}
73
74
prepare() {
75
cd "$srcdir/reims-vgpu"
76
77
# vendor/qemu at the commit this checkout pins, from the local mirror makepkg keeps in
78
# SRCDEST; QEMU's own submodules are not needed (its configure fetches what it uses).
79
git submodule init vendor/qemu
80
git config submodule.vendor/qemu.url "$srcdir/qemu-reims-vgpu"
81
if ! git -c protocol.file.allow=always submodule update vendor/qemu; then
82
warning "the pinned QEMU commit is not in the local mirror: fetching it from $_qemu_url"
83
git config --unset submodule.vendor/qemu.url
84
git submodule update --init vendor/qemu
85
fi
86
87
# reims-util at the commit reims-ctl names.
88
local rev; rev="$(_util_rev)"
89
[[ -n $rev ]] || { error "no REV found in crates/reims-ctl/src/reims_util.rs"; return 1; }
90
grep -qF "${_util_url%.git}" crates/reims-ctl/src/reims_util.rs ||
91
warning "reims_util.rs names another repository than ${_util_url%.git}: check the source array"
92
git -C "$srcdir/reims-util" checkout --quiet --detach "$rev"
93
94
# Network is used here, and only here (QEMU's configure aside): the toolchain, then every crate.
95
_env
96
rustup toolchain install "$RUSTUP_TOOLCHAIN" --profile minimal
97
# The library's workspace lock records metal2vulkan (a git dependency, pinned by rev) without
98
# its source, so --locked cannot be used on it: cargo adds the three source lines itself.
99
cargo fetch
100
cargo fetch --locked --manifest-path crates/reims-ctl/Cargo.toml
101
cargo fetch --locked --manifest-path "$srcdir/reims-util/Cargo.toml"
102
}
103
104
build() {
105
_env
106
# Everything cargo needs is in CARGO_HOME now. If a step fails for want of network, remove this.
107
export CARGO_NET_OFFLINE=true
108
cd "$srcdir/reims-vgpu"
109
110
# The library (on Linux the Vulkan platform, in dist-vulkan).
111
CARGO_TARGET_DIR="$srcdir/target" cargo xtask dist
112
local dist="$srcdir/target/dist-vulkan"
113
[[ -f $dist/lib/pkgconfig/reims-vgpu.pc ]] ||
114
{ error "cargo xtask dist wrote no $dist/lib/pkgconfig/reims-vgpu.pc"; return 1; }
115
116
# QEMU on it (the library is linked statically).
117
mkdir -p "$srcdir/qemu-build"
118
cd "$srcdir/qemu-build"
119
PKG_CONFIG_PATH="$dist/lib/pkgconfig" "$srcdir/reims-vgpu/vendor/qemu/configure" \
120
--prefix="$_qemu_prefix" \
121
--target-list=x86_64-softmmu --enable-kvm --disable-sdl --disable-gtk --enable-slirp \
122
--enable-pvg --disable-docs --disable-tests --disable-werror
123
ninja
124
125
# reims-ctl: cargo install --locked --path crates/reims-ctl, as the script does.
126
cd "$srcdir/reims-vgpu"
127
CARGO_TARGET_DIR="$srcdir/ctl-target" \
128
cargo build --release --locked --manifest-path crates/reims-ctl/Cargo.toml
129
130
# reims-util: built from here, so rust-toolchain.toml's channel applies, as in reims_util.rs.
131
CARGO_TARGET_DIR="$srcdir/util-target" \
132
cargo install --locked --path "$srcdir/reims-util" --root "$srcdir/util-root"
133
}
134
135
package() {
136
# QEMU installs straight to its real prefix: no staging and moving, as the script needs.
137
DESTDIR="$pkgdir" ninja -C "$srcdir/qemu-build" install >/dev/null
138
local root="$pkgdir$_qemu_prefix"
139
[[ -x $root/bin/qemu-system-x86_64 ]] || { error "QEMU's install has no qemu-system-x86_64"; return 1; }
140
[[ -x $root/bin/qemu-img ]] || { error "QEMU's install has no qemu-img (reims-ctl needs it)"; return 1; }
141
find "$root" -name ReimsVgpu.rom -type f | grep -q . ||
142
{ error "QEMU's install has no ReimsVgpu.rom: was it configured with reims-vgpu?"; return 1; }
143
144
# reims-ctl finds QEMU at ~/.local/share/reims-ctl/qemu/current unless REIMS_CTL_QEMU names a
145
# binary (qemu-img is then taken from beside it), so no per-user setup is needed.
146
# reims-ctl looks for reims-util beside itself, then on PATH.
147
install -Dm755 "$srcdir/ctl-target/release/reims-ctl" "$pkgdir/usr/lib/reims-ctl/bin/reims-ctl"
148
install -Dm755 "$srcdir/util-root/bin/reims-util" "$pkgdir/usr/lib/reims-ctl/bin/reims-util"
149
install -dm755 "$pkgdir/usr/bin"
150
ln -s ../lib/reims-ctl/bin/reims-util "$pkgdir/usr/bin/reims-util"
151
install -Dm755 /dev/stdin "$pkgdir/usr/bin/reims-ctl" <<'EOF'
152
#!/bin/sh
153
# Runs reims-ctl on the packaged QEMU. Set REIMS_CTL_QEMU to use another QEMU binary.
154
: "${REIMS_CTL_QEMU:=/usr/lib/reims-ctl/qemu/bin/qemu-system-x86_64}"
155
export REIMS_CTL_QEMU
156
exec /usr/lib/reims-ctl/bin/reims-ctl "$@"
157
EOF
158
159
# What the script only warns about, as package files (delete any you do not want):
160
# a VM's guest memory takes about 64 kernel mappings per MiB (30 GiB fits in this)...
161
echo 'vm.max_map_count = 2097152' |
162
install -Dm644 /dev/stdin "$pkgdir/usr/lib/sysctl.d/60-reims-ctl.conf"
163
# ...and an AMD GPU imports it as dma-bufs made by /dev/udmabuf, which kvm's group may open.
164
echo 'udmabuf' |
165
install -Dm644 /dev/stdin "$pkgdir/usr/lib/modules-load.d/reims-ctl.conf"
166
echo 'KERNEL=="udmabuf", SUBSYSTEM=="misc", GROUP="kvm", MODE="0660"' |
167
install -Dm644 /dev/stdin "$pkgdir/usr/lib/udev/rules.d/70-reims-ctl-udmabuf.rules"
168
169
# Licenses: reims-vgpu's (LICENSE names the texts in LICENSES/), QEMU's, reims-util's.
170
cd "$srcdir/reims-vgpu"
171
install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE LICENSES/*.txt
172
install -Dm644 vendor/qemu/COPYING "$pkgdir/usr/share/licenses/$pkgname/QEMU-COPYING"
173
install -Dm644 "$srcdir/reims-util/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/reims-util-LICENSE"
174
}
175
Scan history
| Scanned at (UTC) | Severity | Rules |
|---|---|---|
| 2026-10-18 03:20:54 | Low | 1 |