File sqlitebrowser.spec of Package sqlitebrowser
#
# spec file for package sqlitebrowser
#
# copyright (c) 2025 munix9@googlemail.com
#
%define upd_nlohmann 3.12.0
%define upd_qhexedit 0.8.11
%bcond_without bundled_qcustomplot
%bcond_without bundled_qhexedit
%bcond_with bundled_qscintilla
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%{upd_nlohmann}/json.hpp
Source11: https://github.com/Simsys/qhexedit2/archive/v%{upd_qhexedit}/qhexedit2-%{upd_qhexedit}.tar.gz
Patch0: fix-switch_case_return.patch
BuildRequires: cmake
BuildRequires: desktop-file-utils
BuildRequires: git
BuildRequires: hicolor-icon-theme
BuildRequires: ninja
BuildRequires: pkgconfig
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(sqlcipher)
BuildRequires: pkgconfig(sqlite3)
Suggests: sqlite3
Suggests: sqlite3-doc
Provides: bundled(nlohmann_json) = %{upd_nlohmann}
%if 0%{?suse_version} < 1600
BuildRequires: gcc11
BuildRequires: gcc11-PIE
BuildRequires: gcc11-c++
%else
BuildRequires: gcc-c++
%endif
%if %{with bundled_qcustomplot}
Provides: bundled(qcustomplot) = 2.1.1
%else
BuildRequires: pkgconfig(qcustomplot) >= 2.1.1
%endif
%if %{with bundled_qhexedit}
Provides: bundled(qhexedit2) = %{upd_qhexedit}
%else
BuildRequires: pkgconfig(qhexedit2) >= 0.8.6
%endif
%if %{with bundled_qscintilla}
Provides: bundled(qscintilla-qt6) = 2.14.1
%else
BuildRequires: qscintilla-qt6-devel >= 2.14.1
%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 libs/json/json.hpp
install -m 0644 -t libs/json %{SOURCE10}
%if %{with bundled_qhexedit}
rm -r libs/qhexedit/src
tar -xf %{SOURCE11} --strip-components=1 -C libs/qhexedit qhexedit2-%{upd_qhexedit}/src
%endif
%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=%{?with_bundled_qcustomplot:ON}%{!?with_bundled_qcustomplot:OFF} \
-DFORCE_INTERNAL_QHEXEDIT=%{?with_bundled_qhexedit:ON}%{!?with_bundled_qhexedit:OFF} \
-DFORCE_INTERNAL_QSCINTILLA=%{?with_bundled_qscintilla:ON}%{!?with_bundled_qscintilla:OFF} \
-DQT_MAJOR=Qt6 \
-Dsqlcipher=ON
%cmake_build
%install
%cmake_install
install -D -m 0644 -t %{buildroot}%{_mandir}/man1 %{SOURCE1}
%check
desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop
%ctest --parallel 1 --timeout 60 --verbose
%files
%license LICENSE*
%doc README.md
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/256x256/apps/%{name}.png
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%{_datadir}/metainfo/%{name}.desktop.appdata.xml
%{_mandir}/man1/%{name}.1%{?ext_man}
%changelog