Skip to content
Merged
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
37 changes: 12 additions & 25 deletions .github/actions/qt-setup-taskcluster/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,22 @@ inputs:
toolchain-alias:
description: 'Taskcluster toolchain alias'
required: false
default: ${{ runner.os == 'Windows' && 'qt-windows-x86_64-6.10' || 'qt-macos-6.10' }}
default: ${{ case(runner.os == 'Windows', 'qt-windows-x86_64-6.10',
runner.os == 'macOS', 'qt-macos-6.10',
'qt-linux') }}
cache:
description: 'Cache Qt toolchain artifacts'
required: false
default: ${{ runner.os == 'Windows' }}
cmake-env:
description: 'Add cmake environment variables'
required: false
default: true

outputs:
cmake-prefix-path:
description: 'Path to Qt CMake files for CMAKE_PREFIX_PATH'
value: ${{ steps.get-cmake-path.outputs.cmake-prefix-path }}
path:
description: 'Qt toolchain installation path'
value: ${{ steps.resolve.outputs.toolchain-path }}

runs:
using: "composite"
steps:
- name: Set destination path
id: set-dest
shell: bash
run: echo "path=${GITHUB_WORKSPACE}/3rdparty" >> $GITHUB_OUTPUT

- name: Resolve artifact task
id: resolve
shell: bash
Expand All @@ -48,40 +41,34 @@ runs:
# contents. Lucky for us, tar is a streamable format so this kinda works
# even though the archive is truncated.
curl -sSL -r0-4096 "https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/${TASKID}/artifacts/${NAME}" -o qt-toolchain-head.tar.xz
echo "toolchain-path=$(xzcat qt-toolchain-head.tar.xz 2>/dev/null | tar t 2>/dev/null | head -1 | grep -o '^[^/]*')" >> $GITHUB_OUTPUT
TARBALL_PATH=$((xzcat qt-toolchain-head.tar.xz | tar t | head -1 | grep -o '^[^/]*') 2>/dev/null || true)
echo "toolchain-path=${GITHUB_WORKSPACE}/3rdparty/${TARBALL_PATH}" >> $GITHUB_OUTPUT

- name: Cache Qt toolchain
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
id: qt-toolchain-cache
if: ${{ inputs.cache == 'true' }}
with:
path: ${{ steps.set-dest.outputs.path }}/${{ steps.resolve.outputs.toolchain-path }}
path: ${{ steps.resolve.outputs.toolchain-path }}
key: qt-toolchain-${{ steps.resolve.outputs.taskid }}
enableCrossOsArchive: true

- name: Install Qt toolchain
if: ${{ inputs.cache != 'true' || steps.qt-toolchain-cache.outputs.cache-hit != 'true' }}
id: qt-toolchain-install
working-directory: ${{ steps.set-dest.outputs.path }}
working-directory: ${{ runner.temp }}
shell: bash
env:
QT6_TOOLCHAIN_URL: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/${{ steps.resolve.outputs.taskid }}/artifacts/${{ steps.resolve.outputs.filename }}
run: |
FILENAME=$(basename "${QT6_TOOLCHAIN_URL}")
curl -sSL "${QT6_TOOLCHAIN_URL}" -o ${FILENAME}
tar -xf ${FILENAME}

- name: Get CMake prefix path
if: ${{ inputs.cmake-env == 'true' }}
id: get-cmake-path
working-directory: ${{ steps.set-dest.outputs.path }}/${{ steps.resolve.outputs.toolchain-path }}
shell: bash
run: echo "cmake-prefix-path=$(pwd)/lib/cmake" >> $GITHUB_OUTPUT
tar -C ${GITHUB_WORKSPACE}/3rdparty/ -xf ${FILENAME}

