File maya-calendar.spec of Package maya-calendar

#
# spec file for package maya-calendar
#
# Copyright (c) 2018 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 lname   libmaya-calendar0
Name:           maya-calendar
Version:        0.4.1
Release:        0
Summary:        Maya Calendar for the Pantheon Desktop
License:        GPL-3.0-or-later
Group:          Productivity/Office/Organizers
Url:            https://elementary.io
Source:         https://github.com/elementary/calendar/archive/%{version}.tar.gz#/calendar-%{version}.tar.gz
# PATCH-FIX-UPSTREAM -- Remove NLTime because it was upstreamed (#234)
Patch0:         maya-calendar-0.4.1-vapi.patch
BuildRequires:  cmake >= 2.8
BuildRequires:  elementary-icon-theme
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  intltool
BuildRequires:  pkgconfig
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(champlain-0.12)
BuildRequires:  pkgconfig(champlain-gtk-0.12)
BuildRequires:  pkgconfig(clutter-1.0)
BuildRequires:  pkgconfig(folks)
BuildRequires:  pkgconfig(gconf-2.0)
BuildRequires:  pkgconfig(gee-0.8)
BuildRequires:  pkgconfig(geocode-glib-1.0)
BuildRequires:  pkgconfig(gio-2.0)
BuildRequires:  pkgconfig(gmodule-2.0)
BuildRequires:  pkgconfig(granite)
BuildRequires:  pkgconfig(gtk+-3.0) >= 3.11.6
BuildRequires:  pkgconfig(libecal-1.2) >= 3.8.0
BuildRequires:  pkgconfig(libedataserver-1.2)
BuildRequires:  pkgconfig(libical)
BuildRequires:  pkgconfig(libsoup-2.4)
BuildRequires:  pkgconfig(vapigen) >= 0.28.0
Recommends:     %{name}-lang
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%glib2_gsettings_schema_requires

%description
A slim, lightweight GTK+3 calendar app written in Vala, designed for
Elementary OS where it is known simply as Calendar.

Also looks and works great on other GTK+ desktops.

%package        devel
Summary:        Development files for lib%{name}
Group:          Development/Libraries/C and C++
Requires:       %{lname} = %{version}

%description    devel
This subpackage contains libraries and header files for developing
applications that want to make use of the libmaya shared library.

%package -n     %{lname}
Summary:        The Maya Calendar main library
Group:          System/Libraries

%description -n %{lname}
A slim, lightweight GTK+3 calendar app written in Vala, designed for
Elementary OS where it is known simply as Calendar.

%lang_package

%prep
%setup -q -n calendar-%{version}
%if 0%{?suse_version} > 1500
%patch0 -p2
%endif

%build
%cmake \
    -DCMAKE_SHARED_LINKER_FLAGS="-Wl,--as-needed" \
    -DGSETTINGS_COMPILE=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

for _file in $(find -name \*.desktop); do
  _file=$(basename $_file)
  %suse_update_desktop_file ${_file%.*}
done
popd

%find_lang %{name} %{?no_lang_C}
%fdupes %{buildroot}/%{_datadir}

%post
%icon_theme_cache_post
%desktop_database_post
%glib2_gsettings_schema_post

%postun
%icon_theme_cache_postun
%desktop_database_postun
%glib2_gsettings_schema_postun

%post   -n %{lname} -p /sbin/ldconfig
%postun -n %{lname} -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc AUTHORS COPYING README*
%{_bindir}/maya*
%{_libdir}/%{name}/
%{_datadir}/%{name}/
%dir %{_datadir}/appdata
%{_datadir}/appdata/org.pantheon.maya.appdata.xml
%{_datadir}/applications/org.pantheon.maya*.desktop
%{_datadir}/glib-2.0/schemas/org.pantheon.maya.gschema.xml
%{_datadir}/icons/hicolor/*/actions/calendar-go-today.??g
%{_datadir}/icons/hicolor/*/apps/office-calendar.??g

%files devel
%defattr(-,root,root)
%{_includedir}/%{name}/
%{_libdir}/lib%{name}.so
%{_libdir}/pkgconfig/%{name}.pc
%{_datadir}/vala/vapi/%{name}.deps
%{_datadir}/vala/vapi/%{name}.vapi

%files -n %{lname}
%defattr(-,root,root)
%{_libdir}/lib%{name}.so.*

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

%changelog
openSUSE Build Service is sponsored by