Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable qemu-user-static builds #2009

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 84 additions & 3 deletions extra/qemu/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# ALARM: Kevin Mihelich <[email protected]>
# - remove makedepends on seabios, revert not installing qemu seabios files
# ALARM: Qu Wenruo <[email protected]>
# - remove static build, make qemu-base/qemu-desktop meta packages to use their native system emulator as default dependency
# - make qemu-base/qemu-desktop meta packages to use their native system emulator as default dependency

pkgbase=qemu
pkgname=(
Expand All @@ -25,7 +25,7 @@ pkgname=(
qemu-tests
qemu-tools
qemu-ui-{curses,dbus,egl-headless,gtk,opengl,sdl,spice-{app,core}}
qemu-user{,-binfmt}
qemu-user{,-static}{,-binfmt}
qemu-vhost-user-gpu
qemu-{base,desktop,emulators-full,full}
)
Expand Down Expand Up @@ -280,6 +280,7 @@ prepare() {

# create build dir
mkdir -vp build
mkdir -vp build-static
}

build() {
Expand All @@ -300,6 +301,51 @@ build() {
--with-coroutine=ucontext
)

local configure_static_options=(
"${common_configure_options[@]}"
--enable-attr
--enable-linux-user
--enable-tcg
--disable-bpf
--disable-bsd-user
--disable-capstone
--disable-docs
--disable-fdt
--disable-gcrypt
--disable-glusterfs
--disable-gnutls
--disable-gtk
--disable-install-blobs
--disable-kvm
--disable-libiscsi
--disable-libnfs
--disable-libssh
--disable-linux-io-uring
--disable-nettle
--disable-opengl
--disable-qom-cast-debug
--disable-sdl
--disable-system
--disable-tools
--disable-tpm
--disable-vde
--disable-vhost-crypto
--disable-vhost-kernel
--disable-vhost-net
--disable-vhost-user
--disable-vnc
--disable-werror
--disable-xen
--disable-zstd
--static
)

(
cd build-static
../$pkgbase-$pkgver/configure "${configure_static_options[@]}"
ninja
)

(
cd build
../$pkgbase-$pkgver/configure "${configure_options[@]}"
Expand All @@ -324,6 +370,23 @@ package_qemu-common() {
)
install=$pkgname.install

# install static binaries
meson install -C build-static --destdir "$pkgdir"
install -vdm 755 "$pkgdir/usr/lib/binfmt.d/"
$pkgbase-$pkgver/scripts/qemu-binfmt-conf.sh "${binfmt_conf_options[@]}"

# rename static binaries to prevent name conflicts
for _src in "$pkgdir/usr/bin/qemu-"*; do
mv -v "$_src" "$pkgdir/usr/bin/$(basename "$_src")-static"
done
# modify and rename binfmt.d configs to prevent name conflicts
for _conf in "$pkgdir/usr/lib/binfmt.d/"*; do
_exe_name="$(basename "${_conf/.conf/}")"
_new_exe_name="${_exe_name}-static"
_new_conf_name="${_conf/.conf/-static.conf}"
sed -e "s|usr/bin/${_exe_name}|usr/bin/${_new_exe_name}|" "$_conf" > "${_new_conf_name}"
done

# install default binaries
meson install -C build --destdir "$pkgdir"

Expand Down Expand Up @@ -513,6 +576,9 @@ package_qemu-common() {
_pick qemu-ui-spice-app usr/lib/qemu/ui-spice-app.so
_pick qemu-ui-spice-core usr/lib/qemu/ui-spice-core.so

_pick qemu-user-static usr/bin/qemu-*-static
_pick qemu-user-static-binfmt usr/lib/binfmt.d/*-static.conf

_pick qemu-user usr/bin/qemu-{aarch64{,_be},alpha,arm{,eb},cris,hexagon,hppa,i386,loongarch64,m68k,microblaze{,el},mips{,64,64el,el,n32,n32el},nios2,or1k,ppc{,64,64le},riscv{32,64},s390x,sh4{,eb},sparc{,32plus,64},x86_64,xtensa{,eb}}
_pick qemu-user-binfmt usr/lib/binfmt.d/*.conf

Expand Down Expand Up @@ -852,7 +918,7 @@ package_qemu-system-tricore() {

package_qemu-system-x86() {
pkgdesc="QEMU system emulator for x86"
depends=("${_qemu_system_deps[@]}" edk2-ovmf qemu-system-x86-firmware=$pkgver-$pkgrel seabios systemd-libs libudev.so)
depends=("${_qemu_system_deps[@]}" qemu-system-x86-firmware=$pkgver-$pkgrel systemd-libs libudev.so)
mv -v $pkgname/* "$pkgdir"
}

Expand Down Expand Up @@ -991,6 +1057,21 @@ package_qemu-user-binfmt() {
mv -v $pkgname/* "$pkgdir"
}

package_qemu-user-static() {
pkgdesc="QEMU static user mode emulation"
depends=(glibc)
optdepends=('qemu-user-static-binfmt: for binary format rules')
mv -v $pkgname/* "$pkgdir"
}

package_qemu-user-static-binfmt() {
pkgdesc="Binary format rules for QEMU static user mode emulation"
depends=(qemu-user-static=$pkgver-$pkgrel)
provides=(qemu-user-binfmt-provider)
conflicts=(qemu-user-binfmt-provider)
mv -v $pkgname/* "$pkgdir"
}

package_qemu-vhost-user-gpu() {
pkgdesc="QEMU vhost-user-gpu display device"
depends=(gcc-libs glib2 libglib-2.0.so libgmodule-2.0.so glibc pixman libepoxy libpixman-1.so mesa numactl libnuma.so qemu-common=$pkgver-$pkgrel virglrenderer)
Expand Down