File qtkeychain.spec of Package qtkeychain
#
# spec file for package qtkeychain-qt6
#
# Copyright (c) 2023 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
%define sover 1
#
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == ""
ExclusiveArch: do_not_build
%else
%define _pkg_name_suffix -%{?flavor}
%endif
%if "%{flavor}" == "qt5"
%define qt5 1
%define qt_min_version 5.12.0
%define qt_major 5
%define library_name libqt5keychain%{sover}
%endif
%if "%{flavor}" == "qt6"
%define qt6 1
%define qt_min_version 6.2.0
%define qt_major 6
%define library_name libqt6keychain%{sover}
%endif
Name: qtkeychain%{?_pkg_name_suffix}
Version: 0.14.1
Release: 0
Summary: Platform-independent Qt API for storing passwords securely
License: BSD-2-Clause
URL: https://github.com/frankosterfeld/qtkeychain
Source: https://github.com/frankosterfeld/qtkeychain/archive/refs/tags/%%{version}.tar.gz#/qtkeychain-%{version}.tar.xz
BuildRequires: pkgconfig
BuildRequires: cmake(Qt%{qt_major}Core) >= %{qt_min_version}
BuildRequires: cmake(Qt%{qt_major}DBus) >= %{qt_min_version}
BuildRequires: cmake(Qt%{qt_major}LinguistTools) >= %{qt_min_version}
BuildRequires: cmake(Qt%{qt_major}Test) >= %{qt_min_version}
BuildRequires: pkgconfig(libsecret-1)
%description
QtKeychain is a Qt API to store passwords and other secret data securely.
%package -n %{library_name}
Summary: Qt %{qt_major} keychain library
# Renamed
Obsoletes: qtkeychain-qt%{qt_major}-lang <= %{version}
%description -n %{library_name}
The Qt %{qt_major} keychain library.
%package devel
Summary: Development files for libqt%{qt_major}keychain
Requires: %{library_name} = %{version}
Requires: cmake(Qt%{qt_major}Core)
Requires: cmake(Qt%{qt_major}DBus)
%description devel
This package contains development files for using the Qt%{qt_major} keychain API.
%lang_package -n %{library_name}
%prep
%autosetup -p1 -n qtkeychain-%{version}
%build
%if 0%{?qt5}
%cmake -DBUILD_TEST_APPLICATION=OFF ..
%cmake_build
%endif
%if 0%{?qt6}
%cmake_qt6 \
-DBUILD_WITH_QT6=ON \
-DQMAKE_EXECUTABLE=%{_qt6_bindir}/qmake
%qt6_build
%endif
%install
%if 0%{?qt5}
%cmake_install
%endif
%if 0%{?qt6}
%qt6_install
%endif
%find_lang qtkeychain --with-qt
%ldconfig_scriptlets -n %{library_name}
%files -n %{library_name}
%license COPYING
%doc ChangeLog ReadMe.md
%{_libdir}/libqt%{qt_major}keychain.so.*
%files devel
%{_includedir}/qt%{qt_major}keychain/
%{_libdir}/libqt%{qt_major}keychain.so
%{_libdir}/cmake/Qt%{qt_major}Keychain/
%{_libdir}/%{flavor}/mkspecs/modules/qt_Qt%{qt_major}Keychain.pri
%files -n %{library_name}-lang -f qtkeychain.lang
%dir %{_datadir}/qt%{qt_major}keychain
%{_datadir}/qt%{qt_major}keychain/translations/
%changelog