File extra.spec of Package extra

#
# spec file for package extra
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


Name:           extra
Version:        @SERVICE@
Release:        0
Summary:        A desktop application to download and install themes
License:        GPL-3.0
Group:          Productivity/Graphics/Visualization/Other
Url:            https://www.enlightenment.org/
Source:         %{name}-%{version}.tar.xz
BuildRequires:  ImageMagick
BuildRequires:  hicolor-icon-theme
BuildRequires:  meson >= 0.40.0
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(ecore)
BuildRequires:  pkgconfig(edje)
BuildRequires:  pkgconfig(eina)
BuildRequires:  pkgconfig(elementary)
BuildRequires:  pkgconfig(evas)
Recommends:     %{name}-lang
%if 0%{?suse_version}
BuildRequires:  fdupes
BuildRequires:  update-desktop-files
%endif

%description
Extra is a app which allows you to install elementary themes on your computer.

The app is based on elementary and uses efl libraries to download the theme.
It does so by fetching themes from extra.enlightenment.org.

%lang_package

%prep
%setup -q

%build
export CFLAGS="%{optflags} -g"
%meson
%meson_build

%install
%meson_install

_file=$(find -name %{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]' | sort -n | 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/%{name}.png
    fi
  done
else
  install -Dm0644 $_file %{buildroot}%{_datadir}/pixmaps/%{name}.png
fi

rm %{buildroot}%{_datadir}/icons/%{name}.png
mkdir -p %{buildroot}%{_mandir}/man1/}%{name}.1
mv %{buildroot}{%{_datadir}/doc/%{name}/,%{_mandir}/man1/}/%{name}.1

%find_lang %{name}
%if 0%{?suse_version}
%suse_update_desktop_file -r %{name} Enlightenment Settings DesktopSettings
%fdupes %{buildroot}%{_datadir}
%endif

%if 0%{?suse_version} < 1320
%post
%icon_theme_cache_post
%desktop_database_post

%postun
%icon_theme_cache_postun
%desktop_database_postun
%endif

%{?suse_version:%files}
%{!?suse_version:%files -f %{name}.lang}
%doc AUTHORS COPYING* ChangeLog README
%{_bindir}/%{name}
%{_libdir}/lib%{name}.so
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.??g
%{_mandir}/man?/%{name}.?.?z

%{?suse_version:%files lang -f %{name}.lang}

%changelog
openSUSE Build Service is sponsored by