File ibus.spec of Package ibus

#
# spec file for package ibus
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define build_gtk3 (0%{?suse_version} >= 1140)
%define build_without_dbus_autolaunch (0%{?suse_version} >= 1210)
%define domain_name %{name}10

Name:           ibus
Version:        1.5.2
Release:        4.6.1
Summary:        Intelligent Input Bus for Linux OS
License:        LGPL-2.1+
Group:          System/I18n/Chinese
Url:            http://code.google.com/p/ibus/
Source:         http://ibus.googlecode.com/files/%{name}-%{version}.tar.gz
Source1:        xim.d-ibus
Source2:        ibus-README.suse
Source3:        xim.ibus.suse.template
Source4:        xim.d-ibus-121
Patch0:         ibus-python-install-dir.patch
BuildRequires:  dbus-1-python-devel >= 0.83.0
BuildRequires:  fdupes
BuildRequires:  gettext-devel
BuildRequires:  gobject-introspection-devel
BuildRequires:  gtk-doc
BuildRequires:  intltool
BuildRequires:  iso-codes-devel
BuildRequires:  libtool
BuildRequires:  pkg-config
BuildRequires:  python
BuildRequires:  python-gobject2-devel
BuildRequires:  update-desktop-files
BuildRequires:  vala
BuildRequires:  pkgconfig(dbus-glib-1)
BuildRequires:  pkgconfig(gconf-2.0)
BuildRequires:  pkgconfig(gtk+-2.0)
Requires(pre):  /usr/bin/touch
Requires:       dbus-1-python
Requires:       gconf2
Requires:       gobject-introspection
Requires:       iso-codes
Requires:       libibus-1_0-5 = %{version}
Requires:       notification-daemon
Requires:       python-gtk
Requires:       python-notify
Requires:       python-xdg
Provides:       locale(ja;ko;zh)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%gconf_schemas_prereq

%define python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")
%define gtk_binary_version %(pkg-config  --variable=gtk_binary_version gtk+-2.0)

%description
IBus means 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 -n libibus-1_0-5
Summary:        IBus libraries
Group:          System/I18n/Chinese

%description -n libibus-1_0-5
This package contains the libraries for IBus

%package -n typelib-1_0-IBus-1_0
Summary:        IBus libraries -- Introspection bindings
Group:          System/I18n/Chinese

%description -n typelib-1_0-IBus-1_0
This package contains the introspection bindings for the IBus library.

%package gtk
Summary:        IBus im module for gtk2
Group:          System/I18n/Chinese
Requires:       %{name} = %{version}
Supplements:    packageand(ibus:gtk2)
%gtk2_immodule_requires

%description gtk
This package contains ibus im module for gtk2

%if %{build_gtk3}

%package gtk3

Summary:        IBus im module for gtk3
Group:          System/I18n/Chinese
BuildRequires:  gtk3-devel
Requires:       %{name} = %{version}
Supplements:    packageand(ibus:gtk3)
%gtk3_immodule_requires

%description gtk3
This package contains ibus im module for gtk3
%endif

%package devel
Summary:        Development tools for ibus
Group:          Development/Libraries/Other
Requires:       gtk-doc
Requires:       ibus = %{version}
Requires:       typelib-1_0-IBus-1_0 = %{version}
Requires:       pkgconfig(dbus-1)
Requires:       pkgconfig(glib-2.0)

%description devel
The ibus-devel package contains the header files and developer
docs for ibus.

%prep
%setup -q
%patch0 -p1

%build
autoreconf -fi
intltoolize -f
%configure --disable-static \
%if %{build_gtk3}
		--enable-gtk3 \
%endif
                   --disable-dconf \
                   --enable-gconf \
                   --enable-python-library \
		   --enable-gtk-doc \
	           --libexecdir=%{_libdir}/ibus
make %{?_smp_mflags}

%install
make install DESTDIR=%{buildroot}

# Autostart
mkdir -p %{buildroot}%{_sysconfdir}/X11/xim.d/
%if %{build_without_dbus_autolaunch}
install -m 644 $RPM_SOURCE_DIR/xim.d-ibus-121 %{buildroot}%{_sysconfdir}/X11/xim.d/ibus
%else
install -m 644 $RPM_SOURCE_DIR/xim.d-ibus %{buildroot}%{_sysconfdir}/X11/xim.d/ibus
%endif
sed -i 1i"SYS_LIB=%{_lib}" %{buildroot}%{_sysconfdir}/X11/xim.d/ibus

PRIORITY=40
pushd %{buildroot}%{_sysconfdir}/X11/xim.d/
    for lang in am ar as bn el fa gu he hi hr ja ka kk kn ko lo ml my \
                pa ru sk vi zh_TW zh_CN zh_HK zh_SG \
                de fr it es nl cs pl da nn nb fi en sv
    do
        mkdir $lang
        pushd $lang
            ln -s ../ibus $PRIORITY-ibus
        popd
    done
popd

