%define mapname fotoxx-maps
%define mapver  1.1
%define mapsrc  %{mapname}-%{mapver}

Summary:	Digital Photo editor
Summary(ja):	デジタル写真編集ソフトウェア

Name:		fotoxx
Version:	15.03.1
Release:	2%{?_dist_release}

Group:		Applications/Multimedia
License:	GPLv3+
URL:		http://www.kornelix.com/fotoxx.html

Source0:	http://www.kornelix.com/uploads/1/3/0/3/13035936/%{name}-%{version}.tar.gz
Source1:        http://www.kornelix.com/uploads/1/3/0/3/13035936/%{mapsrc}.tar.gz
Source2:	%{name}.desktop

BuildRoot:      %{_tmppath}/%{name}-%{version}-root
BuildRequires:	desktop-file-utils
BuildRequires:  freeimage-devel
BuildRequires:	gtk3-devel
BuildRequires:  libtiff-devel
BuildRequires:	perl-Image-ExifTool 
BuildRequires:  ufraw
BuildRequires:  xdg-utils
BuildRequires:  lcms2-devel

Requires:	dcraw
Requires:	ufraw
Requires:	perl-Image-ExifTool
Requires:	xdg-utils

Vendor:         Project Vine
Distribution:   Vine Linux

%description
Fotoxx is a free open source Linux program for editing image files
from a digital camera. The goal of fotoxx is to meet most image editing
needs while remaining easy to use.

%prep
%setup -q -a 1 

%build
# This package's Makefile is bizarre
# Misc. environment tweaks to let Makefile honor %%{optflags}
make %{?_smp_mflags} PREFIX=%{_prefix} \
  CXXFLAGS="%{optflags}" \
  LDFLAGS="%{optflags}"

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} DOCDIR=%{_docdir}/%{name}-%{version}
install -Dm 644 -p icons/%{name}.png  $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.png

pushd %{mapsrc}
make install DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} DOCDIR=%{_docdir}/%{name}-%{version}
popd

desktop-file-install \
    --vendor="" \
    --mode 644 \
    --remove-category="Application" \
    --dir $RPM_BUILD_ROOT%{_datadir}/applications/ \
    %{SOURCE2}

mkdir -p $RPM_BUILD_ROOT/%{_datadir}/appdata/
install -m 644 appdata/%{name}.appdata.xml $RPM_BUILD_ROOT/%{_datadir}/appdata/%{name}.appdata.xml


%clean
rm -rf $RPM_BUILD_ROOT


%posttrans
update-desktop-database -q &> /dev/null ||:

%postun
if [ $1 -eq 0 ] ; then
    update-desktop-database -q &> /dev/null ||:
fi


%files
%defattr(-,root,root,-)
%doc doc/*
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{mapname}
%{_bindir}/%{name}
%{_datadir}/%{name}/*
%{_datadir}/%{mapname}/*
%{_datadir}/appdata/%{name}.appdata.xml
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%{_mandir}/man1/*

%changelog
* Sun Jul 10 2016 Yoji TOYODA <bsyamato@sea.plala.or.jp> 15.03.1-2
- rebuild with gcc-5.4.0

* Tue Mar 10 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 15.03.1-1
- new upstream release including fotoxx-maps-1.1
- updated desktop file (SOURCE2)
- rebuilt with libtiff 4.0.3  
- added Vendor and Distribution tag

* Sun Jul 31 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 10.11.1-1
- updated to 10.11.1
- built with new toolchains

* Thu Jun 11 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 6.0-1
- initial build for Vine Linux

* Wed Feb 25 2009 Dennis Gilmore <dennis@ausil.us> - 6.0-3
- add patch to dynamically link to libfreeimage

* Wed Feb 25 2009 Pavel Alexeev <Pahan [ at ] Hubbitus [ DOT ] spb [ dOt.] su> - 6.0-2
- Forgot patch

* Wed Feb 25 2009 Pavel Alexeev <Pahan [ at ] Hubbitus [ DOT ] spb [ dOt.] su> - 6.0-1
- New version 6.0
- Adjust Source0 url (inspired by Kevin Fenzi in fedora-devel-list: https://www.redhat.com/archives/fedora-devel-list/2009-February/msg01622.html ).

* Wed Feb 25 2009 Pavel Alexeev <Pahan [ at ] Hubbitus [ DOT ] spb [ dOt.] su> - 5.8-2
- Add patch0 fotoxx-5.8.constchar.patch
- Reformat spec with tabs, remove trailing spaces.

* Sun Jan  4 2009 Nicoleau Fabien <nicoleau.fabien@gmail.com> - 5.8-1
- Rebuild for 5.8
* Mon Dec  1 2008 Nicoleau Fabien <nicoleau.fabien@gmail.com> - 5.7-1
- Rebuild for 5.7
* Sun Nov 16 2008 Nicoleau Fabien <nicoleau.fabien@gmail.com> - 5.6-1
- Rebuild for 5.6
* Tue Nov  4 2008 Nicoleau Fabien <nicoleau.fabien@gmail.com> - 5.5-1
- Rebuild for 5.5
* Thu Oct  9 2008 Nicoleau Fabien <nicoleau.fabien@gmail.com> - 5.4-1
- Rebuild for 5.4
* Thu Sep 18 2008 Nicoleau Fabien <nicoleau.fabien@gmail.com> - 5.3-1
- Rebuild for 5.3
* Sun Aug 31 2008 Nicoleau Fabien <nicoleau.fabien@gmail.com> - 5.2-1
- Rebuild for 5.2
* Sun Aug 24 2008 Nicoleau Fabien <nicoleau.fabien@gmail.com> - 5.1-1
- Rebuild for 5.1
* Fri Aug  8 2008 Nicoleau Fabien <nicoleau.fabien@gmail.com> - 5.0.1-1
- Rebuild for 5.0.1
* Sat Aug  2 2008 Nicoleau Fabien <nicoleau.fabien@gmail.com> - 5.0-1
- Rebuild for 5.0
* Tue Jul 22 2008 Nicoleau Fabien <nicoleau.fabien@gmail.com> - 4.9-1
- Initial build
