void-packages/srcpkgs/qemu-user-static/template

55 lines
1.7 KiB
Bash

# Template file for 'qemu-user-static'
# This package should be updated together with qemu
pkgname=qemu-user-static
version=9.0.1
revision=1
build_style=configure
configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec
--disable-kvm --disable-png --disable-virtfs --disable-fdt --disable-seccomp
--enable-linux-user --disable-system --static --disable-pie"
hostmakedepends="flex glib-devel pkg-config perl python3 ninja"
makedepends="dtc-devel glib-devel pixman-devel libuuid-devel"
short_desc="QEMU User-mode emulators (statically compiled)"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-only, LGPL-2.1-only"
homepage="https://www.qemu.org"
distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
checksum=c79bd301abd9f2501bdf0a543c6f6f7474424178dcfde2be271150988cadc0a7
if [ "$CROSS_BUILD" ]; then
configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}-"
fi
_omit=("${XBPS_TARGET_MACHINE%-*}")
case "$XBPS_TARGET_MACHINE" in
x86_64*) _omit+=(i386) ;;
armv*) _omit+=(arm) ;;
ppc64le*) _omit+=(ppcle) ;;
ppc64*) _omit+=(ppc) ;;
esac
post_install() {
# Remove unneeded stuff.
rm -rf ${DESTDIR}/etc ${DESTDIR}/usr/share ${DESTDIR}/usr/libexec
for f in nbd io img; do
rm -f ${DESTDIR}/usr/bin/qemu-${f}
done
for f in ${DESTDIR}/usr/bin/*; do
mv ${f} ${f}-static
done
vmkdir usr/share/binfmts
scripts/qemu-binfmt-conf.sh --debian ALL --exportdir "${DESTDIR}"/usr/share/binfmts \
--qemu-path /usr/bin --preserve-argv0 yes --persistent yes --credential yes
for bf in "${DESTDIR}"/usr/share/binfmts/*; do
for ar in "${_omit[@]}"; do
if [[ "$bf" = */qemu-"$ar" ]]; then
rm "$bf"
continue 2
fi
done
vsed -i -e "s/${bf##*/}/&-static/g" "$bf"
mv "$bf" "${bf}-static"
done
}