- name: Save Qt toolchain
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
if: ${{ inputs.cache == 'true' && github.event_name == 'push' && steps.qt-toolchain-cache.outputs.cache-hit != 'true'}}
with:
path: ${{ steps.set-dest.outputs.path }}/${{ steps.resolve.outputs.toolchain-path }}
path: ${{ steps.resolve.outputs.toolchain-path }}
key: qt-toolchain-${{ steps.resolve.outputs.taskid }}
enableCrossOsArchive: true
10 changes: 8 additions & 2 deletions .github/workflows/linux_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ jobs:
persist-credentials: false
- run: |
sudo apt-get update
sudo apt-get install -y $(./scripts/linux/getdeps.py -a linux/debian/control) ccache
sudo apt-get install -y $(./scripts/linux/getdeps.py --build --no-qt) ccache

- name: Setup Qt for Linux
id: setup-qt
uses: ./.github/actions/qt-setup-taskcluster

- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
Expand All @@ -60,6 +64,8 @@ jobs:

- name: Compile test client
shell: bash
env:
CMAKE_PREFIX_PATH: ${{ steps.setup-qt.outputs.path }}/lib/cmake
run: |
mkdir -p build-${{ runner.os }}
cmake -S $(pwd) -B build-${{ runner.os }} -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \
Expand Down Expand Up @@ -122,7 +128,7 @@ jobs:
- name: Install test dependecies
run: |
sudo apt-get update
sudo apt-get install -y $(./scripts/linux/getdeps.py -r linux/debian/control)
sudo apt-get install -y $(./scripts/linux/getdeps.py --runtime --no-qt)
sudo apt install --no-upgrade firefox xvfb -y
chmod +x build-${{ runner.os }}/src/mozillavpn

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/macos_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,18 @@ jobs:
- name: Setup Qt for macOS
id: setup-qt
uses: ./.github/actions/qt-setup-taskcluster
with:
toolchain-alias: qt-macos-6.10

- name: Setup Qt host tools
uses: ./.github/actions/qt-setup-taskcluster
with:
toolchain-alias: qt-tools-6.10
cmake-env: false

- name: Compile test client
env:
SDKROOT: ${{ steps.set-sdkroot.outputs.SDKROOT }}
CMAKE_PREFIX_PATH: ${{ steps.setup-qt.outputs.cmake-prefix-path }}
CMAKE_PREFIX_PATH: ${{ steps.setup-qt.outputs.path }}/lib/cmake
run: |
mkdir -p build/cmake
cmake -S $(pwd) -B build/cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/test_unit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ jobs:
- name: Install dependences
run: |
sudo apt-get update
sudo apt-get install -y $(./scripts/linux/getdeps.py -a linux/debian/control)
sudo apt-get install -y $(./scripts/linux/getdeps.py --all --no-qt)

- name: Setup Qt for Linux
id: setup-qt
uses: ./.github/actions/qt-setup-taskcluster

- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
Expand All @@ -39,6 +43,8 @@ jobs:

- name: Building tests
shell: bash
env:
CMAKE_PREFIX_PATH: ${{ steps.setup-qt.outputs.path }}/lib/cmake
run: |
mkdir -p build
cmake -S $(pwd) -B build -GNinja
Expand Down Expand Up @@ -83,7 +89,7 @@ jobs:

- name: Building tests
env:
CMAKE_PREFIX_PATH: ${{ steps.setup-qt.outputs.cmake-prefix-path }}
CMAKE_PREFIX_PATH: ${{ steps.setup-qt.outputs.path }}/lib/cmake
run: |
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
mkdir -p build
Expand Down Expand Up @@ -149,7 +155,7 @@ jobs:
env:
CC: ${{ steps.set-compiler.outputs.CC }}
CXX: ${{ steps.set-compiler.outputs.CXX }}
CMAKE_PREFIX_PATH: ${{ steps.setup-qt-win.outputs.cmake-prefix-path }}
CMAKE_PREFIX_PATH: ${{ steps.setup-qt-win.outputs.path }}/lib/cmake
run: |
mkdir ./build-win

