%define name	poedit
%define version	1.5.5
%define release	3%{?_dist_release}

Summary:	Gettext catalogs editor
Summary(ja): 	Gettext カタログの翻訳用エディタ
Name:		%{name}
Version:	%{version}
Release: 	%{release}
Source0:	%{name}-%{version}.tar.gz
Patch0: del_comment_desktop.patch
Patch1: poedit-1.5.5-wx28.patch

License:	MIT
Group:		Applications/Development
URL:		http://www.poedit.net/

BuildRequires: desktop-file-utils
BuildRequires: wxGTK-devel >= 2.8.0
BuildRequires: gtkspell-devel >= 2.0, libdb-cxx-devel
BuildRequires: libboost-devel
BuildRoot:	%{_tmppath}/%{name}-%{version}-root


%description
Poedit is cross-platform gettext catalogs (.po files) editor.
It is built with wxWidgets toolkit and can run on any platform
supported by it (although it was only tested on Unix with GTK+
and Windows).
It aims to provide more convenient approach to editing catalogs
than launching vi and editing the file by hand.

%description -l ja
Poedit はクロス・プラットフォームな gettext カタログ (.po ファイル)
用のエディタです。Toolkit に wxWidgets を使っており、この Toolkit
がサポートする環境であればどんなプラットフォームでも動作します。
(実際には GTK+ を使った Unix と Windows でしかテストされていませんが)
このプログラムは、vi を使ってファイルを編集するよりも、もっと簡単に
カタログを編集する方法を提供することを目指しています。


%prep
%setup -q
%patch0 -p1
%patch1 -p1


%build
%configure
%{__make} %{?_smp_mflags}


%install
%{__rm} -rf ${RPM_BUILD_ROOT}
make install DESTDIR=$RPM_BUILD_ROOT INSTALL='install -p'

# Remove a few unnecessary locations where the makefile may install
# copies of icons and .desktop files
rm -rf \
    $RPM_BUILD_ROOT%{_datadir}/applnk \
    $RPM_BUILD_ROOT%{_datadir}/mimelnk \
    $RPM_BUILD_ROOT%{_datadir}/gnome \
    $RPM_BUILD_ROOT%{_datadir}/mime-info

# Install the desktop file
desktop-file-install \
    --delete-original \
    --add-category=GTK \
    --dir $RPM_BUILD_ROOT%{_datadir}/applications \
    $RPM_BUILD_ROOT%{_datadir}/applications/poedit.desktop

%find_lang %{name}

# work around for https://bugzilla.redhat.com/show_bug.cgi?id=866058
rm -f $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/*/mimetypes/text-x-gettext-translation.*

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

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


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


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


%files -f %{name}.lang
%defattr(-,root,root)
%doc AUTHORS COPYING NEWS README TODO
%{_bindir}/poedit
%{_datadir}/applications/poedit.desktop
%{_datadir}/icons/hicolor/*/apps/
%{_datadir}/icons/hicolor/*/mimetypes/
%{_datadir}/pixmaps/poedit.png
#%{_datadir}/poedit/help
%{_datadir}/poedit/icons
%{_mandir}/man1/poedit.1.gz

%changelog
* Fri Jul 1 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.5.5-3
- rebuilt with new toolchain.

* Sun Aug 02 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.5.5-2
- add BuildRequires: libdb-cxx-devel
- remove BuildRequires: db4-devel

* Sun Feb 10 2013 Toshiharu Kudoh <toshi.kd2@gmail.com> 1.5.5-1
- new upstream release
- added Patch1 from gentoo to fix build error 
- deleted unnecessary files
- fixed file conflict with virtaal-0.7.1

* Sun Oct 14 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> 1.5.4-1
- new upstream release
- added patch0 to suppress error in installing desktop file

* Fri Aug 10 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> 1.5.2-2
- new upstream release
- added BuildRequires: desktop-file-utils, libboost-devel
- changed BuildRequires: wxGTK-devel >= 2.6.0 to 2.8.0
- used %%{?_smp_mflags}
- run gtk-update-icon-cache and update-desktop-database in %%post, %%postun

* Sun Jul 01 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> 1.4.6.1-2
- changed BuildRequires: wx-gtk2-devel >= 2.6.0 to wxGTK-devel >= 2.6.0

* Sat Jun 18 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.4.6.1-1
- new upstream release

* Wed Apr 01 2009 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 1.4.2-1
- new upstream release

* Sun Aug 24 2008 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.3.9-1
- spec in UTF-8; new versioning policy

* Tue Jan  1 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 1.3.9-0vl1
- rebuild for VineSeed.
  * Tue Jan  1 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 1.3.9-0vl0
  - initial build for Vine Linux.

* Tue Jan  1 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 1.3.9-0vl0
- initial build for Vine Linux.
