Name:           ibus-table-chinese
Version:        1.8.2
Release:        14
Summary:        IBus Chinese input tables
License:        GPL-3.0-or-later
URL:            https://github.com/definite/ibus-table-chinese
Source0:        https://github.com/definite/ibus-table-chinese/archive/%{version}.tar.gz

BuildRequires:  cmake >= 2.6.2 ibus-table-devel >= 1.2.0
Requires:       ibus-table >= 1.2.0
Obsoletes:      ibus-table-yinma < 1.3 ibus-table-xingma < 1.3

BuildArch:      noarch

%description
ibus-table-chinese provides the Chinese input methods infrastructure.

%package        array
Summary:        Array input methods
License:        Freely redistributable without restriction
Requires:       %{name} = %{version}-%{release}
Provides:       ibus-table-array30 = %{version}-%{release}
Obsoletes:      ibus-table-array30 < 1.3

%description    array
Array is a free, open-minded character-structured input method.

%package        cangjie
Summary:        Cangjie based input methods
License:        Freely redistributable without restriction
Requires:       %{name} = %{version}-%{release}
Provides:       ibus-table-cangjie = %{version}-%{release}
Obsoletes:      ibus-table-cangjie < 1.3

%description    cangjie
Cangjie based input methodses.

%package        cantonese
Summary:        Cantonese input methods
License:        GPL-2.0-only AND GPL-3.0-or-later AND MIT
Requires:       %{name} = %{version}-%{release}
Provides:       ibus-table-cantonese = %{version}-%{release}
Obsoletes:      ibus-table-cantonese < 1.3

%description    cantonese
Cantonese includes Cantonese, Hong-Kong version of Cantonese and jyutping.

%package        easy
Summary:        Easy input method
License:        GPL-2.0-only
Requires:       %{name} = %{version}-%{release}
Provides:       ibus-table-easy = %{version}-%{release}
Obsoletes:      ibus-table-easy < 1.3

%description    easy
Easy phrase-wise input method.

%package        erbi
Summary:        Erbi input method
License:        GPL-2.0-or-later
Requires:       %{name} = %{version}-%{release}
Provides:       ibus-table-erbi = %{version}-%{release}
Obsoletes:      ibus-table-erbi < 1.3

%description    erbi
Erbi  Includes Super Erbi and Erbi Qin-Song.

%package        quick
Summary:        Quick-to-learn input methods
License:        Freely redistributable without restriction
Requires:       %{name} = %{version}-%{release}
Provides:       ibus-table-quick = %{version}-%{release}
Obsoletes:      ibus-table-quick < 1.3

%description    quick
Quick is based on Cangjie input method.

%package        scj
Summary:        Smart Cangjie
License:        GPL-3.0-or-later
Requires:       %{name} = %{version}-%{release}
Provides:       ibus-table-cangjie = %{version}-%{release}
Obsoletes:      ibus-table-cangjie < 1.3

%description    scj
Smart Cangjie is an improved Cangjie base input method.

%package        stroke5
Summary:        Stroke 5 input method
License:        GPL-3.0-or-later
Requires:       %{name} = %{version}-%{release}
Provides:       ibus-table-stroke5 = %{version}-%{release}
Obsoletes:      ibus-table-stroke5 < 1.3 ibus-table-yinma < 1.3

%description    stroke5
Stroke5 input method.

%package        wu
Summary:        Wu pronunciation input method
License:        GPL-2.0-or-later
Requires:       %{name} = %{version}-%{release}
Provides:       ibus-table-wu = %{version}-%{release}
Obsoletes:      ibus-table-wu < 1.3

%description    wu
Wu pronunciation input method.

%package        wubi-haifeng
Summary:        Haifeng Wubi input method
License:        BSD
Requires:       %{name} = %{version}-%{release}
Provides:       ibus-table-wubi = %{version}-%{release}
Obsoletes:      ibus-table-wubi < 1.3

%description    wubi-haifeng
Haifeng Wubi current includes Haifeng Wubi 86.

%package        wubi-jidian
Summary:        Jidian Wubi 86 input method
License:        Freely redistributable without restriction
Requires:       %{name} = %{version}-%{release}
Provides:       ibus-table-wubi = %{version}-%{release}
Obsoletes:      ibus-table-wubi < 1.3

%description    wubi-jidian
Jidian Wubi current includes Wubi 86.

%package        yong
Summary:        YongMa input method
License:        GPL-3.0-only
Requires:       %{name} = %{version}-%{release}
Provides:       ibus-table-yong = %{version}-%{release}
Obsoletes:      ibus-table-yong < 1.3

%description    yong
YongMa input method.

%prep
%autosetup -n %{name}-%{version}-Source -p1
%{__sed} -i 's/\r//' tables/wubi-haifeng/COPYING

%build
%cmake -DMANAGE_MESSAGE_LEVEL=6 .
%make_build VERBOSE=1

