File scim.spec of Package scim

#
# spec file for package scim
#
# Copyright (c) 2011 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/
#

# norootforbuild


Name:           scim
BuildRequires:  docbook-xsl-stylesheets gcc-c++ gtk2-devel intltool libgnomeui-devel perl-XML-Parser update-desktop-files
BuildRequires:  doxygen graphviz graphviz-gd libxslt
# for older distros
BuildRequires:  libexpat-devel
Summary:        Smart Chinese/Common Input Method platform
Version:        1.4.11
Release:        183
License:        LGPLv2.1+
Group:          System/I18n/Chinese
PreReq:         /usr/bin/touch
Obsoletes:      scim-frontend-x11, scim-server-rawcode, scim-config-simple, scim-server-table, scim-gtk2-immodule, scim-config-socket, scim-server-socket, scim-config-gconf, scim-frontend-socket
Provides:       locale(ja;ko;zh)
Provides:       scim-frontend-x11, scim-server-rawcode, scim-config-simple, scim-server-table, scim-gtk2-immodule, scim-config-socket, scim-server-socket, scim-frontend-socket
Url:            http://www.scim-im.org/
Source0:        scim-%{version}.tar.gz
Source1:        baselibs.conf
Source10:       etc-x11-xim.d-scim
Source11:       SuSEconfig.scim
Patch1:         configs.patch
Patch3:         scim-no-setpwent.diff
Patch4:         scim-gtk2-register-fix.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%gtk2_immodule_requires

%define gnome_prefix %(pkg-config --variable=prefix libgnomeui-2.0)

%description
SCIM is a developing platform to significantly reduce the difficulty of
input method development.



Authors:
--------
    James Su <suzhe@tsinghua.org.cn>

%package devel
License:        LGPLv2.1+
Summary:        Include Files and Libraries mandatory for Development.
Group:          System/I18n/Chinese
Requires:       %{name} = %{version}, libstdc++-devel
Requires:       pkgconfig >= 0.12
Requires:       gtk2-devel
Requires:       libexpat-devel

%description devel
This package contains all necessary include files and libraries needed
to develop applications that require these.



Authors:
--------
    James Su <suzhe@tsinghua.org.cn>

%prep
%define build_config_socket	1
%define build_config_simple	1
%define build_frontend_x11	1
%define build_frontend_socket	1
%define build_imengine_rawcode	1
%define build_imengine_table	1
%define build_imengine_socket	1
%define build_gtk2_immodule	1
%define build_scim_setup        1
%define build_panel_gtk         1
%define build_gtk_utils         1
%setup -q -n %{name}-%{version}
%patch1 -p1
%if %suse_version > 1110
%patch3 -p1
%endif
%patch4 -p1
find . -type f | xargs chmod u+w
UTF_8_LOCALES=$(locale -a | grep utf8 | perl -p -e "s/utf8/UTF-8/; s/\n/,/; " | perl -p -e "s/,$//")
perl -pi -e "s/\/SupportedUnicodeLocales =.*/\/SupportedUnicodeLocales = $UTF_8_LOCALES/"  ./configs/global
# hack to build with older distros
%if %suse_version < 1100
sed -i -e'/supplements/d' $RPM_SOURCE_DIR/baselibs.conf
%endif

%build
%if %suse_version <= 1100
libtoolize --force
autoreconf --force --install --verbose
%endif
if [ ! -f po/Makevars -a -f po/Makevars.template ] ; then
    cp po/Makevars.template po/Makevars
fi
if [ ! -f po/Makevars -a -f /usr/share/gettext/po/Makevars.template ] ; then
    cp  /usr/share/gettext/po/Makevars.template po/Makevars
fi
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
%configure\
	--libexecdir=%{_prefix}/lib/scim-1.0\
	--disable-static\
%if ! %{build_config_socket}
	--disable-config-socket\
%endif
%if ! %{build_config_simple}
	--disable-config-simple\
%endif
%if ! %{build_frontend_x11}
	--disable-frontend-x11\
%endif
%if ! %{build_frontend_socket}
	--disable-frontend-socket\
