A new user interface for you!

File scim.spec of Package scim

# spec file for package scim
# Copyright (c) 2013 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:           scim
BuildRequires:  docbook-xsl-stylesheets
BuildRequires:  doxygen
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  graphviz
BuildRequires:  graphviz-gd
BuildRequires:  intltool
# for older distros
BuildRequires:  gtk2-devel
BuildRequires:  libexpat-devel
BuildRequires:  libgnomeui-devel
%if 0%{?suse_version} >= 1310
BuildRequires:  libpng-tools
BuildRequires:  libqt4-devel
BuildRequires:  libtool
BuildRequires:  libxslt
BuildRequires:  perl-XML-Parser
BuildRequires:  update-desktop-files
%if 0%{?suse_version} > 1130
BuildRequires:  gtk3-devel
Version:        1.4.14
Release:        0
Summary:        Smart Chinese/Common Input Method platform
License:        LGPL-2.1+
Group:          System/I18n/Chinese
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
Patch2:         scim-no-setpwent.diff
#FIX-FOR-UPSTREAM fix build im-scim.version-script
# Patch3:         scim-1.4.13-ld-version-script.patch
#FIX-FOR-UPSTREAM fix an upstream typo error in panel/*.cpp
Patch4:         sle-11-gtk-widget-get-visible.patch
Requires(pre):  /usr/bin/touch
Obsoletes:      scim-config-gconf < %{version}-%{release}
Obsoletes:      scim-config-simple < %{version}-%{release}
Obsoletes:      scim-config-socket < %{version}-%{release}
Obsoletes:      scim-frontend-socket < %{version}-%{release}
Obsoletes:      scim-frontend-x11 < %{version}-%{release}
Obsoletes:      scim-gtk2-immodule < %{version}-%{release}
Obsoletes:      scim-server-rawcode < %{version}-%{release}
Obsoletes:      scim-server-socket < %{version}-%{release}
Obsoletes:      scim-server-table < %{version}-%{release}
Provides:       scim-config-gconf
Provides:       scim-config-simple
Provides:       scim-config-socket
Provides:       scim-frontend-socket
Provides:       scim-frontend-x11
Provides:       scim-gtk2-immodule
Provides:       scim-server-rawcode
Provides:       scim-server-socket
Provides:       scim-server-table
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1130
%define gnome_prefix %(pkg-config --variable=prefix libgnomeui-2.0)

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

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

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

%package gtk
Summary:        SCIM im module for gtk2
Group:          System/I18n/Chinese
Requires:       %{name} = %{version}
Supplements:    packageand(scim:gtk2)

%description gtk
This package contains SCIM im module for gtk2

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

Summary:        SCIM im module for gtk3
Group:          System/I18n/Chinese
Requires:       %{name} = %{version}
BuildRequires:  gtk3-devel
Supplements:    packageand(scim:gtk3)

%description gtk3
This package contains SCIM im module for gtk3

%package qt4
Summary:        SCIM im module for qt4
Group:          System/I18n/Chinese
Requires:       %{name} = %{version}
BuildRequires:  libqt4-devel
Supplements:    packageand(scim:libqt4)

%description qt4
This package contains SCIM im module for qt4

%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
%patch1 -p1
%if 0%{?suse_version} > 1110
%patch2 -p1
# %patch3 -p1
%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 0%{?suse_version} < 1100
sed -i -e'/supplements/d' $RPM_SOURCE_DIR/baselibs.conf

%if 0%{?suse_version} <= 1100
libtoolize --force
autoreconf --force --install --verbose

if [ ! -f po/Makevars -a -f po/Makevars.template ] ; then
    cp po/Makevars.template po/Makevars
if [ ! -f po/Makevars -a -f /usr/share/gettext/po/Makevars.template ] ; then
    cp  /usr/share/gettext/po/Makevars.template po/Makevars
export CFLAGS="%{optflags} -fno-strict-aliasing"
# so configure detects gettext with gcc-4.7
export CXXFLAGS="-fpermissive"
%if 0%{?suse_version} > 1130
%if ! %{build_config_socket}
%if ! %{build_config_simple}
%if ! %{build_frontend_x11}
%if ! %{build_frontend_socket}
%if ! %{build_imengine_rawcode}
%if ! %{build_imengine_table}
%if ! %{build_imengine_socket}
%if ! %{build_gtk2_immodule}
%if ! %{build_scim_setup}
make top_builddir=$(pwd)
# build documentation:
make -C docs html
# manual is missing in 1.4.11
## make -C docs/manual/zh_CN html

make DESTDIR=%{buildroot} top_builddir=$(pwd) install
mkdir -p %{buildroot}/%{_libdir}/scim-1.0/{Config,FrontEnd,IMEngine,SetupUI}
rm -f %{buildroot}/%{_libdir}/lib*.*a
rm -f %{buildroot}/%{_libdir}/scim-1.0/*/*/*.*a
rm -f %{buildroot}/%{_libdir}/gtk-2.0/2.10.0/immodules/im-scim.la
rm -f %{buildroot}/%{_libdir}/qt4/plugins/inputmethods/im-scim.la
%if 0%{?suse_version} > 1130
rm -f %{buildroot}/%{_libdir}/gtk-3.0/3.0.0/immodules/*.la
# 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 %{buildroot}%{_sysconfdir}/X11/xim.d/
install -m 644 $RPM_SOURCE_DIR/etc-x11-xim.d-scim \
# install symlinks in /etc/X11/xim.d/$lang for all languages
# where SCIM might be useful:
pushd %{buildroot}%{_sysconfdir}/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
        mkdir $lang
	pushd $lang
            ln -s ../scim $PRIORITY-scim
install -m 755 $RPM_SOURCE_DIR/SuSEconfig.scim \
%find_lang scim
%suse_update_desktop_file scim-setup System SystemSetup

%if 0%{?suse_version} >= 1310
%png_fix %{buildroot}/%{_datadir}/%{name}/icons/menu.png
%fdupes %{buildroot}

%if %{build_gtk2_immodule}
%if 0%{?suse_version} > 1130
#Add icons to gnome3 panel
if [ -f $TARGET ] && [ ! -f $TARGET-scim ] ; then
sed "/^const STANDARD_TRAY_ICON_IMPLEMENTATIONS/a \    'scim-panel-gtk': 'input-method'," $TARGET-scim > $TARGET
# Update KeyboardLayout

%if %{build_gtk2_immodule}
%if 0%{?suse_version} > 1130

%files -f scim.lang
%defattr(-, root, root)
# %doc docs/dist/manual/zh_CN
%dir %{_sysconfdir}/X11/xim.d/
%config %{_sysconfdir}/X11/xim.d/*
%dir %{_sysconfdir}/scim
%config %{_sysconfdir}/scim/*
%if %{build_scim_setup}

%files gtk
%defattr(-, root, root)
%dir %{gnome_prefix}/%{_lib}/gtk-2.0/2.10.0
%dir %{gnome_prefix}/%{_lib}/gtk-2.0/2.10.0/immodules

%if 0%{?suse_version} > 1130
%files gtk3
%defattr(-, root, root)

%files qt4
%defattr(-, root, root)

%files devel
%defattr(-, root, root)
%doc docs/html
%doc docs/developers