A new user interface for you! Read more...

File fcitx.spec of Package fcitx

%{!?gtk2_binary_version: %define gtk2_binary_version %(pkg-config  --variable=gtk_binary_version gtk+-2.0)}

Name:       fcitx
Summary:    Free Chinese Input Toy for X (XIM)
Version:    4.2.6.1
Release:    1%{?dist}
License:    GPLv2+
Group:      User Interface/Desktops
URL:        http://code.google.com/p/%{name}/
Source0:    http://%{name}.googlecode.com/files/%{name}-%{version}_dict.tar.xz
#Source1:    en_dict-20120815.tar.gz
#Source2:    pinyin.tar.gz
#Source3:    table.tar.gz
BuildRoot:  %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
# to correct debuginfo package name;
BuildRequires:      redhat-rpm-config redhat-release
BuildRequires:      gcc-c++ pango-devel, dbus-devel, iso-codes-devel, opencc
BuildRequires:      opencc-devel, opencc, libxml2-devel, libxkbfile-devel
#BuildRequires:      sysconftool
BuildRequires:      wget, intltool, chrpath, enchant-devel
BuildRequires:      cmake, libtool, doxygen, libicu-devel
BuildRequires:      qt-devel, gtk2-devel, libicu
BuildRequires:      libX11-devel, qt-x11, dbus-glib-devel, dbus-x11
BuildRequires:      desktop-file-utils
Requires:           %{name}-data = %{version}-%{release}
Requires:           %{name}-libs = %{version}-%{release}

%description
FCITX(Free Chinese Input Toy of X) is a collection of Simplified Chinese
input methods for Linux. It supports Pinyin, QuWei and Table-based input
methods. It's small and fast.

%package data
Summary:        Data files of FCITX
Group:          System Environment/Libraries
BuildArch:      noarch

%description data
The %{name}-data package provides shared datas for FCITX.

%package libs
Summary:        Shared libraries for FCITX
Group:          System Environment/Libraries

%description libs
The %{name}-libs package provides shared libraries for FCITX

%package devel
Summary:        Development files for FCITX
Group:          Development/Libraries
Requires:       %{name}-libs = %{version}-%{release}
Requires:       libX11-devel

%description devel
The %{name}-devel package contains libraries and header files necessary for
developing programs using FCITX libraries.

%package table-chinese
Summary:        Chinese table of FCITX
Group:          System Environment/Libraries
BuildArch:      noarch
Requires:       %{name} = %{version}-%{release}

%description table-chinese
The %{name}-table-chinese package provides other Chinese table for FCITX.

%package gtk2
Summary:        FCITX im module for gtk2
Group:          System Environment/Libraries
Requires:       %{name} = %{version}-%{release}

%description gtk2
This package contains ibus im module for gtk2.

%package qt4
Summary:        FCITX im module for qt4
Group:          System Environment/Libraries
Requires:       %{name} = %{version}-%{release}

%description qt4
This package contains fcitx im module for qt4.

%prep
%setup -q
#cp %{SOURCE1} ./data/
#cp %{SOURCE2} ./data/
#cp %{SOURCE3} ./data/table/

%build
mkdir -p build
pushd build
%cmake .. -DCMAKE_BUILD_TYPE=Release \
    -DENABLE_GTK3_IM_MODULE=Off \
    -DENABLE_QT_IM_MODULE=On \
    -DENABLE_GTK2_IM_MODULE=On \
    -DENABLE_OPENCC=On \
    -DENABLE_LUA=Off

make VERBOSE=1 %{?_smp_mflags}

