File box64.spec of Package box64

#
# spec file for package box64
#
# Copyright (c) 2024 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/
#

# Exclude the x86_64 libraries
%global __requires_exclude_from %{_prefix}/lib/box64-x86_64-linux-gnu/.*
%global __provides_exclude_from %{_prefix}/lib/box64-x86_64-linux-gnu/.*

%ifarch riscv64
%define cmake_build_arch    RV64
%endif
%ifarch aarch64
%define cmake_build_arch    ARM64
%endif

Name:           box64
Version:        0.3.8
Release:        0
Summary:        Linux Userspace x86_64 Emulator with a twist
License:        MIT
Group:          System/Emulators/Other
URL:            https://github.com/ptitSeb/%{name}
Source:         %{name}-%{version}.tar.gz
BuildRequires:  cmake
BuildRequires:  gcc
BuildRequires:  python3-base
BuildRequires:  patchelf

ExclusiveArch:  riscv64 aarch64

%description
Box64 - Linux Userspace x86_64 Emulator with a twist, targeted at ARM64 Linux devices

%prep
%setup -q

%build
%cmake -D%cmake_build_arch=1 -DNOGIT=1 -DBOX64_AVX=2 -DINSTALL_PATH=%{buildroot}%{_prefix}/lib/x86_64-linux-gnu/
%cmake_build

%install
%cmake_install
# Strip rpath from some of the x86_64 libraries
patchelf --remove-rpath %{buildroot}%{_prefix}/lib/box64-x86_64-linux-gnu/libmbedtls.so.14
patchelf --remove-rpath %{buildroot}%{_prefix}/lib/box64-x86_64-linux-gnu/libmbedx509.so.1

%files
%{_bindir}/box64
%{_bindir}/box64-bash
%dir %{_sysconfdir}/binfmt.d
%config(noreplace) %{_sysconfdir}/binfmt.d/box64.conf
%config(noreplace) %{_sysconfdir}/box64.box64rc
%dir %{_prefix}/lib/box64-x86_64-linux-gnu
%{_prefix}/lib/box64-x86_64-linux-gnu/*.so*
%doc README.md
%license LICENSE

%changelog
openSUSE Build Service is sponsored by