--- /dev/null
+#
+# spec file for package qemu
+#
+# Copyright (c) 2021 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+# !! IMPORTANT !! See README.PACKAGING before modifying package in any way
+
+#!ForceMultiversion
+
+%define _buildshell /bin/bash
+
+%bcond_with system_membarrier
+
+Name: qemu-arm-static
+URL: https://www.qemu.org/
+Summary: Machine emulator and virtualizer
+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: System/Emulators/PC
+Version: 5.2.0.tizen20230829
+Release: 0
+Source: qemu-5.2.0.tar.bz2
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+
+# Common BuildRequires listed here:
+BuildRequires: fdupes
+BuildRequires: gcc-c++
+BuildRequires: meson
+BuildRequires: ninja >= 1.7
+BuildRequires: python3-base >= 3.6
+BuildRequires: python3-setuptools
+
+BuildRequires: glib2-devel-static
+BuildRequires: glibc-devel-static
+BuildRequires: pcre-devel-static
+BuildRequires: zlib-devel-static
+
+Provides: qemu:%_bindir/qemu-arm-static
+Provides: tizen-qemu-arm-static = 2023.08.29
+
+%description
+QEMU provides CPU emulation along with other related capabilities. This package
+provides programs to run user space binaries and libraries meant for another
+architecture. The syscall interface is intercepted and execution below the
+syscall layer occurs on the native hardware and operating system.
+
+%prep
+%setup -q -n qemu-5.2.0
+
+%build
+
+# non-x86 archs still seem to have some issues with Link Time Optimization
+%ifnarch %ix86 x86_64
+%define _lto_cflags %{nil}
+%endif
+
+%define srcdir %{_builddir}/%buildsubdir
+%define blddir %srcdir/build
+mkdir -p %blddir
+cd %blddir
+
+%srcdir/configure \
+ --prefix=%_prefix \
+ --sysconfdir=%_sysconfdir \
+ --libdir=%_libdir \
+ --libexecdir=%_libexecdir \
+ --localstatedir=%_localstatedir \
+ --docdir=%_docdir \
+ --firmwarepath=%_datadir/%name \
+ --python=%_bindir/python3 \
+ --extra-cflags="%{optflags}" \
+ --target-list="arm-linux-user,aarch64-linux-user,riscv32-linux-user,riscv64-linux-user" \
+ --disable-fuzzing \
+ --disable-stack-protector \
+ --disable-strip \
+ --without-default-devices \
+ --disable-system \
+ --enable-linux-user \
+ --disable-tools \
+ --disable-guest-agent \
+ --static \
+ --disable-modules \
+ --disable-pie \
+ --disable-docs \
+ --audio-drv-list="" \
+ --disable-blobs \
+ --disable-bochs \
+ --disable-capstone \
+ --disable-cloop \
+ --enable-coroutine-pool \
+ --disable-dmg \
+ --disable-fdt \
+ --disable-iconv \
+ --disable-kvm \
+ --disable-libdaxctl \
+ --disable-linux-io-uring \
+ --disable-malloc-trim \
+%if %{with system_membarrier}
+ --enable-membarrier \
+%else
+ --disable-membarrier \
+%endif
+ --disable-parallels \
+ --disable-plugins \
+ --disable-qcow1 \
+ --disable-qed \
+ --disable-replication \
+ --disable-sheepdog \
+ --disable-safe-stack \
+ --disable-slirp \
+ --disable-tpm \
+ --disable-vdi \
+ --disable-vhost-crypto \
+ --disable-vhost-kernel \
+ --disable-vhost-net \
+ --disable-vhost-scsi \
+ --disable-vhost-user \
+ --disable-vhost-user-blk-server \
+ --disable-vhost-user-fs \
+ --disable-vhost-vsock \
+ --disable-vnc \
+ --disable-vvfat \
+ --disable-xkbcommon
+
+make %{?_smp_mflags} V=1
+
+%install
+cd %blddir
+
+make %{?_smp_mflags} install DESTDIR=%{buildroot}
+rm -rf %{buildroot}%_datadir/qemu/keymaps
+unlink %{buildroot}%_datadir/qemu/trace-events-all
+install -d -m 755 %{buildroot}%_sbindir
+install -m 755 scripts/qemu-binfmt-conf.sh %{buildroot}%_sbindir
+
+cp %{buildroot}%_bindir/qemu-binfmt %{buildroot}%_bindir/qemu-arm-binfmt
+cp %{buildroot}%_bindir/qemu-binfmt %{buildroot}%_bindir/qemu-arm64-binfmt
+cp %{buildroot}%_bindir/qemu-binfmt %{buildroot}%_bindir/qemu-riscv32-binfmt
+cp %{buildroot}%_bindir/qemu-binfmt %{buildroot}%_bindir/qemu-riscv64-binfmt
+
+mv %{buildroot}%_bindir/qemu-arm %{buildroot}%_bindir/qemu-arm-static
+mv %{buildroot}%_bindir/qemu-aarch64 %{buildroot}%_bindir/qemu-arm64-static
+mv %{buildroot}%_bindir/qemu-riscv32 %{buildroot}%_bindir/qemu-riscv32-static
+mv %{buildroot}%_bindir/qemu-riscv64 %{buildroot}%_bindir/qemu-riscv64-static
+
+%fdupes -s %{buildroot}
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(-, root, root)
+%_bindir/qemu-*-binfmt
+%_bindir/qemu-*-static
+%_sbindir/qemu-binfmt-conf.sh
+
+%changelog