%clean

%install
%make_install
install -d $RPM_BUILD_ROOT%{_datadir}/appdata
cat << EOF > $RPM_BUILD_ROOT%{_datadir}/appdata/stroke5.appdata.xml
<?xml version="1.0" encoding="UTF-8"?>
<component type="inputmethod">
  <id>stroke5.db</id>
  <metadata_license>CC0-1.0</metadata_license>
  <name>Stroke 5</name>
  <summary>Chinese input method</summary>
  <description>
    <p>
      Stroke 5 is a very simple stroke-based Chinese input method.
      It was designed specifically for people with limited hand mobility or computer
      literacy, like the elderly or disabled.
    </p>
    <p>
      Input methods are typing systems allowing users to input complex languages.
      They are necessary because these contain too many characters to simply be laid
      out on a traditional keyboard.
    </p>
  </description>
  <url type="homepage">https://code.google.com/p/ibus/</url>
  <url type="bugtracker">https://code.google.com/p/ibus/issues/list</url>
  <url type="help">https://code.google.com/p/ibus/wiki/FAQ</url>
  <languages>
    <lang percentage="100">zh_CN</lang>
    <lang percentage="100">zh_HK</lang>
    <lang percentage="100">zh_SG</lang>
    <lang percentage="100">zh_TW</lang>
  </languages>
  <update_contact><!-- upstream-contact_at_email.com --></update_contact>
</component>
EOF
cat << EOF  > $RPM_BUILD_ROOT%{_datadir}/appdata/wubi-haifeng86.appdata.xml
<?xml version="1.0" encoding="UTF-8"?>
<component type="inputmethod">
  <id>wubi-haifeng86.db</id>
  <metadata_license>CC0-1.0</metadata_license>
  <name>HaiFeng Wubi 86</name>
  <summary>Simplified Chinese input method</summary>
  <description>
    <p>
      The HaiFeng Wubi 86 input method is designed for entering Simplified Chinese text.
    </p>
    <p>
      Input methods are typing systems allowing users to input complex languages.
      They are necessary because these contain too many characters to simply be laid
      out on a traditional keyboard.
    </p>
  </description>
  <url type="homepage">http://code.google.com/p/ibus/</url>
  <url type="bugtracker">https://code.google.com/p/ibus/issues/list</url>
  <url type="help">https://code.google.com/p/ibus/wiki/FAQ</url>
  <languages>
    <lang percentage="100">zh_CN</lang>
    <lang percentage="100">zh_HK</lang>
    <lang percentage="100">zh_SG</lang>
    <lang percentage="100">zh_TW</lang>
  </languages>
  <update_contact><!-- upstream-contact_at_email.com --></update_contact>
</component>
EOF
cat << EOF > $RPM_BUILD_ROOT%{_datadir}/appdata/wubi-jidian86.appdata.xml
<?xml version="1.0" encoding="UTF-8"?>
<component type="inputmethod">
  <id>wubi-jidian86.db</id>
  <metadata_license>CC0-1.0</metadata_license>
  <name>Jidian Wubi 86</name>
  <summary>Simplified Chinese input method</summary>
  <description>
    <p>
      The Jidian Wubi 86 input method is designed for entering Simplified Chinese text.
    </p>
    <p>
      Input methods are typing systems allowing users to input complex languages.
      They are necessary because these contain too many characters to simply be laid
      out on a traditional keyboard.
    </p>
  </description>
  <url type="homepage">http://code.google.com/p/ibus/</url>
  <url type="bugtracker">https://code.google.com/p/ibus/issues/list</url>
  <url type="help">https://code.google.com/p/ibus/wiki/FAQ</url>
  <languages>
    <lang percentage="100">zh_CN</lang>
    <lang percentage="100">zh_HK</lang>
    <lang percentage="100">zh_SG</lang>
    <lang percentage="100">zh_TW</lang>
  </languages>
  <update_contact><!-- upstream-contact_at_email.com --></update_contact>
</component>
EOF