# Remove static libs
rm -f %{buildroot}/%{_libdir}/gtk-2.0/%{gtk_binary_version}/immodules/im-ibus.*a
rm -f %{buildroot}/%{_libdir}/libibus-*.*a

rm -rf %{buildroot}%{_sysconfdir}/xdg/autostart/ibus.desktop
mkdir -p %{buildroot}%{_datadir}/pixmaps
ln -sf %{_datadir}/icons/hicolor/48x48/apps/ibus-keyboard.png \
  %{buildroot}%{_datadir}/pixmaps/ibus-keyboard.png

%suse_update_desktop_file  %{name} Utility DesktopUtility
%suse_update_desktop_file  %{name}-setup System Utility settings

%find_lang %{domain_name}
%find_gconf_schemas
cat %{name}.schemas_list %{domain_name}.lang > %{name}.lst
%fdupes -s %{buildroot}

%pre -f %{name}.schemas_pre

%post gtk
%gtk2_immodule_post

%preun -f %{name}.schemas_preun

%posttrans -f %{name}.schemas_posttrans

%postun gtk
%gtk2_immodule_postun

%post -n libibus-1_0-5 -p /sbin/ldconfig

%postun -n libibus-1_0-5 -p /sbin/ldconfig

%if %{build_gtk3}

%post gtk3
%gtk3_immodule_post

%postun gtk3
%gtk3_immodule_postun
%endif

