summaryrefslogtreecommitdiff
path: root/repo/qemu/qemu.xibuild
blob: 4660aafec5c69adcbf74b5c6910c0de91ffef02c (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
#!/bin/sh

NAME="qemu"
DESC="QEMU is a generic machine emulator and virtualizer"

MAKEDEPS=" meson bash alsa-lib bison curl flex glib glib gnutls gtk3 libaio libcap libcap-ng libjpeg-turbo libnfs libpng libseccomp libssh2 liburing libusb libxml2 linux-headers lzo ncurses numactl perl pulseaudio python python-sphinx sdl2 snappy spice spice-server texinfo usbredir util-linux vde2 virglrenderer vte3 xfsprogs zlib zlib zstd zstd python-sphinx-rtd-theme"

PKG_VER=7.0.0
SOURCE="https://wiki.qemu-project.org/download/qemu-$PKG_VER.tar.xz"

ADDITIONAL="
0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch
80-kvm.rules
CVE-2021-20255.patch
MAP_SYNC-fix.patch
bridge.conf
fix-sockios-header.patch
guest-agent-shutdown.patch
mips-softfloat.patch
musl-initialise-msghdr.patch
qemu-guest-agent.confd
qemu-guest-agent.initd
xattr_size_max.patch
"

prepare () {
    apply_patches
} 

build() {
	mkdir -p "$BUILD_ROOT"/build
	cd "$BUILD_ROOT"/build
    CFLAGS="$CFLAGS -O2" "$BUILD_ROOT"/configure \
        --prefix=/usr \
        --sysconfdir=/etc \
        --libexecdir=/usr/libexec \
        --localstatedir=/var \
        --disable-glusterfs \
        --disable-xen \
        --enable-docs \
        --enable-kvm \
        --enable-libusb \
        --enable-pie \
        --enable-snappy \
        --enable-tpm \
        --enable-usb-redir \
        --enable-vhost-net \
        --enable-virtfs \
        --enable-vnc-png\
        --audio-drv-list=alsa,sdl,jack,pa \
        --enable-opengl \
        --enable-pa \
        --enable-sdl \
        --enable-spice \
        --enable-virglrenderer \
        --enable-gtk 
	make ARFLAGS="rc"
}

package() {
	cd "$BUILD_ROOT"/build
	make DESTDIR="$PKG_DEST" install

	install -Dm640 -g qemu "$BUILD_ROOT"/bridge.conf \
		"$PKG_DEST"/etc/qemu/bridge.conf

	install -Dm644 "$BUILD_ROOT"/80-kvm.rules \
		"$PKG_DEST"/lib/udev/rules.d/80-kvm.rules

	# qemu-bridge-helper needs suid to create tunX devices;
	# allow only users in the qemu group to run it.
	chmod 04710 "$PKG_DEST"/usr/lib/qemu/qemu-bridge-helper
	chgrp qemu "$PKG_DEST"/usr/lib/qemu/qemu-bridge-helper

	# Do not install HTML docs.
	rm -rf "$PKG_DEST"/usr/share/doc
	# remove accel-qtest-* modules, not needed for package
	rm -f "$PKG_DEST"/usr/lib/qemu/accel-qtest-*
}

postinstall () {
    addgroup -S -g 34 kvm 2>/dev/null || true
    addgroup -S -g 36 qemu 2>/dev/null || true
    adduser -S -H -h /dev/null -u 36 -G kvm -s /sbin/nologin qemu 2>/dev/null || true
}