%global _build_id_links none %global debug_package %{nil} %undefine source_date_epoch_from_changelog %global upstream_version 0.1.2 %global software_name hid2pcsc Name: %{software_name} Version: %{upstream_version} Release: 1%{?dist} Summary: User-space PC/SC bridge for proprietary HID smart card readers License: MIT URL: https://git.sudolife.dev:8443/eos/hid2pcsc # Source0 unpacks to hid2pcsc-%%{upstream_version}/ (archive prefix set by # the vendoring workflow). Same filename/layout as the Debian orig tarball. Source0: %{software_name}_%{upstream_version}.orig.tar.gz # Vendored crates (Debian orig-vendor component: contents of vendor/ only). Source1: %{software_name}_%{upstream_version}.orig-vendor.tar.gz BuildRequires: tar, rust >= 1.78.0, cargo >= 1.78.0, gcc, systemd-rpm-macros # The bridge needs pcscd plus an ifd-vpcd driver at runtime; vpcd is not # packaged in Fedora yet (see URL). Requires: pcsc-lite %{?systemd_requires} %description hid2pcsc bridges proprietary USB-HID smart card readers (currently the DeCard T10 family, 0471:a112/a120) into the standard PC/SC stack: it speaks the vendor HID feature-report protocol and connects to ifd-vpcd (vsmartcard), so applications see a normal PC/SC reader. Ships a udev rule for device-node access and a systemd unit. %prep %autosetup -p1 -n %{software_name}-%{upstream_version} # Use vendored crates to minimize network access during build. mkdir -p vendor tar -xf %{SOURCE1} -C vendor if [ ! -d vendor ]; then echo "ERROR: vendor/ directory not found." >&2 exit 1 fi %build export CARGO_HOME="$PWD/.cargo-home" export RUSTFLAGS="-C link-arg=-Wl,--as-needed" cargo build --release --frozen --offline %install install -Dsm755 target/release/%{software_name} %{buildroot}%{_bindir}/%{software_name} install -Dpm0644 dist/70-%{software_name}.rules %{buildroot}%{_udevrulesdir}/70-%{software_name}.rules install -Dpm0644 dist/%{software_name}.service %{buildroot}%{_unitdir}/%{software_name}.service %post %systemd_post %{software_name}.service udevadm control --reload >/dev/null 2>&1 || : %preun %systemd_preun %{software_name}.service %postun %systemd_postun_with_restart %{software_name}.service udevadm control --reload >/dev/null 2>&1 || : %check %files %license LICENSE %doc README.md %{_bindir}/%{software_name} %{_udevrulesdir}/70-%{software_name}.rules %{_unitdir}/%{software_name}.service %changelog