%define rname wallet_engine Name: libwallet_engine Version: 0.0.7 Release: 1%{?dist} Summary: TON wallet engine library with a C++ binding License: MIT OR Apache-2.0 URL: https://github.com/i582/wallet-engine Source0: %{url}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz Source1: %{name}-development-%{version}.tar.gz Source2: config.toml # Telegram Desktop applies it on top of the engine and uses its API # (ton_connect_tlb module, decode_sign_data_cell): # https://github.com/desktop-app/patches/blob/master/wallet-engine.patch Patch: wallet-engine.patch # Rust is a bundled dependency on Fedora: use the system toolchain directly. BuildRequires: cargo BuildRequires: rustc BuildRequires: gcc-c++ %description Wallet Engine is a Rust library for TON wallet applications: it creates and imports wallets, parses and formats TON addresses, signs and submits transfers, and connects decentralized applications over TON Connect. It is used by Telegram Desktop 7.3 and newer. %package devel Summary: Development files for %{name} Requires: %{name} = %{version}-%{release} %description devel Wallet Engine is a Rust library for TON wallet applications: it creates and imports wallets, parses and formats TON addresses, signs and submits transfers, and connects decentralized applications over TON Connect. It is used by Telegram Desktop 7.3 and newer. This package contains the link library and the C++ binding generated by UniFFI (a header and a source file which the application compiles and links itself). %prep %autosetup -p1 -n wallet-engine-%{version} # unpack the vendored crate sources used for the offline build tar xf %{SOURCE1} # use the system Rust toolchain instead of the one pinned upstream rm -f rust-toolchain.toml # point cargo at the vendored crate sources install -D %{SOURCE2} .cargo/config.toml %build export CARGO_HOME="$PWD/.cargo" # the same profile overrides as in the Telegram Desktop build; # rustc does not set a soname for a cdylib, so pass it explicitly cargo rustc --offline --locked --lib --release --crate-type cdylib \ --config "profile.release.opt-level=3" \ --config "profile.release.panic='unwind'" \ -- -C link-arg=-Wl,-soname,lib%{rname}.so.0 # generate the C++ binding from the metadata embedded in the library cargo run --offline --locked --manifest-path bindgen/cpp/bindgen/Cargo.toml -- \ --library --out-dir out/%{rname} target/release/lib%{rname}.so %check export CARGO_HOME="$PWD/.cargo" # test the optimized code: the deep cell tests run on a 512 KiB thread stack, # which unoptimized frames overflow on aarch64 cargo test --offline --locked --lib --release \ --config "profile.release.opt-level=3" \ --config "profile.release.panic='unwind'" # the generated binding must compile and link against the library cd out/%{rname} echo '#include "wallet_engine.hpp" int main() { return 0; }' > check.cpp g++ -std=c++20 -Wno-pessimizing-move check.cpp wallet_engine.cpp \ -L../../target/release -l%{rname} -Wl,--no-undefined -o check rm -f check check.cpp %install install -pD -m755 target/release/lib%{rname}.so %{buildroot}%{_libdir}/lib%{rname}.so.%{version} ln -sf lib%{rname}.so.%{version} %{buildroot}%{_libdir}/lib%{rname}.so.0 ln -sf lib%{rname}.so.0 %{buildroot}%{_libdir}/lib%{rname}.so mkdir -p %{buildroot}%{_includedir}/%{rname} install -pm644 out/%{rname}/* %{buildroot}%{_includedir}/%{rname}/ %files %license LICENSE-MIT LICENSE-APACHE %doc README.md CHANGELOG.md %{_libdir}/lib%{rname}.so.* %files devel %{_libdir}/lib%{rname}.so %{_includedir}/%{rname}/ %changelog * Wed Oct 21 2026 Arkady L. Shane - 0.0.7-1 - Rebuild for Fedora: adapt the spec to the Fedora packaging guidelines - use the system (bundled) Rust toolchain instead of ALT rust build helpers * Fri Oct 09 2026 Vitaly Lipatov - 0.0.7-alt1 - initial build for Sisyphus