Summary:	Painting program for creating icons and pixel-based artwork
Summary(ja):	アイコンやピクセルベースの描画向けのペイントプログラム
Name:		mtpaint
Version:	3.31
Release:	2%{?_dist_release}
License:	GPLv3+
Group:		Applications/Graphics
URL:		http://mtpaint.sourceforge.net/
Source:		http://downloads.sf.net/%{name}/%{name}-%{version}.tar.bz2
Patch:		%{name}-3.19-xdg-open.patch
#Patch1:		%{name}-3.19-openjpeg.patch

BuildRoot:	%{_tmppath}/%{name}-%{version}-root
BuildRequires:	gtk2-devel zlib-devel
BuildRequires:	libpng-devel giflib-devel libjpeg-devel libtiff-devel
BuildRequires:	openjpeg-devel
BuildRequires:	desktop-file-utils gettext

%description
mtPaint is a simple painting program designed for creating icons and
pixel-based artwork. It can edit indexed palette or 24 bit RGB images
and offers basic painting and palette manipulation tools. Its main
file format is PNG, although it can also handle JPEG, GIF, TIFF, BMP,
XPM, and XBM files.

%description -l ja
mtPaint はシンプルなアイコンやピクセルベースの画像の作成用に
デザインされたペイントプログラムです。インデックスパレットや
24ビットカラーの画像を編集することが可能で、基本的なペイント
機能とパレットの編集ツールを備えています。ファイル形式は PNG
の他にも、JPEG や GIF、TIFF、BMP、XPM、XBM等が扱えます。


%prep
%setup -q
%patch -p1
#%patch1 -p1

# We have moved docs
%{__sed} -i 's,"/usr/doc/mtpaint/index.html","%{_docdir}/%{name}-handbook-%{version}/index.html",' src/png.c

%build
# This is not a "normal" configure
%configure cflags asneeded intl man gtk2 tiff jpeg GIF
%{__make} %{?_smp_mflags}

%install
%{__rm} -rf %{buildroot}
%{__make} install MT_PREFIX=%{buildroot}%{_prefix}            \
                  MT_MAN_DEST=%{buildroot}%{_mandir}/man1     \
                  MT_LANG_DEST=%{buildroot}%{_datadir}/locale \
                  BIN_INSTALL=%{buildroot}%{_bindir}

# install .desktop
cat > $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop <<EOF
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Name=%{name}
GenericName=Image Editor
GenrricName[ja]=イメージエディタ
Comment=Painting program to create pixel art and manipulate digital photos
Comment[ja]=ピクセルアートやデジタル写真の加工を行います
TryExec=%{name}
Exec=%{_bindir}/%{name} %%F
Icon=mtpaint
Terminal=false
Categories=Graphics;2DGraphics;RasterGraphics;GTK;
MimeType=image/bmp;image/x-bmp;image/gif;image/jpeg;\
image/jpg;image/pjpeg;image/png;image/x-png;image/tiff;\
image/x-tga;image/xbm;image/x-xbm;image/x-xbitmap;\
image/xpm;image/x-xpm;image/x-xpixmap;
EOF

%find_lang %{name}

%clean
%{__rm} -rf %{buildroot}

%post
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
if [ -x %{_bindir}/update-desktop-database ] ; then
  %{_bindir}/update-desktop-database &> /dev/null
fi
exit 0

%postun
if [ $1 -eq 0 ] ; then
  touch --no-create %{_datadir}/icons/hicolor &>/dev/null
  gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi
if [ -x %{_bindir}/update-desktop-database ] ; then
  %{_bindir}/update-desktop-database &> /dev/null
fi
exit 0

%posttrans
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :

%files -f %{name}.lang
%defattr(-, root, root, -)
%doc COPYING NEWS README
%{_mandir}/man1/%{name}*
%{_bindir}/%{name}
%{_datadir}/applications/*.desktop
%{_datadir}/pixmaps/%{name}.png

%changelog
* Thu Apr 14 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 3.31-2
- rebuilt with openjpeg-1.4

* Thu Mar 11 2010 Kazutaka HARADA <kazutaka@vinelinux.org> 3.31-1
- initial build for Vine Linux based on fedora development

* Wed Aug 19 2009 Christoph Wickert <cwickert@fedoraproject.org> - 3.31-1
- Update to 3.31
- Make handbook package noarch
- New gtk-update-icon-cache scriptlets

* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.21-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.21-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Fri Aug 15 2008 Terje Rosten <terje.rosten@ntnu.no> - 3.21-1
- 3.21
- add %%defattr on handbook

* Sat Feb  9 2008 Terje Rosten <terje.rosten@ntnu.no> - 3.20-3
- Rebuild

* Wed Jan 23 2008 Terje Rosten <terje.rosten@ntnu.no> - 3.20-2
- Unzip by %%setup
- Simplify %%post/postun
- Added COPYING to handbook

* Sat Dec 29 2007 Terje Rosten <terje.rosten@ntnu.no> - 3.20-1
- 3.20
- include patch now upstream
- handbook patch now upstream

* Wed Dec 19 2007 Terje Rosten <terje.rosten@ntnu.no> - 3.20-0.1.rc2
- 3.20RC2
- disable openjpeg support
- icon and desktop file now upstream

* Sun Dec 16 2007 Terje Rosten <terje.rosten@ntnu.no> - 3.19-1
- upgrade to 3.19
- misc fixes to be rpmlint clean
- fix debuginfo package
- handle translations
- fix license
- compile with correct flags
- add patch to compile
- add handbook subpackage (and fix app to find docs)
- add xdg-open patch
- dont' use %%makeinstall
- add icon and mimetypes to desktop file

* Mon Apr 16 2007 Dries Verachtert <dries@ulyssis.org> - 3.11-1 - 5280/dries
- Updated to release 3.11.

* Sun Nov 12 2006 Dries Verachtert <dries@ulyssis.org> - 3.02-1
- Updated to release 3.02.

* Mon Aug 07 2006 Dries Verachtert <dries@ulyssis.org> - 3.01-1
- Updated to release 3.01.

* Wed May 31 2006 Dries Verachtert <dries@ulyssis.org> - 2.31-1
- Updated to release 2.31.

* Sat Apr 08 2006 Dries Verachtert <dries@ulyssis.org> - 2.30-1.2
- Rebuild for Fedora Core 5.

* Wed Mar 01 2006 Dries Verachtert <dries@ulyssis.org> - 2.30-1
- Updated to release 2.30.

* Sun Jan 01 2006 Dries Verachtert <dries@ulyssis.org> - 2.20-1
- Updated to release 2.20.

* Mon Nov 21 2005 Dries Verachtert <dries@ulyssis.org> - 2.10-1
- Updated to release 2.10.

* Sat Sep 24 2005 Dries Verachtert <dries@ulyssis.org> - 2.03-1
- Updated to release 2.03.

* Tue Sep 20 2005 Dries Verachtert <dries@ulyssis.org> - 2.02-1
- Initial package.

