qemu-user-static: simplify binfmt generation, adopt

This commit is contained in:
classabbyamp 2024-08-05 22:07:03 -04:00
parent d4b9e81158
commit 16d4f23b59
No known key found for this signature in database
GPG Key ID: 6BE0755918A4C7F5
1 changed files with 4 additions and 27 deletions

View File

@ -10,7 +10,7 @@ configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec
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>"
maintainer="classabbyamp <void@placeviolette.net>"
license="GPL-2.0-only, LGPL-2.1-only"
homepage="https://www.qemu.org"
distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
@ -20,24 +20,6 @@ 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
case "$XBPS_TARGET_MACHINE" in
x86_64*|i686*) _host_arch="i386" ;;
mips*) _host_arch="mips" ;;
ppc*le) _host_arch="ppcle" ;;
ppc*) _host_arch="ppc" ;;
arm*|aarch64*) _host_arch="arm" ;;
riscv*) _host_arch="riscv" ;;
*) _host_arch="${XBPS_TARGET_MACHINE%-musl}" ;;
esac
post_install() {
# Remove unneeded stuff.
rm -rf ${DESTDIR}/etc ${DESTDIR}/usr/share ${DESTDIR}/usr/libexec
@ -49,15 +31,10 @@ post_install() {
done
vmkdir usr/share/binfmts
HOST_ARCH="$_host_arch" scripts/qemu-binfmt-conf.sh --debian --exportdir "${DESTDIR}"/usr/share/binfmts \
--qemu-path /usr/bin --preserve-argv0 yes --persistent yes --credential yes
HOST_ARCH="${XBPS_TARGET_MACHINE%-musl}" scripts/qemu-binfmt-conf.sh --debian \
--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