A new user interface for you! Read more...

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
%endif
BuildRequires:  libqt4-devel
BuildRequires:  libtool
BuildRequires:  libxslt
BuildRequires:  perl-XML-Parser
BuildRequires:  update-desktop-files
%if 0%{?suse_version} > 1130
BuildRequires:  gtk3-devel
%endif
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
%gtk2_immodule_requires
%if 0%{?suse_version} > 1130
%gtk3_immodule_requires
%endif
%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.

%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}
%gtk2_immodule_requires
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
%gtk3_immodule_requires
Supplements:    packageand(scim:gtk3)

%description gtk3
This package contains SCIM im module for gtk3
%endif

%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

%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
%patch1 -p1
%if 0%{?suse_version} > 1110
%patch2 -p1
%endif
# %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
%endif

%build
%if 0%{?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="%{optflags} -fno-strict-aliasing"
# so configure detects gettext with gcc-4.7
export CXXFLAGS="-fpermissive"
%configure\
	--libexecdir=%{_prefix}/lib/scim-1.0\
%if 0%{?suse_version} > 1130
        --with-gtk3-im-module-dir=%{_libdir}/gtk-3.0/3.0.0/immodules\
        --with-gtk-version=3\
%endif
	--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\
         --enable-gtk2-immodule\
         --enable-qt4-immodule
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=%{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
%endif
# 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 \
               %{buildroot}%{_sysconfdir}/X11/xim.d/scim
# install symlinks in /etc/X11/xim.d/$lang for all languages
# where SCIM might be useful:
PRIORITY=50
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
    do
        mkdir $lang
	pushd $lang
            ln -s ../scim $PRIORITY-scim
	popd
    done
popd
install -m 755 $RPM_SOURCE_DIR/SuSEconfig.scim \
               %{buildroot}/%{_datadir}/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
%endif
%fdupes %{buildroot}

%post
/sbin/ldconfig
%if %{build_gtk2_immodule}
%gtk2_immodule_post
%endif
%if 0%{?suse_version} > 1130
#Add icons to gnome3 panel
TARGET="/usr/share/gnome-shell/js/ui/statusIconDispatcher.js"
if [ -f $TARGET ] && [ ! -f $TARGET-scim ] ; then
mv $TARGET $TARGET-scim
sed "/^const STANDARD_TRAY_ICON_IMPLEMENTATIONS/a \    'scim-panel-gtk': 'input-method'," $TARGET-scim > $TARGET
fi
%gtk3_immodule_post
%endif
# Update KeyboardLayout
%{_datadir}/scim/SuSEconfig.scim

%postun
/sbin/ldconfig
%if %{build_gtk2_immodule}
%gtk2_immodule_postun
%endif
%if 0%{?suse_version} > 1130
%gtk3_immodule_postun
%endif

%files -f scim.lang
%defattr(-, root, root)
%doc AUTHORS COPYING README ChangeLog TODO
# %doc docs/dist/manual/zh_CN
%dir %{_sysconfdir}/X11/xim.d/
%config %{_sysconfdir}/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

%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
%{gnome_prefix}/%{_lib}/gtk-2.0/2.10.0/immodules/im-scim.so

%if 0%{?suse_version} > 1130
%files gtk3
%defattr(-, root, root)
%{_libdir}/gtk-3.0/3.0.0/immodules/im-scim.so
%endif

%files qt4
%defattr(-, root, root)
%{_libdir}/qt4/plugins/

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

%changelog