File feather-wallet.spec of Package feather-wallet

Name:           feather-wallet
Version:        2.8.1
Release:        4.1
Summary:        A free, open-source Monero wallet

License:        BSD-3-Clause
URL:            https://featherwallet.org
Source0:        https://featherwallet.org/files/releases/linux/feather-%{version}-linux.zip

BuildArch:      noarch

# Common build dependencies for both distributions
BuildRequires:  unzip
BuildRequires:  desktop-file-utils
BuildRequires:  file

# Fedora specific build dependencies
%if 0%{?fedora}
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: cmake
BuildRequires: ninja-build
BuildRequires: gnupg2
BuildRequires: zeromq-devel
BuildRequires: qrencode-devel
BuildRequires: zbar-devel
BuildRequires: qt6-qtbase-devel
BuildRequires: qt6-qtsvg-devel
BuildRequires: qt6-qtwebsockets-devel
BuildRequires: qt6-qtmultimedia-devel
BuildRequires: qt6-qtwayland-devel
BuildRequires: libgcrypt-devel
BuildRequires: openssl-devel
BuildRequires: libzip-devel
BuildRequires: boost-devel
BuildRequires: boost-filesystem
BuildRequires: boost-thread
BuildRequires: boost-system
BuildRequires: boost-regex
BuildRequires: boost-chrono
BuildRequires: libsodium-devel
BuildRequires: protobuf-lite-devel
BuildRequires: libusb1-devel
BuildRequires: unbound-devel
BuildRequires: wayland-devel
BuildRequires: zxing-cpp-devel
%endif

# Runtime dependencies
Requires:       qt6-qtbase
Requires:       qt6-qtmultimedia
Requires:       qt6-qtsvg
Requires:       qt6-qtwayland
Requires:       libunbound
Requires:       openssl
Requires:       libsodium
Requires:       libgcrypt
Requires:       boost-filesystem
Requires:       boost-system
Requires:       boost-thread
Requires:       boost-chrono
Requires:       boost-date_time
Requires:       boost-regex
Requires:       boost-program_options
Requires:       boost-locale
Requires:       boost-serialization
Requires:       zxing-cpp
Requires:       qrencode
Requires:       fontconfig

# Distribution specific runtime dependencies
%if 0%{?suse}
Requires:       tor
%endif

%if 0%{?fedora}
Requires:       tor
%endif

%description
Feather is a free, open-source Monero wallet for Linux, Tails, Windows and Mac. 
It is written in C++ with the Qt framework.

%prep
# Extract zip file to a temporary directory to avoid conflicts
mkdir -p feather-extracted
cd feather-extracted
unzip -q %{_sourcedir}/feather-%{version}-linux.zip
echo "=== Files in extracted directory ==="
ls -la

%build
# For binary package, we just verify the files
%if 0%{?suse}
# On OpenSUSE - binary package approach
cd feather-extracted

if [ -f feather-%{version} ]; then
    echo "Found binary: feather-%{version}"
    file feather-%{version}
    chmod +x feather-%{version}
    
    # Check ELF dependencies
    echo "=== ELF dependencies ==="
    ldd feather-%{version} || true
else
    echo "ERROR: Binary file feather-%{version} not found!"
    find . -type f -ls
    exit 1
fi
%endif

%if 0%{?fedora}
# On Fedora - we could either use binary package or build from source
# For now, using binary package approach for consistency
cd feather-extracted

if [ -f feather-%{version} ]; then
    echo "Found binary: feather-%{version}"
    file feather-%{version}
    chmod +x feather-%{version}
    
    # Check ELF dependencies
    echo "=== ELF dependencies ==="
    ldd feather-%{version} || true
else
    echo "ERROR: Binary file feather-%{version} not found!"
    find . -type f -ls
    exit 1
fi
%endif

%install
# Change to the extracted directory
cd feather-extracted

# Create directories
install -d %{buildroot}%{_bindir}
install -d %{buildroot}%{_datadir}/applications
install -d %{buildroot}%{_datadir}/feather

# Copy all files from the extracted directory
echo "=== Copying files to package ==="
for file in *; do
    if [ -e "$file" ]; then
        echo "Copying: $file"
        cp -r "$file" %{buildroot}%{_datadir}/feather/
    fi
done

# Rename the binary to just 'feather' for easier execution
if [ -f %{buildroot}%{_datadir}/feather/feather-%{version} ]; then
    mv %{buildroot}%{_datadir}/feather/feather-%{version} %{buildroot}%{_datadir}/feather/feather
    chmod +x %{buildroot}%{_datadir}/feather/feather
fi

# Verify the binary in target location
echo "=== Verifying installed binary ==="
file %{buildroot}%{_datadir}/feather/feather
ldd %{buildroot}%{_datadir}/feather/feather || true

# Create launcher script
cat > %{buildroot}%{_bindir}/feather-wallet << 'EOF'
#!/bin/bash
cd %{_datadir}/feather
exec ./feather "$@"
EOF
chmod 755 %{buildroot}%{_bindir}/feather-wallet

# Create desktop file WITHOUT icon reference
cat > %{buildroot}%{_datadir}/applications/feather-wallet.desktop << 'EOF'
[Desktop Entry]
Version=1.0
Type=Application
Name=Feather Wallet
GenericName=Monero Wallet
Comment=A free, open-source Monero wallet
Exec=feather-wallet
Categories=Finance;Network;
Terminal=false
StartupWMClass=feather
Keywords=monero;crypto;wallet;xmr;
EOF

%post
update-desktop-database %{_datadir}/applications >/dev/null 2>&1 || :

%postun
update-desktop-database %{_datadir}/applications >/dev/null 2>&1 || :

%files
%defattr(-,root,root,-)
%{_bindir}/feather-wallet
%{_datadir}/applications/feather-wallet.desktop
%dir %{_datadir}/feather
%{_datadir}/feather/*

%changelog
* Tue Oct 21 2025 Alvin J. Merphy aka Sylar <renard.corp@hotmail.com> - 2.8.1-1
- Added Fedora 42 build support with all required dependencies
- Added conditional build requirements for Fedora and OpenSUSE
- Added tor dependency for both distributions
- Maintained binary package approach for both distributions
- Improved distribution-specific dependency handling

* Wed Oct 15 2025 Alvin J. Merphy aka Sylar <renard.corp@hotmail.com> - 2.8.1-1
- Initial package for Feather Wallet 2.8.1
- Binary package - no compilation needed
- Removed icon files to fix build issues
- Added missing fontconfig dependency
openSUSE Build Service is sponsored by