# libkrun tests require access to "/dev/kvm", which is usually not be available # not available on build sandboxes. %bcond_with check Name: libkrun Version: 1.2.1 Release: 1%{?dist} Summary: Dynamic library providing Virtualization-based process isolation capabilities # Upstream license specification: Apache-2.0 AND BSD-3-Clause License: ASL 2.0 URL: https://github.com/containers/libkrun Source: https://github.com/containers/libkrun/archive/refs/tags/v%{version}.tar.gz # Remove references to unused deps so we don't need to install them for # building this package Patch0: libkrun-remove-unused-deps.diff # libkrun only supports x86_64 and aarch64 ExclusiveArch: x86_64 aarch64 # While this project is composed mostly by Rust code, this is not a # conventional Rust crate. The root of the project is a workspace, there's a C # file that also needs to be compiled, and the resulting binary a dynamic # library providing a C-compatible ABI. # # As a result, we can't fully rely on rust-packaging for managing this package. # Instead, we use some of it's tasks (cargo_prep and cargo_test) and combine # them with using the Makefile provided by the project. We also need to manage # BuildRequires manually, as rust-packaging gets confused trying to generate # them dynamically. BuildRequires: rust-packaging >= 21 BuildRequires: glibc-static BuildRequires: patchelf BuildRequires: binutils BuildRequires: libkrunfw-devel >= 3.0.0 %ifarch aarch64 BuildRequires: libfdt-devel %endif BuildRequires: crate(libc/default) >= 0.2.39 BuildRequires: (crate(vm-memory/backend-mmap) >= 0.8.0 with crate(vm-memory/backend-mmap) < 0.9.0~) BuildRequires: (crate(vm-memory/default) >= 0.8.0 with crate(vm-memory/default) < 0.9.0~) BuildRequires: crate(kvm-bindings/default) >= 0.2.0 BuildRequires: crate(kvm-bindings/fam-wrappers) >= 0.2.0 BuildRequires: crate(kvm-ioctls/default) >= 0.4.0 BuildRequires: crate(vmm-sys-util/default) >= 0.7.0 BuildRequires: (crate(bitflags/default) >= 1.2.0 with crate(bitflags/default) < 2.0.0~) BuildRequires: (crate(env_logger/default) >= 0.9.0 with crate(env_logger/default) < 0.10.0~) BuildRequires: (crate(log/default) >= 0.4.0 with crate(log/default) < 0.5.0~) BuildRequires: (crate(nix/default) >= 0.24.1 with crate(nix/default) < 0.25.0~) BuildRequires: (crate(rand/default) >= 0.8.5 with crate(rand/default) < 0.9.0~) BuildRequires: (crate(once_cell/default) >= 1.4.1 with crate(once_cell/default) < 2.0.0~) %description %{summary}. %package devel Summary: Header files and libraries for libkrun development Requires: %{name}%{?_isa} = %{version}-%{release} %description devel The libkrun-devel package containes the libraries and headers needed to develop programs that use libkrun Virtualization-based process isolation capabilities. %prep %autosetup -n %{name}-%{version_no_tilde} -p1 %cargo_prep %build %make_build RUSTFLAGS="-Cdebuginfo=1" %install %make_install PREFIX=%{_prefix} %files %license LICENSE %doc README.md %{_libdir}/libkrun.so.%{version} %{_libdir}/libkrun.so.1 %files devel %{_libdir}/libkrun.so %{_includedir}/libkrun.h %if %{with check} %check %cargo_test %endif %changelog * Tue Jun 21 2022 Sergio Lopez - 1.2.1-1 - Initial package