Skip to content

Commit 6d141d4

Browse files
committed
Refactor: Move to simple default builds
* Remove individual feature flags in favor of a single `KPXC_MINIMAL` flag that removes advanced features from the build. Basic features are no longer guarded by feature flags. * Basic features: Auto-Type, Yubikey, KeeShare * Advanced features include: Browser (and passkeys), SSH Agent, and Secret Service * Networking, Documentation, and Update Checking remain as feature flags to accommodate various distro requirements. This change also cleans up the main CMakeLists.txt by re-arranging some content and placing macros into a dedicated include file. The minimum CMake version was bumped to 3.16.0 to conform to our minimum Ubuntu support of Focal (20.04). This also allows us to default to C++20, we fall back to C++17 for Qt versions less than 5.15.0 due to lack of support. Lastly this change removes the KEEPASSXC_BUILD_TYPE="PreRelease" which is never used. We only support "Snapshot" and "Release" now.
1 parent f53c7e5 commit 6d141d4

File tree

76 files changed

+703
-1123
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+703
-1123
lines changed

CMakeLists.txt

Lines changed: 186 additions & 289 deletions
Large diffs are not rendered by default.

INSTALL.md

Lines changed: 31 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
Build and Install KeePassXC
2-
=================
1+
# Build and Install KeePassXC
32

