File viber.spec of Package viber
%global __provides_exclude_from ^/opt/.*$
%global __requires_exclude_from ^/opt/.*$
%global debug_package %{nil}
Name: viber
Version: %(rpm -qp %{_sourcedir}/%{name}.rpm 2>/dev/null | sed "s|%{name}-\\(.\\+\\)-.*|\\1|")
Release: 0
Summary: %(rpm -qi %{_sourcedir}/%{name}.rpm 2>/dev/null | grep Summary | sed "s|Summary.*\:||")
Group: Productivity/Networking/Other
License: Apache-2.0
URL: https://www.%{name}.com/
Source0: %{name}.rpm
BuildRequires: rpm
BuildRequires: cpio
BuildRequires: hicolor-icon-theme
BuildRequires: chrpath
BuildRequires: fdupes
BuildRequires: desktop-file-utils
%description
Free and secure calls and messages to anyone, anywhere, on any device and network, in any country!
Viber for Desktop syncs your contacts, messages and call history with your mobile device.
%prep
%build
%install
rpm2cpio %{SOURCE0} | cpio -idm -D %{buildroot}
if [ -d "%{buildroot}/usr/lib/.build-id" ] ; then rm -rf %{buildroot}/usr/lib/.build-id ; fi
mkdir -p %{buildroot}%{_bindir}
cat >%{buildroot}%{_bindir}/%{name} <<'EOF'
#!/bin/sh
export LD_LIBRARY_PATH="/opt/viber/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
exec /opt/viber/Viber "$@"
EOF
chmod +x %{buildroot}%{_bindir}/%{name}
sed -i 's|Exec=/opt/viber/Viber %u|Exec=viber %u|g' %{buildroot}/%{_datadir}/applications/%{name}.desktop
desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop
for sofile in $(find %{buildroot}/opt -name *.so*) ; do chrpath --delete ${sofile} ; done
for sofile in $(find %{buildroot}/opt -name *.so*) ; do strip --strip-unneeded ${sofile} ; done
for sofile in $(find %{buildroot}/opt -name *.so*) ; do chmod +x ${sofile} ; done
chrpath --delete %{buildroot}/opt/viber/Viber
chrpath --delete %{buildroot}/opt/viber/libexec/QtWebEngineProcess
%fdupes -s %{buildroot}/opt/
%fdupes -s %{buildroot}/usr/
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%{_bindir}/%{name}
%dir /opt/viber
/opt/viber/*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/scalable/apps/Viber.svg
%{_datadir}/pixmaps/viber.png
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*
%changelog