Expand Down
13 changes: 5 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ find_package(Qt6 REQUIRED COMPONENTS
Xml
Svg
)
include("scripts/cmake/check_qt_breakage.cmake")
if(Qt6_VERSION VERSION_LESS 6.9.0)
message(FATAL_ERROR "Qt 6.9.0 or higher is required. You are building with version ${Qt6_VERSION}")
endif()

if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten" AND
NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Android")
Expand All @@ -161,13 +163,8 @@ if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten" AND
)
endif()

if(QT_KNOWN_POLICY_QTP0001)
qt_policy(SET QTP0001 NEW)
endif()

if(QT_KNOWN_POLICY_QTP0004)
qt_policy(SET QTP0004 OLD)
endif()
qt_policy(SET QTP0001 NEW)
qt_policy(SET QTP0004 OLD)

message("Using Qt version ${Qt6_VERSION}")
add_definitions(-DQT_DEPRECATED_WARNINGS)
Expand Down
24 changes: 23 additions & 1 deletion linux/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,38 @@ Build-Depends: debhelper (>= 13),
python3-yaml:native,
python3-jinja2:native,
python3-click:native,
libdbus-1-dev,
libgcrypt20-dev,
libgl-dev,
libgles-dev,
libfontconfig1-dev,
libfreetype6-dev,
libopengl-dev (>= 1.3.0~),
libpolkit-gobject-1-dev,
libqt6core5compat6-dev (>=6.2.0~),
libqt6networkauth6-dev (>=6.2.0~),
libqt6opengl6-dev (>=6.2.0~),
libqt6svg6-dev (>=6.2.0~),
libx11-dev,
libx11-xcb-dev,
libxcb1-dev,
libxcb-cursor-dev,
libxcb-glx0-dev,
libxcb-keysyms1-dev,
libxcb-image0-dev,
libxcb-shm0-dev,
libxcb-icccm4-dev,
libxcb-sync-dev,
libxcb-xfixes0-dev,
libxcb-shape0-dev,
libxcb-randr0-dev,
libxcb-render-util0-dev,
libxcb-util-dev,
libxcb-xinerama0-dev,
libxcb-xkb-dev,
libxkbcommon-dev,
libxkbcommon-x11-dev,
libwayland-dev,
ninja-build,
qmake6 (>=6.2.0~),
qt6-base-dev (>=6.2.0~),
Expand All @@ -41,7 +64,6 @@ Vcs-Git: https://github.com/mozilla-mobile/mozilla-vpn-client
Package: mozillavpn
Architecture: any
Depends: wireguard (>=1.0.20200319),
wireguard-tools (>=1.0.20200319),
libfreetype6,
libfontconfig1,
libegl1,
Expand Down
26 changes: 0 additions & 26 deletions scripts/cmake/check_qt_breakage.cmake

This file was deleted.

18 changes: 16 additions & 2 deletions scripts/linux/getdeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
help='List packages from the Depends paragraph')
parser.add_argument('-a', '--all', action='store_true',
help='List all packages dependencies')
parser.add_argument('-n', '--no-qt', action='store_true',
help='Ignore Qt package dependencies')
args = parser.parse_args()

## If no control file was provided, assume control.qt6 from the source checkout.
Expand All @@ -32,9 +34,21 @@
# Parse the control file to dump the package dependencies.
def dump(depends):
for dep in depends.split(','):
if dep.startswith('$'):
pkg = dep.split()[0]
if pkg.startswith('$'):
continue
print(dep.split()[0])

if args.no_qt:
if pkg.startswith('qml6'):
continue
if pkg.startswith('qt6'):
continue
if pkg.startswith('libqt6'):
continue
if pkg.startswith('qmake'):
continue

print(pkg)

for p in Deb822.iter_paragraphs(open(args.control)):
for item in p.items():
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ mz_target_handle_warnings(mozillavpn)

find_package(Qt6 REQUIRED COMPONENTS Svg)
if(Qt6_VERSION VERSION_GREATER_EQUAL 6.10.0)
set(QT_NO_PRIVATE_MODULE_WARNING ON)
Comment thread
mcleinman marked this conversation as resolved.
find_package(Qt6 REQUIRED COMPONENTS GuiPrivate QmlPrivate)
endif()

