%define _debugsource_template %{nil} %define debug_package %{nil} %bcond_without selinux %bcond_with vendored Name: cpx Version: 0.1.4 Release: 3%{?dist} Summary: Modern fast file copy tool for Linux License: MIT URL: https://github.com/11happy/cpx Source0: %{url}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz %if %{with vendored} Source1: %{name}-%{version}-vendor.tar.zst %endif Source2: %{name}-%{version}-rpm-assets.tar.gz BuildRequires: cargo >= 1.85 BuildRequires: rust >= 1.85 BuildRequires: gcc BuildRequires: make BuildRequires: pkgconf-pkg-config %if %{with selinux} BuildRequires: libselinux-devel BuildRequires: clang-devel %endif %global _description %{expand: cpx is a modern replacement for cp, written in Rust. It supports fast parallel copying, progress bars, resumable interrupted transfers, gitignore-style exclude patterns, configurable defaults, reflink support, and preservation options for common file attributes.} %description %{_description} %prep %autosetup -n %{name}-%{version} tar -xaf %{SOURCE2} %if %{with vendored} tar -xaf %{SOURCE1} if [ ! -f .cargo/config.toml ]; then mkdir -p .cargo cat > .cargo/config.toml <<'EOF_CARGO' [source.crates-io] replace-with = "vendored-sources" [source.vendored-sources] directory = "vendor" EOF_CARGO fi %endif %build export CARGO_HOME=$PWD/.cargo-home export RUSTFLAGS="%{?build_rustflags}" %if %{with vendored} export CARGO_NET_OFFLINE=true %endif %if %{with selinux} # selinux-sys uses bindgen and needs libclang during the build. export LIBCLANG_PATH=%{_libdir} %if %{with vendored} cargo build --release --frozen --offline --features selinux-support %else cargo build --release --features selinux-support %endif %else %if %{with vendored} cargo build --release --frozen --offline %else cargo build --release %endif %endif %install install -Dpm 0755 target/release/cpx %{buildroot}%{_bindir}/cpx install -Dpm 0644 assets/usr/share/bash-completion/completions/cpx \ %{buildroot}%{_datadir}/bash-completion/completions/cpx install -Dpm 0644 assets/usr/share/fish/vendor_completions.d/cpx.fish \ %{buildroot}%{_datadir}/fish/vendor_completions.d/cpx.fish install -Dpm 0644 assets/usr/share/zsh/site-functions/_cpx \ %{buildroot}%{_datadir}/zsh/site-functions/_cpx %check %{buildroot}%{_bindir}/cpx --version %files %license LICENSE %doc README.md README_CRATES.md CONTRIBUTING.md docs %{_bindir}/cpx %{_datadir}/bash-completion/completions/cpx %{_datadir}/fish/vendor_completions.d/cpx.fish %{_datadir}/zsh/site-functions/_cpx %changelog * Sun Apr 26 2026 sachesi - 0.1.4-3 - Add pregenerated Bash, Fish, and Zsh completions under assets * Sun Apr 26 2026 sachesi - 0.1.4-2 - Add clang-devel and LIBCLANG_PATH for selinux-sys bindgen builds * Sun Apr 26 2026 sachesi - 0.1.4-1 - Initial RPM package for cpx 0.1.4