# Generated by rust2rpm 28 %bcond check 1 %global crate sandlock-ffi Name: rust-sandlock-ffi Version: 0.7.0 Release: %autorelease Summary: C ABI for sandlock process sandbox License: Apache-2.0 URL: https://crates.io/crates/sandlock-ffi Source: %{crates_source} # * include license file # * TODO https://github.com/multikernel/sandlock/pull/XX Source2: https://raw.githubusercontent.com/multikernel/sandlock/refs/tags/v%{version}/LICENSE BuildRequires: cargo-rpm-macros >= 24 %global _description %{expand: C ABI for sandlock process sandbox.} %description %{_description} %package -n libsandlock_ffi Summary: %{summary} # (MIT OR Apache-2.0) AND Apache-2.0 # 0BSD OR MIT OR Apache-2.0 # Apache-2.0 # Apache-2.0 AND ISC AND (MIT OR Apache-2.0) # Apache-2.0 OR ISC OR MIT # Apache-2.0 OR MIT # BSD-2-Clause # BSD-2-Clause OR Apache-2.0 OR MIT # BSD-3-Clause # BSD-3-Clause AND MIT # CDLA-Permissive-2.0 # ISC # MIT # MIT OR Apache-2.0 # MIT OR Zlib OR Apache-2.0 # Unlicense OR MIT License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND CDLA-Permissive-2.0 AND ISC AND MIT # LICENSE.dependencies contains a full license breakdown %description -n libsandlock_ffi %{_description} %files -n libsandlock_ffi %license LICENSE %license LICENSE.dependencies %doc README.md # a tricky way to append so file with soversion variable to libsandlock_ffi %global soversion 0.7 %{_libdir}/libsandlock_ffi.so.%{soversion} %package -n libsandlock_ffi-devel Summary: %{summary} Requires: libsandlock_ffi%{?_isa} = %{version}-%{release} %description -n libsandlock_ffi-devel %{_description} %files -n libsandlock_ffi-devel %{_libdir}/libsandlock_ffi.so %{_includedir}/sandlock.h %package -n libsandlock_ffi-static Summary: %{summary} Requires: libsandlock_ffi-devel%{?_isa} = %{version}-%{release} %description -n libsandlock_ffi-static %{_description} %files -n libsandlock_ffi-static %{_libdir}/libsandlock_ffi.a %prep %autosetup -n %{crate}-%{version} -p1 %cargo_prep # copy in license file cp -p %{SOURCE2} . #Either use sed or use a patch to modify build.rs to pass -Wl,-soname,libsandlock_ffi.so.%{soversion} to cargo::rustc-link-arg-cdylib= sed -i '/fn main/a \ \ \ \ println!("cargo::rustc-link-arg-cdylib=-Wl,-soname,libsandlock_ffi.so.%{soversion}");' build.rs %generate_buildrequires %cargo_generate_buildrequires %build %cargo_build %{cargo_license_summary} %{cargo_license} > LICENSE.dependencies %install # install shared library mkdir -p %{buildroot}/%{_libdir} cp -pav target/release/libsandlock_ffi.so %{buildroot}/%{_libdir}/libsandlock_ffi.so.%{soversion} cp -pav target/release/libsandlock_ffi.a %{buildroot}/%{_libdir}/libsandlock_ffi.a mkdir -p %{buildroot}/%{_includedir} cp -pav include/sandlock.h %{buildroot}/%{_includedir}/sandlock.h ln -s libsandlock_ffi.so.%{soversion} %{buildroot}/%{_libdir}/libsandlock_ffi.so %if %{with check} %check %cargo_test %endif %changelog %autochangelog