#%define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(0)")

%define git_source 0
%define vine_ja_po 0

Summary: Intelligent Input Bus for Linux / Unix OS
Name: ibus
Version: 1.2.0.20091215
Release: 2%{?_dist_release}
License: LGPL
Group: System Environment/Libraries 
URL: http://code.google.com/p/ibus/
Source0: %{name}-%{version}.tar.gz
#Source1: ibus-1.1.0.20090407-ja.po
Patch0: ibus-1.2.0.20091024-fixPOFILES.in.patch
Requires: gtk2, pyxdg, iso-codes, dbus-python >= 0.83.0
BuildRequires: gettext >= 0.16.1, gtk2-devel, intltool >= 0.40.0
BuildRequires: dbus-devel, dbus-python-devel >= 0.83.0
BuildRequires: glib2-devel >= 2.0.0
BuildRequires: GConf2-devel >= 2.12
BuildRequires: perl >= 5.8.1 perl-XML-Parser
Buildrequires: python >= 2.5
Buildroot: %{_tmppath}/%{name}-%{version}-root
Provides: iBus

Packager: iwaim

%description
IBus is an Intelligent Input Bus. It is a new input framework for Linux OS.
It provides full featured and user friendly input method user interface.
It also may help developers to develop input method easily.

%package devel
Summary: Header files for iBus
Group: Development/Libraries
Requires: ibus == %{version}-%{release}

%description devel
Header files for iBus.

%prep
%setup -q
%patch0 -p1
%if %{git_source}
./autogen.sh
%endif
# replace ja.po
%if %{vine_ja_po}
%{__rm} -f po/ja.{po,gmo}
%{__cp} %{SOURCE1} po/ja.po
%endif
%configure --disable-static --with-gtk-im-module-dir=%{_libdir}/gtk-2.0/immodules

%build
pushd po
make ja.gmo
popd
make %{?_smp_mflags}

%install
rm -rf %{buildroot}
make DESTDIR=%{buildroot} install

rm -rf %{buildroot}%{_libdir}/libibus.la
rm -rf %{buildroot}%{_libdir}/gtk-2.0/immodules/im-ibus.la

%find_lang %{name}

%clean 
rm -rf %{buildroot}

%check
make check

%post
/sbin/ldconfig
%{_bindir}/gtk-query-immodules-2.0 > %{_sysconfdir}/gtk-2.0/%{_arch}/gtk.immodules

%postun
/sbin/ldconfig
%{_bindir}/gtk-query-immodules-2.0 > %{_sysconfdir}/gtk-2.0/%{_arch}/gtk.immodules


%files -f %{name}.lang
%defattr(-,root,root,-)
%doc AUTHORS COPYING ChangeLog NEWS README
%{_bindir}/ibus*
%{_libdir}/libibus.so.*
%{_libdir}/gtk-2.0/immodules/im-ibus.so
%{_libexecdir}/ibus-gconf
%{_libexecdir}/ibus-ui-gtk
%{_libexecdir}/ibus-x11
%{python_sitearch}/ibus
%{_datadir}/applications/*
%{_datadir}/ibus
%{_datadir}/gtk-doc/html/ibus
%{_datadir}/icons/hicolor/*/apps/*
%{_sysconfdir}/xdg/autostart/ibus.desktop
%{_sysconfdir}/gconf/schemas/ibus.schemas

%files devel
%defattr(-,root,root,-)
%{_libdir}/pkgconfig/ibus-1.0.pc
%{_libdir}/libibus.so
%{_includedir}/ibus-1.0

%changelog
* Mon Jan 25 2010 IWAI, Masaharu <iwai@alib.jp> 1.2.0.20091215-2
- add BuildRequires: GConf2-devel >= 2.12: fix <BTS:VineLinux:901>

* Fri Dec 18 2009 IWAI, Masaharu <iwai@alib.jp> 1.2.0.20091215-1
- new upstream release

* Sat Dec  5 2009 IWAI, Masaharu <iwai@alib.jp> 1.2.0.20091204-1
- new upstream release

* Sun Nov 29 2009 IWAI, Masaharu <iwai@alib.jp> 1.2.0.20091124-1
- new upstream release

* Wed Nov  4 2009 IWAI, Masaharu <iwai@alib.jp> 1.2.0.20091024-1 
- new upstream release
- add fix POFILES.in patch (Patch0)
- update file list in %%files section
- running ldconfig and gtk-query-immodules-2.0 in %%post and %%postun

* Thu Oct  8 2009 IWAI, Masaharu <iwai@alib.jp> 1.2.0.20090927-1
- new upstream release

* Thu Sep 17 2009 IWAI, Masaharu <iwai@alib.jp> 1.2.0.20090915-1
- new upstream release
- update %%files section
- update BuildRequires
- drop obsoleted configure option: --disable-qt4-immodule

* Fri Aug 28 2009 IWAI, Masaharu <iwai@alib.jp> 1.1.0.20090812-1
- new upstream release

* Sat Jun 20 2009 IWAI, Masaharu <iwai@alib.jp> 1.1.0.20090612-1
- new upstream release
- add Packager tag

* Tue Jun  2 2009 IWAI, Masaharu <iwai@alib.jp> 1.1.0.20090531-1
- new upstream release

* Sat May  9 2009 IWAI, Masaharu <iwai@alib.jp> 1.1.0.20090508-1
- new upstream release
- update BuildRequires
  - add dbus-devel, intltool >= 0.40.0
  - drop qt4-devel

* Sun Apr 26 2009 IWAI, Masaharu <iwai@alib.jp> 1.1.0.20090423-1
- new upstream release
- drop defined python_sitearch rpm macro

* Fri Apr 17 2009 IWAI, Masaharu <iwai@alib.jp> 1.1.0.20090417-1
- new upstream release

* Tue Apr 14 2009 IWAI, Masaharu <iwai@alib.jp> 1.1.0.20090413-1
- new upstream release
- drop Vine ja.po (SOURCE1)

* Wed Apr  8 2009 IWAI, Masaharu <iwai@alib.jp> 1.1.0.20090407-1
- new upstream release
- update ja.po (SOURCE1)

* Sat Apr  4 2009 IWAI, Masaharu <iwai@alib.jp> 1.1.0.20090331-1
- new upstream release

* Sat Mar 21 2009 IWAI, Masaharu <iwai@alib.jp> - 1.1.0.20090311-3
- add ja.po (SOURCE1): update
- add ibus.desktop file in xdg autostart
- add ibus.schemas file

* Fri Mar 20 2009 Shu KONNO <owa@bg.wakwak.com> - 1.1.0.20090311-2
- set python_sitearch to arch independent path

* Tue Mar 17 2009 IWAI, Masaharu <iwai@alib.jp> - 1.1.0.20090311-1
- new upstream release
- add dbus-python version ( 0.83.0 and more ) in Requires
- add BuildRequires: dbus-python-devel >= 0.83.0

* Mon Feb 23 2009 IWAI, Masaharu <iwai@alib.jp> - 1.1.0.20090217-1
- new upstream release
- add Requires: iso-codes, dbus-python: <BTS:VineLinux:656>
- generate devel sub package
- stop creating qt4 immodule
- drop .la files

* Mon Jan 26 2009 IWAI, Masaharu <iwai@alib.jp> - 0.1.1.20090126-1
- initial release