43
This document will guide you through the steps to build and install KeePassXC from source.
54
For more information, see also the [_Building KeePassXC_](https://github.com/keepassxreboot/keepassxc/wiki/Building-KeePassXC) page on the wiki.
65

76
The [QuickStart Guide](https://keepassxc.org/docs/KeePassXC_GettingStarted.html) gets you started using KeePassXC on your Windows, macOS, or Linux computer using pre-compiled binaries from the [downloads page](https://keepassxc.org/download).
87

9-
Toolchain and Build Dependencies
10-
================================
8+
## Toolchain and Build Dependencies
119

1210
The following build tools must exist within your PATH:
1311

14-
* cmake (>= 3.10.0)
12+
* cmake (>= 3.16.0)
1513
* make (>= 4.2) or ninja (>= 1.10)
16-
* g++ (>= 4.9) or clang++ (>= 6.0)
14+
* g++ (>= 9.3.0) or clang++ (>= 10.0)
1715
* asciidoctor (>= 2.0)
1816

1917
* Besides a working C++ toolchain, KeePassXC also has a number of direct build and runtime dependencies. For detailed information about how to install them, please refer to the GitHub wiki:
@@ -22,8 +20,8 @@ The following build tools must exist within your PATH:
2220
* [Set up Build Environment on Windows](https://github.com/keepassxreboot/keepassxc/wiki/Set-up-Build-Environment-on-Windows)
2321
* [Set up Build Environment on macOS](https://github.com/keepassxreboot/keepassxc/wiki/Set-up-Build-Environment-on-macOS)
2422

25-
Build Steps
26-
===========
23+
## Build Steps
24+
2725
We recommend using the release tool to perform builds, please read up-to-date instructions [on our wiki](https://github.com/keepassxreboot/keepassxc/wiki/Building-KeePassXC#building-using-the-release-tool).
2826

2927
To compile from source, open a **Terminal (Linux/MacOS)**, the **MSVC Tools Command Prompt (Windows)**, or **MSYS2-MinGW shell (Windows)**. For code development on Windows, you can use Visual Studio 2022, Visual Studio Code, or CLion.
@@ -55,10 +53,10 @@ To compile from source, open a **Terminal (Linux/MacOS)**, the **MSVC Tools Comm
5553
```
5654
mkdir build
5755
cd build
58-
cmake -DWITH_XC_ALL=ON ..
56+
cmake ..
5957
make
6058
```
61-
59+
6260
If you have `vcpkg` installed, add `-DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake` to the `cmake` command to automatically download and install all required build and runtime dependencies locally to your build directory before compiling KeePassXC. Using `vcpkg` is the preferred way to install dependencies on macOS and required on Windows if using the MSVC toolchain.
6361

6462
For more detailed build instructions for each platform, please refer to the [GitHub wiki](https://github.com/keepassxreboot/keepassxc/wiki/Building-KeePassXC).
@@ -77,58 +75,47 @@ When building with ASAN support on macOS, you need to use `export ASAN_OPTIONS=d
7775

7876
If you are using MSYS2, you have to add ```-G "MSYS Makefiles"``` at the beginning of the cmake command.
7977

80-
CMake Configuration Options
81-
==========================
82-
83-
## Recommended CMake Build Parameters
84-
85-
```
86-
-DCMAKE_VERBOSE_MAKEFILE=ON
87-
-DCMAKE_BUILD_TYPE=<RelWithDebInfo/Debug/Release>
88-
-DWITH_GUI_TESTS=ON
89-
```
90-
9178
## Additional CMake Parameters
9279

93-
KeePassXC comes with a variety of build options that can turn on/off features. Most notably, we allow you to build the application with all TCP/IP networking code disabled. Please note that we still require and link against Qt5's network library in order to use local named pipes on all operating systems. Each of these build options are supplied at the time of calling cmake:
80+
KeePassXC comes with a variety of build options that can turn on/off features. Each of these build options are supplied at the time of calling cmake:
9481

9582
```
96-
-DWITH_XC_AUTOTYPE=[ON|OFF] Enable/Disable Auto-Type (default: ON)
97-
-DWITH_XC_YUBIKEY=[ON|OFF] Enable/Disable YubiKey HMAC-SHA1 authentication support (default: OFF)
98-
-DWITH_XC_BROWSER=[ON|OFF] Enable/Disable KeePassXC-Browser extension support (default: OFF)
99-
-DWITH_XC_BROWSER_PASSKEYS=[ON|OFF] Enable/Disable Passkeys support for browser integration (default: OFF)
100-
-DWITH_XC_NETWORKING=[ON|OFF] Enable/Disable Networking support (e.g., favicon downloading) (default: OFF)
101-
-DWITH_XC_SSHAGENT=[ON|OFF] Enable/Disable SSHAgent support (default: OFF)
102-
-DWITH_XC_FDOSECRETS=[ON|OFF] (Linux Only) Enable/Disable Freedesktop.org Secrets Service support (default:OFF)
103-
-DWITH_XC_KEESHARE=[ON|OFF] Enable/Disable KeeShare group synchronization extension (default: OFF)
104-
-DWITH_XC_ALL=[ON|OFF] Enable/Disable compiling all plugins above (default: OFF)
105-
106-
-DWITH_XC_UPDATECHECK=[ON|OFF] Enable/Disable automatic updating checking (requires WITH_XC_NETWORKING) (default: ON)
83+
-DKPXC_MINIMAL=[ON|OFF] Build KeePassXC with the minimal feature set required for basic usage (default: OFF)
84+
-DKPXC_FEATURE_BROWSER=[ON|OFF] Browser integration and passkeys support (default: ON)
85+
-DKPXC_FEATURE_SSHAGENT=[ON|OFF] SSH Agent integration (default: ON)
86+
-DKPXC_FEATURE_FDOSECRETS=[ON|OFF] (Linux Only) freedesktop.org Secret Service integration; replace system keyring (default:ON)
87+
88+
-DKPXC_FEATURE_NETWORK=[ON|OFF] Include code that reaches out to external networks (e.g. downloading icons) (default: ON)
89+
-DKPXC_FEATURE_UPDATES=[ON|OFF] Include automatic update checks; disable for managed distributions (requires networking) (default: ON)
90+
-DKPXC_FEATURE_DOCS=[ON|OFF] Build offline documentation; requires asciidoctor tool (default: ON)
10791
10892
-DWITH_TESTS=[ON|OFF] Enable/Disable building of unit tests (default: ON)
10993
-DWITH_GUI_TESTS=[ON|OFF] Enable/Disable building of GUI tests (default: OFF)
110-
-DWITH_DEV_BUILD=[ON|OFF] Enable/Disable deprecated method warnings (default: OFF)
94+
-DWITH_WARN_DEPRECATED=[ON|OFF] Development only: warn about deprecated methods, including Qt. (default: OFF)
11195
-DWITH_ASAN=[ON|OFF] Enable/Disable address sanitizer checks (Linux / macOS only) (default: OFF)
11296
-DWITH_COVERAGE=[ON|OFF] Enable/Disable coverage tests (GCC only) (default: OFF)
11397
-DWITH_APP_BUNDLE=[ON|OFF] Enable Application Bundle for macOS (default: ON)
98+
-DWITH_CCACHE=[ON|OFF] Use ccache for build speed optimization (default: OFF)
99+
-DWITH_X11=[ON|OFF] Enable building with X11 dependencies (default: ON)
114100
115-
-DKEEPASSXC_BUILD_TYPE=[Snapshot|PreRelease|Release] Set the build type to show/hide stability warnings (default: "Snapshot")
116-
-DKEEPASSXC_DIST_TYPE=[Snap|AppImage|Other] Specify the distribution method (default: "Other")
101+
-DKEEPASSXC_BUILD_TYPE=[Snapshot|Release] Set the build type to show/hide stability warnings (default: "Snapshot")
102+
-DKEEPASSXC_DIST_TYPE=[Snap|AppImage|Flatpak|Native] Specify the distribution method (default: "Native")
117103
-DOVERRIDE_VERSION=[X.X.X] Specify a version number when building. Used with snapshot builds (default: "")
118104
-DGIT_HEAD_OVERRIDE=[XXXXXXX] Specify the 7 digit git commit ref for this build. Used with distribution builds (default: "")
119105
```
120106

121-
Installation
122-
============
107+
Note: Even though you can build the application with all TCP/IP networking code disabled, we still require and link against
108+
Qt5's network library to use local named pipes on all operating systems.
109+
110+
## Installation
123111

124112
After you have successfully built KeePassXC, install the binary by executing the following:
125113

126114
```
127115
sudo make install
128116
```
129117

130-
Packaging
131-
=========
118+
## Packaging
132119

133120
You can create a package to redistribute KeePassXC (zip, deb, rpm, dmg, etc..). Refer to [keepassxc-packaging](https://github.com/keepassxreboot/keepassxc-packaging) for packaging scripts.
134121

@@ -138,21 +125,23 @@ To package using CMake, run the following command using whichever [generators](h
138125
cpack -G "ZIP;WIX"
139126
```
140127

141-
Testing
142-
=======
128+
## Testing
143129

144130
You can perform tests on the built executables with:
131+
145132
```
146133
make test ARGS+="--output-on-failure"
147134
```
148135

149136
On Linux, if you are not currently running on an X Server or Wayland, run the tests as follows:
137+
150138
```
151139
make test ARGS+="-E test\(cli\|gui\) --output-on-failure"
152140
xvfb-run -e errors -a --server-args="-screen 0 1024x768x24" make test ARGS+="-R test\(cli\|gui\) --output-on-failure"
153141
```
154142

155143
Common parameters:
144+
156145
```
157146
CTEST_OUTPUT_ON_FAILURE=1
158147
ARGS+=-jX

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# <img src="https://keepassxc.org/assets/img/keepassxc.svg" width="40" height="40"/> KeePassXC
2+
23
[![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/6326/badge)](https://bestpractices.coreinfrastructure.org/projects/6326)
34
[![TeamCity Build Status](https://ci.keepassxc.org/app/rest/builds/buildType:\(project:KeepassXC\)/statusIcon)](https://ci.keepassxc.org/?guest=1)
45
[![codecov](https://codecov.io/gh/keepassxreboot/keepassxc/branch/develop/graph/badge.svg)](https://codecov.io/gh/keepassxreboot/keepassxc)
@@ -10,16 +11,22 @@
1011
[KeePassXC](https://keepassxc.org) is a modern, secure, and open-source password manager that stores and manages your most sensitive information. You can run KeePassXC on Windows, macOS, and Linux systems. KeePassXC is for people with extremely high demands of secure personal data management. It saves many different types of information, such as usernames, passwords, URLs, attachments, and notes in an offline, encrypted file that can be stored in any location, including private and public cloud solutions. For easy identification and management, user-defined titles and icons can be specified for entries. In addition, entries are sorted into customizable groups. An integrated search function allows you to use advanced patterns to easily find any entry in your database. A customizable, fast, and easy-to-use password generator utility allows you to create passwords with any combination of characters or easy to remember passphrases.
1112

1213
## Quick Start
14+
1315
The [QuickStart Guide](https://keepassxc.org/docs/KeePassXC_GettingStarted.html) gets you started using KeePassXC on your Windows, macOS, or Linux computer using pre-compiled binaries from the [downloads page](https://keepassxc.org/download). Additionally, individual Linux distributions may ship their own versions, so please check your distribution's package list to see if KeePassXC is available. Detailed documentation is available in the [User Guide](https://keepassxc.org/docs/KeePassXC_UserGuide.html).
1416

1517
## Features List
18+
1619
KeePassXC has numerous features for novice and power users alike. Our goal is to create an application that can be used by anyone while still offering advanced features to those that need them.
1720

18-
### Basic
21+
### Core Features
22+
1923
* Create, open, and save databases in the KDBX format (KeePass-compatible with KDBX4 and KDBX3)
24+
* All information is encrypted at rest and never exposed outside the program
2025
* Store sensitive information in entries that are organized by groups
21-
* Search for entries
2226
* Password generator
27+
* Search for entries
28+
* TOTP storage and generation
29+
* YubiKey/OnlyKey challenge-response support
2330
* Auto-Type passwords into applications
2431
* Browser integration with Google Chrome, Mozilla Firefox, Microsoft Edge, Chromium, Vivaldi, Brave, and Tor-Browser
2532
* Support for passkeys using the browser integration
@@ -33,10 +40,7 @@ KeePassXC has numerous features for novice and power users alike. Our goal is to
3340
* Field references between entries
3441
* File attachments and custom attributes
3542
* Entry history and data restoration
36-
* YubiKey/OnlyKey challenge-response support
3743
* Command line interface (keepassxc-cli)
38-
* Auto-Open databases
39-
* KeeShare shared databases (import, export, and synchronize)
4044
* SSH Agent integration
4145
* FreeDesktop.org Secret Service (replace Gnome keyring, etc.)
4246
* Additional encryption choices: Twofish and ChaCha20

cmake/CompilerFlags.cmake

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Copyright (C) 2024 KeePassXC Team <[email protected]>
2+
#
3+
# This program is free software: you can redistribute it and/or modify
4+
# it under the terms of the GNU General Public License as published by
5+
# the Free Software Foundation, either version 2 or (at your option)
6+
# version 3 of the License.
7+
#
8+
# This program is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
# GNU General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU General Public License
14+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
16+
macro(add_gcc_compiler_cxxflags FLAGS)
17+
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
18+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}")
19+
endif()
20+
endmacro()
21+
22+
macro(add_gcc_compiler_cflags FLAGS)
23+
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
24+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS}")
25+
endif()
26+
endmacro()
27+
28+
macro(add_gcc_compiler_flags FLAGS)
29+
add_gcc_compiler_cxxflags("${FLAGS}")
30+
add_gcc_compiler_cflags("${FLAGS}")
31+
endmacro()
32+
33+
# Copies of above macros that first ensure the compiler understands a given flag
34+
# Because check_*_compiler_flag() sets -D with name, need to provide "safe" FLAGNAME
35+
macro(check_add_gcc_compiler_cxxflag FLAG FLAGNAME)
36+
check_cxx_compiler_flag("${FLAG}" CXX_HAS${FLAGNAME})
37+
if(CXX_HAS${FLAGNAME})
38+
add_gcc_compiler_cxxflags("${FLAG}")
39+
endif()
40+
endmacro()
41+
42+
macro(check_add_gcc_compiler_cflag FLAG FLAGNAME)
43+
check_c_compiler_flag("${FLAG}" CC_HAS${FLAGNAME})
44+
if(CC_HAS${FLAGNAME})
45+
add_gcc_compiler_cflags("${FLAG}")
46+
endif()
47+
endmacro()
48+
49+
# This is the "front-end" for the above macros
50+
# Optionally takes additional parameter(s) with language to check (currently "C" or "CXX")
51+
macro(check_add_gcc_compiler_flag FLAG)
52+
string(REGEX REPLACE "[-=]" "_" FLAGNAME "${FLAG}")
53+
set(check_lang_spec ${ARGN})
54+
list(LENGTH check_lang_spec num_extra_args)
55+
set(langs C CXX)
56+
if(num_extra_args GREATER 0)
57+
set(langs "${check_lang_spec}")
58+
endif()
59+
if("C" IN_LIST langs)
60+
check_add_gcc_compiler_cflag("${FLAG}" "${FLAGNAME}")
61+
endif()
62+
if("CXX" IN_LIST langs)
63+
check_add_gcc_compiler_cxxflag("${FLAG}" "${FLAGNAME}")
64+
endif()
65+
endmacro()
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <sys/ptrace.h>
2+
#include <sys/types.h>
3+
4+
int main()
5+
{
6+
ptrace(PT_DENY_ATTACH, 0, 0, 0);
7+
return 0;
8+
}

release-tool

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ CMAKE_OPTIONS=""
4747
CPACK_GENERATORS="WIX;ZIP"
4848
COMPILER="g++"
4949
MAKE_OPTIONS="-j$(getconf _NPROCESSORS_ONLN)"
50-
BUILD_PLUGINS="all"
5150
INSTALL_PREFIX="/usr/local"
5251
ORIG_BRANCH=""
5352
ORIG_CWD="$(pwd)"
@@ -132,8 +131,6 @@ Options:
132131
-m, --make-options Make options for compiling sources (default: '${MAKE_OPTIONS}')
133132
-g, --generators Additional CPack generators (default: '${CPACK_GENERATORS}')
134133
-i, --install-prefix Install prefix (default: '${INSTALL_PREFIX}')
135-
-p, --plugins Space-separated list of plugins to build
136-
(default: ${BUILD_PLUGINS})
137134
--snapshot Don't checkout the release tag
138135
-n, --no-source-tarball Don't build source tarball
139136
-h, --help Show this help
@@ -829,10 +826,6 @@ build() {
829826
INSTALL_PREFIX="$2"
830827
shift ;;
831828

832-
-p|--plugins)
833-
BUILD_PLUGINS="$2"
834-
shift ;;
835-
836829
-n|--no-source-tarball)
837830
build_source_tarball=false ;;
838831

@@ -870,13 +863,9 @@ build() {
870863
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DKEEPASSXC_BUILD_TYPE=Snapshot -DOVERRIDE_VERSION=${RELEASE_NAME}"
871864
else
872865
checkWorkingTreeClean
873-
if echo "$TAG_NAME" | grep -qE '\-(alpha|beta)[0-9]+$'; then
874-
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DKEEPASSXC_BUILD_TYPE=PreRelease"
875-
logInfo "Checking out pre-release tag '${TAG_NAME}'..."
876-
else
877-
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DKEEPASSXC_BUILD_TYPE=Release"
878-
logInfo "Checking out release tag '${TAG_NAME}'..."
879-
fi
866+
867+
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DKEEPASSXC_BUILD_TYPE=Release"
868+
logInfo "Checking out release tag '${TAG_NAME}'..."
880869

881870
if ! git checkout "$TAG_NAME" > /dev/null 2>&1; then
882871
exitError "Failed to check out target branch."
@@ -922,9 +911,6 @@ build() {
922911
cd "${OUTPUT_DIR}/build-release"
923912

924913
logInfo "Configuring sources..."
925-
for p in ${BUILD_PLUGINS}; do
926-
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DWITH_XC_$(echo $p | tr '[:lower:]' '[:upper:]')=On"
927-
done
928914
if [ -n "$OS_LINUX" ] && ${build_appimage}; then
929915
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DKEEPASSXC_DIST_TYPE=AppImage"
930916
# linuxdeploy requires /usr as install prefix

0 commit comments

Comments
 (0)