You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rust-libbpf-sys/rust-libbpf-sys.spec

141 lines
3.3 KiB

# Generated by rust2rpm 23
%bcond_without check
%global debug_package %{nil}
%global crate libbpf-sys
%global upstream_version 1.0.4+v1.0.1
%if 0%{?fedora} == 38
# Fedora 38's libbpf is new enough
# currently: 1.1.0
%bcond_without novendor
%else
%bcond_with novendor
%endif
Name: rust-libbpf-sys
Version: 1.0.4
Release: %autorelease
Summary: Rust bindings to libbpf from the Linux kernel
License: BSD-2-Clause
URL: https://crates.io/crates/libbpf-sys
Source: %{crates_source %{crate} %{upstream_version}}
# Manually created patch for downstream crate metadata changes
# * remove version suffix from crate version
# * bump bindgen to 0.63
Patch: libbpf-sys-fix-metadata.diff
# Conditional patch for defaulting to novendor
Patch101: libbpf-sys-default-to-novendor.diff
BuildRequires: rust-packaging >= 21
# the system libbpf is too old, use the bundled copy
Provides: bundled(libbpf) = 1.0.1
%global _description %{expand:
Rust bindings to libbpf from the Linux kernel.}
%description %{_description}
%package devel
Summary: %{summary}
BuildArch: noarch
Requires: elfutils-libelf-devel
Requires: kernel-headers
%if %{with novendor}
Requires: libbpf-devel
%endif
Requires: zlib-devel
%description devel %{_description}
This package contains library source intended for building other packages which
use the "%{crate}" crate.
%files devel
%license %{crate_instdir}/LICENSE
%doc %{crate_instdir}/README.md
%{crate_instdir}/
%package -n %{name}+default-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+default-devel %{_description}
This package contains library source intended for building other packages which
use the "default" feature of the "%{crate}" crate.
%files -n %{name}+default-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+bindgen-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+bindgen-devel %{_description}
This package contains library source intended for building other packages which
use the "bindgen" feature of the "%{crate}" crate.
%files -n %{name}+bindgen-devel
%ghost %{crate_instdir}/Cargo.toml
%if %{with novendor}
%package -n %{name}+novendor-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+novendor-devel %{_description}
This package contains library source intended for building other packages which
use the "novendor" feature of the "%{crate}" crate.
%files -n %{name}+novendor-devel
%ghost %{crate_instdir}/Cargo.toml
%endif
%package -n %{name}+static-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+static-devel %{_description}
This package contains library source intended for building other packages which
use the "static" feature of the "%{crate}" crate.
%files -n %{name}+static-devel
%ghost %{crate_instdir}/Cargo.toml
%prep
%autosetup -n %{crate}-%{upstream_version} -N
%autopatch -p1 -M 100
%if %{with novendor}
%autopatch -p1 -m 101
%endif
%cargo_prep
%generate_buildrequires
%cargo_generate_buildrequires
echo 'elfutils-libelf-devel'
echo 'kernel-headers'
%if %{with novendor}
echo 'libbpf-devel'
%endif
echo 'zlib-devel'
%build
%cargo_build
%install
%cargo_install
%if %{with check}
%check
%cargo_test
%endif
%changelog
%autochangelog