File gcin.spec of Package gcin
#
# spec file for package gcin
#
# Copyright (c) 2014 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/
#
Name: gcin
Version: 2.8.2
Release: 0
Summary: Chinese input method server
License: LGPL-2.1
Group: System/I18n/Chinese
Url: http://hyperrate.com/dir.php?eid=67
Source: gcin-%{version}.tar.bz2
Source1: xim.d-gcin
Source2: gcin-README.suse
Source3: xim.gcin.suse.template
# PATCH-FIX-UPSTREAM glin@suse.com - just install the _only_ icon to pixmaps
Patch1: icon_path.diff
# PATCH-FIX-UPSTREAM swyear@opensuse.org - fix qt3 detection in configure
Patch2: gcin-libdir.patch
# PATCH-FIX-UPSTREAM marguerite@opensuse.org - fix gtk2/3 immodules install path
Patch3: gcin-2.8.1-gtk_immodules_path.patch
# PATCH-FIX-UPSTREAM swyear@opensuse.org - fix doc path (used to open doc from gcin-tools)
Patch4: doc_dir.diff
# PATCH-FIX-UPSTREAM glin@suse.com - keep the debug symbols
Patch5: gcin-keep-debug-symbols.patch
# PATCH-FIX-UPSTREAM glin@suse.com - fix the Makefile dependency for parallel compiling
Patch7: gcin-parallel-compiling.patch
BuildRequires: anthy-devel
BuildRequires: fdupes
BuildRequires: gtk2-devel
BuildRequires: libjpeg-devel
BuildRequires: libqt4-devel
BuildRequires: pkg-config
BuildRequires: update-desktop-files
%if 0%{?suse_version} > 1130
BuildRequires: gtk3-devel
%endif
Requires: %{name}-branding
Requires: %{name}-gtk2-immodule = %{version}
Requires: %{name}-qt4-immodule = %{version}
%if 0%{?suse_version} > 1130
Requires: %{name}-gtk3-immodule = %{version}
%endif
Recommends: libreoffice-gnome
Provides: locale(zh_TW;zh_HK;zh_MO)
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
gcin is a Chinese input method server for traditional Chinese.
It features a better GTK user interface.
%package branding-upstream
Summary: Upstream branding of gcin
License: LGPL-2.1
Group: System/I18n/Chinese
Requires: gcin = %{version}
Supplements: packageand(%{name}:branding-upstream)
Provides: %{name}-branding = %{version}
Conflicts: otherproviders(%{name}-branding)
%description branding-upstream
This package provides upstream look and feel for gcin
%package gtk2-immodule
Summary: Gcin gtk2 immodule
License: LGPL-2.1
Group: System/I18n/Chinese
Requires: %{name} = %{version}
%gtk2_immodule_requires
%description gtk2-immodule
gcin gtk2 immodule, support gtk2-based applications
%package qt4-immodule
Summary: Gcin qt4 immodule
License: GPL-2.0
Group: System/I18n/Chinese
Requires: %{name} = %{version}
%description qt4-immodule
gcin qt4 immodule, support Qt4-based applications
%package anthy-module
Summary: Gcin anthy module
License: LGPL-2.1
Group: System/I18n/Chinese
Requires: %{name} = %{version}
%description anthy-module
gcin anthy module, try this to input Japanese with libanthy
%if 0%{?suse_version} > 1130
%package gtk3-immodule
Summary: Gcin gtk3 immodule
License: LGPL-2.1
Group: System/I18n/Chinese
Requires: %{name} = %{version}
%gtk3_immodule_requires
%description gtk3-immodule
gcin gtk3 immodule, support gtk3-based applications
%endif
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch7 -p1
cp -r %{SOURCE2} .
cp -r %{SOURCE3} .
# scripts/modify-XIM is mainly for Fedora/Mandriva and Qt3, obsoleted
rm -rf scripts/modify-XIM
sed -i "s/modify-XIM//" scripts/Makefile
%build
%if %{_lib} == lib64
sed -e "s,^LIB='lib',LIB=lib64," -i configure
%endif
CFLAGS="%{optflags}" %configure --prefix=/usr --use_i18n=Y \
--use_anthy=Y --doc_version_dir=N
make %{?_smp_mflags}
%install
%makeinstall
mkdir -p %{buildroot}%{_sysconfdir}/X11/xim.d/
install -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/X11/xim.d/gcin
rm -rf %{buildroot}%{_datadir}/doc
%suse_update_desktop_file -r -G "Set Up your inputmethod" gcin-tools Settings System SystemSetup
PRIORITY=30
pushd %{buildroot}%{_sysconfdir}/X11/xim.d/
for lang in en zh_TW zh_HK zh_MO ; do
mkdir $lang
pushd $lang
ln -s ../gcin $PRIORITY-gcin
popd
done
popd
%find_lang %{name}
%fdupes %{buildroot}
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%post anthy-module -p /sbin/ldconfig
%postun anthy-module -p /sbin/ldconfig
%post gtk2-immodule
/sbin/ldconfig
%gtk2_immodule_post
%postun gtk2-immodule
/sbin/ldconfig
%gtk2_immodule_postun
%if 0%{?suse_version} > 1130
%post gtk3-immodule
/sbin/ldconfig
#Add icons to gnome3 panel
TARGET="/usr/share/gnome-shell/js/ui/statusIconDispatcher.js"
if [ -f $TARGET ] ; then
if [ -z "`grep gcin $TARGET`" ] ; then
mv $TARGET $TARGET-gcin
# add gcin string to the file
sed "/^const STANDARD_TRAY_ICON_IMPLEMENTATIONS/a \ 'gcin': 'input-method'," $TARGET-gcin > $TARGET
fi
fi
%gtk3_immodule_post
%postun gtk3-immodule
/sbin/ldconfig
%gtk3_immodule_postun
%endif
%files -f %{name}.lang
%defattr(-,root,root)
%doc README.html Changelog.html COPYING AUTHORS gcin-README.suse xim.gcin.suse.template
%config %{_sysconfdir}/X11/xim.d/
%{_bindir}/*
%{_libdir}/gcin/
%{_datadir}/gcin/
%{_datadir}/pixmaps/gcin.png
%{_datadir}/applications/*
%exclude %{_libdir}/gcin/anthy-module.so
%dir %{_datadir}/icons/gcin/
%files branding-upstream
%defattr(-,root,root)
%{_datadir}/icons/gcin/*
%files gtk2-immodule
%defattr(-,root,root)
%{_libdir}/gtk-2.0/2.10.0/immodules/im-gcin.so
%files qt4-immodule
%defattr(-,root,root)
%{_libdir}/qt4/plugins/inputmethods/im-gcin.so
%files anthy-module
%defattr(-,root,root)
%{_libdir}/gcin/anthy-module.so
%if 0%{?suse_version} > 1130
%files gtk3-immodule
%defattr(-,root,root)
%{_libdir}/gtk-3.0/3.0.0/immodules/im-gcin.so
%endif
%changelog