Expand Down
8 changes: 3 additions & 5 deletions src/cmake/android.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,10 @@ set_property(TARGET mozillavpn PROPERTY QT_ANDROID_EXTRA_LIBS
APPEND)


if( ${Qt6_VERSION} VERSION_GREATER_EQUAL 6.4.0)
set_property(TARGET mozillavpn PROPERTY QT_ANDROID_EXTRA_LIBS
set_property(TARGET mozillavpn APPEND PROPERTY
QT_ANDROID_EXTRA_LIBS
${OPENSSL_LIBS_DIR}/libcrypto_3.so
${OPENSSL_LIBS_DIR}/libssl_3.so
APPEND)
Comment thread
mcleinman marked this conversation as resolved.
endif()
${OPENSSL_LIBS_DIR}/libssl_3.so)

option(MZ_ANDROID_FOSS_BUILD "Build apk without google play services" OFF)

Expand Down
12 changes: 5 additions & 7 deletions src/cmake/linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,23 @@ target_sources(mozillavpn PRIVATE
)

# Resolving the parent window handle for the XDG desktop portal on Wayland
# needs the Gui internal header files on Qt 6.5.0 and later. Otherwise it
# only works for X11.
if(Qt6_VERSION VERSION_GREATER_EQUAL 6.5.0)
target_link_libraries(mozillavpn PRIVATE Qt6::GuiPrivate)
endif()
# needs the Gui internal header files on Qt 6.5.0 and later.
target_link_libraries(mozillavpn PRIVATE Qt6::GuiPrivate)

if(NOT BUILD_FLATPAK)
# Link to polkit
find_package(PkgConfig REQUIRED)
pkg_check_modules(polkit REQUIRED IMPORTED_TARGET polkit-gobject-1)
target_link_libraries(mozillavpn PRIVATE PkgConfig::polkit)

if (QT_FEATURE_static)
find_package(Qt6 REQUIRED COMPONENTS WaylandClientPrivate)
qt_import_plugins(mozillavpn INCLUDE Qt6::QWaylandIntegrationPlugin)
qt_import_plugins(mozillavpn INCLUDE Qt6::QWaylandAdwaitaDecorationPlugin)
target_link_libraries(mozillavpn PRIVATE Qt6::WaylandClientPrivate)
endif()

target_link_libraries(mozillavpn PRIVATE PkgConfig::polkit)
qt_import_plugins(mozillavpn INCLUDE Qt6::QOffscreenIntegrationPlugin)
Comment thread
mcleinman marked this conversation as resolved.
endif()

target_sources(mozillavpn PRIVATE
${CMAKE_SOURCE_DIR}/src/platforms/linux/linuxcontroller.cpp
Expand Down
11 changes: 0 additions & 11 deletions src/commands/commandui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,6 @@ int CommandUI::run(QStringList& tokens) {
vpn->initialize();
logger.debug() << "VPN initialized";

// Prior to Qt 6.5, there was no default QML import path. We must set one.
#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0)
engine->addImportPath("qrc:/");
engine->addImportPath("qrc:/qt/qml");
logger.debug() << "Added QML import paths";
#endif
QQuickImageProvider* provider = ImageProviderFactory::create(qApp);
if (provider) {
engine->addImageProvider(QString("app"), provider);
Expand All @@ -268,13 +262,8 @@ int CommandUI::run(QStringList& tokens) {
I18nStrings::instance());
logger.debug() << "Registered I18nStrings";

#if MZ_IOS && QT_VERSION < 0x060300
QObject::connect(qApp, &QCoreApplication::aboutToQuit, vpn,
&MozillaVPN::quit);
#else
QObject::connect(qApp, &QCoreApplication::aboutToQuit, vpn,
[] { MozillaVPN::instance()->aboutToQuit(); });
#endif

QObject::connect(
qApp, &QGuiApplication::commitDataRequest, vpn,
Expand Down
Loading
Loading