%define nam             @PACKAGE@
%define ver             @VERSION@
%define skim            @SCIM_TABLES_ENABLE_SKIM_SUPPORT@
%define rel             1

%define scim_version	@SCIM_VERSION@

%define build_scim_setup	@SCIM_BUILD_SETUP@

Summary:	SCIM Generic Table IMEngine and its data files.
Name:		%{nam}
Version:	%{ver}
Release:	%{rel}
License:	GPL
Group:		System Environment/Libraries
URL:		http://sourceforge.net/projects/scim
BuildRoot:	%{_tmppath}/%{name}-%{version}-root
Source0:	%{name}-%{version}.tar.gz

PreReq:		/sbin/ldconfig, /bin/sh

Requires:	scim >= %{scim_version}
BuildRequires:	scim-devel >= %{scim_version}

Requires:	gtk2 >= 2.0.0
BuildRequires:	gtk2-devel >= 2.0.0

%if %{skim}
BuildRequires:	skim-devel >= 1.2.0
%endif

%description
This package includes Generic Table IMEngine for SCIM and many data files for it.

%if %{skim}
%package skim
Summary:        Skim support for Generic Table
Group:          System/I18n
Requires:	%{name} = %{version}
Requires:	skim >= 1.2.0

%description skim
This package includes Skim support for Generic Table IMEngine.
%endif

%package zh
Summary:	Data files for Chinese
Group:		System Environment/Libraries
Requires:	scim-tables >= %{ver}

%description zh
This package includes table IM data files for Chinese.

%package ja
Summary:	Data files for Japanese
Group:		System Environment/Libraries
Requires:	scim-tables >= %{ver}

%description ja
This package includes table IM data files for Japanese.

%package ko
Summary:	Data files for Korean
Group:		System Environment/Libraries
Requires:	scim-tables >= %{ver}

%description ko
This package includes table IM data files for Korean.

%package additional
Summary:	Data files for additional languages.
Group:		System Environment/Libraries
Requires:	scim-tables >= %{ver}

%description additional
This package includes table IM data files for additional languages,
such as Russian etc..

#--------------------------------------------------

%changelog
* Wed Jan 5 2005 James Su <suzhe@tsinghua.org.cn>
- Added Generic Table IMEngine module into this package.

* Sun Jun 20 2004 James Su <suzhe@tsinghua.org.cn>
- Added Amharic table.

* Mon Apr 05 2004 James Su <suzhe@tsinghua.org.cn>
- Updated Nippon table.
- Added Yawerty table for Russian.

* Fri Nov 28 2003 James Su <suzhe@turbolinux.com.cn>
- upgraded CangJie.txt.in, added README-CangJie.txt

* Tue Sep 02 2003 James Su <suzhe@turbolinux.com.cn>
- updated table format according to SCIM 0.8.0
- added icon files.

* Wed Feb 26 2003 James Su <suzhe@turbolinux.com.cn>
- updated table format according to SCIM 0.3.1.

* Mon Nov 04 2002 James Su <suzhe@turbolinux.com.cn>
- Initial release.
#--------------------------------------------------

%prep
rm -rf ${RPM_BUILD_ROOT}

%setup -n %{name}-%{version}

%build
./configure --prefix=%{_prefix} --sysconfdir=%{_sysconfdir} --mandir=%{_mandir}

make 

%install
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT

make DESTDIR=${RPM_BUILD_ROOT} install

rm -f ${RPM_BUILD_ROOT}/%{_libdir}/scim-1.0/*/*.{a,la}

gzip -9nf ${RPM_BUILD_ROOT}/%{_mandir}/man?/*.?

%if %{skim}
rm -f $RPM_BUILD_ROOT/@KDEDIR@/lib/kde*/*.{a,la}
%endif

%clean
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT

%post

%postun

%files
%doc AUTHORS COPYING NEWS README ChangeLog THANKS
%doc %{_mandir}/man*/*
%{_bindir}/scim-make-table
@SCIM_MODULEDIR@/IMEngine/table.so
@SCIM_ICONDIR@/table.png
%if %{build_scim_setup}
@SCIM_MODULEDIR@/SetupUI/table-imengine-setup.so
%endif
%{_datadir}/locale/*/LC_MESSAGES/scim-tables.mo

%files zh
%defattr(-, root, root)
%doc tables/zh/README-Erbi.txt tables/zh/README-CangJie.txt
@SCIM_TABLEDIR@/Array30.bin
@SCIM_TABLEDIR@/CangJie.bin
@SCIM_TABLEDIR@/CangJie3.bin
@SCIM_TABLEDIR@/CangJie5.bin
@SCIM_TABLEDIR@/Cantonese.bin
@SCIM_TABLEDIR@/CantonHK.bin
@SCIM_TABLEDIR@/CNS11643.bin
@SCIM_TABLEDIR@/Dayi3.bin
@SCIM_TABLEDIR@/Erbi.bin
@SCIM_TABLEDIR@/Erbi-QS.bin
@SCIM_TABLEDIR@/EZ-Big.bin
@SCIM_TABLEDIR@/Jyutping.bin
@SCIM_TABLEDIR@/Quick.bin
@SCIM_TABLEDIR@/Simplex.bin
@SCIM_TABLEDIR@/Stroke5.bin
@SCIM_TABLEDIR@/Wu.bin
@SCIM_TABLEDIR@/Wubi.bin
@SCIM_TABLEDIR@/Ziranma.bin
@SCIM_TABLEDIR@/ZhuYin.bin
@SCIM_TABLEDIR@/ZhuYin-Big.bin
@SCIM_ICONDIR@/Array30.png
@SCIM_ICONDIR@/CangJie.png
@SCIM_ICONDIR@/CangJie3.png
@SCIM_ICONDIR@/Cantonese.png
@SCIM_ICONDIR@/CantonHK.png
@SCIM_ICONDIR@/CNS11643.png
@SCIM_ICONDIR@/Dayi.png
@SCIM_ICONDIR@/Erbi.png
@SCIM_ICONDIR@/Erbi-QS.png
@SCIM_ICONDIR@/EZ.png
@SCIM_ICONDIR@/Jyutping.png
@SCIM_ICONDIR@/Quick.png
@SCIM_ICONDIR@/Simplex.png
@SCIM_ICONDIR@/Stroke5.png
@SCIM_ICONDIR@/Wu.png
@SCIM_ICONDIR@/Wubi.png
@SCIM_ICONDIR@/Ziranma.png
@SCIM_ICONDIR@/ZhuYin.png

