# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=qemu-minimal-static
pkgver=5.0.0
pkgrel=1
pkgdesc="A stripped down, chrooted version of qemu for untrusted guests"
url="https://qemu.org/"
arch="all"
license="GPL-2.0 LGPL-2"
makedepends="
glib-dev
glib-static
libaio-dev
libcap-dev
libcap-ng-dev
linux-headers
lzo-dev
perl
pixman-static
pixman-dev
python3
texinfo
util-linux-dev
vde2-dev
zlib-dev
zlib-static
"
install="$pkgname.pre-install"
options="suid !strip !check" # strip fails on .img files; suid for chroot binary
source="
https://wiki.qemu-project.org/download/qemu-$pkgver.tar.xz
90-kvm.rules
qemu-chroot.c
xattr_size_max.patch
"
builddir="$srcdir/qemu-$pkgver"
prepare() {
default_prepare
sed -i 's/^VL_LDFLAGS=$/VL_LDFLAGS=-Wl,-z,execheap/' \
Makefile.target
}
build() {
./configure \
--prefix=/ \
--static \
--python=/usr/bin/python3 \
--audio-drv-list="" \
--disable-docs \
--disable-debug-info \
--disable-opengl \
--disable-virglrenderer \
--disable-vte \
--disable-gtk \
--disable-sdl \
--disable-spice \
--disable-vnc \
--disable-curses \
--disable-xen \
--disable-smartcard \
--disable-libnfs \
--disable-libusb \
--disable-glusterfs \
--disable-tools \
--disable-werror \
--target-list="x86_64-softmmu,i386-softmmu,aarch64-softmmu,arm-softmmu,ppc64-softmmu,s390x-softmmu,riscv64-softmmu,mips-softmmu,mipsel-softmmu,mips64el-softmmu"
cc -o qemu-chroot "$srcdir"/qemu-chroot.c
}
package() {
make DESTDIR="$pkgdir/usr/lib/qemu-minimal-static" install
mkdir -p "$pkgdir"/usr/lib/qemu-minimal-static/dev
mkdir -p "$pkgdir"/usr/lib/qemu-minimal-static/base
mkdir -p "$pkgdir"/usr/lib/qemu-minimal-static/var/tmp
touch "$pkgdir"/usr/lib/qemu-minimal-static/dev/null
touch "$pkgdir"/usr/lib/qemu-minimal-static/dev/kvm
install -Dm644 "$srcdir"/90-kvm.rules \
"$pkgdir"/lib/udev/rules.d/90-kvm.rules
mkdir -p "$pkgdir"/usr/bin
install -Dm755 qemu-chroot "$pkgdir"/usr/bin/qemu-chroot
chmod a+s "$pkgdir"/usr/bin/qemu-chroot
rm "$pkgdir"/usr/lib/qemu-minimal-static/libexec/qemu-bridge-helper
}
sha512sums="21ef0cbe107c468a40f0fa2635db2a40048c8790b629dfffca5cd62bb1b502ea8eb133bfc40df5ecf1489e2bffe87f6829aee041cb8a380ff04a8afa23b39fcf qemu-5.0.0.tar.xz
9b7a89b20fcf737832cb7b4d5dc7d8301dd88169cbe5339eda69fbb51c2e537d8cb9ec7cf37600899e734209e63410d50d0821bce97e401421db39c294d97be2 90-kvm.rules
996d78a60d4283b31400a808916c774e7dd80ae5827aa25966a19a8134710bf4a010f1eccc680dc6a4fdbaef953323e50674d6b857f4197d32d266ff106904c7 qemu-chroot.c
4b1e26ba4d53f9f762cbd5cea8ef6f8062d827ae3ae07bc36c5b0c0be4e94fc1856ad2477e8e791b074b8a25d51ed6d0ddd75e605e54600e5dd0799143793ce4 xattr_size_max.patch"