File gcin.spec of Package gcin

# spec file for package gcin
# Copyright (c) 2017 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

Name:           gcin
Version:        2.8.5
Release:        0
Summary:        Chinese input method server
License:        LGPL-2.1
Group:          System/I18n/Chinese
Source1:        xim.d-gcin
Source2:        gcin-README.suse
Source3:        xim.gcin.suse.template
Source99:       baselibs.conf
# PATCH-FIX-UPSTREAM - just install the _only_ icon to pixmaps
Patch1:         icon_path.diff
# PATCH-FIX-UPSTREAM - fix qt3 detection in configure
Patch2:         gcin-libdir.patch
# PATCH-FIX-UPSTREAM - fix gtk2/3 immodules install path
Patch3:         gcin-2.8.1-gtk_immodules_path.patch
# PATCH-FIX-UPSTREAM - fix doc path (used to open doc from gcin-tools)
Patch4:         doc_dir.diff
# PATCH-FIX-UPSTREAM - keep the debug symbols
Patch5:         gcin-keep-debug-symbols.patch
# PATCH-FIX-UPSTREAM - fix the Makefile dependency for parallel compiling
Patch7:         gcin-parallel-compiling.patch
# PATCH-FIX-OPENSUSE - improve build with pkgconfig and add private headers at moc period
Patch8:         gcin-improve-build-with-pkgconfig.patch
# PATCH-FIX-UPSTREAM boo#951750 - fix the qt5 iid
Patch9:         gcin-fix-qt5-iid.patch
# PATCH-FIX-OPENSUSE - Don't copy since we already patched gcin-qt5.h
Patch10:        gcin-dont-copy-gcin-qt5-header.patch
# PATCH-FIX-UPSTREAM bwiedemann@suse - initialize memory to make build reproducible
Patch11:        gcin-reproducible.patch
BuildRequires:  anthy-devel
BuildRequires:  fdupes
BuildRequires:  gtk2-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libqt4-devel
BuildRequires:  pkg-config
BuildRequires:  update-desktop-files
BuildRequires:  xz
%if 0%{?suse_version} > 1310
BuildRequires:  libQt5Gui-private-headers-devel
BuildRequires:  libQt5PlatformSupport-devel-static
BuildRequires:  libqt5-qtbase-devel
Requires:       %{name}-branding
Requires:       %{name}-gtk2 = %{version}
Requires:       %{name}-qt4 = %{version}
Requires:       libgcin-im-client1 = %{version}
Recommends:     libreoffice-gnome
Provides:       locale(zh_TW;zh_HK;zh_MO)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1130
BuildRequires:  gtk3-devel
Requires:       %{name}-gtk3 = %{version}
%if 0%{?suse_version} >= 1310
Requires:       %{name}-qt5 = %{version}

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)
Conflicts:      otherproviders(%{name}-branding)
Provides:       %{name}-branding = %{version}

%description branding-upstream
This package provides upstream look and feel for gcin

%package -n libgcin-im-client1
Summary:        Share libraries of gcin
License:        LGPL-2.1
Group:          System/Libraries

%description -n libgcin-im-client1
This package provides runtime libraries for gcin.

%package gtk2
Summary:        Gcin gtk2 immodule
License:        LGPL-2.1
Group:          System/I18n/Chinese
Requires:       %{name} = %{version}
Provides:       %{name}-gtk2-immodule = %{version}
Obsoletes:      %{name}-gtk2-immodule <= 2.8.4-77.16

%description gtk2
gcin gtk2 immodule, support gtk2-based applications

%package qt4
Summary:        Gcin qt4 immodule
License:        GPL-2.0
Group:          System/I18n/Chinese
Requires:       %{name} = %{version}
Provides:       %{name}-qt4-immodule = %{version}
Obsoletes:      %{name}-qt4-immodule <= 2.8.4-77.16

%description qt4
gcin qt4 immodule, support Qt4-based applications

%if 0%{?suse_version} >= 1310
%package qt5
Summary:        Gcin qt5 immodule
License:        GPL-2.0
Group:          System/I18n/Chinese
Requires:       %{name} = %{version}
Provides:       %{name}-qt5-immodule = %{version}
Obsoletes:      %{name}-qt5-immodule <= 2.8.4-77.16

%description qt5
gcin qt5 immodule, support Qt5-based applications

%package anthy
Summary:        Gcin anthy module
License:        LGPL-2.1
Group:          System/I18n/Japanese
Requires:       %{name} = %{version}
Provides:       %{name}-anthy-module = %{version}
Obsoletes:      %{name}-anthy-module <= 2.8.4-77.16

%description anthy
gcin anthy module, try this to input Japanese with libanthy

%if 0%{?suse_version} > 1130
%package gtk3
Summary:        Gcin gtk3 immodule
License:        LGPL-2.1
Group:          System/I18n/Chinese
Requires:       %{name} = %{version}
Provides:       %{name}-gtk3-immodule = %{version}
Obsoletes:      %{name}-gtk3-immodule <= 2.8.4-77.16

%description gtk3
gcin gtk3 immodule, support gtk3-based applications

%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -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

%if %{_lib} == lib64
sed -e "s,^LIB='lib',LIB=lib64," -i configure
CFLAGS="%{optflags}" %configure --prefix=/usr --use_i18n=Y \
--use_anthy=Y --doc_version_dir=N

make %{?_smp_mflags}

make DESTDIR=%{buildroot} install %{?_smp_mflags}

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

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

%find_lang %{name}
%fdupes %{buildroot}

%post -n libgcin-im-client1 -p /sbin/ldconfig

%postun -n libgcin-im-client1 -p /sbin/ldconfig

%post anthy -p /sbin/ldconfig

%postun anthy -p /sbin/ldconfig

%post gtk2

%postun gtk2

%if 0%{?suse_version} > 1130
%post gtk3
#Add icons to gnome3 panel
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


%postun gtk3

%post qt4 -p /sbin/ldconfig
%postun qt4 -p /sbin/ldconfig
%if 0%{?suse_version} >= 1310
%post qt5 -p /sbin/ldconfig
%postun qt5 -p /sbin/ldconfig

%files -f %{name}.lang
%doc README.html Changelog.html COPYING AUTHORS gcin-README.suse xim.gcin.suse.template
%config %{_sysconfdir}/X11/xim.d/
%dir %{_datadir}/icons/gcin/

%files -n libgcin-im-client1
%dir %{_libdir}/gcin

%files branding-upstream

%files gtk2

%files qt4

%if 0%{?suse_version} >= 1310
%files qt5

%files anthy

%if 0%{?suse_version} > 1130
%files gtk3

openSUSE Build Service is sponsored by