File screenshot-tool.spec of Package screenshot-tool

#
# spec file for package screenshot-tool
#
# 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/
#


%define _name screenshot
Name:           screenshot-tool
Version:        0.1.4
Release:        0
Summary:        A simple screen capture tool
License:        GPL-3.0
Group:          Productivity/Graphics/Other
Url:            https://launchpad.net/screenshot-tool
Source:         https://launchpad.net/screenshot-tool/0.1.x/%{version}/+download/%{name}-%{version}.tar.xz
BuildRequires:  cmake
BuildRequires:  elementary-icon-theme
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  intltool
BuildRequires:  pkgconfig
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(gdk-pixbuf-2.0)
BuildRequires:  pkgconfig(granite)
BuildRequires:  pkgconfig(gtk+-3.0) >= 3.12
BuildRequires:  pkgconfig(libcanberra)
BuildRequires:  pkgconfig(vapigen) >= 0.28.0
Recommends:     %{name}-lang
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%glib2_gsettings_schema_requires

%description
A simple screen capture tool made for elementary OS.

%lang_package

%prep
%setup -q

%build
%cmake \
    -DGSETTINGS_COMPILE=OFF \
    -DICON_UPDATE=OFF
make %{?_smp_mflags}

%install
%cmake_install

pushd %{buildroot}
for _icon in $(find -name \*.desktop* | xargs sed -n '/Icon/s/^.*\=//p'); do
    _icon=${_icon##*/}
    if ! find -name "$_icon" | grep -q .; then
        _icon=$(find %{_datadir}/icons -name "${_icon%.*}.svg" | sort | head -n1)
        install -Dm0644 \
            "$_icon" ".%{_datadir}/icons/hicolor/scalable/apps/${_icon##*/}"
    else
        echo "Found: $_icon"
        exit 1
    fi
done
popd

%suse_update_desktop_file -r -G Screenshot %{name} GTK Utility DesktopUtility
%fdupes %{buildroot}%{_datadir}/locale
%find_lang %{name}

%post
%icon_theme_cache_post
%desktop_database_post
%glib2_gsettings_schema_post

%postun
%icon_theme_cache_postun
%desktop_database_postun
%glib2_gsettings_schema_postun

%files
%defattr(-,root,root)
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/accessories-screenshot.??g
%{_datadir}/glib-2.0/schemas/net.launchpad.screenshot.gschema.xml
%dir %{_datadir}/appdata
%{_datadir}/appdata/%{name}.appdata.xml

%files lang -f %{name}.lang
%defattr(-,root,root)

%changelog
openSUSE Build Service is sponsored by