File unicorn.spec of Package unicorn

#
# spec file for package unicorn
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


%define _lver   2
Name:           unicorn
Version:        2.0.1.post1
Release:        0
Summary:        Lightweight multi-platform, multi-architecture CPU emulator framework
License:        GPL-2.0
Group:          System/Emulators/Other
Url:            http://www.unicorn-engine.org
Source0:        https://github.com/unicorn-engine/unicorn/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz 
# PATCH-FIX-OPENSUSE openSUSE-unicorn-python-rm-distutils.patch code@bnavigator.de remove distutils for incompatible non-x86 platform tags on wheel build
Patch0:         openSUSE-unicorn-python-rm-distutils.patch
BuildRequires:  fdupes
BuildRequires:  cmake
BuildRequires:  gcc
BuildRequires:  pkg-config
BuildRequires:  python-rpm-macros
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module wheel}
Provides:       bundled(qemu) = 2.2.1
%define python_subpackage_only 1
%python_subpackages

%description
Unicorn is a lightweight multi-platform, multi-architecture CPU emulator
framework.

Highlight features:

   * Multi-architecture: ARM, ARM64 (ARMv8), M68K, MIPS, PowerPC, RISCV, SPARC, S390X, TriCore and X86 (16, 32, 64-bit)
   * Clean/simple/lightweight/intuitive architecture-neutral API.
   * Implemented in pure C language, with bindings for Crystal, Clojure, Visual Basic, Perl, Rust, Ruby, Python, Java, .NET, Go, Delphi/Free Pascal, Haskell, Pharo, and Lua.
   * Native support for Windows & *nix (with Mac OSX, Linux, *BSD
     & Solaris confirmed).
   * High performance by using Just-In-Time compiler.
   * Support fine-grained instrumentation at various levels.
   * Thread-safe by design.
   * Distributed under free software license GPLv2.

%package        devel
Summary:        Development files for package %{name}
Group:          Development/Libraries/C and C++
Requires:       lib%{name}%{_lver} = %{version}

%description    devel
This package contains development files for %{name}

%package -n     lib%{name}%{_lver}
Summary:        Support library for %{name}
Group:          System/Libraries

%description -n lib%{name}%{_lver}
This package contains the support library for %{name}

%package -n     python-%{name}
Summary:        Python bindings for %{name}
Group:          Development/Languages/Python
Requires:       lib%{name}%{_lver} = %{version}
BuildArch:      noarch

%description -n python-%{name}
This package contains the Python bindings for %{name}


%prep
%autosetup -p1 -n %{name}-%{version}

#options required for fixing https://github.com/unicorn-engine/unicorn/issues/1840
%build
%cmake -DCMAKE_BUILD_TYPE=Debug \
       -DCMAKE_EXE_LINKER_FLAGS="-latomic"
%cmake_build

pushd ../bindings/python
%pyproject_wheel
popd

%install
%cmake_install

# no static library
rm %{buildroot}%{_libdir}/libunicorn.a

pushd bindings/python
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
popd


%check
%ctest


%ldconfig_scriptlets -n lib%{name}%{_lver}

%files devel
%doc ChangeLog COPYING CREDITS.TXT README.md
%{_includedir}/%{name}/
%{_libdir}/lib%{name}.so
%{_libdir}/pkgconfig/%{name}.pc

%files -n lib%{name}%{_lver}
%doc AUTHORS.TXT ChangeLog CREDITS.TXT README.md
%license COPYING
%{_libdir}/libunicorn.so.2

%files %{python_files %{name}}
%doc ChangeLog COPYING CREDITS.TXT bindings/python/README.TXT README.md
%{python_sitelib}/%{name}
%{python_sitelib}/%{name}-%{version}.dist-info/

%changelog
openSUSE Build Service is sponsored by