## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 2;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%global __provides_exclude_from ^%{_libdir}/(fcitx5|qt5)/.*\\.so$

%global build_qt6 1

Name:           fcitx5-qt
Version:        5.1.8
Release:        %autorelease
Summary:        Qt library and IM module for fcitx5
# Fcitx5Qt{4,5}DBusAddons Library and Input context plugin are released under BSD.
# Automatically converted from old format: LGPLv2+ and BSD - review is highly recommended.
License:        LicenseRef-Callaway-LGPLv2+ AND LicenseRef-Callaway-BSD
URL:            https://github.com/fcitx/fcitx5-qt
Source:         https://download.fcitx-im.org/fcitx5/%{name}/%{name}-%{version}.tar.zst
Source1:        https://download.fcitx-im.org/fcitx5/%{name}/%{name}-%{version}.tar.zst.sig
Source2:        https://pgp.key-server.io/download/0x8E8B898CBF2412F9

BuildRequires:  gnupg2
BuildRequires:  cmake
BuildRequires:  extra-cmake-modules
BuildRequires:  gcc-c++
BuildRequires:  ninja-build
BuildRequires:  pkgconfig(xkbcommon-x11)
BuildRequires:  pkgconfig(Fcitx5Utils)
BuildRequires:  pkgconfig(Qt5)
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5Gui) 
BuildRequires:  pkgconfig(Qt6WaylandClient)
BuildRequires:  pkgconfig(wayland-client)
BuildRequires:  pkgconfig(wayland-cursor) 
BuildRequires:  pkgconfig(wayland-egl)
BuildRequires:  pkgconfig(wayland-server)
BuildRequires:  gettext
BuildRequires:  qt5-qtbase-private-devel
%if %{build_qt6}
BuildRequires:  pkgconfig(Qt6)
BuildRequires:  qt6-qtbase-private-devel
Requires:       ((fcitx5-qt6%{?_isa} = %{version}-%{release}) if qt6-qtbase)
%endif


# pull in im-modules for existing qt version
Requires:       ((fcitx5-qt5%{?_isa} = %{version}-%{release}) if qt5-qtbase)

%description
Qt library and IM module for fcitx5.

%package -n fcitx5-qt5
Summary:        Provides seperately modules for fcitx5-qt 
Provides:       %{name}-module%{?_isa} = %{version}-%{release}
Obsoletes:      %{name}-module < %{version}-%{release}
Conflicts:      %{name}-module%{?_isa} < %{version}-%{release}
# This needs to be rebuilt on every minor Qt5 version bump
%{?_qt5:Requires: %{_qt5}%{?_isa} = %{_qt5_version}}

%description -n fcitx5-qt5
This package provides im-modules that can be installed seperately
from fcitx5-qt.

%package qt5gui
Summary:        Provide gui wrapper for fcitx5 with qt5
Provides:       %{name}%{?_isa} = %{version}-%{release}
Obsoletes:      %{name} < %{version}-%{release}
Conflicts:      %{name}%{?_isa} < %{version}-%{release}

%description qt5gui
Provide gui wrapper for fcitx5 with qt5.

%package libfcitx5qtdbus
Summary:        Provides libFcitx5Qt5DBusAddons for fcitx5

%description libfcitx5qtdbus
This package provides libFcitx5Qt5DBusAddons for fcitx5.

%package libfcitx5qt5widgets
Summary:        Provide libFcitx5Qt5WidgetsAddons for fcitx5

%description libfcitx5qt5widgets
This package provides libFcitx5Qt5WidgetsAddons for fcitx5.


%if %{build_qt6}
%package -n fcitx5-qt6
Summary:        Qt 6 support for fcitx5
# This needs to be rebuilt on every minor Qt6 version bump
%{?_qt6:Requires: %{_qt6}%{?_isa} = %{_qt6_version}}

%description -n fcitx5-qt6
Qt6 library and IM module for fcitx5.

%package qt6gui
Summary:        Provide gui wrapper for fcitx5 with qt6
Provides:       %{name}%{?_isa} = %{version}-%{release}
Obsoletes:      %{name} < %{version}-%{release}
Conflicts:      %{name}%{?_isa} < %{version}-%{release}