%endif
%if ! %{build_imengine_rawcode}
	--disable-im-rawcode\
%endif
%if ! %{build_imengine_table}
	--disable-im-table\
%endif
%if ! %{build_imengine_socket}
	--disable-im-socket\
%endif
%if ! %{build_gtk2_immodule}
	--disable-gtk2-immodule\
%endif
%if ! %{build_scim_setup}
	--disable-setup-ui\
%endif
	--enable-debug\
	--enable-ld-version-script
make top_builddir=$(pwd)
# build documentation:
make -C docs html
# manual is missing in 1.4.11
## make -C docs/manual/zh_CN html

%install
make DESTDIR=${RPM_BUILD_ROOT} top_builddir=$(pwd) install
mkdir -p ${RPM_BUILD_ROOT}/%{_libdir}/scim-1.0/{Config,FrontEnd,IMEngine,SetupUI}
rm -f ${RPM_BUILD_ROOT}/%{_libdir}/lib*.*a
rm -f ${RPM_BUILD_ROOT}/%{_libdir}/scim-1.0/*/*/*.*a
rm -f ${RPM_BUILD_ROOT}/%{gnome_prefix}/%_lib/gtk-2.0/immodules/im-scim.*a
# install user manual
# mkdir -p docs/dist/manual/zh_CN/figures/
# cp -a docs/manual/zh_CN/user-manual.{html,xml} docs/dist/manual/zh_CN/
# cp -a docs/manual/zh_CN/figures/*.png docs/dist/manual/zh_CN/figures/
# install configuration files
mkdir -p $RPM_BUILD_ROOT/etc/X11/xim.d/
install -m 644 $RPM_SOURCE_DIR/etc-x11-xim.d-scim \
               $RPM_BUILD_ROOT/etc/X11/xim.d/scim
# install symlinks in /etc/X11/xim.d/$lang for all languages
# where SCIM might be useful:
PRIORITY=50
pushd $RPM_BUILD_ROOT/etc/X11/xim.d/
    for lang in am ar as bn el fa gu he hi hr ja ka kk kn ko lo ml my \
		pa ru sk vi zh_TW zh_CN zh_HK zh_SG \
		de fr it es nl cs pl da nn nb fi en sv
    do
        mkdir $lang
	pushd $lang
            ln -s ../scim $PRIORITY-scim
	popd
    done
popd
mkdir -p $RPM_BUILD_ROOT/sbin/conf.d/
install -m 755 $RPM_SOURCE_DIR/SuSEconfig.scim \
               $RPM_BUILD_ROOT/sbin/conf.d/SuSEconfig.scim
%find_lang scim
%suse_update_desktop_file scim-setup System SystemSetup

%clean
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT;

%post 
/sbin/ldconfig
%if %{build_gtk2_immodule}
%gtk2_immodule_post
%endif

%postun 
/sbin/ldconfig
%if %{build_gtk2_immodule}
%gtk2_immodule_postun
%endif

%files -f scim.lang
%defattr(-, root, root)
%doc AUTHORS COPYING NEWS README ChangeLog TODO
# %doc docs/dist/manual/zh_CN
/sbin/conf.d/SuSEconfig.scim
%dir /etc/X11/xim.d/
/etc/X11/xim.d/*
%dir %{_sysconfdir}/scim
%config %{_sysconfdir}/scim/*
%{_libdir}/lib*.so.*
%{_libdir}/scim-1.0
%{_datadir}/scim
%{_datadir}/pixmaps/*
%{_bindir}/*
%if %{build_scim_setup}
%{_datadir}/applications/scim-setup.desktop
%{_datadir}/control-center-2.0
%endif
%if %{build_gtk2_immodule}
%dir %{gnome_prefix}/%_lib/gtk-2.0/immodules
%{gnome_prefix}/%_lib/gtk-2.0/immodules/im-scim.so
%endif

%files devel
%defattr(-, root, root)
%doc docs/html
%doc docs/developers
%{_libdir}/libscim*.so
%{_libdir}/pkgconfig/*.pc
%{_includedir}/scim-1.0

%changelog
openSUSE Build Service is sponsored by