%bcond_with gcc

Name:    libplasma
Version: 6.2.5
Release: 1%{?dist}
Summary: Plasma is the foundation of the KDE user interface (v6)

# LicenseRef-QtCommercial is also in the licenses, but is being omitted as it is optional.
License: BSD-3-Clause AND CC0-1.0 AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-only AND LGPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND LGPL-3.0-only AND (GPL-2.0-only OR GPL-3.0-only) AND (LGPL-2.1-only OR LGPL-3.0-only) AND Qt-LGPL-exception-1.1
URL:     https://invent.kde.org/plasma/plasma-framework

Source0: https://download.kde.org/stable/plasma/%{version}/%{name}-%{version}.tar.xz

BuildRequires:  extra-cmake-modules
%if %{with gcc}
BuildRequires:  gcc-toolset-14-gcc-c++
%else
BuildRequires:  clang
%endif

BuildRequires:  cmake(KF6Archive)
BuildRequires:  cmake(KF6Declarative)
BuildRequires:  cmake(KF6Su)
BuildRequires:  cmake(KF6GlobalAccel)
BuildRequires:  cmake(KF6Kirigami2)
BuildRequires:  cmake(KF6Package)
BuildRequires:  cmake(KF6Parts)
BuildRequires:  cmake(KF6ConfigWidgets)
BuildRequires:  cmake(KF6ColorScheme)
BuildRequires:  kf6-rpm-macros
BuildRequires:  cmake(KF6Solid)
BuildRequires:  pkgconfig(openssl) >= 3.0
BuildRequires:  qt6-qtbase-devel
BuildRequires:  qt6-qtbase-private-devel
BuildRequires:  qt6-qtdeclarative-devel
BuildRequires:  qt6-qtsvg-devel

# KDE Frameworks
BuildRequires:  cmake(KF6Config)
BuildRequires:  cmake(KF6ConfigWidgets)
BuildRequires:  cmake(KF6CoreAddons)
BuildRequires:  cmake(KF6DBusAddons)
BuildRequires:  cmake(KF6DocTools)
BuildRequires:  cmake(KF6GuiAddons)
BuildRequires:  cmake(KF6I18n)
BuildRequires:  cmake(KF6IconThemes)
BuildRequires:  cmake(KF6KCMUtils)
BuildRequires:  cmake(KF6KIO)
BuildRequires:  cmake(KF6Notifications)
BuildRequires:  cmake(KF6Service)
BuildRequires:  cmake(KF6Svg)
BuildRequires:  cmake(KF6WidgetsAddons)
BuildRequires:  cmake(KF6WindowSystem)
BuildRequires:  cmake(KF6XmlGui)
BuildRequires:  cmake(PlasmaWaylandProtocols)

# Qt
BuildRequires:  cmake(Qt6WaylandClient)

# Plasma
BuildRequires:  cmake(PlasmaActivities)

BuildRequires:  pkgconfig(wayland-server) >= 1.22
BuildRequires:  kwayland-devel

Requires:       kf6-filesystem
Requires:       libwayland-client.so.0()%{?__isa:(%{__isa_bits}bit)}%{!?__isa:%{nil}} >= 1.22
Requires:       libwayland-cursor.so.0()%{?__isa:(%{__isa_bits}bit)}%{!?__isa:%{nil}} >= 1.22

# Renamed from kf6-plasma
Obsoletes:      kf6-plasma < 1:%{version}-%{release}
Provides:       kf6-plasma = 1:%{version}-%{release}

%description
%{summary}.

%package        devel
Summary:        Development files for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       cmake(KF6Package)
Requires:       qt6-qtbase-devel
Requires:       cmake(KF6Service)
Requires:       cmake(KF6WindowSystem)
Obsoletes:      kf6-plasma-devel < 1:%{version}-%{release}
Provides:       kf6-plasma-devel = 1:%{version}-%{release}
%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%package        doc
Summary:        Developer Documentation files for %{name}
BuildArch:      noarch
%description    doc
Developer Documentation files for %{name} for use with KDevelop or QtCreator.

%prep
%autosetup -n %{name}-%{version} -p1

%build
%if %{with gcc}
%enable_devtoolset14
export CC=gcc
export CXX=c++
%else
%global optflags %(echo %{optflags}) -Qunused-arguments
%endif

%global _rxlibdir /opt/rx/%{_lib}
export PATH=/opt/rx/bin:$PATH
export LDFLAGS="-L%{_rxlibdir} -Wl,-rpath=%{_rxlibdir} ${LDFLAGS}"
export PKG_CONFIG_PATH=%{_rxlibdir}/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}
%cmake_kf6
%cmake_build

%install
%cmake_install
%find_lang %{name} --all-name --with-man --all-name

# create/own dirs
mkdir -p %{buildroot}%{_kf6_datadir}/plasma/plasmoids
mkdir -p %{buildroot}%{_kf6_qmldir}/org/kde/private

