File kcm-fcitx.spec of Package kcm-fcitx

#
# spec file for package kcm-fcitx
#
# 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		pkgname	fcitx-config-kde4

Name:           kcm-fcitx
Version:        0.4.3
Release:        0
Summary:        KDE control module for Fcitx
License:        GPL-2.0+
Group:          System/I18n/Chinese
Url:            http://github.com/fcitx/kcm-fcitx
Source:         http://download.fcitx-im.org/kcm-fcitx/%{name}-%{version}.tar.xz
Source1:        input-keyboard.svg
Obsoletes:      %{name} < 0.2.0
Provides:       %{name} = %{version}
BuildRequires:  fcitx-devel
BuildRequires:  libkde4-devel
BuildRequires:  rsvg-view
%if 0%{?suse_version} <= 1140 
BuildRequires:  libunique-devel
%else
BuildRequires:  libunique1-devel
%endif
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  intltool
BuildRequires:  libtool
BuildRequires:  xz
Requires:       fcitx-kcm-icons = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
KDE control module for Fcitx. 

You can config fcitx through "Configue Desktop" - "Locale" - Fcitx now.

%package -n %{pkgname}
Summary:        KDE control module for Fcitx
Group:          System/I18n/Chinese
%kde4_runtime_requires
%fcitx_requires
Provides:       locale(kdebase4:ko;zh_CN;zh_SG)
Supplements:    packageand(fcitx:kdebase4)	

%description -n %{pkgname}
KDE control module for Fcitx.

You can config fcitx through "Configure Desktop" - "Locale" - Fcitx now.

%package -n %{pkgname}-icons
Summary:        Keyboard icons for %{pkgname}
Group:          System/I18n/Chinese
Requires:       %{pkgname} = %{version}
Provides:       fcitx-kcm-icons = %{version}
Conflicts:      otherproviders(fcitx-kcm-icons)
Supplements:    packageand(%{pkgname}:kdebase4-workspace-branding)
BuildArch:      noarch

%description -n %{pkgname}-icons
This package provides systemsetting icons for fcitx in kdebase4-workspace.

%prep
%setup -q -n %{name}-%{version}

%build
%{__mkdir} -pv build
pushd build

cmake .. -DCMAKE_INSTALL_PREFIX=%{_prefix} -DLIB_INSTALL_DIR=%{_libdir}

make

%install
pushd build

make DESTDIR=%{buildroot} install

popd

sed -i "s/Categories=Qt;KDE;Utility/Categories=Qt;KDE;Utility;DesktopUtility;/" %{buildroot}%{_datadir}/applications/kde4/kbd-layout-viewer.desktop

ICONSIZE="16 22 32 48 64 128 256"
for i in $ICONSIZE; do
    mkdir -pv %{buildroot}%{_datadir}/icons/hicolor/${i}x${i}/devices/
    rsvg-convert -h $i -w $i %{SOURCE1} -o %{buildroot}%{_datadir}/icons/hicolor/${i}x${i}/devices/input-keyboard.png
done

%find_lang kcm_fcitx

%kde_post_install

%post -n %{pkgname} -p /sbin/ldconfig

%postun -n %{pkgname} -p /sbin/ldconfig

%files -n %{pkgname} -f kcm_fcitx.lang
%defattr(-,root,root,-)
%{_bindir}/kbd-layout-viewer
%{_libdir}/kde4/kcm_fcitx.so
%{_datadir}/kde4/config/fcitx-skin.knsrc
%{_datadir}/kde4/services/kcm_fcitx.desktop
%{_datadir}/applications/kde4/kbd-layout-viewer.desktop

%files -n %{pkgname}-icons
%defattr(-,root,root,-)
%{_datadir}/icons/hicolor/*/devices/input-keyboard.png

%changelog
openSUSE Build Service is sponsored by