diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..51eae11 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/libbpf-cargo-0.21.2.crate diff --git a/libbpf-cargo-fix-finding-libbpf-rs.diff b/libbpf-cargo-fix-finding-libbpf-rs.diff new file mode 100644 index 0000000..0a71bd8 --- /dev/null +++ b/libbpf-cargo-fix-finding-libbpf-rs.diff @@ -0,0 +1,18 @@ +--- a/src/test.rs ++++ b/src/test.rs +@@ -108,14 +108,7 @@ fn validate_bpf_o(path: &Path) { + + /// Returns the path to the local libbpf-rs + fn get_libbpf_rs_path() -> PathBuf { +- // The `CARGO_MANIFEST_DIR` environment variable points to the +- // libbpf-cargo directory, at build time. +- let libcargo_dir = env!("CARGO_MANIFEST_DIR"); +- +- Path::new(&libcargo_dir) +- .parent() +- .expect("failed to get parent of libbpf-cargo directory") +- .join("libbpf-rs") ++ Path::new("/usr/share/cargo/registry/libbpf-rs-0.21.2") + .canonicalize() + .expect("failed to canonicalize libbpf-rs") + } diff --git a/rust-libbpf-cargo0.21.spec b/rust-libbpf-cargo0.21.spec new file mode 100644 index 0000000..3458c30 --- /dev/null +++ b/rust-libbpf-cargo0.21.spec @@ -0,0 +1,116 @@ +# Generated by rust2rpm 25 +%bcond_without check + +%global crate libbpf-cargo + +Name: rust-libbpf-cargo0.21 +Version: 0.21.2 +Release: %autorelease +Summary: Cargo plugin to build bpf programs + +License: LGPL-2.1-only OR BSD-2-Clause +URL: https://crates.io/crates/libbpf-cargo +Source: %{crates_source} +# by default, test.rs expects libbpf-rs to be in the same checkout +# fix to point to /usr/share/cargo/registry +Patch: libbpf-cargo-fix-finding-libbpf-rs.diff + +BuildRequires: cargo-rpm-macros >= 24 + +%global _description %{expand: +Cargo plugin to build bpf programs.} + +%description %{_description} + +%package -n %{crate} +Summary: %{summary} +# (MIT OR Apache-2.0) AND Unicode-DFS-2016 +# Apache-2.0 OR BSL-1.0 +# Apache-2.0 OR MIT +# Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT +# BSD-2-Clause +# BSD-3-Clause OR MIT OR Apache-2.0 +# LGPL-2.1-only OR BSD-2-Clause +# MIT +# MIT OR Apache-2.0 +License: (LGPL-2.1-only OR BSD-2-Clause) AND ((MIT OR Apache-2.0) AND Unicode-DFS-2016) AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND BSD-2-Clause AND (BSD-3-Clause OR MIT OR Apache-2.0) AND MIT +# LICENSE.dependencies contains a full license breakdown + +%description -n %{crate} %{_description} + +%files -n %{crate} +%license LICENSE +%license LICENSE.BSD-2-Clause +%license LICENSE.LGPL-2.1 +%license LICENSE.dependencies +%doc CHANGELOG.md +%doc README.md +%{_bindir}/cargo-libbpf + +%package devel +Summary: %{summary} +BuildArch: noarch +Requires: clang +Requires: rustfmt + +%description devel %{_description} + +This package contains library source intended for building other packages which +use the "%{crate}" crate. + +%files devel +%license %{crate_instdir}/LICENSE +%license %{crate_instdir}/LICENSE.BSD-2-Clause +%license %{crate_instdir}/LICENSE.LGPL-2.1 +%doc %{crate_instdir}/CHANGELOG.md +%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}+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 + +%prep +%autosetup -n %{crate}-%{version} -p1 +%cargo_prep + +%generate_buildrequires +%cargo_generate_buildrequires +echo 'clang' +echo 'rustfmt' + +%build +%cargo_build +%{cargo_license_summary} +%{cargo_license} > LICENSE.dependencies + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +%autochangelog diff --git a/rust2rpm.toml b/rust2rpm.toml new file mode 100644 index 0000000..dec1df8 --- /dev/null +++ b/rust2rpm.toml @@ -0,0 +1,3 @@ +[requires] +build = ["clang", "rustfmt"] +lib = ["clang", "rustfmt"] diff --git a/sources b/sources new file mode 100644 index 0000000..f7edabb --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (libbpf-cargo-0.21.2.crate) = 8cc6e1e9f159fdc619621fe21960d6c634a978b14a203fdbad5b8615e31e871f68f85ad43521625235bf312f03804de633d7d45d0056b58288e612d6794f5db3