%if 0%{?el6}
%bcond_with gsettings
%bcond_without gconf2
%else
%bcond_without gsettings
%bcond_with gconf2
%endif
%if %{with gsettings}
%global gsettings_support ON
%else
%global gsettings_support OFF
%endif
%if %{with gconf2}
%global gconf2_support ON
%else
%global gconf2_support OFF
%endif
Name: ibus-chewing
Version: 1.6.1
Release: %autorelease
Summary: The Chewing engine for IBus input platform
Summary(zh_TW): IBus新酷音輸入法
License: GPL-2.0-or-later
URL: https://github.com/definite/ibus-chewing
Source0: https://github.com/definite/%{name}/releases/download/%{version}/%{name}-%{version}-Source.tar.gz
Patch1: %{name}-1799517-no-gob2.patch
Patch2: %{name}-1863869-cmake-build.patch
# https://src.fedoraproject.org/rpms/ibus-chewing/pull-request/2
Patch3: %{name}-backport-ignore-mod4.patch
BuildRequires: cmake >= 2.6.2
BuildRequires: pkgconfig
BuildRequires: ibus-devel >= 1.3
BuildRequires: libchewing-devel >= 0.3.3
BuildRequires: glib2-devel
BuildRequires: gtk2-devel
BuildRequires: libX11-devel
BuildRequires: gettext-runtime
BuildRequires: findutils
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: git
Requires: ibus >= 1.3
Requires: libchewing >= 0.3.3
Requires: gtk2
%description
IBus-chewing is an IBus front-end of Chewing, an intelligent Chinese input
method for Zhuyin (BoPoMoFo) users.
It supports various Zhuyin keyboard layout, such as standard (DaChen),
IBM, Gin-Yeah, Eten, Eten 26, Hsu, Dvorak, Dvorak-Hsu, and DaChen26.
Chewing also support toned Hanyu pinyin input.
%description -l zh_TW
IBus-chewing 是新酷音輸入法的IBus前端。
新酷音輸入法是個智慧型注音輸入法,支援多種鍵盤布局,諸如:
標準注音鍵盤、IBM、精業、倚天、倚天26鍵、許氏、Dvorak、Dvorak許氏
及大千26鍵。
本輸入法也同時支援帶調漢語拼音輸入。
%prep
%autosetup -S git -n %{name}-%{version}-Source
%build
# $RPM_OPT_FLAGS should be loaded from cmake macro.
%cmake -DCMAKE_FEDORA_ENABLE_FEDORA_BUILD=1 -DGSETTINGS_SUPPORT=%{gsettings_support} -DGCONF2_SUPPORT=%{gconf2_support} .
%cmake_build
%install
%cmake_install
# We install document using doc
rm -fr %{buildroot}%{_docdir}/*
%find_lang %{name}
%pre
%if "%{gconf2_support}" == "ON"
if [ "$1" -gt 1 ] ; then
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
[ -r %{_sysconfdir}/gconf/schemas/%{name}.schemas ] &&
gconftool-2 --makefile-uninstall-rule %{_sysconfdir}/gconf/schemas/%{name}.schemas >/dev/null || :
# Upgrading 1.0.2.20090302-1.fc11 or older?
[ -r %{_sysconfdir}/gconf/schemas/%{name}.schema ] &&
gconftool-2 --makefile-uninstall-rule %{_sysconfdir}/gconf/schemas/%{name}.schema >/dev/null || :
fi
%endif
%preun
%if "%{gconf2_support}" == "ON"
if [ "$1" -eq 0 ] ; then
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-uninstall-rule %{_sysconfdir}/gconf/schemas/%{name}.schemas > /dev/null || :
fi
%endif
%post
%if "%{gconf2_support}" == "ON"
if [ $1 -gt 1 ] ; then
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
[ -r %{_sysconfdir}/gconf/schemas/%{name}.schemas ] && gconftool-2 --makefile-install-rule %{_sysconfdir}/gconf/schemas/%{name}.schemas >/dev/null || :
fi
%endif
%postun
%if "%{gconf2_support}" == "ON"
if [ $1 -gt 1 ] ; then
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
[ -r %{_sysconfdir}/gconf/schemas/%{name}.schemas ] &&
gconftool-2 --makefile-uninstall-rule %{_sysconfdir}/gconf/schemas/%{name}.schemas >/dev/null || :
fi
%endif
%files -f %{name}.lang
%doc AUTHORS README.md ChangeLog USER-GUIDE
%license COPYING
%{_datadir}/%{name}/icons/%{name}-chi-full.svg
%{_datadir}/%{name}/icons/%{name}-chi-half.svg
%{_datadir}/%{name}/icons/%{name}-eng-full.svg
%{_datadir}/%{name}/icons/%{name}-eng-half.svg
%{_datadir}/%{name}/icons/%{name}-orig.png
%{_datadir}/%{name}/icons/%{name}-template.svg
%{_datadir}/%{name}/icons/%{name}.png
%{_datadir}/%{name}/icons/ibus-setup-chewing.png
%{_datadir}/applications/ibus-setup-chewing.desktop
%{_datadir}/glib-2.0/schemas/org.freedesktop.IBus.Chewing.gschema.xml
%{_datadir}/ibus/component/chewing.xml
%{_libexecdir}/ibus-engine-chewing
%{_libexecdir}/ibus-setup-chewing
%changelog
%autochangelog