File kimtoy.spec of Package kimtoy

#
# spec file for package kimtoy
#
# Copyright (c) 2015 SUSE LINUX 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 app_id 140967
Name:           kimtoy
Version:        1.91
Release:        0
Summary:        An input method frontend for KDE
License:        GPL-2.0+
Group:          System/I18n/Chinese
Url:            https://www.linux-apps.org/content/show.php/KIMToy?content=%{app_id}
Source:         http://kde-apps.org/CONTENT/content-files/%{app_id}-kimtoy-%{version}.tar
Source1:        xim.d-kimtoy
BuildRequires:  cmake
BuildRequires:  extra-cmake-modules
BuildRequires:  gcc-c++
BuildRequires:  ibus-devel
BuildRequires:  libqt5-qtbase-devel 
BuildRequires:  libqt5-qtx11extras-devel
BuildRequires:  plasma-framework-devel
BuildRequires:  knotifications-devel
BuildRequires:  knewstuff-devel
BuildRequires:  kio-devel
BuildRequires:  kiconthemes-devel
BuildRequires:  karchive-devel
BuildRequires:  kconfig-devel
BuildRequires:  kconfigwidgets-devel
BuildRequires:  kcoreaddons-devel
BuildRequires:  kdbusaddons-devel
BuildRequires:  ki18n-devel
BuildRequires:  kwidgetsaddons-devel
BuildRequires:  kfilemetadata5-devel
BuildRequires:  openssl-devel
BuildRequires:  scim-devel
BuildRequires:  update-desktop-files
Recommends:     %{name}-lang = %{version}

%description
KIMToy is an input method frontend for KDE. It is an alternative to kimpanel plasmoid. KIMToy uses the same dbus ipc specification as kimpanel, say org.kde.impanel, so where kimpanel works, where KIMToy works.

KIMToy is a standalone application, has no dependence on plasma, so it won\'t make your whole desktop unstable.

KIMToy aims to provide a stable and intergrated frontend for Asian input method, such as fcitx, scim and ibus.

KIMToy makes easy for fcitx/ibus/scim users. These three input method should work out of box since KIMToy-0.2.

KIMToy is able to load sogou input method theme since KIMToy-0.4.

%package backend-scim
Summary:        Scim Backend for Kimtoy
Group:          System/I18n/Chinese
Requires:       %{name} = %{version}
Requires:       scim

%description backend-scim
KIMToy is an input method frontend for KDE.

This contains its scim backend

%package backend-ibus
Summary:        Ibus Backend for Kimtoy
Group:          System/I18n/Chinese
Requires:       %{name} = %{version}
Requires:       ibus >= 1.5.0

%description backend-ibus
KIMToy is an input method frontend for KDE.

This contains its ibus backend.

%lang_package

%prep
%setup -q

%build
mkdir build
cd build
CXXFLAGS="-pthread" cmake .. -DCMAKE_INSTALL_PREFIX=%{_prefix} -DLIB_INSTALL_DIR=%{_libdir}
make %{?_smp_mflags}

%install
cd build
%make_install

cd ..
%suse_update_desktop_file %{buildroot}%{_datadir}/applications/org.kde.%{name}.desktop Utility DesktopUtility

#The autolaunch of fcitx must be disabled. The following is just a work around.
mkdir -p %{buildroot}%{_sysconfdir}/X11/xim.d/
install -m 644 $RPM_SOURCE_DIR/xim.d-kimtoy %{buildroot}%{_sysconfdir}/X11/xim.d/kimtoy

pushd  %{buildroot}%{_sysconfdir}/X11/xim.d/
    for lang in en zh_CN zh_TW ja ko; do
        mkdir $lang
        pushd $lang
            ln -s ../kimtoy 35-kimtoy
        popd
    done
popd

%find_lang %{name}

%files
%defattr(-,root,root,-)
%{_bindir}/kimtoy
%{_datadir}/applications/org.kde.kimtoy.desktop
%{_sysconfdir}/xdg/autostart/org.kde.kimtoy.desktop
%{_sysconfdir}/xdg/kimtoy.knsrc
%{_datadir}/icons/hicolor/*/apps/kimtoy.png
%{_libdir}/qt5/plugins/*.so
%{_datadir}/kservices5/*.desktop
%{_datadir}/mime/packages/*.xml
%{_libdir}/qt5/plugins/kf5/kfilemetadata/kfilemetadata_ssfextractor.so
%{_libdir}/qt5/plugins/kf5/kfilemetadata/kfilemetadata_fskinextractor.so
%{_libdir}/qt5/plugins/imageformats/kimg_apng.so

%dir %{_sysconfdir}/X11/xim.d
%config %{_sysconfdir}/X11/xim.d/*

%files lang -f %{name}.lang
%defattr(-,root,root,-)

%files backend-scim
%defattr(-,root,root,-)
%dir %{_libdir}/scim-1.0
%dir %{_libdir}/scim-1.0/1.4.0
%dir %{_libdir}/scim-1.0/1.4.0/Config
%{_libdir}/scim-1.0/1.4.0/Config/kconfig5.so

%files backend-ibus
%defattr(-,root,root,-)
%dir %{_libdir}/ibus
%dir %{_datadir}/ibus
%dir %{_datadir}/ibus/component
%{_libdir}/ibus/ibus-kconfig
%{_datadir}/ibus/component/kconfig.xml
%{_libdir}/ibus/ibus-ui-impanel
%{_datadir}/ibus/component/impanel.xml

%post -p /sbin/ldconfig

%post backend-scim -p /sbin/ldconfig

%post backend-ibus -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%postun backend-scim -p /sbin/ldconfig

%postun backend-ibus -p /sbin/ldconfig

%changelog
openSUSE Build Service is sponsored by