Name:           shotwell
Version:        0.28.4
Release:        1
Summary:        A photo organizer for the GNOME desktop

# LGPLv2+ for the code
# CC-BY-SA for some of the icons
License:        LGPLv2+ and CC-BY-SA
URL:            https://wiki.gnome.org/Apps/Shotwell
Source0:        https://download.gnome.org/sources/shotwell/0.28/shotwell-%{version}.tar.xz

BuildRequires:  vala
BuildRequires:  desktop-file-utils
BuildRequires:  libappstream-glib >= 0.7.3
BuildRequires:  gettext
BuildRequires:  itstool
BuildRequires:  pkgconfig(atk)
BuildRequires:  pkgconfig(libgdata)
BuildRequires:  pkgconfig(gcr-3)
BuildRequires:  pkgconfig(gcr-ui-3)
BuildRequires:  pkgconfig(gdk-3.0)
BuildRequires:  pkgconfig(gdk-x11-3.0)
BuildRequires:  pkgconfig(gee-0.8) >= 0.8.5
BuildRequires:  pkgconfig(gexiv2) >= 0.10.4
BuildRequires:  pkgconfig(gio-unix-2.0) >= 2.20
BuildRequires:  pkgconfig(glib-2.0) >= 2.40.0
BuildRequires:  pkgconfig(gmodule-2.0) >= 2.24.0
BuildRequires:  pkgconfig(gnome-doc-utils)
BuildRequires:  pkgconfig(gstreamer-1.0) >= 1.0.0
BuildRequires:  pkgconfig(gstreamer-base-1.0) >= 1.0.0
BuildRequires:  pkgconfig(gstreamer-plugins-base-1.0) >= 1.0.0
BuildRequires:  pkgconfig(gstreamer-pbutils-1.0) >= 1.0.0
BuildRequires:  pkgconfig(gtk+-3.0) >= 3.14.0
BuildRequires:  pkgconfig(gudev-1.0) >= 145
BuildRequires:  pkgconfig(json-glib-1.0)
BuildRequires:  pkgconfig(libexif) >= 0.6.16
BuildRequires:  pkgconfig(libgphoto2) >= 2.5.0
BuildRequires:  pkgconfig(libraw) >= 0.13.2
BuildRequires:  pkgconfig(libsoup-2.4) >= 2.42.0
BuildRequires:  pkgconfig(libxml-2.0) >= 2.6.32
BuildRequires:  pkgconfig(sqlite3) >= 3.5.9
BuildRequires:  pkgconfig(webkit2gtk-4.0) >= 2.6.3

# Needed by the publishing plugins
BuildRequires:  pkgconfig(rest-0.7) >= 0.7

# used by shotwell-settings-migrator
Requires:       dconf

%description
Shotwell is an easy-to-use, fast photo organizer designed for the GNOME
desktop.  It allows you to import photos from your camera or disk, organize
them by date and subject matter, even ratings.  It also offers basic photo
editing, like crop, red-eye correction, color adjustments, and straighten.
Shotwell's non-destructive photo editor does not alter your master photos,
making it easy to experiment and correct errors.


%prep
%setup -q


%build
%configure \
  --disable-schemas-compile \
  --disable-silent-rules \
  --disable-static
# --disable-rpath to configure doesn't seem to work
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
%make_build


%install
# otherwise gettext always returns English text regardless of LANGUAGE asked
export LANG=en_US.utf8
%make_install

# Remove libtool .la files
find %{buildroot} -name '*.la' -delete

# Update the screenshot shown in the software center
#
# NOTE: It would be *awesome* if this file was pushed upstream.
#
# See http://people.freedesktop.org/~hughsient/appdata/#screenshots for more details.
#
appstream-util replace-screenshots %{buildroot}%{_datadir}/metainfo/shotwell.appdata.xml \
  https://raw.githubusercontent.com/hughsie/fedora-appstream/master/screenshots-extra/shotwell/a.png \
  https://raw.githubusercontent.com/hughsie/fedora-appstream/master/screenshots-extra/shotwell/b.png \
  https://raw.githubusercontent.com/hughsie/fedora-appstream/master/screenshots-extra/shotwell/c.png \
  https://raw.githubusercontent.com/hughsie/fedora-appstream/master/screenshots-extra/shotwell/d.png

%find_lang %{name} --with-gnome


%check
desktop-file-validate %{buildroot}%{_datadir}/applications/shotwell.desktop
desktop-file-validate %{buildroot}%{_datadir}/applications/shotwell-viewer.desktop


%post
/sbin/ldconfig
update-desktop-database &>/dev/null || :
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :


%postun
/sbin/ldconfig
update-desktop-database &> /dev/null || :
if [ $1 -eq 0 ] ; then
  touch --no-create %{_datadir}/icons/hicolor &>/dev/null
  gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor &>/dev/null || :
  /usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
fi


%posttrans
gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor &>/dev/null || :
/usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :


%files -f %{name}.lang
%license COPYING
%doc README NEWS THANKS AUTHORS
%{_bindir}/shotwell
%{_libdir}/shotwell
%{_libdir}/libshotwell-authenticator.so.*
%exclude %{_libdir}/libshotwell-authenticator.so
%{_libdir}/libshotwell-plugin-common.so.*
%exclude %{_libdir}/libshotwell-plugin-common.so
%{_libexecdir}/shotwell
%{_datadir}/applications/shotwell.desktop
%{_datadir}/applications/shotwell-viewer.desktop
%{_datadir}/metainfo/shotwell.appdata.xml
%{_datadir}/glib-2.0/schemas/*.xml
%{_datadir}/icons/hicolor/*/apps/shotwell.png
%{_datadir}/icons/hicolor/symbolic/apps/shotwell-symbolic.svg
%{_mandir}/man1/*


%changelog
* Tue Aug 25 2020 douyan <douyan@kylinos.cn> - 0.28.4-1
- Init package for openEuler
