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
# SPDX-License-Identifier: GPL-2.0-only %define _unpackaged_files_terminate_build 1 %global __find_debuginfo_files %nil %set_verify_elf_method skip Name: qemu-system-aarch64-core-bundle Summary: Native qemu-system-aarch64 binary bundle Version: 1 Release: alt1 License: BSD-2-Clause AND BSD-3-Clause AND GPL-2.0-only AND GPL-2.0-or-later AND LGPL-2.1-or-later AND MIT Group: Emulators ExclusiveArch: aarch64 BuildArch: noarch AutoReqProv: no BuildRequires: glibc-devel-static BuildRequires: qemu-system-aarch64-core %define get_strict_dep() %(rpmquery --qf '%%{NAME} = %%|epoch?{%%{epoch}:}|%%{version}-%%{release}%%|disttag?{:%%{disttag}}|' %1 2>/dev/null || echo '%1 = unknown') Requires: %{get_strict_dep qemu-system-aarch64-core} %description Wondrous package to run qemu-system-aarch64 on armh to access KVM. ,, /,`\ ` | \____/\ _( ) \ \-\~~~_|\ \ ` \ ` \ ` ` ` %prep %setup -cT %build gcc %optflags -s -o kvm_ok -xc - <<'EOF' #include <fcntl.h> int main(void) { return open("/dev/kvm", O_RDONLY) < 0; } EOF %install %define bundle %_datadir/%name T=%buildroot%bundle BINARY=%_bindir/qemu-system-aarch64 INTERP=$(readelf -W -l $BINARY | sed -ne 's,^[[:space:]]*\[Requesting program interpreter: \(/[^]]\+\)\]$,\1,p') mkdir -p $T cp -v -L -p $BINARY $INTERP kvm_ok -t $T/ ldd $BINARY | cut -d' ' -f 3 | grep / | xargs -i -- cp -v -L -p {} -t $T/ mkdir -p %buildroot%_bindir %define wrapper %_bindir/qemu-system-aarch64-bundle cat <<EOF > %buildroot%wrapper #!/bin/sh exec %bundle/$(basename $INTERP) --library-path %bundle %bundle/$(basename $BINARY) "\$@" EOF chmod a+x %buildroot%wrapper %define kvm_ok %wrapper-kvm-ok cat <<EOF > %buildroot%wrapper-kvm-ok #!/bin/sh exec %bundle/$(basename $INTERP) --library-path %bundle %bundle/kvm_ok EOF chmod a+x %buildroot%wrapper-kvm-ok %files %bundle %wrapper %kvm_ok %changelog * Sat May 13 2023 Vitaly Chikunov <vt@altlinux.org> 1-alt1 - Fix bundling symlinked interpreter (on p10). * Wed Dec 15 2021 Vitaly Chikunov <vt@altlinux.org> 0-alt1 - Initial version.