Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default qt6 #1307

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
HOME: /home/runner
runs-on: ubuntu-22.04
container:
image: ghcr.io/kiwix/kiwix-build_ci_${{matrix.image_variant}}:2024-12-18
image: ghcr.io/kiwix/kiwix-build_ci_${{matrix.image_variant}}:2024-12-26

steps:
- name: Install dependencies
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# - debian-bullseye
- ubuntu-noble
- ubuntu-jammy
- ubuntu-focal
# - ubuntu-focal
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -72,7 +72,7 @@
# with:
# args: --no-sign

- uses: legoktm/gh-action-build-deb@9114a536498b65c40b932209b9833aa942bf108d # pin@ubuntu-noble
- uses: legoktm/gh-action-build-deb@ubuntu-noble

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Packages' step
Uses Step: build-ubuntu-noble
uses 'legoktm/gh-action-build-deb' with ref 'ubuntu-noble', not a pinned commit hash
if: matrix.distro == 'ubuntu-noble'
name: Build package for ubuntu-noble
id: build-ubuntu-noble
Expand All @@ -88,13 +88,13 @@
args: --no-sign
ppa: ${{ steps.ppa.outputs.ppa }}

- uses: legoktm/gh-action-build-deb@ubuntu-focal
if: matrix.distro == 'ubuntu-focal'
name: Build package for ubuntu-focal
id: build-ubuntu-focal
with:
args: --no-sign
ppa: ${{ steps.ppa.outputs.ppa }}
# - uses: legoktm/gh-action-build-deb@ubuntu-focal
# if: matrix.distro == 'ubuntu-focal'
# name: Build package for ubuntu-focal
# id: build-ubuntu-focal
# with:
# args: --no-sign
# ppa: ${{ steps.ppa.outputs.ppa }}

- uses: actions/upload-artifact@v4
with:
Expand Down
67 changes: 38 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<img width="100" alt="Download on Flathub" src="https://flathub.org/assets/badges/flathub-badge-en.png" />
</a>

Kiwix Desktop
=============
Kiwix Linux/Windows
=====================

The Kiwix Desktop is a viewer/manager of ZIM files for GNU/Linux and
Microsoft Windows OSes.
The Kiwix Linux/Windows is a viewer/manager of ZIM files for GNU/Linux
and Microsoft Windows OSes.

