File libASqlQt6.spec of Package libASqlQt6
#
# spec file for package libASqlQt6
#
# Copyright (c) 2020-2025 Matthias Fehring <buschmann23@opensuse.org>
# Copyright (c) 2020-2025 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/
#
%bcond_with demos
%define _sonum 0
%define _tarname asql
%{?!__builddir:%global __builddir build}
%{?!cmake_build:%global cmake_build() make %{?_smp_mflags} VERBOSE=1}
%{?!cmake_install:%global cmake_install() DESTDIR=%{buildroot} make install -C %__builddir}
%{?!ctest:%global ctest() %{_bindir}/ctest --output-on-failure --force-new-ctest-process}
%if 0%{?mageia}
%define _libpkgname %{mklibname ASqlQt6_%{_sonum}}
%define _libPgPkgName %{mklibname ASqlQt6Pg _%{_sonum}}
%define _libSqlitePkgName %{mklibname ASqlQt6Sqlite _%{_sonum}}
%define _libMigPkgName %{mklibname ASqlQt6Migrations _%{_sonum}}
%define _libdpkgname %{mklibname ASqlQt6 -d}
%else
%define _libpkgname libASqlQt6-%{_sonum}
%define _libPgPkgName libASqlQt6Pg%{_sonum}
%define _libSqlitePkgName libASqlQt6Sqlite%{_sonum}
%define _libMigPkgName libASqlQt6Migrations%{_sonum}
%define _libdpkgname libASqlQt6-devel
%endif
%define _ninjaPkg ninja
%if 0%{?fedora}
%define _ninjaPkg ninja-build
%endif
Name: libASqlQt6
Version: 0.102.0
Release: 0
Summary: Qt6 Async SQL Library
License: MIT
Group: System/Libraries
URL: https://github.com/cutelyst/asql
Source0: https://github.com/cutelyst/asql/archive/v%{version}.tar.gz#/%{_tarname}-%{version}.tar.gz
BuildRequires: pkgconfig
BuildRequires: cmake >= 3.26
BuildRequires: %{_ninjaPkg}
BuildRequires: pkgconfig(libpq)
BuildRequires: pkgconfig(sqlite3)
BuildRequires: cmake(Qt6Core) >= 6.4.0
BuildRequires: cmake(Qt6Test) >= 6.4.0
%if 0%{?sle_version} == 150600
BuildRequires: gcc14-c++ >= 14.2.1
%endif
%description
Qt6 based library to support asynchronous SQL database queries.
%package -n %{_libpkgname}
Summary: Qt Async SQL Library
Group: System/Libraries
%description -n %{_libpkgname}
Qt6 based library to support asynchronous SQL database queries.
%package -n %{_libPgPkgName}
Summary: Qt Async PostgreSQL Library
Group: System/Libraries
%description -n %{_libPgPkgName}
Qt6 based library to support asynchronous PostgreSQL database queries.
%package -n %{_libSqlitePkgName}
Summary: Qt Async SQLite Library
Group: System/Libraries
%description -n %{_libSqlitePkgName}
Qt6 based library to support asynchronous SQLite database queries.
%package -n %{_libMigPkgName}
Summary: Qt Async SQL Migrations Library
Group: System/Libraries
%description -n %{_libMigPkgName}
Qt6 based library to suppor async SQL migrations.
%package -n %{_libdpkgname}
Summary: Development files for %{name}
Group: Development/Libraries/C and C++
Requires: %{_libpkgname} = %{version}
Requires: %{_libPgPkgName} = %{version}
Requires: %{_libSqlitePkgName} = %{version}
Requires: %{_libMigPkgName} = %{version}
Requires: pkgconfig(libpq)
Requires: cmake(Qt6Core)
%description -n %{_libdpkgname}
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}%{_sonum}.
%package -n asql-migration-qt6
Summary: Database Migration Tool
Group: Development/Tools/Other
Obsoletes: asql-migration <= %{version}
%description -n asql-migration-qt6
The asql-migration tool is used to run database migrations based on %{name}.
%prep
%autosetup -n %{_tarname}-%{version}
%build
%cmake_qt6 \
%if 0%{?sle_version} == 150600
-DCMAKE_C_COMPILER:STRING=gcc-14 \
-DCMAKE_CXX_COMPILER:STRING=g++-14 \
%endif
%{!?with_demos:-DBUILD_DEMOS:BOOL=OFF}
%if 0%{?suse_version}
%qt6_build
%else
%cmake_build
%endif
%install
%if 0%{?suse_version}
%qt6_install
%else
%cmake_install
%endif
%check
%ctest
%post -n %{_libpkgname} -p /sbin/ldconfig
%postun -n %{_libpkgname} -p /sbin/ldconfig
%post -n %{_libPgPkgName} -p /sbin/ldconfig
%postun -n %{_libPgPkgName} -p /sbin/ldconfig
%post -n %{_libSqlitePkgName} -p /sbin/ldconfig
%postun -n %{_libSqlitePkgName} -p /sbin/ldconfig
%post -n %{_libMigPkgName} -p /sbin/ldconfig
%postun -n %{_libMigPkgName} -p /sbin/ldconfig
%files -n %{_libpkgname}
%license LICENSE
%{_libdir}/%{name}.so.*
%files -n %{_libPgPkgName}
%license LICENSE
%{_libdir}/libASqlQt6Pg.so.*
%files -n %{_libSqlitePkgName}
%license LICENSE
%{_libdir}/libASqlQt6Sqlite.so.*
%files -n %{_libMigPkgName}
%license LICENSE
%{_libdir}/libASqlQt6Migrations.so.*
%files -n %{_libdpkgname}
%doc README.md
%{_includedir}/asql-qt6
%{_libdir}/%{name}.so
%{_libdir}/libASqlQt6Pg.so
%{_libdir}/libASqlQt6Sqlite.so
%{_libdir}/libASqlQt6Migrations.so
%{_libdir}/pkgconfig/ASqlQt6.pc
%{_libdir}/cmake/ASqlQt6
%files -n asql-migration-qt6
%license LICENSE
%{_bindir}/asql-migration0-qt6
%changelog