[GH-ISSUE #3162] Make 3rd-party dependencies optional to allow using system libraries #1465

Open
opened 2026-10-13 20:42:59 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @blshkv on GitHub (Sep 13, 2026).
Original GitHub issue: https://github.com/amnezia-vpn/amnezia-client/issues/3162

Problem

The build system unconditionally bundles several 3rd-party libraries (qtkeychain, libssh) and builds them from the vendored sources in client/3rd/. This makes it impossible for Linux distributions to use system-provided versions, which:

  • duplicates libraries already installed on the system
  • prevents security updates from reaching the bundled copies
  • complicates packaging for distributions that have policies against vendored dependencies (Gentoo, Fedora, Debian, etc.)

Suggestion

Add CMake options (e.g. USE_SYSTEM_QTKEYCHAIN, USE_SYSTEM_LIBSSH, or a single USE_SYSTEM_LIBS) that, when enabled, replace the bundled copies with find_package() calls to locate the system-installed versions.

This is the standard approach used by many Qt-based projects and would not affect the default build behavior (bundled remains the default).

Example

For qtkeychain, the switch would be:

if(USE_SYSTEM_QTKEYCHAIN)
    find_package(Qt6Keychain REQUIRED)
    set(LIBS ${LIBS} Qt6Keychain::Qt6Keychain)
else()
    add_subdirectory(${CLIENT_ROOT_DIR}/3rd/qtkeychain ...)
    set(LIBS ${LIBS} qt6keychain)
endif()

This is already how it works in practice when patched for distribution packaging.

Originally created by @blshkv on GitHub (Sep 13, 2026). Original GitHub issue: https://github.com/amnezia-vpn/amnezia-client/issues/3162 ## Problem The build system unconditionally bundles several 3rd-party libraries (qtkeychain, libssh) and builds them from the vendored sources in `client/3rd/`. This makes it impossible for Linux distributions to use system-provided versions, which: - duplicates libraries already installed on the system - prevents security updates from reaching the bundled copies - complicates packaging for distributions that have policies against vendored dependencies (Gentoo, Fedora, Debian, etc.) ## Suggestion Add CMake options (e.g. `USE_SYSTEM_QTKEYCHAIN`, `USE_SYSTEM_LIBSSH`, or a single `USE_SYSTEM_LIBS`) that, when enabled, replace the bundled copies with `find_package()` calls to locate the system-installed versions. This is the standard approach used by many Qt-based projects and would not affect the default build behavior (bundled remains the default). ## Example For qtkeychain, the switch would be: ```cmake if(USE_SYSTEM_QTKEYCHAIN) find_package(Qt6Keychain REQUIRED) set(LIBS ${LIBS} Qt6Keychain::Qt6Keychain) else() add_subdirectory(${CLIENT_ROOT_DIR}/3rd/qtkeychain ...) set(LIBS ${LIBS} qt6keychain) endif() ``` This is already how it works in practice when patched for distribution packaging.
Author
Owner

@blshkv commented on GitHub (Sep 13, 2026):

Note: this was previously submitted as PR #2733, which was accidentally deleted.

<!-- gh-comment-id:5651701812 --> @blshkv commented on GitHub (Sep 13, 2026): Note: this was previously submitted as PR #2733, which was accidentally deleted.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amnezia-client#1465
No description provided.