File winbox.spec of Package winbox

#
# spec file for package WinBox
#
# Copyright (c) 2019 Mistific@tor
#

Name:           winbox
Version:        3.21
Release:        0
License:        MIT
Summary:        Winbox is a small utility that allows administration of MikroTik RouterOS using a fast and simple GUI
Url:            https://mikrotik.com/
Group:          System/X11/Utilities
Source:         %{name}_%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       wine
ExclusiveArch:  x86_64

%description
Winbox is a small utility that allows administration of MikroTik RouterOS using a fast and simple GUI.

%global debug_package %{nil}
%prep
%setup -q -n %{name}_%{version}

%build
cat << EOF > %{name}.sh
#!/bin/bash
FREETYPE_PROPERTIES="truetype:interpreter-version=35" wine %{_libdir}/%{name}/winbox.exe
EOF

cat << EOF > %{name}.desktop
[Desktop Entry]
Name=WinBox
GenericName=Configuration tool for RouterOS
Comment=Configuration tool for RouterOS
Exec=%{name}
Icon=%{_libdir}/%{name}/%{name}.png
Terminal=false
Type=Application
StartupNotify=true
Categories=Network;RemoteAccess;
Keywords=winbox;mikrotik;
EOF

%install
mkdir -p %{buildroot}%{_libdir}
cp -a . %{buildroot}%{_libdir}/%{name}
install -m 0755 %{name}.sh %{buildroot}%{_libdir}/%{name}
mkdir -p %{buildroot}%{_datadir}/applications
install -m 644 %{name}.desktop %{buildroot}%{_datadir}/applications

%post
ln -sf %{_libdir}/%{name}/%{name}.sh %{_bindir}/%{name}
/sbin/ldconfig

# Setup desktop file
if command -v update-desktop-database >/dev/null 2>&1; then
  update-desktop-database -q /usr/share/applications 2>/dev/null ||:
fi

%postun
/sbin/ldconfig

%files
%defattr(-,root,root)
%doc
%{_libdir}/%{name}
%{_datadir}/applications/%{name}.desktop
%changelog
* Fri Feb 14 2020 Mistific@tor - 3.21
- Package: WinBox 3.21
* Mon Oct 21 2019 Mistific@tor - 3.20
- Package: WinBox 3.20
* Sun Sep 08 2019 Mistific@tor - 3.19
- Package: WinBox 3.19