%files -f %{name}.lang
%dir %{_kf6_qmldir}/org/
%dir %{_kf6_qmldir}/org/kde/
%dir %{_kf6_qmldir}/org/kde/private/
%doc README.md
#%%lang(lt) %{_datadir}/locale/lt/LC_SCRIPTS/libplasma6/
%license LICENSES/*.txt
%{_kf6_datadir}/plasma/
%{_kf6_datadir}/qlogging-categories6/*plasma*
%{_libdir}/libPlasma.so.*
%{_libdir}/libPlasmaQuick.so.*
%{_kf6_plugindir}/kirigami/
%{_kf6_plugindir}/packagestructure
%{_kf6_qmldir}/org/kde/plasma/
%{_kf6_qmldir}/org/kde/kirigami/styles/Plasma/AbstractApplicationHeader.qml
#{_kf6_qmldir}/org/kde/kirigami/styles/Plasma/Icon.qml

%files devel
%dir %{_kf6_datadir}/kdevappwizard/
%{_kf6_datadir}/kdevappwizard/templates/
%{_includedir}/Plasma/
%{_includedir}/PlasmaQuick/
%{_libdir}/cmake/Plasma/
%{_libdir}/cmake/PlasmaQuick/
%{_libdir}/libPlasma.so
%{_libdir}/libPlasmaQuick.so
%{_qt6_docdir}/*.tags
 
%files doc
%{_qt6_docdir}/*.qch

%changelog
* Thu Jan  2 2025 Raven <raven@sysadmins.ws> - 6.2.5-1
- 6.2.5

* Sat Dec 14 2024 Raven <raven@sysadmins.ws> - 6.2.4-2
- rebuild (qt6)

* Wed Nov 27 2024 Raven <raven@sysadmins.ws> - 6.2.4-1
- 6.2.4

* Wed Nov  6 2024 Raven <raven@sysadmins.ws> - 6.2.3-1
- 6.2.3

* Wed Oct 23 2024 Raven <raven@sysadmins.ws> - 6.2.2-1
- 6.2.2

* Tue Oct 15 2024 Raven <raven@sysadmins.ws> - 6.2.1-1
- 6.2.1

* Tue Oct  8 2024 Raven <raven@sysadmins.ws> - 6.2.0-1
- 6.2.0

* Thu Sep 12 2024 Raven <raven@sysadmins.ws> - 6.1.5-1
- 6.1.5

* Wed Aug  7 2024 Raven <raven@sysadmins.ws> - 6.1.4-1
- 6.1.4

* Mon Jul  8 2024 Raven <raven@sysadmins.ws> - 6.1.2-1
- 6.1.2

* Fri Jun 28 2024 Raven <raven@sysadmins.ws> - 6.1.1-1
- 6.1.1

* Wed Jun 26 2024 Raven <raven@sysadmins.ws> - 6.1.0-4
- rebuild with libxkbcommon_ng

* Tue Jun 18 2024 Raven <raven@sysadmins.ws> - 6.1.0-1
- 6.1.0

* Mon Jun  3 2024 Raven <raven@sysadmins.ws> - 6.0.5-1
- 6.0.5

* Fri Apr 19 2024 Raven <raven@sysadmins.ws> - 6.0.4-1
- 6.0.4

* Wed Apr  3 2024 Raven <raven@sysadmins.ws> - 6.0.3-1
- 6.0.3

* Thu Mar 14 2024 Raven <raven@sysadmins.ws> - 6.0.2-1
- 6.0.2

* Sat Mar 09 2024 Marie Loise Nolden <loise@kde.org> - 6.0.1-2
- add missing BuildArch: noarch to -doc package

* Wed Mar 06 2024 Marc Deop i Argemí <marcdeop@fedoraproject.org> - 6.0.1-1
- 6.0.1

* Wed Feb 21 2024 Marc Deop i Argemí <marcdeop@fedoraproject.org> - 6.0.0-1
- 6.0.0

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

* Wed Jan 31 2024 Marc Deop i Argemí <marcdeop@fedoraproject.org> - 5.93.0-1
- 5.93.0

* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 5.92.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 5.92.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Wed Jan 10 2024 Marc Deop i Argemí <marcdeop@fedoraproject.org> - 5.92.0-1
- 5.92.0

* Tue Jan 09 2024 Marie Loise Nolden <loise@kde.org> - 5.91.0-2
- add doc package for KF6 API

* Thu Dec 21 2023 Marc Deop i Argemí <marcdeop@fedoraproject.org> - 5.91.0-1
- 5.91.0

* Sun Dec 03 2023 Justin Zobel <justin.zobel@gmail.com> - 5.90.0-1
- Update to 5.90.0

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

* Fri Nov 24 2023 Alessandro Astone <ales.astone@gmail.com> - 5.27.80-1
- Renamed from kf6-plasma