%install
pushd build
make install INSTALL="install -p" DESTDIR=$RPM_BUILD_ROOT
rm -f %{buildroot}%{_libdir}/*.la
popd

%find_lang %{name}

desktop-file-install --delete-original \
  --dir ${RPM_BUILD_ROOT}%{_datadir}/applications \
  ${RPM_BUILD_ROOT}%{_datadir}/applications/%{name}-skin-installer.desktop

desktop-file-install --delete-original \
  --dir ${RPM_BUILD_ROOT}%{_datadir}/applications \
  ${RPM_BUILD_ROOT}%{_datadir}/applications/%{name}-configtool.desktop

desktop-file-install --delete-original \
  --dir ${RPM_BUILD_ROOT}%{_datadir}/applications \
  ${RPM_BUILD_ROOT}%{_datadir}/applications/%{name}.desktop

rm %{buildroot}/etc/xdg/autostart/fcitx-autostart.desktop

%clean
rm -rf %{buildroot}

%post
update-desktop-database %{_datadir}/applications &>/dev/null || :

%postun
update-desktop-database %{_datadir}/applications &>/dev/null || :

%post libs -p /sbin/ldconfig

%postun libs -p /sbin/ldconfig

%post gtk2
#https://bugzilla.redhat.com/show_bug.cgi?id=743229
%ifarch i386
%{_bindir}/update-gtk-immodules i386-redhat-linux-gnu || :
%endif

%ifarch x86_64
%{_bindir}/update-gtk-immodules x86_64-redhat-linux-gnu || :
%endif

%postun gtk2
%ifarch i386
%{_bindir}/update-gtk-immodules i386-redhat-linux-gnu || :
%endif

%ifarch x86_64
%{_bindir}/update-gtk-immodules x86_64-redhat-linux-gnu || :
%endif

%files -f %{name}.lang
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog THANKS TODO COPYING
#%doc __doc/*
%{_bindir}/fcitx-*
%{_bindir}/fcitx
%{_bindir}/createPYMB
%{_bindir}/mb2org
%{_bindir}/mb2txt
%{_bindir}/readPYBase
%{_bindir}/readPYMB
%{_bindir}/scel2org
%{_bindir}/txt2mb
%{_datadir}/applications/%{name}-skin-installer.desktop
%{_datadir}/applications/%{name}-configtool.desktop
%{_datadir}/applications/%{name}.desktop
%{_datadir}/mime/packages/x-fskin.xml
%{_docdir}/%{name}/
%{_mandir}/man1/createPYMB.1.gz
%{_mandir}/man1/fcitx-remote.1.gz
%{_mandir}/man1/fcitx.1.gz
%{_mandir}/man1/mb2org.1.gz
%{_mandir}/man1/mb2txt.1.gz
%{_mandir}/man1/readPYBase.1.gz
%{_mandir}/man1/readPYMB.1.gz
%{_mandir}/man1/scel2org.1.gz
%{_mandir}/man1/txt2mb.1.gz
%{_datadir}/%{name}/

%files libs
%defattr(-,root,root,-)
%doc
%{_bindir}/fcitx4-config
%{_libdir}/libfcitx*.so.*
%{_libdir}/%{name}/

%files data
%defattr(-,root,root,-)
%doc
%{_datadir}/icons/hicolor/16x16/apps/%{name}.png
%{_datadir}/icons/hicolor/22x22/apps/%{name}.png
%{_datadir}/icons/hicolor/24x24/apps/%{name}.png
%{_datadir}/icons/hicolor/32x32/apps/%{name}.png
%{_datadir}/icons/hicolor/48x48/apps/%{name}.png
%{_datadir}/icons/hicolor/128x128/apps/%{name}.png
%{_datadir}/icons/hicolor/16x16/status/*.png
%{_datadir}/icons/hicolor/22x22/status/*.png
%{_datadir}/icons/hicolor/24x24/status/*.png
%{_datadir}/icons/hicolor/48x48/status/*.png
%{_datadir}/icons/hicolor/scalable/status/*.svg
%{_datadir}/icons/gnome/scalable/status/*.svg
%{_datadir}/%{name}/inputmethod/

%files devel
%defattr(-,root,root,-)
%doc
%{_libdir}/libfcitx*.so
%{_libdir}/pkgconfig/fcitx*.pc
%{_includedir}/fcitx*
%{_datadir}/cmake/%{name}/

%files table-chinese
%defattr(-,root,root,-)
%doc
%{_datadir}/%{name}/table/qxm.conf
%{_datadir}/%{name}/table/qxm.mb
%{_datadir}/%{name}/table/cangjie.conf
%{_datadir}/%{name}/table/cj.mb
%{_datadir}/%{name}/table/db.conf
%{_datadir}/%{name}/table/db.mb
%{_datadir}/%{name}/table/erbi.conf
%{_datadir}/%{name}/table/erbi.mb
%{_datadir}/%{name}/table/wanfeng.conf
%{_datadir}/%{name}/table/wanfeng.mb
%{_datadir}/%{name}/table/wbpy.conf
%{_datadir}/%{name}/table/wbpy.mb
%{_datadir}/%{name}/table/zrm.conf
%{_datadir}/%{name}/table/zrm.mb

%files gtk2
%defattr(-,root,root,-)
%{_libdir}/gtk-2.0/%{gtk2_binary_version}/immodules/im-fcitx.so

%files qt4
%defattr(-,root,root,-)
%{_libdir}/qt4/plugins/inputmethods/libqtim-fcitx.so

%changelog