%global _build_id_links none %global debug_package %{nil} %undefine source_date_epoch_from_changelog %global upstream_version 0.2.1 %global software_name hid2pcsc Name: %{software_name} Version: %{upstream_version} Release: 1%{?dist} Summary: PC/SC IFD handler 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 # pcscd dlopens libhid2pcsc.so; it needs no vpcd and no extra service. Requires: pcsc-lite %description hid2pcsc is a PC/SC IFD handler for proprietary USB-HID smart card readers (currently the DeCard T10 family, 0471:a112/a120). pcscd loads the shared object directly via /etc/reader.conf.d, so applications see a normal PC/SC reader with two slots (contact + contactless) and no extra daemon runs. %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 -Dm0755 target/release/lib%{software_name}.so \ %{buildroot}%{_libdir}/readers/%{software_name}/lib%{software_name}.so install -Dm0644 dist/%{software_name}.conf \ %{buildroot}%{_sysconfdir}/reader.conf.d/%{software_name}.conf install -Dm0644 dist/70-%{software_name}.rules \ %{buildroot}%{_udevrulesdir}/70-%{software_name}.rules install -Dm0755 target/release/%{software_name} %{buildroot}%{_bindir}/%{software_name} %post udevadm control --reload >/dev/null 2>&1 || : %postun udevadm control --reload >/dev/null 2>&1 || : %files %license LICENSE %doc README.md %{_libdir}/readers/%{software_name}/lib%{software_name}.so %config(noreplace) %{_sysconfdir}/reader.conf.d/%{software_name}.conf %{_udevrulesdir}/70-%{software_name}.rules %{_bindir}/%{software_name} %changelog