%files -f %{name}.lst
%defattr(-,root,root,-)
%doc AUTHORS COPYING README
%doc $RPM_SOURCE_DIR/xim.ibus.suse.template
%doc $RPM_SOURCE_DIR/ibus-README.suse
%dir %{_sysconfdir}/X11/xim.d
%config %{_sysconfdir}/X11/xim.d/*
%{python_sitelib}/ibus
%dir %{_datadir}/ibus/
%{_bindir}/ibus
%{_bindir}/ibus-daemon
%{_bindir}/ibus-setup
%{_datadir}/ibus/*
%{_datadir}/applications/*
%{_datadir}/icons/hicolor/*/apps/*
%{_datadir}/pixmaps/*
%{_datadir}/bash-completion/completions/ibus.bash
%{_libdir}/ibus

%files -n libibus-1_0-5
%defattr(-,root,root,-)
%{_libdir}/lib*.so.*

%files -n typelib-1_0-IBus-1_0
%defattr(-,root,root,-)
%{_libdir}/girepository-1.0/IBus-1.0.typelib

%files gtk
%defattr(-,root,root,-)
%{_libdir}/gtk-2.0/%{gtk_binary_version}/immodules/im-ibus.so

%if 0%{?suse_version} >= 1140

%files gtk3
%defattr(-,root,root,-)
%{_libdir}/gtk-3.0/3.0.0/immodules/*
%endif

%files devel
%defattr(-,root,root,-)
%{_libdir}/lib*.so
%{_includedir}/*
%{_datadir}/gtk-doc/html/*
%{_libdir}/pkgconfig/*
%{_datadir}/gir-1.0/IBus-1.0.gir
%{_datadir}/vala/

%changelog
* Sun Apr 28 2013 kyoushuu@yahoo.com
- Update to 1.5.2
- Remove obsolete patches
- Remove patches for GNOME Shell extension
- Remove obsolete configure options
- Add new configure options
  * Enable gconf
  * Disable dconf
  * Enable python library
- Add vala to build dependencies
- Add bash completion
* Fri Mar 29 2013 i@marguerite.su
- Put gnome-shell integration files into separate package because
  these (since openSUSE 12.3) pull in a lot of new unwanted packages
  on a GNOME-less system compared to 12.2. (bnc#812298)
- Use more robust make install call
- Remove redundant %%clean section
- fix python-bytecode-inconsistent-mtime
* Sat Feb 16 2013 ftake@geeko.jp
- better solution for bnc#802967
  * add ibus_indicator-14.patch: a shell extension for GNOME 3.6
  * update ibus-fix-tray-icon-on-gnome-3.6.patch
* Sat Feb  9 2013 hillwood@linuxfans.org
- fix bnc#802967
  * fix ibus's tray icon can't show in gnome-shell 3.6 for openSUSE 12.3,
    add ibus-fix-tray-icon-on-gnome-3.6.patch
* Thu Jan 10 2013 ftake@geeko.jp
- add ibus-fix-docs-build-error.patch: to fix build error
  in Factory
* Wed Oct 17 2012 douglarek@outlook.com
-  .spec file optimization
  * remove commented patch lines
  * use `make %%{?_smp_mflags}` instead of `make %%{?jobs:-j%%jobs}`
    see: http://en.opensuse.org/openSUSE:Specfile_guidelines#Parallel_make
* Sun Aug 26 2012 hillwood@linuxfans.org
- update to 1.4.2
  Some bug fixings
* Mon Jun 18 2012 tiwai@suse.de
- Move the strict dependency on libibus-1_0-0 to ibus main package;
  otherwise user may get the inconsistent setups
* Thu May 17 2012 swyear@gmail.com
- remove soft link in RPM_BUILD_ROOT
* Thu May 17 2012 swyear@gmail.com
- mkdir target directory before link
* Thu May 17 2012 swyear@gmail.com
- fix build error in Factory: ln should be done in buildroot
* Thu Mar  8 2012 hillwood@linuxfans.org
- Fix FSF-address warnings in RPMLINT report
* Wed Mar  7 2012 hillwood@linuxfans.org
- Update to 1.4.1
  * Many bug fixings
- Fix several RPMLINT report warnings
* Sun Feb 12 2012 ftake@geeko.jp
- Fix problem default preload engines do not work (bnc#746612)
- Fix slow down issue after "source xim.d/ibus" in a SSH session
* Tue Jan 24 2012 vuntz@opensuse.org
- Split typelib file into typelib-1_0-IBus-1_0 subpackage.
- Add typelib-1_0-IBus-1_0 Requires to devel subpackage.
* Thu Oct 13 2011 tiwai@suse.de
- Add obsoletes for libibus2-32bit in baselibs.conf
* Wed Oct 12 2011 ftake@geeko.jp
- update to 1.4.0
  * Status icon for GNOME 3 (bug#723591)
* Tue Sep  6 2011 ftake@geeko.jp
- Fix xim.d/ibus to launch D-Bus daemon (only for newer D-Bus)
* Mon Aug  8 2011 tiwai@suse.de
- Fix baselibs.conf to update GTK immodule cache properly for
  ibus-gtk-32bit and ibus-gtk3-32bit packages, too
- Clean up spec file
* Mon Jun 27 2011 tiwai@suse.de
- dropped the dependencies with release number
- simplify for passing gtk3 configure option
* Sun Jun 19 2011 swyear@gmail.com
- Change files in package, some should move to devel subpackage and libibus package
* Thu Jun 16 2011 tiwai@suse.de
- Fix xim.d locale directories of ja and ko
- Add xim.d selections for more locales to replace with SCIM
* Wed Jun 15 2011 tiwai@suse.de
- Add provides tag for supported locales (ja, ko, zh)
- Add proper supplements tags to gtk immodule packages
* Mon Jun 13 2011 swyear@gmail.com
- Update to ibus 1.3.9
- Set priority to 40, if we want to use ibus as default input method,
  better use a lower priority, so if any other input method framework
  installed, system can use other input method instead.
- Update README
- Remove kimpanel script from start up script
- Add gtk3 immodule
* Wed Mar  9 2011 tiwai@suse.de
- Fix post scripts to use new gtk2_immodule_* macros (bnc#678080)
* Wed Nov 17 2010 mxwu@novell.com
- Upgrade to ibus 1.3.8:
  * Fix CPU 100%% usage with signal.SIGCHLD
  * Destroy existing connection before creating a new
    connection, and only create the fake context once.
  * Move the candidate window just above the cursor
    when the window and a preedit string overlap.
  * Enable key snooper by default again
  * Always consume the hotkey, even if the hotkey
    associated engine already activated.
  * Fix race condition in bus_ibus_impl_create_engine()
  * Fix a build error of IBus-1.0.gir with gobject-introspection 0.9.6
  * Implement stress tool for ibus.
  * Fix a build error with GTK3 gdkkeysyms.h
  * Add time info in log message from satorux@chromium.org
  * Fix memory leak in ibus_input_context_process_key_event by Fujiwarat
  * Fix segv in bus_engine_proxy_process_key_event_reply_cb
  * Fix property issue.
  * Updated many translations.
* Tue Jul 13 2010 mxwu@novell.com
- Add ibus-disable-portability-check.patch
  * Disable automake's portability check, make OBS happy.
* Mon Jul 12 2010 mxwu@novell.com
- Upgrade to 1.3.6:
  * Support gtk3
  * Support gobject-introspection
  * Support vala language
  * Fix some bugs
* Tue May 11 2010 mxwu@novell.com
- Upgrade to 1.3.3:
  * Add configure option to disable key snooper in gtk im context
  * Fix a crash in ibus-x11
  * Fix a crash in ibus-daemon
  * For show language bar option, use {Embedded in menu} to replace {Never}.
  * Update some translation files
  * Fix crash if ibus loads engine.xml failed
  * Fix focus problems
  * Does not hard code iso-codes location
  * Fix link problem with binutils-gold
  * Updated translations
  * Optimize database query method for better performance
  * Many bug fixing
  * use floating IBusObject
  * support share one global engine in all applications
  * some ui improvements
  * many bug fixing
* Fri Mar 26 2010 tiwai@suse.de
- move post scriptlets to install
* Wed Mar 24 2010 tiwai@suse.de
- Split libibus1 subpackage
- Misc clean-ups in spec file, avoid unnecessary workarounds
* Thu Jan 28 2010 mxwu@novell.com
- Add ibus-python-install-dir.patch
  - Fix the installing path on X86_64
* Thu Jan 28 2010 mxwu@novell.com
- Initial import
openSUSE Build Service is sponsored by