rm -fr %{buildroot}%{_docdir}/*

%post           array
ibus-table-createdb -i -n %{_datadir}/ibus-table/tables/array30.db
ibus-table-createdb -i -n %{_datadir}/ibus-table/tables/array30-big.db

%post           cangjie
ibus-table-createdb -i -n %{_datadir}/ibus-table/tables/cangjie3.db
ibus-table-createdb -i -n %{_datadir}/ibus-table/tables/cangjie5.db
ibus-table-createdb -i -n %{_datadir}/ibus-table/tables/cangjie-big.db

%post           cantonese
ibus-table-createdb -i -n %{_datadir}/ibus-table/tables/cantonese.db
ibus-table-createdb -i -n %{_datadir}/ibus-table/tables/cantonhk.db
ibus-table-createdb -i -n %{_datadir}/ibus-table/tables/jyutping.db

%post           easy
ibus-table-createdb -i -n %{_datadir}/ibus-table/tables/easy-big.db

%post           erbi
ibus-table-createdb -i -n %{_datadir}/ibus-table/tables/erbi.db
ibus-table-createdb -i -n %{_datadir}/ibus-table/tables/erbi-qs.db

%post           quick
ibus-table-createdb -i -n %{_datadir}/ibus-table/tables/quick3.db
ibus-table-createdb -i -n %{_datadir}/ibus-table/tables/quick5.db
ibus-table-createdb -i -n %{_datadir}/ibus-table/tables/quick-classic.db

%post           scj
ibus-table-createdb -i -n %{_datadir}/ibus-table/tables/scj6.db

%post           stroke5
ibus-table-createdb -i -n %{_datadir}/ibus-table/tables/stroke5.db

%post           wu
ibus-table-createdb -i -n %{_datadir}/ibus-table/tables/wu.db

%post           wubi-haifeng
ibus-table-createdb -i -n %{_datadir}/ibus-table/tables/wubi-haifeng86.db

%post           wubi-jidian
ibus-table-createdb -i -n %{_datadir}/ibus-table/tables/wubi-jidian86.db

%post           yong
ibus-table-createdb -i -n %{_datadir}/ibus-table/tables/yong.db

%files
%doc

%files          array
%{_datadir}/ibus-table/icons/{array30.*,array30-big.*}
%verify(not size md5 mtime) %{_datadir}/ibus-table/tables/array30.db
%verify(not size md5 mtime) %{_datadir}/ibus-table/tables/array30-big.db

%files          cangjie
%{_datadir}/ibus-table/icons/{cangjie3.*,cangjie5.*,cangjie-big.*}
%verify(not size md5 mtime) %{_datadir}/ibus-table/tables/cangjie3.db
%verify(not size md5 mtime) %{_datadir}/ibus-table/tables/cangjie5.db
%verify(not size md5 mtime) %{_datadir}/ibus-table/tables/cangjie-big.db

%files          cantonese
%{_datadir}/ibus-table/icons/{cantonese.*,cantonhk.*,jyutping.*}
%verify(not size md5 mtime) %{_datadir}/ibus-table/tables/cantonese.db
%verify(not size md5 mtime) %{_datadir}/ibus-table/tables/cantonhk.db
%verify(not size md5 mtime) %{_datadir}/ibus-table/tables/jyutping.db

%files          easy
%{_datadir}/ibus-table/icons/easy-big.*
%verify(not size md5 mtime) %{_datadir}/ibus-table/tables/easy-big.db

%files          erbi
%{_datadir}/ibus-table/icons/{erbi.*,erbi-qs.*}
%verify(not size md5 mtime) %{_datadir}/ibus-table/tables/erbi.db
%verify(not size md5 mtime) %{_datadir}/ibus-table/tables/erbi-qs.db

%files          quick
%{_datadir}/ibus-table/icons/{quick3.*,quick5.*,quick-classic.*}
%verify(not size md5 mtime) %{_datadir}/ibus-table/tables/quick3.db
%verify(not size md5 mtime) %{_datadir}/ibus-table/tables/quick5.db
%verify(not size md5 mtime) %{_datadir}/ibus-table/tables/quick-classic.db

%files          scj
%{_datadir}/ibus-table/icons/scj6.*
%verify(not size md5 mtime) %{_datadir}/ibus-table/tables/scj6.db

%files          stroke5
%{_datadir}/appdata/stroke5.appdata.xml
%{_datadir}/ibus-table/icons/stroke5.*
%verify(not size md5 mtime) %{_datadir}/ibus-table/tables/stroke5.db

%files          wu
%{_datadir}/ibus-table/icons/wu.*
%verify(not size md5 mtime) %{_datadir}/ibus-table/tables/wu.db

%files          wubi-haifeng
%{_datadir}/appdata/wubi-haifeng86.appdata.xml
%doc tables/wubi-haifeng/{COPYING,README}
%{_datadir}/ibus-table/icons/wubi-haifeng86.*
%verify(not size md5 mtime) %{_datadir}/ibus-table/tables/wubi-haifeng86.db

%files          wubi-jidian
%{_datadir}/appdata/wubi-jidian86.appdata.xml
%{_datadir}/ibus-table/icons/wubi-jidian86.*
%verify(not size md5 mtime) %{_datadir}/ibus-table/tables/wubi-jidian86.db

%files          yong
%{_datadir}/ibus-table/icons/yong.*
%{_datadir}/ibus-table/tables/yong.db

%changelog
* Thu Jun 13 2024 yao_xin <yao_xin001@hoperun.com> - 1.8.2-14
- License compliance rectification

* Mon Apr 20 2020 lizhenhua <lizhenhua21@huawei.com> - 1.8.2-13
- Package init