[![Release](https://img.shields.io/github/v/tag/kiwix/kiwix-desktop?label=release&sort=semver)](https://download.kiwix.org/release/kiwix-desktop/)
[![Repositories](https://img.shields.io/repology/repositories/kiwix-desktop?label=repositories)](https://github.com/kiwix/kiwix-desktop/wiki/Repology)
Expand All @@ -25,7 +25,7 @@ at [kiwix-build](https://github.com/kiwix/kiwix-build).
Dependencies
------------

The Kiwix Desktop application relies on many third party software libraries.
The Kiwix application relies on many third party software libraries.
The following libraries need to be available:

* [libkiwix](https://github.com/kiwix/libkiwix/)
Expand All @@ -41,19 +41,33 @@ version by hand.
Libkiwix has to be compiled dynamically, the best way to have it is
to use [kiwix-build](https://github.com/kiwix/kiwix-build).

Install needed packages (on Ubuntu 18.04+):
Install needed packages (on Ubuntu 22.04+):

```bash
sudo apt-get install libqt5gui5 qtbase5-dev qtwebengine5-dev \
libqt5svg5-dev qt5-image-formats-plugins aria2 \
qttools5-dev-tools qtchooser qt5-qmake \
qtbase5-dev-tools
sudo apt install qt6-base-dev qt6-base-dev-tools qt6-webengine-dev \
libqt6webenginecore6-bin libqt6svg6 qt6-speech-flite-plugin \
qt6-speech-speechd-plugin qt6-speech-flite-plugin
```

Compilation
-----------

Once all dependencies are installed, you can compile Kiwix Desktop:
`qmake` needs to be configured to use Qt6:

```bash
qtchooser -install qt6 $(which qmake6) # run once
export QT_SELECT=qt6 # set in environments where Qt6 builds are desired
```

First confirm `qmake` is using the right version, this should produces this output:

```bash
$ qmake --version
QMake version 3.1
Using Qt version 6.2.4 in /usr/lib/aarch64-linux-gnu
```

Once all dependencies are installed, you can compile Kiwix:

```bash
qmake .
Expand All @@ -69,35 +83,30 @@ for example, for x86-64 native systems:
export PKG_CONFIG_PATH="<...>/BUILD_native_dyn/INSTALL/lib/x86_64-linux-gnu/pkgconfig"
```

You may want to simply open the kiwix-desktop project in QtCreator and
You may want to simply open the `kiwix-desktop` project in QtCreator and
then compile the project from there (don't forget to update
`PKG_CONFIG_PATH` if necessary).

Compilation with Qt6
Compilation with Qt5
--------------------

There is initial support for Qt6. Additional packages are needed:
It is still possible to compile using Qt5, following packages are needed:

```bash
sudo apt install qt6-base-dev qt6-base-dev-tools qt6-webengine-dev libqt6webenginecore6-bin libqt6svg6
sudo apt-get install libqt5gui5 qtbase5-dev qtwebengine5-dev \
libqt5svg5-dev qt5-image-formats-plugins aria2 \
qttools5-dev-tools qtchooser qt5-qmake \
qtbase5-dev-tools libqt5texttospeech5-dev
```

And `qmake` needs to be configured to use Qt6. First confirm `qmake` is using the right version:
`qmake` needs to be configured to use Qt5:

```bash
qtchooser -install qt6 $(which qmake6) # run once
export QT_SELECT=qt6 # set in environments where Qt6 builds are desired
qtchooser -install qt5 $(which qmake5) # run once
export QT_SELECT=qt5 # set in environments where Qt5 builds are desired
qmake --version
```

produces this output:

```bash
$ qmake --version
QMake version 3.1
Using Qt version 6.2.4 in /usr/lib/aarch64-linux-gnu
```

then build as normal:

```bash
Expand All @@ -114,17 +123,17 @@ documentation](https://github.com/kiwix/kiwix-build/wiki/Compile-on-Microsoft-Wi
Installation
------------

To install Kiwix Desktop on the system:
To install Kiwix on the system:
```bash
sudo make install
```

Run
---

To run Kiwix Desktop
To run Kiwix:
```bash
kiwix-desktop
kiwix
```

You might have to refresh the `ld` database before:
Expand Down
8 changes: 5 additions & 3 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ Priority: optional
Maintainer: Kiwix team <[email protected]>
Build-Depends: debhelper-compat (= 13),
pkg-config,
qtbase5-dev,
qtwebengine5-dev,
libqt5texttospeech5-dev,
qtchooser,
qt6-base-dev,
qt6-svg-dev,
qt6-webengine-dev,
qt6-speech-dev,
libkiwix-dev (>= 14.0), libkiwix-dev (<< 15.0),
libzim-dev (>= 9.0), libzim-dev (<< 10.0),
Standards-Version: 4.5.0
Expand Down
2 changes: 1 addition & 1 deletion debian/rules
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/make -f
export QT_SELECT=qt5
export QT_SELECT = qt6
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
Expand Down
12 changes: 11 additions & 1 deletion kiwix-desktop.pro
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,22 @@ CONFIG += link_pkgconfig

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = kiwix-desktop
TARGET = kiwix
TEMPLATE = app

QMAKE_CXXFLAGS += -std=c++17
QMAKE_LFLAGS += -std=c++17

# Kiwix requires per default on Qt6 (but can still compile with Qt5 if explicitly
# requested, see README.md for more information).
QT_SELECT += $$(QT_SELECT)
lessThan(QT_MAJOR_VERSION, 6) {
!equals(QT_SELECT, "qt5") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want a kiwix-specific env var to control the build behavior? The QT_SELECT env var is not the only way to select which Qt installation to use, so someone might be intentionally using a qt5 toolchain yet the build would fail because the QT_SELECT env var was not set. Similarly, if someone already set QT_SELECT=qt5 as part of their default shell environment, the build wouldn't fail even though maybe it should have.

A kiwix-specific var like KIWIX_QT=qt5 would prevent this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no strong opinion on this point... I mostly focus on simplicity. Just to be sure I understand your scenarios:

someone might be intentionally using a qt5 toolchain yet the build would fail because the QT_SELECT env var was not set.

OK, but then he clearly ignores the README right? If he ignores the README he won't find out how to set KIWIX_QT=qt5 either.

Similarly, if someone already set QT_SELECT=qt5 as part of their default shell environment, the build wouldn't fail even though maybe it should have.

You mean, he would have set QT_SELECT=qt5 but actually compiling with Qt6 for example? OK... but that sounds pretty weird!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, but then he clearly ignores the README

I typically assume folks ignore the README, at least to some degree. They will usually follow any initial instructions but I would not expect beginners to dig into the details of the README. Even if they read it, they don't often know the significance of what they read, or what context it applies. Just saying there are limits to what beginners will pick up on.

With KIWIX_QT=qt5, my understanding was that you wanted a default Qt6 experience, where everyone compiles with qt6 by default, and only drops back to qt5 for certain cases like compiling on older distros. If that's what you want, using a kiwix-specific env var would accomplish that.

Regarding my original comment - someone might be intentionally using a qt5 toolchain - what I mean is that they could use a different avenue of configuring qtchooser, like via a config file. They could have intentionally setup their environment to build with Qt5, but the build would fail because they configured qtchooser via config instead of QT_SELECT. This is not a huge deal, but could trip up someone who doesn't understand the intent of the environment variables. This is why I think KIWIX_QT is more clear all around. If we use QT_SELECT to determine whether a Qt5 build is allowed, we're conflating the configuration of qtchooser ("which version of Qt does the system provide") with the requirements of kiwix ("which version of Qt does the project require").

he would have set QT_SELECT=qt5 but actually compiling with Qt6

No, I mean that a Qt developer with a preexisting default of QT_SELECT=qt5 in their environment could walk into the project and accidentally compile with Qt5. If I understand what you want - compile with Qt6 by default except some limited circumstances - this scenario seems to break your requirement. Also not a huge deal, but I bring it up because it seems contrary to the desired experience.

message("Qt 6 is required, but Qt $${QT_VERSION} is used")
error("Use Qt 6.0.0 or newer")
}
}

!win32 {
QMAKE_CXXFLAGS += -Werror
equals(QT_MAJOR_VERSION, 6):equals(QT_MINOR_VERSION, 6) {
Expand Down
6 changes: 3 additions & 3 deletions resources/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"name":"English",
"error-title":"Error",
"error-downloader-window-title":"Cannot create downloader",
"error-downloader-launch-message":"Impossible to launch downloader, Kiwix-desktop will start but all download functions will not working!",
"error-downloader-launch-message":"Impossible to launch downloader, Kiwix will start but all download functions will not working!",
"error-launch-server-message":"An error has occured!",
"error-archive":"Cannot get the archive",
"error-opening-file": "There was an error opening the file.",
Expand Down Expand Up @@ -78,14 +78,14 @@
"reset":"Reset",
"clear":"Clear",
"browse":"Browse",
"about-kiwix-desktop-title":"Kiwix Desktop",
"about-kiwix-desktop-title":"Kiwix",
"about-kiwix-desktop-description":"Kiwix allows you to have the entirety of Wikipedia at hand wherever you go! On a boat, in the middle of nowhere, or in jail, Kiwix gives you access to all of human knowledge. You don't need Internet, everything is stored on your computer.",
"about-learn-more-about-kiwix":"Learn more about Kiwix",
"about-release-title":"Release",
"about-source-code":"This software is released under the terms of the GNU General Public License version 3. View the source code on <a href='{{GITHUB_URL}}'>Github</a>.",
"about-version":"Version: {{VERSION}}",
"about-reporting-problem-title":"Reporting problems",
"about-report-issue":"To open an issue, visit <a href='{{TRACKER_URL}}'>Kiwix-desktop issue tracker</a> and open an issue describing your problem.",
"about-report-issue":"To open an issue, visit <a href='{{TRACKER_URL}}'>Kiwix issue tracker</a> and open an issue describing your problem.",
"about-report-issue-2":"Please mention the version in the issue.",
"about-libraries-title":"Libraries",
"kiwix-server-running-message":"The Kiwix Server is running and can be accessed in the local network at:",
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int main(int argc, char *argv[])
KiwixApp a(argc, argv);

QCommandLineParser parser;
parser.setApplicationDescription(QStringLiteral("The Kiwix Desktop is a viewer/manager of ZIM files for GNU/Linux and Microsoft Windows OSes."));
parser.setApplicationDescription(QStringLiteral("Kiwix is a viewer/manager of ZIM files for GNU/Linux and Microsoft Windows OSes."));
parser.addHelpOption();
parser.addPositionalArgument("zimfile", "The zim file");

Expand Down
Loading