Summary:	Utility for digital camera raw images
Summary(ja): 	デジタルカメラの raw イメージ用ユーティリティ
Name:		ufraw
Version:	0.18
Release: 	3%{?_dist_release}

License:	GPL
Group:		Applications/Graphics
URL:		http://ufraw.sourceforge.net/

Source0:	%{name}-%{version}.tar.gz

BuildRoot:	%{_tmppath}/%{name}-%{version}-root
BuildRequires:  cfitsio-devel
BuildRequires:  exiv2-devel
BuildRequires:  gimp-devel
BuildRequires:	gtk2-devel >= 2.6
BuildRequires:  gtkimageview-devel >= 1.3.0
BuildRequires:	lcms-devel
BuildRequires:	libexif-devel
BuildRequires:	libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:	libtiff-devel
BuildRequires:	zlib-devel
Requires(post): GConf2, shared-mime-info, desktop-file-utils
Requires(postun): shared-mime-info, desktop-file-utils
Requires(pre): GConf2
Requires(preun): GConf2

%description
Application allowed to read and manipulate raw images from digital
cameras. Takes care of the color management, handles the Nikon curve
formats and has editor for the tone curves. It allows easy process more
images in a batch on command-line.

%description -l ja
デジタルカメラの raw イメージを読み込み、操作するためのアプリケーション
です。カラーマネージメント機能を持ち、Nikon のカーブフォーマットの読み
込みやトーンカーブの編集が可能です。また大量のファイルをコマンドライン
から簡単にバッチ処理できます。

#---------------------------------------------------------------------------

%package gimp
Summary:        Raw image loader plugin for The GIMP
Summary(ja):	GIMP 用の raw イメージ読み込み用プラグイン
Group:		Applications/Graphics
Requires:       gimp

%description gimp
ufraw-gimp is a GIMP plug-in to read and manipulate raw images from 
digital cameras.

%description gimp -l ja
ufraw-gimp はデジタルカメラの raw イメージを読み込み、操作するための
GIMP 用の plug-in です。

#---------------------------------------------------------------------------

	
%prep
%setup -q

%build
%configure --enable-gimp --enable-extras --with-libexif --with-exiv2 DESTDIR=$RPM_BUILD_ROOT
%{__make}

%install
%{__rm} -rf $RPM_BUILD_ROOT

export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1
%{__make} install DESTDIR=${RPM_BUILD_ROOT}
unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL

# install schemas to sysconfdir manually.
%{__install} -d ${RPM_BUILD_ROOT}/%{_sysconfdir}/gconf/schemas
./generate_schemas.sh %{_prefix} $RPM_BUILD_ROOT%{_sysconfdir}/gconf/schemas/ufraw.schemas
#{__mv} ${RPM_BUILD_ROOT}/%{_datadir}/gconf/schemas/ufraw.schemas ${RPM_BUILD_ROOT}/%{_sysconfdir}/gconf/schemas
#{__rm} -rf ${RPM_BUILD_ROOT}/%{_datadir}/gconf/schemas

# install .desktop manually.
%{__install} -d $RPM_BUILD_ROOT/%{_datadir}/applications
%{__install} -m 644 ufraw.desktop $RPM_BUILD_ROOT/%{_datadir}/applications

# install mime-info manually. (But this has been included in shared-mime-info >= 0.21)
%{__install} -d ${RPM_BUILD_ROOT}/%{_datadir}/mime/packages
%{__install} -m 644 ufraw-mime.xml ${RPM_BUILD_ROOT}/%{_datadir}/mime/packages

%find_lang %{name}


%clean
%{__rm} -rf ${RPM_BUILD_ROOT}


%post
update-mime-database %{_datadir}/mime >& /dev/null ||:
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-install-rule %{_sysconfdir}/gconf/schemas/ufraw.schemas > /dev/null ||:
update-desktop-database %{_datadir}/applications >& /dev/null ||:

%pre
if [ "$1" -gt 1 ]; then
    export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
    gconftool-2 --makefile-uninstall-rule \
	%{_sysconfdir}/gconf/schemas/ufraw.schemas > /dev/null ||:
fi

%preun
if [ "$1" -eq 0 ]; then
    export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
    gconftool-2 --makefile-uninstall-rule \
	%{_sysconfdir}/gconf/schemas/ufraw.schemas > /dev/null ||:
fi

%postun
update-mime-database %{_datadir}/mime >& /dev/null ||:
update-desktop-database %{_datadir}/applications >& /dev/null ||:


%files -f %{name}.lang
%defattr(-,root,root)
%doc COPYING MANIFEST README TODO
%{_bindir}/ufraw
%{_bindir}/ufraw-batch
%{_bindir}/dcraw
%{_bindir}/nikon-curve
%{_sysconfdir}/gconf/schemas/ufraw.schemas
%{_datadir}/applications/ufraw.desktop
%{_datadir}/mime/packages/ufraw-mime.xml
%{_datadir}/pixmaps/ufraw.png
%{_mandir}/man1/ufraw.1*

%files gimp
%defattr(-,root,root)
%{_libdir}/gimp/2.0/plug-ins/ufraw-gimp

%changelog
* Sun Jul 29 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.18-3
- rebuild with exiv2-0.23

* Mon May 07 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.18-2
- rebuild with exiv2-0.22

* Sun Jul 31 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.18-1
- new upstream release
- built with exiv2-0.21.1
- added BR: cfitsio-devel, libtiff-devel

* Wed May  5 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.17-1
- new upstream release
- built with exiv2-0.19

* Sun Apr 12 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.15-1
- new upstream release

* Sun Oct  5 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.13-1vl5
- new upstream release

* Thu Sep 25 2008 Shu KONNO <owa@bg.wakwak.com> 0.12.1-1vl5
- applied new versioning policy, spec in utf-8
- built with exiv2

* Fri Aug 17 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.12.1-0vl1
- new upstream release.
- add Requires(post, postun)

* Tue Aug 07 2007 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.12-0vl1
- new upstream release.
- add BuildRequires gtkimageview-devel >= 1.3.0

* Mon Jun 11 2007 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.11-0vl1
- initial build for Vine Linux
