File beebeep.spec of Package beebeep

#
# spec file for package beebeep
#
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define rsvn r1557
Name:           beebeep
Version:        5.8.6
Release:        0
Summary:        Secure Lan Messenger
License:        GPL-3.0-or-later
Group:          Productivity/Networking/Instant Messenger
URL:            http://beebeep.sourceforge.net/
Source0:        http://sourceforge.net/projects/beebeep/files/Sources/beebeep-code-%{version}.zip
# PATCH-FIX-OPENSUSE data.patch avvissu@yandex.ru -- Change path to data files
Patch0:         beebeep-5.6.8-data.patch
BuildRequires:  ImageMagick
BuildRequires:  dos2unix
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  libqt5-linguist
BuildRequires:  pkgconfig
BuildRequires:  unzip
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(Qt5Core) >= 5.2.0
BuildRequires:  pkgconfig(Qt5Gui)
BuildRequires:  pkgconfig(Qt5Multimedia)
BuildRequires:  pkgconfig(Qt5Network)
BuildRequires:  pkgconfig(Qt5PrintSupport)
BuildRequires:  pkgconfig(Qt5Widgets)
BuildRequires:  pkgconfig(Qt5X11Extras)
BuildRequires:  pkgconfig(Qt5Xml)
BuildRequires:  pkgconfig(avahi-compat-libdns_sd)
Recommends:     %{name}-lang
Recommends:     %{name}-plugins
Recommends:     pulseaudio

%description
BeeBEEP is a secure (encryption based on Rjandell Algorithm, AES) peer to
peer lan messenger. You can talk and send files with all your friends
inside a local area network such of an office, home or internet cafe
without a server.

%package        plugins
Summary:        A collection of plugins for %{name}
Group:          Productivity/Networking/Instant Messenger
Requires:       %{name} = %{version}

%description    plugins
Secure Lan Messenger.

This package contains a collection of plugins: lifegame, numbertextmarker,
rainbowtextmarker, regularboldtextmarker etc.

%lang_package

%prep
%setup -q -n beebeep-code-%{rsvn}
%patch0 -p1

dos2unix -k CHANGELOG*

# Fix incorrect sRGB profile
for f in $(find . -type f -name \*.png); do
convert $f -strip $f
done

sed -i 's/lrelease-qt4/lrelease-qt5/' locale/locale.pri

%build
%qmake5

%make_build

%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_datadir}/%{name}
mkdir -p %{buildroot}%{_libdir}/%{name}/plugins
install -Dm 0755 test/%{name} %{buildroot}%{_libdir}/%{name}/%{name}
ln -s %{_libdir}/%{name}/%{name} %{buildroot}%{_bindir}/%{name}
find test -name \*.so | while read so; do
VERSION=$(readlink -qne ${so}|sed 's/.*[a-z]//')
install -m 0755 ${so}$VERSION %{buildroot}%{_libdir}/%{name}/plugins; done
install -m 0644 misc/{*.rc,*.ini,*.wav} %{buildroot}%{_datadir}/%{name}

# Install icon files to hicolor
_file=src/images/%{name}.png
_width=$(identify -format %w $_file)
_height=$(identify -format %h $_file)
if [ "$_width" -eq $_height ]; then
  ls %{_datadir}/icons/hicolor | grep '[0-9]x[0-9]' | while read _size; do
    if [ "$_width" -ge ${_size%x*} ]; then
      mkdir -p %{buildroot}%{_datadir}/icons/hicolor/${_size}/apps
      convert -strip \
        $_file -resize $_size \
        %{buildroot}%{_datadir}/icons/hicolor/${_size}/apps/${_file##*/}
    fi
  done
else
  install -Dm0644 $_file %{buildroot}%{_datadir}/pixmaps/${_file##*/}
fi
#

%suse_update_desktop_file -c %{name} BeeBEEP "Secure Lan Messenger" %{name} %{name} Qt Network InstantMessaging
%fdupes %{buildroot}%{_datadir}

langlist=$PWD/%{name}.lang
langdir=%{_datadir}/%{name}/languages
pushd locale
  for qm in *.qm; do
    [ -e "$qm" ] || continue
    if ! grep -xqs "\%dir\ $langdir" $langlist; then
      echo "%dir $langdir" >> $langlist
    fi
    install -Dm0644 $qm %{buildroot}$langdir/$qm
    lang=$(echo $qm | sed 's/.*\_\(.*\)\..*/\1/')
    [ "$(echo $lang | wc -c)" -le 6 ] || exit $?
    lang=${lang:+%lang($lang)\ }
    echo "$lang$langdir/$qm" >> $langlist
  done
popd

%files
%license LICENSE*
%doc BEEBEEP-HELP* CHANGELOG*
%{_bindir}/%{name}
%{_libdir}/%{name}/
%{_datadir}/%{name}/
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/*/%{name}.??g
%exclude %{_libdir}/%{name}/plugins
%exclude %{_datadir}/%{name}/languages

%files plugins
%{_libdir}/%{name}/plugins/

%files lang -f %{name}.lang

%changelog
openSUSE Build Service is sponsored by