File dtk6log.spec of Package dtk6log

#
# spec file for package dtk6log
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2024 Hillwood Yang <hillwood@opensuse.org>
#
# 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 Qt_ver  6
%define dtk_ver 6
%define sover   0

Name:           dtk6log
Version:        0.0.6
Release:        0
Summary:        Dtk6log
License:        LGPL-3.0-or-later
Group:          System/GUI/Other
URL:            https://github.com/linuxdeepin/dtk6log
Source0:        https://github.com/linuxdeepin/dtk6log/archive/%{version}/%{name}-%{version}.tar.gz
%if "%{Qt_ver}" == "6"
BuildRequires:  qt6-core-private-devel
%else
BuildRequires:  libQt5Core-private-headers-devel
%endif
BuildRequires:  pkgconfig(Qt%{Qt_ver}Core)
BuildRequires:  pkgconfig(spdlog)
BuildRequires:  pkgconfig(libsystemd)
%if 0%{?suse_version} < 1600
BuildRequires:  gcc13-c++
%endif

%description
Simple, convinient and thread safe logger for Qt-based C++ apps.

%package -n lib%{name}%{sover}
Summary:        Libraries of dtk6log
Group:          System/Libraries

%description -n lib%{name}%{sover}
Simple, convinient and thread safe logger for Qt-based C++ apps.

%package devel
Summary:        Development tools for dtk6log
Group:          Development/Languages/C and C++
Requires:       lib%{name}%{sover} = %{version}-%{release}

%description devel
The dtk6log-devel package contains the header files for dtk6log.

%prep
%autosetup -p1

%build
%if 0%{?suse_version} < 1600
    export CXX=g++-13
%endif
%cmake -DDLOG_VERSION=%{version} \
%if "%{Qt_ver}" == "6"
       -DBUILD_WITH_QT6=ON \
%endif
       -DBUILD_WITH_SYSTEMD=ON
%cmake_build

%install
%cmake_install

%post -n lib%{name}%{sover} -p /sbin/ldconfig
%postun -n lib%{name}%{sover} -p /sbin/ldconfig

%files -n lib%{name}%{sover}
%{_libdir}/lib%{name}.so.*

%files devel
%{_libdir}/lib%{name}.so
%{_libdir}/pkgconfig/%{name}.pc
%{_libdir}/qt%{Qt_ver}/mkspecs/modules/qt_lib_dtklog.pri
%{_libdir}/cmake/Dtk*
%dir %{_includedir}/dtk%{dtk_ver}
%{_includedir}/dtk%{dtk_ver}/DLog

%changelog
openSUSE Build Service is sponsored by