%description qt6gui
Provide gui wrapper for fcitx5 with qt6.

%package libfcitx5qt6widgets
Summary:        Provide libFcitx5Qt6WidgetsAddons for fcitx5

%description libfcitx5qt6widgets
This package provides libFcitx5Qt6WidgetsAddons for fcitx5.
%endif

%package devel
Summary:        Development files for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       fcitx5-devel
Requires:       cmake-filesystem%{?_isa}

%description devel
Development files for %{name}

%prep
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
%autosetup -p1

%build
%cmake -GNinja -DENABLE_QT4=False \
%if %{build_qt6}
    -DENABLE_QT6=True
%else
    -DENABLE_QT6=False
%endif
%cmake_build 

%install
%cmake_install

%find_lang %{name}


%files 
%license LICENSES/LGPL-2.1-or-later.txt
%doc README.md 

%files qt5gui -f %{name}.lang
%license LICENSES/LGPL-2.1-or-later.txt
%{_libdir}/fcitx5/qt5/
%{_libexecdir}/fcitx5-qt5-gui-wrapper
%{_datadir}/applications/org.fcitx.fcitx5-qt5-gui-wrapper.desktop


%if %{build_qt6}
%files -n fcitx5-qt6
%license LICENSES/LGPL-2.1-or-later.txt
%{_qt6_plugindir}/platforminputcontexts/libfcitx5platforminputcontextplugin.so
%{_bindir}/fcitx5-qt6-immodule-probing
%{_libdir}/libFcitx5Qt6DBusAddons.so.1
%{_libdir}/libFcitx5Qt6DBusAddons.so.*.*

%files qt6gui -f %{name}.lang
%license LICENSES/LGPL-2.1-or-later.txt
%{_libdir}/fcitx5/qt6/
%{_libexecdir}/fcitx5-qt6-gui-wrapper
%{_datadir}/applications/org.fcitx.fcitx5-qt6-gui-wrapper.desktop

%files libfcitx5qt6widgets
%license LICENSES/LGPL-2.1-or-later.txt
%{_libdir}/libFcitx5Qt6WidgetsAddons.so.2
%{_libdir}/libFcitx5Qt6WidgetsAddons.so.*.*
%endif

%files devel
%{_includedir}/Fcitx5Qt5/
%{_libdir}/cmake/Fcitx5Qt5*
%{_libdir}/libFcitx5Qt5DBusAddons.so
%{_libdir}/libFcitx5Qt5WidgetsAddons.so
%if %{build_qt6}
%{_libdir}/libFcitx5Qt6DBusAddons.so
%{_libdir}/cmake/Fcitx5Qt6*
%{_includedir}/Fcitx5Qt6/
%{_libdir}/libFcitx5Qt6WidgetsAddons.so
%endif


%files -n fcitx5-qt5 
%{_qt5_plugindir}/platforminputcontexts/libfcitx5platforminputcontextplugin.so
%{_bindir}/fcitx5-qt5-immodule-probing

%files libfcitx5qt5widgets
%license LICENSES/LGPL-2.1-or-later.txt
%{_libdir}/libFcitx5Qt5WidgetsAddons.so.2
%{_libdir}/libFcitx5Qt5WidgetsAddons.so.*.*

%files libfcitx5qtdbus
%license LICENSES/LGPL-2.1-or-later.txt
%{_libdir}/libFcitx5Qt5DBusAddons.so.1
%{_libdir}/libFcitx5Qt5DBusAddons.so.*.*



%changelog
## START: Generated by rpmautospec
* Wed Dec 04 2024 Jan Grulich <grulja@gmail.com> - 5.1.8-2
- Rebuild (qt6)

* Mon Oct 21 2024 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.1.8-1
- update to upstream release 5.1.8

* Mon Oct 14 2024 Jan Grulich <jgrulich@redhat.com> - 5.1.7-2
- Rebuild (qt6)

* Thu Oct 10 2024 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.1.7-1
- update to upstream release 5.1.7

* Thu Sep 05 2024 Jan Grulich <jgrulich@redhat.com> - 5.1.6-7
- Rebuild (qt5)

