File litecoin.spec of Package litecoin

Name:           litecoin
Version:        0.21.4
Release:        0
Summary:        Litecoin cryptocurrency client
License:        MIT
Group:          Productivity/Financial
URL:            https://litecoin.org
Source0:        https://download.litecoin.org/litecoin-%{version}/linux/litecoin-%{version}-x86_64-linux-gnu.tar.gz
Source1:        bitcoin256.png

# Минимальные зависимости для бинарного пакета
BuildRequires:  desktop-file-utils
BuildRequires:  hicolor-icon-theme

BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Litecoin is a peer-to-peer Internet currency that enables instant, near-zero cost payments to anyone in the world. 
Litecoin is an open source, global payment network that is fully decentralized without any central authorities. 
Mathematics secures the network and empowers individuals to control their own finances.

%package utils
Summary:        Command-line utilities for Litecoin
Group:          Productivity/Financial

%description utils
Command-line utilities for Litecoin cryptocurrency including litecoin-cli and litecoin-tx.

%package qt
Summary:        Qt GUI for Litecoin
Group:          Productivity/Financial

%description qt
Qt-based graphical user interface for Litecoin cryptocurrency.

%package -n litecoind
Summary:        Litecoin headless daemon
Group:          Productivity/Financial

%description -n litecoind
Headless daemon for Litecoin cryptocurrency (litecoind).

%prep
%setup -q -n litecoin-%{version}

%build
# Бинарный пакет - компиляция не требуется
echo "Building binary package - no compilation needed"

%install
# Создание необходимых каталогов
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_datadir}/applications
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/256x256/apps
mkdir -p %{buildroot}%{_datadir}/pixmaps

# Установка бинарных файлов из готового архива
install -m 755 bin/litecoin-cli %{buildroot}%{_bindir}
install -m 755 bin/litecoin-qt %{buildroot}%{_bindir}
install -m 755 bin/litecoin-tx %{buildroot}%{_bindir}
install -m 755 bin/litecoind %{buildroot}%{_bindir}

# Установка desktop-файла
cat > %{buildroot}%{_datadir}/applications/litecoin-qt.desktop << 'EOF'
[Desktop Entry]
Encoding=UTF-8
Name=Litecoin Core
Comment=Litecoin cryptocurrency client
Exec=litecoin-qt
Icon=litecoin
Terminal=false
Type=Application
Categories=Office;Finance;
EOF

# Установка иконок из локального источника
if [ -f %{SOURCE1} ]; then
    install -m 644 %{SOURCE1} %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/litecoin.png
    install -m 644 %{SOURCE1} %{buildroot}%{_datadir}/pixmaps/litecoin.png
else
    echo "Warning: bitcoin256.png not found in sources"
fi

# Создание файла лицензии, если его нет в архиве
if [ ! -f COPYING ]; then
    cat > COPYING << 'EOF'
Copyright (c) 2009-2020 The Bitcoin Core developers
Copyright (c) 2011-2020 The Litecoin Core developers

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
EOF
fi

# Установка документации и лицензии
mkdir -p %{buildroot}%{_defaultdocdir}/%{name}
mkdir -p %{buildroot}%{_defaultlicensedir}/%{name}

if [ -f README.md ]; then
    install -m 644 README.md %{buildroot}%{_defaultdocdir}/%{name}/
else
    # Создание минимального README если его нет
    cat > %{buildroot}%{_defaultdocdir}/%{name}/README.md << 'EOF'
# Litecoin Core

Litecoin is a peer-to-peer Internet currency that enables instant, near-zero cost payments to anyone in the world.

## Installation

This is a binary distribution of Litecoin Core for openSUSE Tumbleweed.

## Usage

- litecoin-qt: Graphical user interface
- litecoind: Headless daemon
- litecoin-cli: Command line interface
- litecoin-tx: Transaction tool

For more information visit: https://litecoin.org
EOF
fi

if [ -f COPYING ]; then
    install -m 644 COPYING %{buildroot}%{_defaultdocdir}/%{name}/
    install -m 644 COPYING %{buildroot}%{_defaultlicensedir}/%{name}/
else
    install -m 644 COPYING %{buildroot}%{_defaultdocdir}/%{name}/
    install -m 644 COPYING %{buildroot}%{_defaultlicensedir}/%{name}/
fi

%post qt
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
  %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi

%postun qt
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
  %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi

%files
%defattr(-,root,root,-)
%doc %{_defaultdocdir}/%{name}/
%license %{_defaultlicensedir}/%{name}/

%files utils
%defattr(-,root,root,-)
%{_bindir}/litecoin-cli
%{_bindir}/litecoin-tx

%files qt
%defattr(-,root,root,-)
%{_bindir}/litecoin-qt
%{_datadir}/applications/litecoin-qt.desktop
%{_datadir}/icons/hicolor/256x256/apps/litecoin.png
%{_datadir}/pixmaps/litecoin.png

%files -n litecoind
%defattr(-,root,root,-)
%{_bindir}/litecoind

%changelog
* Wed Oct 15 2025 Alvin J. Merphy aka Sylar <renard.corp@hotmail.com> - 0.21.4-0
- Initial package for openSUSE Tumbleweed
- Binary package distribution - no compilation
- Added bitcoin256.png icon support from local source
openSUSE Build Service is sponsored by