File utox.spec of Package utox

#
# spec file for package utox
#
# Copyright (c) 2021 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 realname uTox
Name:           utox
Version:        0.18.1
Release:        0
Summary:        Client µTox is lightweight Tox client written in C
License:        GPL-3.0-only
Group:          Productivity/Networking/Instant Messenger
URL:            https://github.com/uTox/uTox/
#Source:         %%{realname}-%%{version}.tar.gz
#Source:         https://github.com/uTox/uTox/archive/v%%{version}/%%{name}-%%{version}.tar.gz
Source:         https://github.com/uTox/uTox/releases/download/v%{version}/%{realname}-%{version}-full.tar.gz
Source1:        %{name}.svg
#Patch0:        utox-64bit-portability-issue.patch
Patch1:         %{name}-desktop.patch
BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  git
BuildRequires:  pkgconfig
BuildRequires:  rsvg-convert
BuildRequires:  hicolor-icon-theme
BuildRequires:  unzip
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(check)
BuildRequires:  pkgconfig(dbus-1)
BuildRequires:  pkgconfig(filteraudio)
BuildRequires:  pkgconfig(freealut)
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(libsodium)
BuildRequires:  pkgconfig(libv4l2)
BuildRequires:  pkgconfig(openal)
BuildRequires:  pkgconfig(opus)
BuildRequires:  pkgconfig(toxcore) >= 0.2
BuildRequires:  pkgconfig(vpx)
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(xft)
BuildRequires:  pkgconfig(xrender)

%description
Lightweight Tox client.
Still early in development, though it already supports one of most important
features, like file transfers, A/V, group chats, DNS Discovery.

%prep
%setup -q -n %{realname}
#%%patch0 -p 1
%patch1 -p1

%build
#sed -i 's|\($(CFLAGS)\)|$(CUSTOM_CFLAGS)\ \1|' Makefile
mkdir build
pushd build
# FIXME: you should use the %%cmake macros
cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
      -DENABLE_ASAN=OFF \
      -DCMAKE_CXX_FLAGS="-std=c++11" \
      ..
%make_build \
    CUSTOM_CFLAGS="%{optflags}" \
    %{?_smp_mflags}
popd

%install
make install -C build PREFIX=%{_prefix} DESTDIR=%{buildroot}

ICONSIZE="14 16 22 24 32 36 48 64 72 96 128 192 256 512"
for i in $ICONSIZE; do
    DIR=%{buildroot}%{_datadir}/icons/hicolor/${i}x${i}/apps
    mkdir -p $DIR
    rsvg-convert -h $i -w $i %{SOURCE1} -o $DIR/%{name}.png
done

PIXMAPS=%{buildroot}%{_datadir}/pixmaps
mkdir -p $PIXMAPS
cp $DIR/%{name}.png $PIXMAPS

SCALABLE=%{buildroot}%{_datadir}/icons/hicolor/scalable/apps
mkdir -p $SCALABLE
cp %{SOURCE1} $SCALABLE

%fdupes %{buildroot}

%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun

%files
%license LICENSE
%doc README.md
%{_bindir}/utox
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%dir %{_datadir}/icons/hicolor/14x14
%dir %{_datadir}/icons/hicolor/14x14/apps
%{_datadir}/icons/hicolor/*/apps/%{name}*.png
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%{_mandir}/man1/utox.1%{?ext_man}

%changelog
openSUSE Build Service is sponsored by