* Wed Aug 28 2024 Miroslav Suchý <msuchy@redhat.com> - 5.1.6-6
- convert license to SPDX

* Wed Jul 17 2024 Fedora Release Engineering <releng@fedoraproject.org> - 5.1.6-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Tue Jul 02 2024 Jan Grulich <jgrulich@redhat.com> - 5.1.6-4
- Rebuild (qt6)

* Thu May 30 2024 Jan Grulich <jgrulich@redhat.com> - 5.1.6-3
- Rebuild (qt5)

* Tue May 21 2024 Jan Grulich <jgrulich@redhat.com> - 5.1.6-2
- Rebuild (qt6)

* Tue Apr 23 2024 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.1.6-1
- update to upstream release 5.1.6

* Thu Apr 04 2024 Jan Grulich <jgrulich@redhat.com> - 5.1.5-4
- Rebuild (qt6)

* Thu Apr 04 2024 Jan Grulich <jgrulich@redhat.com> - 5.1.5-3
- Rebuild (qt6)

* Fri Mar 15 2024 Jan Grulich <jgrulich@redhat.com> - 5.1.5-2
- Rebuild (qt5)

* Fri Mar 01 2024 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.1.5-1
- update to upstream release 5.1.5

* Fri Feb 16 2024 Jan Grulich <jgrulich@redhat.com> - 5.1.4-6
- Rebuild (qt6)

* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 5.1.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 5.1.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Fri Jan 05 2024 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.1.4-3
- improve requires entries

* Fri Jan 05 2024 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.1.4-2
- re-organize subpackages by qt version

* Fri Jan 05 2024 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.1.4-1
- update to upstream release 5.1.4

* Wed Jan 03 2024 Jan Grulich <jgrulich@redhat.com> - 5.1.3-3
- Rebuild (qt5)

* Wed Nov 29 2023 Jan Grulich <jgrulich@redhat.com> - 5.1.3-2
- Rebuild (qt6)

* Sat Nov 04 2023 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.1.3-1
- update to upstream release 5.1.3

* Fri Nov 03 2023 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.1.2-3
- fix building with QT6 < 6.6.0

* Thu Nov 02 2023 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.1.2-2
- Add required dependencies

* Thu Nov 02 2023 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.1.2-1
- update to upstream release 5.1.2

* Fri Oct 13 2023 Jan Grulich <jgrulich@redhat.com> - 5.1.1-5
- Rebuild (qt6)

* Mon Oct 09 2023 Jan Grulich <jgrulich@redhat.com> - 5.1.1-4
- Rebuild (qt5)

* Thu Oct 05 2023 Jan Grulich <jgrulich@redhat.com> - 5.1.1-3
- Rebuild (qt6)

* Tue Oct 03 2023 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.1.1-2
- Enable s390x build

* Mon Oct 02 2023 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.1.1-1
- update to upstream release 5.1.1

* Fri Aug 18 2023 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.1.0-1
- update to upstream release 5.1.0

* Mon Jul 24 2023 Jan Grulich <jgrulich@redhat.com> - 5.0.17-9
- Rebuild (qt6)

* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.17-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Wed Jul 12 2023 Jan Grulich <jgrulich@redhat.com> - 5.0.17-7
- Rebuild for qtbase private API version change

* Wed Jul 12 2023 Jan Grulich <jgrulich@redhat.com> - 5.0.17-6
- Rebuild for qtbase private API version change

* Wed Jun 14 2023 Jan Grulich <jgrulich@redhat.com> - 5.0.17-5
- Rebuild (qt5)

* Fri May 26 2023 Jan Grulich <jgrulich@redhat.com> - 5.0.17-4
- Rebuild (qt6)

* Tue Apr 04 2023 Jan Grulich <jgrulich@redhat.com> - 5.0.17-3
- Rebuild (qt6)

* Mon Mar 27 2023 Jan Grulich <jgrulich@redhat.com> - 5.0.17-2
- Rebuild (qt6)

* Sun Mar 12 2023 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.17-1
- update to upstream release 5.0.17

* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.16-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Tue Jan 17 2023 Jan Grulich <jgrulich@redhat.com> - 5.0.16-3
- Rebuild (qt6)

