File sqlitebrowser.spec of Package sqlitebrowser

#
# spec file for package sqlitebrowser
#
# copyright (c) 2025 munix9@googlemail.com
#

%define nlohmann 3.12.0
%define qhexedit 0.8.11

Name:           sqlitebrowser
Version:        3.13.99
Release:        0
Summary:        DB Browser for SQLite
License:        GPL-3.0-or-later AND MIT AND MPL-2.0
URL:            https://sqlitebrowser.org/
Source0:        _service
Source1:        %{name}.1
Source10:       https://github.com/nlohmann/json/releases/download/v%{nlohmann}/json.hpp
Source11:       https://github.com/Simsys/qhexedit2/archive/v%{qhexedit}/qhexedit2-%{qhexedit}.tar.gz
Patch0:         fix-switch_case_return.patch
BuildRequires:  cmake
BuildRequires:  git
BuildRequires:  hicolor-icon-theme
BuildRequires:  ninja
BuildRequires:  pkgconfig
BuildRequires:  qscintilla-qt6-devel
BuildRequires:  qt6-linguist-devel
BuildRequires:  cmake(Qt6Concurrent)
BuildRequires:  cmake(Qt6Core5Compat)
BuildRequires:  cmake(Qt6Gui)
BuildRequires:  cmake(Qt6Network)
BuildRequires:  cmake(Qt6PrintSupport)
BuildRequires:  cmake(Qt6Test)
BuildRequires:  cmake(Qt6Widgets)
BuildRequires:  cmake(Qt6Xml)
#BuildRequires:  pkgconfig(qcustomplot)
#BuildRequires:  pkgconfig(qhexedit2)
BuildRequires:  pkgconfig(sqlcipher)
BuildRequires:  pkgconfig(sqlite3)
Suggests:       sqlite3
Suggests:       sqlite3-doc
Provides:       bundled(nlohmann_json) = %{nlohmann}
Provides:       bundled(qcustomplot) = 2.1.1
Provides:       bundled(qhexedit2) = %{qhexedit}
%if 0%{?suse_version} < 1600
BuildRequires:  gcc11-PIE
BuildRequires:  gcc11-c++
%else
BuildRequires:  gcc-c++
%endif

%description
DB Browser for SQLite (DB4S) is a high quality, visual, open source
tool designed for people who want to create, search, and edit SQLite
or SQLCipher database files. DB4S gives a familiar spreadsheet-like
interface on the database in addition to providing a full SQL query
facility.

DB4S gives access to the full capability of the underlying SQLite
database. Controls and wizards are available to:

   * Create and compact database files
   * Create, define, modify and delete tables
   * Create, define, and delete indexes
   * Browse, edit, add, and delete records
   * Sort and search records
   * Import and export records as text
   * Import and export tables from/to CSV files
   * Import and export databases from/to SQL dump files
   * Issue SQL queries and inspect the results
   * Examine a log of all SQL commands issued by the application
   * Plot simple graphs based on table or query data
   * Add, change, remove SQLCipher encryption from database files

%prep
#%%autosetup -n %%{_sourcedir}/%%{name}-%%{version} -T -D -p1
%setup -q -c -n b -T -D
cd .. && rmdir b && ln -s %{_sourcedir}/%{name}-%{version} b && cd b
%autopatch -p1

rm -r libs/json/json.hpp libs/qhexedit/src
install -m 0644 -t libs/json %{SOURCE10}
tar -xf %{SOURCE11} --strip-components=1 -C libs/qhexedit qhexedit2-%{qhexedit}/src

%build
%define __builder ninja

%cmake \
%if 0%{?suse_version} < 1600
	-DCMAKE_C_COMPILER=gcc-11 \
	-DCMAKE_CXX_COMPILER=g++-11 \
%endif
	-DENABLE_TESTING=ON \
	-DBUILD_SHARED_LIBS=OFF \
	-DBUILD_STATIC_LIBS=ON \
	-DFORCE_INTERNAL_QCUSTOMPLOT=ON \
	-DFORCE_INTERNAL_QHEXEDIT=ON \
	-DFORCE_INTERNAL_QSCINTILLA=OFF \
	-DQSCINTILLA_INCLUDE_DIR=%{_includedir}/qt6/Qsci \
	-DQSCINTILLA_LIBRARY=%{_libdir}/libqscintilla2_qt6.so \
	-DQT_MAJOR=Qt6 \
	-Dsqlcipher=ON

%cmake_build

%install
%cmake_install

install -D -m 0644 -t %{buildroot}%{_mandir}/man1 %{SOURCE1}

%check
%ctest --parallel 1 --timeout 60 --verbose

%files
%license LICENSE*
%doc README.md
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.{png,svg}
%{_datadir}/metainfo/%{name}.desktop.appdata.xml
%{_mandir}/man1/%{name}.1%{?ext_man}

%changelog
openSUSE Build Service is sponsored by