summaryrefslogtreecommitdiff
path: root/repo/qemu/qemu.xibuild
blob: 4f9327b1383eac46d7c31730ad6ccfdc8cb7deed (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
#!/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 texinfo usbredir util-linux vde2 virglrenderer vte3 xfsprogs zlib zlib zstd zstd ceph"

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
qemu.post-install
qemu.pre-install
qemu.pre-upgrade
xattr_size_max.patch
"

prepare () {
    apply_patches
} 

compile_common() {
	CFLAGS="$CFLAGS -O2" "$BUILD_ROOT"/configure \
		--prefix=/usr \
		--localstatedir=/var \
		--sysconfdir=/etc \
		--libexecdir=/usr/lib/qemu \
		--python=/usr/bin/python \
		--disable-glusterfs \
		--disable-debug-info \
		--disable-bsd-user \
		--disable-werror \
		--disable-xen \
		--enable-kvm \
		--enable-seccomp \
		--cc="${CC:-gcc}" \
		"$@"
	make ARFLAGS="rc"
}

build() {
	mkdir -p "$BUILD_ROOT"/build
	cd "$BUILD_ROOT"/build
	CFLAGS="$CFLAGS -O2" "$BUILD_ROOT"/configure \
		--prefix=/usr \
		--localstatedir=/var \
		--sysconfdir=/etc \
		--libexecdir=/usr/lib/qemu \
		--python=/usr/bin/python \
		--disable-glusterfs \
		--disable-debug-info \
		--disable-bsd-user \
		--disable-werror \
		--disable-xen \
		--enable-kvm \
		--enable-seccomp \
		--cc="${CC:-gcc}" \
		--disable-linux-user \
		--audio-drv-list=oss,alsa,sdl,pa \
		--enable-cap-ng \
		--enable-curl \
		--enable-curses \
		--enable-docs \
		--enable-gtk \
		--enable-guest-agent \
		--enable-libnfs \
		--enable-libssh \
		--enable-linux-aio \
		--enable-lzo \
		--enable-modules \
		--enable-numa \
		--enable-pie \
		--enable-sdl \
		--enable-snappy \
		--enable-spice \
		--enable-tpm \
		--enable-usb-redir \
		--enable-vde \
		--enable-vhost-net \
		--enable-virglrenderer \
		--enable-virtfs \
		--enable-vnc \
		--enable-vnc-jpeg \
		--enable-vnc-png \
		--enable-zstd \
        --enable-rbd \
		--tls-priority=@QEMU,SYSTEM
	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
}