File fcitx5.spec of Package fcitx5

# spec file for package fcitx5
# Copyright (c) 2018 SUSE LINUX 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

Name:           fcitx5
Version:        4.99.0+git20181128.984f3f2
Release:        0
Summary:        Next generation of fcitx
License:        LGPL-2.1-or-later
Group:          System/I18n/Chinese          
Source:         %{name}-%{version}.tar.xz
Source1:	en_dict-20121020.tar.gz
Source3:  xim.d-fcitx5
Source4:  macros.fcitx5
Source99:   baselibs.conf
Patch:		fcitx5-no-download.patch
BuildRequires:  cmake
BuildRequires:  extra-cmake-modules
BuildRequires:  gcc-c++
BuildRequires:  xcb-imdkit-devel
BuildRequires:  libpresage-devel
BuildRequires:  enchant-devel
BuildRequires:  systemd-devel
BuildRequires:  dbus-1-devel
BuildRequires:  libevent-devel
BuildRequires:  libjson-c-devel
BuildRequires:  libuuid-devel
BuildRequires:  fmt-devel
BuildRequires:  xcb-util-wm-devel
BuildRequires:  xcb-util-keysyms-devel
BuildRequires:  libxkbfile-devel
BuildRequires:  iso-codes-devel
BuildRequires:  libexpat-devel
BuildRequires:  xkeyboard-config
BuildRequires:  libxkbcommon-devel
BuildRequires:  libxkbcommon-x11-devel
BuildRequires:  wayland-devel
BuildRequires:  wayland-protocols-devel
BuildRequires:  Mesa-libEGL-devel
BuildRequires:  pango-devel
BuildRequires:  cairo-devel
BuildRequires:  gdk-pixbuf-devel
BuildRequires:  update-desktop-files
%if 0%{suse_version} >= 1550
BuildRequires:  rsvg-convert
BuildRequires:  rsvg-view
BuildRequires:  hicolor-icon-theme
BuildRequires:  fdupes
Requires:       libFcitx5Config5 = %{version}
Requires:       libFcitx5Core5 = %{version}
Requires:       libFcitx5Utils1 = %{version}
Recommends:     fcitx5-gtk2
Recommends:     fcitx5-gtk3
Recommends:     fcitx5-qt4
Recommends:     fcitx5-qt5
Provides:       fcitx = %{version}
Obsoletes:      fcitx <=
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

Fcitx 5 is a generic input method framework.

%package devel
Summary:    Development files for fcitx5
Group:      Development/Libraries/C and C++
Requires:   fcitx5 = %{version}

%description devel
This package provides development files for fcitx5.

%package -n libFcitx5Config5
Summary:    Configuration library for fcitx5
Group:      System/Libraries

%description -n libFcitx5Config5
This package provides configuration libraries for fcitx5.

%package -n libFcitx5Core5
Summary:    Core library for fcitx5
Group:      System/Libraries
Provides:   libfcitx-4_2_9 = %{version}
Obsoletes:  libfcitx-4_2_9 <=

%description -n libFcitx5Core5
This package provides core libraries for fcitx5.

%package -n libFcitx5Utils1
Summary:    Utility library for fcitx5
Group:      System/Libraries

%description -n libFcitx5Utils1
This package provides utility libraries for fcitx5.

%setup -q
%patch -p1
cp -r %{S:1} src/modules/spell/dict/

make %{?_smp_mflags}


# create autostart
mkdir -p %{buildroot}%{_sysconfdir}/X11/xim.d/
install -m 644 %{S:3} %{buildroot}%{_sysconfdir}/X11/xim.d/fcitx

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 ../fcitx $priority-fcitx

# install icons
for i in 16 22 24 32 48 512; do
  mkdir -p %{buildroot}%{_datadir}/icons/hicolor/${i}x${i}/apps/
  rsvg-convert -h $i -w $i %{S:2} -o %{buildroot}%{_datadir}/icons/hicolor/${i}x${i}/apps/fcitx.png
install -D -m 0644 %{S:2} %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/fcitx.svg

# install desktop files
%suse_update_desktop_file fcitx5 Utility DesktopUtility
%suse_update_desktop_file -r fcitx5-configtool System X-SuSE-SystemSetup

# own directories
mkdir -p %{buildroot}%{_datadir}/fcitx5/inputmethod
mkdir -p %{buildroot}%{_libdir}/fcitx5/qt5

# install macros.fcitx5
install -Dm 0755 %{S:4} %{buildroot}%{_sysconfdir}/rpm/macros.fcitx5

%find_lang fcitx5
%fdupes %{buildroot}

%post -p /sbin/ldconfig
%post -n libFcitx5Config5 -p /sbin/ldconfig
%post -n libFcitx5Core5 -p /sbin/ldconfig
%post -n libFcitx5Utils1 -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%postun -n libFcitx5Config5 -p /sbin/ldconfig
%postun -n libFcitx5Core5 -p /sbin/ldconfig
%postun -n libFcitx5Utils1 -p /sbin/ldconfig

%files -f fcitx5.lang
%config %{_sysconfdir}/X11/xim.d/

%files devel

%files -n libFcitx5Config5

%files -n libFcitx5Core5

%files -n libFcitx5Utils1