%files ja
%defattr(-, root, root)
%doc tables/ja/kanjidic_licence.html tables/ja/kanjidic_doc.html tables/ja/kanjidic-permission-to-use-for-scim
@SCIM_TABLEDIR@/HIRAGANA.bin
@SCIM_TABLEDIR@/KATAKANA.bin
@SCIM_TABLEDIR@/Nippon.bin
@SCIM_ICONDIR@/HIRAGANA.png
@SCIM_ICONDIR@/KATAKANA.png
@SCIM_ICONDIR@/Nippon.png

%files ko
%defattr(-, root, root)
@SCIM_TABLEDIR@/Hangul.bin
@SCIM_TABLEDIR@/HangulRomaja.bin
@SCIM_TABLEDIR@/Hanja.bin
@SCIM_ICONDIR@/Hangul.png
@SCIM_ICONDIR@/Hanja.png

%files additional
%defattr(-, root, root)
@SCIM_TABLEDIR@/Amharic.bin
@SCIM_TABLEDIR@/Arabic.bin
@SCIM_TABLEDIR@/Bengali-inscript.bin
@SCIM_TABLEDIR@/Bengali-probhat.bin
@SCIM_TABLEDIR@/Gujarati-inscript.bin
@SCIM_TABLEDIR@/Gujarati-phonetic.bin
@SCIM_TABLEDIR@/HebrewComputer.bin
@SCIM_TABLEDIR@/Hindi-inscript.bin
@SCIM_TABLEDIR@/Hindi-phonetic.bin
@SCIM_TABLEDIR@/IPA-X-SAMPA.bin
@SCIM_TABLEDIR@/Kannada-inscript.bin
@SCIM_TABLEDIR@/Kannada-kgp.bin
@SCIM_TABLEDIR@/LaTeX.bin
@SCIM_TABLEDIR@/Malayalam-inscript.bin
@SCIM_TABLEDIR@/Nepali_Rom.bin
@SCIM_TABLEDIR@/Nepali_Trad.bin
@SCIM_TABLEDIR@/Punjabi-inscript.bin
@SCIM_TABLEDIR@/Punjabi-jhelum.bin
@SCIM_TABLEDIR@/Punjabi-phonetic.bin
@SCIM_TABLEDIR@/RussianTraditional.bin
@SCIM_TABLEDIR@/RussianComputer.bin
@SCIM_TABLEDIR@/Tamil-inscript.bin
@SCIM_TABLEDIR@/Tamil-phonetic.bin
@SCIM_TABLEDIR@/Tamil-remington.bin
@SCIM_TABLEDIR@/Telugu-inscript.bin
@SCIM_TABLEDIR@/Thai.bin
@SCIM_TABLEDIR@/Translit.bin
@SCIM_TABLEDIR@/Viqr.bin
@SCIM_TABLEDIR@/Yawerty.bin

@SCIM_ICONDIR@/Amharic.png
@SCIM_ICONDIR@/Arabic.png
@SCIM_ICONDIR@/Bengali-inscript.png
@SCIM_ICONDIR@/Bengali-probhat.png
@SCIM_ICONDIR@/Gujarati-inscript.png
@SCIM_ICONDIR@/Gujarati-phonetic.png
@SCIM_ICONDIR@/Hindi-inscript.png
@SCIM_ICONDIR@/Hindi-phonetic.png
@SCIM_ICONDIR@/IPA-X-SAMPA.png
@SCIM_ICONDIR@/Kannada-inscript.png
@SCIM_ICONDIR@/Kannada-kgp.png
@SCIM_ICONDIR@/LaTeX.png
@SCIM_ICONDIR@/Malayalam-inscript.png
@SCIM_ICONDIR@/Nepali.png
@SCIM_ICONDIR@/Punjabi-inscript.png
@SCIM_ICONDIR@/Punjabi-jhelum.png
@SCIM_ICONDIR@/Punjabi-phonetic.png
@SCIM_ICONDIR@/RussianTraditional.png
@SCIM_ICONDIR@/RussianComputer.png
@SCIM_ICONDIR@/Tamil-inscript.png
@SCIM_ICONDIR@/Tamil-phonetic.png
@SCIM_ICONDIR@/Tamil-remington.png
@SCIM_ICONDIR@/Telugu-inscript.png
@SCIM_ICONDIR@/Thai.png
@SCIM_ICONDIR@/Viqr.png
@SCIM_ICONDIR@/Yawerty.png


%if %{skim}
%files skim
%defattr(-, root, root)
@KDEDIR@/lib/kde*/*.so
@KDEDIR@/share/apps/skim/pics/scim-tables.png
@KDEDIR@/share/config.kcfg/generictable.kcfg
@KDEDIR@/share/locale/*/LC_MESSAGES/skim-scim-tables.mo
@KDEDIR@/share/services/skimconfiguredialog/skimplugin_scim_table_config.desktop
%endif