* Thu Nov 24 2022 Jan Grulich <jgrulich@redhat.com> - 5.0.16-2
- Rebuild (qt6)

* Mon Nov 21 2022 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.16-1
- update to upstream release 5.0.16

* Tue Nov 08 2022 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.15-2
- rebuild for qt6 6.3.1

* Tue Aug 30 2022 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.15-1
- update to upstream release 5.0.15

* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.14-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Thu Jul 14 2022 Jan Grulich <jgrulich@redhat.com> - 5.0.14-2
- Rebuild (qt5)

* Mon Jul 04 2022 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.14-1
- update to upstream release 5.0.14

* Thu Jun 02 2022 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.13-1
- update to upstream release 5.0.13

* Wed Jun 01 2022 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.12-3
- rebuild for QT5 5.15.3

* Mon May 23 2022 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.12-2
- fix building

* Mon May 23 2022 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.12-1
- update to upstream release 5.0.12

* Tue May 17 2022 Jan Grulich <jgrulich@redhat.com> - 5.0.11-4
- Rebuild (qt5)

* Tue May 17 2022 Jan Grulich <jgrulich@redhat.com> - 5.0.11-3
- Rebuild (qt5)

* Fri Apr 22 2022 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.11-2
- rebuild for QT6 6.3.0

* Thu Mar 10 2022 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.11-1
- update to upstream release 5.0.11

* Tue Mar 08 2022 Jan Grulich <jgrulich@redhat.com> - 5.0.10-2
- Rebuild (qt5)

* Wed Feb 02 2022 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.10-1
- update to upstream release 5.0.10

* Tue Feb 01 2022 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.9-5
- rebuild to qt6 6.2.3 update

* Tue Jan 25 2022 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.9-4
- disable qt5 for s390x

* Mon Jan 24 2022 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.9-3
- enable QT6 support

* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Sun Jan 02 2022 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.9-1
- update to 5.0.9

* Sat Nov 06 2021 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.8-1
- update to 5.0.8

* Sun Sep 26 2021 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.7-1
- update to 5.0.7

* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Wed May 05 2021 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.6-1
- Update to 5.0.6 upstream release

* Tue Mar 23 2021 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.5-1
- Update to 5.0.5 upstream release

* Mon Mar 22 2021 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.4-1
- Update to 5.0.4 upstream release

* Sat Feb 20 2021 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.3-1
- update to 5.0.3 upstream release

* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Wed Jan 13 10:50:52 CST 2021 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.2-1
- update to 5.0.2 upstream release

* Sun Dec  6 00:42:46 CST 2020 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.1-2
- split package
- libfcitx5qtdbus and libfcitx5qt5widgets

* Sat Dec  5 14:12:52 CST 2020 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.1-1
- Update to 5.0.1 upstream release

* Tue Nov 24 18:00:57 CST 2020 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.0-2
- rebuild for qt 5.15.2

* Tue Nov  3 19:39:01 CST 2020 Qiyu Yan <yanqiyu@fedoraproject.org> - 5.0.0-1
- update to 5.0.0 upstream release

* Fri Oct 16 2020 Qiyu Yan <yanqiyu@fedoraproject.org> - 0-0.5
- update to 932e25f361f588a1e87f57e8a994bba80bf8798d upstream commit

* Wed Sep 16 2020 Qiyu Yan <yanqiyu@fedoraproject.org> - 0-0.4
- Upstream commit f5adc1bd85a89a1d3888052fa9403c8e9b454bfa
- make provides sane

* Sat Sep 12 2020 Qiyu Yan <yanqiyu@fedoraproject.org> - 0-0.3.20200912git02bbbf6
- Rebuild for fcitx5, QT5
- Upstream commit 02bbbf671dc44e83ef8eb9352483e67ad43381e3

* Sun Aug 16 2020 Qiyu Yan <yanqiyu@fedoraproject.org> - 0-0.2.20200811git3ddd34a
- rebuilt

* Wed Aug 12 2020 Qiyu Yan <yanqiyu@fedoraproject.org> - 0-0.1.20200811git3ddd34a
- initial package

## END: Generated by rpmautospec