File blake3.spec of Package blake3

%define soname 0

Name:           blake3
Version:        1.8.2
Release:        0
Summary:        The official Rust and C implementations of BLAKE3
License:        Apache-2.0
Url:            https://github.com/BLAKE3-team/BLAKE3
Source0:        https://github.com/BLAKE3-team/BLAKE3/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        vendor.tar.zst
BuildRequires:  cargo
BuildRequires:  cargo-packaging
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  tbb-devel
ExclusiveArch:  %{rust_tier1_arches}

%description
The official Rust and C implementations of the BLAKE3 cryptographic hash function.

%package -n b3sum
Summary:        A command line utility for calculating BLAKE3 hashes

%description -n b3sum
A command line utility for calculating BLAKE3 hashes, similar to Coreutils tools
like b2sum or md5sum.

%package -n libblake3-%{soname}
Summary:        The official C implementation of BLAKE3

%description -n libblake3-%{soname}
The official C implementation of BLAKE3.

%package -n libblake3-devel
Requires:       libblake3-%{soname} = %{version}
Summary:        Development files for libblake3

%description -n libblake3-devel
This package contains the development files (mainly C header files) for libblake3.

%prep
%autosetup -p1 -a1 -n BLAKE3-%{version}

%build
pushd b3sum
%cargo_build
popd

pushd c
%cmake -DBLAKE3_USE_TBB=1
%cmake_build
popd

%install
pushd b3sum
%cargo_install
popd

pushd c
%cmake_install
popd

%check
pushd b3sum
%cargo_test
popd

%post -n libblake3-%{soname} -p /sbin/ldconfig

%postun -n libblake3-%{soname} -p /sbin/ldconfig

%files -n b3sum
%license LICENSE_A2 LICENSE_A2LLVM LICENSE_CC0
%{_bindir}/b3sum

%files -n libblake3-%{soname}
%license LICENSE_A2 LICENSE_A2LLVM LICENSE_CC0
%{_libdir}/libblake3.so.*

%files -n libblake3-devel
%license LICENSE_A2 LICENSE_A2LLVM LICENSE_CC0
%{_includedir}/blake3.h
%{_libdir}/cmake/blake3
%{_libdir}/libblake3.so
%{_libdir}/pkgconfig/libblake3.pc

%changelog
openSUSE Build Service is sponsored by