File uim.spec of Package uim
#
# spec file for package uim
#
# Copyright (c) 2018 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/
#
%define is_gnome3 (0%{?suse_version} > 1140)
%define build_applet (0%{?suse_version} < 1310)
%define build_qt4 0%{?suse_version} <= 1500 && 0%{?sle_version} < 150300
Name: uim
Version: 1.8.8
Release: 0
Summary: A multilingual input method framework
License: BSD-3-Clause and LGPL-2.1+ and (BSD-3-Clause or LGPL-2.0)
Group: System/I18n/Japanese
Url: https://github.com/uim/uim
Source0: https://github.com/uim/uim/releases/download/%{version}/%{name}-%{version}.tar.gz
Source1: suse-start-uim.el
Source2: xemacs-auto-autoloads.el
Source3: etc-x11-xim.d-uim
Source4: baselibs.conf
#Source5: uim-pixmap.tar.gz
Patch1: uim-fix-crash-in-firefox.diff
Patch2: uim-fix-multiple_declaration.diff
Patch3: bugzilla-1175274-emacs-27.1.patch
#Patch4: fix-for-sles-qhash-incomplete-type.patch
#Patch5: libgcroots-aarch64.patch
#Patch6: uim-emacs-utf8.patch
Patch10: git_772620b.patch
Patch11: fix-caret-color.patch
Patch12: fix-qt5_applications_segfault.patch
Patch13: fix-gtk-suppress.patch
Patch14: fix-fep-hang_on.patch
Patch15: fix-gtk3_various.patch
Patch16: fix-wrong-character-comparison.patch
#BuildRequires: xz
BuildRequires: anthy-devel
BuildRequires: canna-devel
BuildRequires: emacs-x11
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: automake
BuildRequires: cmake
%if %{build_applet}
BuildRequires: gnome-panel-devel
%endif
BuildRequires: gtk2-devel
BuildRequires: intltool
BuildRequires: libedit-devel
BuildRequires: libexpat-devel
%if %{build_qt4}
BuildRequires: libqt4-devel
%endif
BuildRequires: m17n-lib-devel
BuildRequires: ncurses-devel
BuildRequires: sqlite3-devel
BuildRequires: perl-XML-Parser
BuildRequires: pkg-config
BuildRequires: update-desktop-files
BuildRequires: hicolor-icon-theme
#BuildRequires: rsvg-view
BuildRequires: xemacs
BuildRequires: asciidoc
#BuildRequires: ruby
BuildRequires: pkgconfig(gdk-x11-2.0)
BuildRequires: pkgconfig(gtk+-2.0)
BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(libnotify)
BuildRequires: pkgconfig(x11)
Recommends: %{name}-gtk2 = %{version}
Recommends: %{name}-gtk3 = %{version}
%if %{build_qt4}
Recommends: %{name}-qt4 = %{version}
%endif
BuildRequires: libicu-devel
BuildRequires: libxkbcommon-devel
BuildRequires: libqt5-qtbase-devel
BuildRequires: libqt5-qtbase-private-headers-devel
BuildRequires: libqt5-qtx11extras-devel
BuildRequires: libQt5Core-devel
BuildRequires: libQt5Widgets-devel
Recommends: %{name}-qt5 = %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires(pre): %{_bindir}/touch
%if ! (%{build_applet})
# If we can't build the applet, we need to ensure we can cleanly 'upgrade' Obsoleting the applet.
Obsoletes: %{name}-applet-gnome <= %{version}
%endif
%description
Uim is a multilingual input method framework. Uim's goal is to
provide simple, easily extensible and high code-quality input
method development platform, and useful input method environment
for users of desktop and embedded platforms.
%package devel
Summary: Include Files and Libraries mandatory for Development
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
%description devel
Include Files and Libraries mandatory for Development with uim.
%package gtk2
Summary: GTK2 IM Module for UIM
Group: System/I18n/Japanese
Requires: %{name} = %{version}
%gtk2_immodule_requires
%description gtk2
Contains GTK+2.0 IM module for uim
%package gtk3
Summary: GTK3 IM Module for UIM
Group: System/I18n/Japanese
Requires: %{name} = %{version}
%gtk3_immodule_requires
%description gtk3
Contains GTK+3.0 IM module for uim
%if %{build_applet}
%package applet-gnome
Summary: GNOME applet for uim
Group: System/I18n/Japanese
Requires: %{name} = %{version}
Obsoletes: uim-applet < %{version}
Provides: uim-applet = %{version}
%description applet-gnome
GNOME applet for uim
%endif
%if %{build_qt4}
%package qt4
Summary: Qt4 input module plugin for uim
Group: System/I18n/Japanese
Requires: %{name} = %{version}
%description qt4
Contains Qt4 input module plugin for uim
%endif
%package qt5
Summary: Qt5 input module plugin for uim
Group: System/I18n/Japanese
Requires: %{name} = %{version}
%description qt5
Contains Qt5 input module plugin for uim
%prep
%setup0 -q
%patch1 -p1
%patch2 -p0
%patch3 -p0
#%patch3 -p1
#%patch4 -p1
#%patch5 -p1
#%patch6 -p1
#%patch7 -p1
#%patch8 -p1
#%patch9 -p1
%patch10
%patch11
%patch12
%patch13
%patch14
%patch15
%patch16
cp emacs/README README.emacs
iconv -f euc-jp -t utf-8 < emacs/README.ja > README.ja.emacs
# hack to fix incompatibility of gtk-query-immodules-2.0 (bnc#845860)
%if %suse_version < 1310
sed -i \
-e's@\(gtk-query-immodules-2.0-64\) --update-cache@\1 > <prefix>%{_sysconfdir}/gtk-2.0/gtk64.immodules@g' \
-e's@\(gtk-query-immodules-2.0\) --update-cache@\1 > <prefix>%{_sysconfdir}/gtk-2.0/gtk.immodules@g' \
$RPM_SOURCE_DIR/baselibs.conf
%endif
%build
#export RUBYOPT=-EUTF-8
export CFLAGS="$CFLAGS -fcommon"
%configure --disable-static --with-pic \
--libexecdir=%{_prefix}/lib/uim \
--with-canna\
--with-anthy-utf8 \
%if %{build_qt4}
--with-qt4 \
--with-qt4-immodule \
%endif
--with-qt5 \
--with-qt5-immodule \
--enable-kde-applet \
--enable-openssl \
--enable-dict \
--disable-warnings-into-error
make %{?_smp_mflags}
%install
%makeinstall
rm -f %{buildroot}%{_includedir}/gcroots.h
rm -f %{buildroot}%{_libdir}/pkgconfig/gcroots.pc
# this file is generated by "uim-module-manager".
# touch it here to make sure that it is in the file list of the
# package, then it will be deleted when the package is uninstalled:
touch %{buildroot}%{_datadir}/uim/modules
mkdir -p %{buildroot}%{_sysconfdir}/X11/xim.d/ja
install -m 644 $RPM_SOURCE_DIR/etc-x11-xim.d-uim \
%{buildroot}%{_sysconfdir}/X11/xim.d/uim
pushd %{buildroot}%{_sysconfdir}/X11/xim.d/ja
ln -s ../uim 60-uim
popd
# GNU Emacs:
install -m 644 $RPM_SOURCE_DIR/suse-start-uim.el %{buildroot}%{_datadir}/emacs/site-lisp/
pushd %{buildroot}%{_datadir}/emacs/site-lisp/uim-el
for i in $(find . -name "*.el")
do
emacs -no-site-file -q -batch -eval '(setq load-path (cons "." load-path))' -f batch-byte-compile $i
done
popd
# XEmacs
mkdir -p %{buildroot}%{_datadir}/xemacs/site-packages/lisp/uim-el
install -m 644 emacs/*.el %{buildroot}%{_datadir}/xemacs/site-packages/lisp/uim-el
pushd %{buildroot}%{_datadir}/xemacs/site-packages/lisp/uim-el
for i in $(find . -name "*.el")
do
xemacs -no-site-file -q -batch -eval '(setq load-path (cons "." load-path))' -f batch-byte-compile $i
done
popd
install -m 644 $RPM_SOURCE_DIR/xemacs-auto-autoloads.el \
%{buildroot}%{_datadir}/xemacs/site-packages/lisp/uim-el/auto-autoloads.el
# replace buildroot in comments in .elc files by spaces with the same total length:
BUILD_ROOT_REPLACEMENT=$(echo %{buildroot} | tr [:print:] ' ')
for i in $(find %{buildroot} -name "*.elc")
do
perl -pi -e "s|(;;; from file )%{buildroot}(%{_datadir}/xemacs/site-packages/.*)|\1BUILD_ROOT_REPLACEMENT\2|" $i
perl -pi -e "s|(;;; from file )%{buildroot}(%{_datadir}/emacs/site-lisp/.*)|\1BUILD_ROOT_REPLACEMENT\2|" $i
done
%find_lang uim
%if 0%{?suse_version} > 1100
touch uim-chardict-qt.lang
%else
%find_lang uim-chardict-qt
%endif
%suse_update_desktop_file uim System SystemSetup
find %{buildroot} -name "*.scm" \
| grep -E -v "installed-modules.scm|loader.scm" \
| sort | uniq | perl -p -e "s|%{buildroot}||" >> uim.lang
%if 0%{?suse_version} > 1020
%fdupes %{buildroot}%{_prefix}/share
%endif
find %{buildroot} -type f -name "*.la" -delete -print
rm -f doc/Makefile*
# uim/pixmaps
#rm -r %{buildroot}%{_datadir}/uim/pixmaps
#cp -a -r ./uim-pixmap/pixmaps %{buildroot}%{_datadir}/uim/
%post
/sbin/ldconfig
# register uim modules to uim. This will change the files:
# %{_datadir}/uim/installed-modules.scm
# %{_datadir}/uim/loader.scm
uim-module-manager --register \
ajax-ime anthy anthy-utf8 byeoru canna elatin hangul ipa-x-sampa \
latin m17nlib pyload skk tcode trycode tutcode viqr
%postun -p /sbin/ldconfig
%post gtk2
%gtk2_immodule_post
%postun gtk2
%gtk2_immodule_postun
%post gtk3
%gtk3_immodule_post
%postun gtk3
%gtk3_immodule_postun
%files -f uim.lang
%defattr(-, root, root)
%doc AUTHORS COPYING NEWS* README*
%doc doc
%dir %{_sysconfdir}/X11/xim.d/
%{_sysconfdir}/X11/xim.d/*
%{_datadir}/uim
# autogenerated by uim-module-manager:
%ghost %{_datadir}/uim/installed-modules.scm
%ghost %{_datadir}/uim/loader.scm
%ghost %{_datadir}/uim/modules
%{_bindir}/uim-sh
%{_bindir}/uim-module-manager
%{_bindir}/uim-xim
%{_bindir}/uim-fep
%{_bindir}/uim-fep-tick
%{_bindir}/uim-el-agent
%{_bindir}/uim-el-helper-agent
%{_bindir}/uim-help
%{_bindir}/uim-m17nlib-relink-icons
%{_libdir}/*.so.*
%dir %{_libdir}/uim
%if "%{_libdir}" != "%{_prefix}/lib"
%dir %{_prefix}/lib/uim
%endif
%{_prefix}/lib/uim/uim-helper-server
%dir %{_libdir}/uim/plugin/
%{_libdir}/uim/plugin/*.so
%doc %{_mandir}/man1/*.1.gz
%{_datadir}/applications/%{name}.desktop
%{_datadir}/emacs/site-lisp/*
%{_datadir}/xemacs/site-packages
%files devel
%defattr(-, root, root)
%{_libdir}/*.so
%{_includedir}/uim/
%{_libdir}/pkgconfig/uim.pc
%files gtk2
%defattr(-, root, root)
%{_bindir}/uim-*-gtk
%{_bindir}/uim-*-gtk-*
%{_bindir}/uim-input-pad-ja
%{_prefix}/lib/uim/uim-*-gtk
%{_libdir}/gtk-2*/*/immodules/*.so
%files gtk3
%defattr(-, root, root)
%{_bindir}/uim-*-gtk3
%{_bindir}/uim-*-gtk3-*
%{_prefix}/lib/uim/uim-*-gtk3
%{_libdir}/gtk-3*/*/immodules/*.so
%if %{build_applet}
%files applet-gnome
%defattr(-, root, root)
%if %{is_gnome3}
%{_prefix}/lib/uim/uim-toolbar-applet-gnome3
%{_datadir}/gnome-panel/*/applets
%{_datadir}/dbus-1/services/*
%else
%{_prefix}/lib/uim/uim-toolbar-applet
%{_libdir}/bonobo/servers/*
%endif
%endif
%if %{build_qt4}
%files qt4 -f uim-chardict-qt.lang
%defattr(-, root, root)
%{_bindir}/uim-*-qt4
%{_prefix}/lib/uim/uim-*-qt4
%{_libdir}/qt4/plugins/inputmethods/*.so
%endif
%files qt5 -f uim-chardict-qt.lang
%defattr(-, root, root)
%{_bindir}/uim-*-qt5
%{_prefix}/lib/uim/uim-*-qt5
%{_libdir}/qt5/plugins/platforminputcontexts/*.so
%changelog