-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Refactor: move to simple default builds #11003
Open
droidmonkey
wants to merge
3
commits into
develop
Choose a base branch
from
refactor/simple-default-build
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+688
−1,153
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,19 +1,17 @@ | ||||||||||||||||
Build and Install KeePassXC | ||||||||||||||||
================= | ||||||||||||||||
# Build and Install KeePassXC | ||||||||||||||||
|
||||||||||||||||
This document will guide you through the steps to build and install KeePassXC from source. | ||||||||||||||||
For more information, see also the [_Building KeePassXC_](https://github.com/keepassxreboot/keepassxc/wiki/Building-KeePassXC) page on the wiki. | ||||||||||||||||
|
||||||||||||||||
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). | ||||||||||||||||
|
||||||||||||||||
Toolchain and Build Dependencies | ||||||||||||||||
================================ | ||||||||||||||||
## Toolchain and Build Dependencies | ||||||||||||||||
|
||||||||||||||||
The following build tools must exist within your PATH: | ||||||||||||||||
|
||||||||||||||||
* cmake (>= 3.10.0) | ||||||||||||||||
* cmake (>= 3.16.0) | ||||||||||||||||
* make (>= 4.2) or ninja (>= 1.10) | ||||||||||||||||
* g++ (>= 4.9) or clang++ (>= 6.0) | ||||||||||||||||
* g++ (>= 9.3.0) or clang++ (>= 10.0) | ||||||||||||||||
* asciidoctor (>= 2.0) | ||||||||||||||||
|
||||||||||||||||
* 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: | |||||||||||||||
* [Set up Build Environment on Windows](https://github.com/keepassxreboot/keepassxc/wiki/Set-up-Build-Environment-on-Windows) | ||||||||||||||||
* [Set up Build Environment on macOS](https://github.com/keepassxreboot/keepassxc/wiki/Set-up-Build-Environment-on-macOS) | ||||||||||||||||
|
||||||||||||||||
Build Steps | ||||||||||||||||
=========== | ||||||||||||||||
## Build Steps | ||||||||||||||||
|
||||||||||||||||
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). | ||||||||||||||||
|
||||||||||||||||
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 | |||||||||||||||
``` | ||||||||||||||||
mkdir build | ||||||||||||||||
droidmonkey marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||
cd build | ||||||||||||||||
cmake -DWITH_XC_ALL=ON .. | ||||||||||||||||
cmake .. | ||||||||||||||||
make | ||||||||||||||||
``` | ||||||||||||||||
Comment on lines
54
to
57
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or:
Suggested change
This way it also works with alternative "generators", such as Ninja instead of Make. |
||||||||||||||||
|
||||||||||||||||
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. | ||||||||||||||||
|
||||||||||||||||
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 | |||||||||||||||
|
||||||||||||||||
If you are using MSYS2, you have to add ```-G "MSYS Makefiles"``` at the beginning of the cmake command. | ||||||||||||||||
|
||||||||||||||||
CMake Configuration Options | ||||||||||||||||
========================== | ||||||||||||||||
|
||||||||||||||||
## Recommended CMake Build Parameters | ||||||||||||||||
|
||||||||||||||||
``` | ||||||||||||||||
-DCMAKE_VERBOSE_MAKEFILE=ON | ||||||||||||||||
-DCMAKE_BUILD_TYPE=<RelWithDebInfo/Debug/Release> | ||||||||||||||||
-DWITH_GUI_TESTS=ON | ||||||||||||||||
``` | ||||||||||||||||
|
||||||||||||||||
## Additional CMake Parameters | ||||||||||||||||
|
||||||||||||||||
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: | ||||||||||||||||
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: | ||||||||||||||||
|
||||||||||||||||
``` | ||||||||||||||||
-DWITH_XC_AUTOTYPE=[ON|OFF] Enable/Disable Auto-Type (default: ON) | ||||||||||||||||
-DWITH_XC_YUBIKEY=[ON|OFF] Enable/Disable YubiKey HMAC-SHA1 authentication support (default: OFF) | ||||||||||||||||
-DWITH_XC_BROWSER=[ON|OFF] Enable/Disable KeePassXC-Browser extension support (default: OFF) | ||||||||||||||||
-DWITH_XC_BROWSER_PASSKEYS=[ON|OFF] Enable/Disable Passkeys support for browser integration (default: OFF) | ||||||||||||||||
-DWITH_XC_NETWORKING=[ON|OFF] Enable/Disable Networking support (e.g., favicon downloading) (default: OFF) | ||||||||||||||||
-DWITH_XC_SSHAGENT=[ON|OFF] Enable/Disable SSHAgent support (default: OFF) | ||||||||||||||||
-DWITH_XC_FDOSECRETS=[ON|OFF] (Linux Only) Enable/Disable Freedesktop.org Secrets Service support (default:OFF) | ||||||||||||||||
-DWITH_XC_KEESHARE=[ON|OFF] Enable/Disable KeeShare group synchronization extension (default: OFF) | ||||||||||||||||
-DWITH_XC_ALL=[ON|OFF] Enable/Disable compiling all plugins above (default: OFF) | ||||||||||||||||
|
||||||||||||||||
-DWITH_XC_UPDATECHECK=[ON|OFF] Enable/Disable automatic updating checking (requires WITH_XC_NETWORKING) (default: ON) | ||||||||||||||||
-DKPXC_MINIMAL=[ON|OFF] Build KeePassXC with the minimal feature set required for basic usage (default: OFF) | ||||||||||||||||
-DKPXC_FEATURE_BROWSER=[ON|OFF] Browser integration and passkeys support (default: ON) | ||||||||||||||||
-DKPXC_FEATURE_SSHAGENT=[ON|OFF] SSH Agent integration (default: ON) | ||||||||||||||||
-DKPXC_FEATURE_FDOSECRETS=[ON|OFF] (Linux Only) freedesktop.org Secret Service integration; replace system keyring (default:ON) | ||||||||||||||||
|
||||||||||||||||
-DKPXC_FEATURE_NETWORK=[ON|OFF] Include code that reaches out to external networks (e.g. downloading icons) (default: ON) | ||||||||||||||||
-DKPXC_FEATURE_UPDATES=[ON|OFF] Include automatic update checks; disable for managed distributions (requires networking) (default: ON) | ||||||||||||||||
-DKPXC_FEATURE_DOCS=[ON|OFF] Build offline documentation; requires asciidoctor tool (default: ON) | ||||||||||||||||
|
||||||||||||||||
-DWITH_TESTS=[ON|OFF] Enable/Disable building of unit tests (default: ON) | ||||||||||||||||
-DWITH_GUI_TESTS=[ON|OFF] Enable/Disable building of GUI tests (default: OFF) | ||||||||||||||||
-DWITH_DEV_BUILD=[ON|OFF] Enable/Disable deprecated method warnings (default: OFF) | ||||||||||||||||
-DWITH_WARN_DEPRECATED=[ON|OFF] Development only: warn about deprecated methods, including Qt. (default: OFF) | ||||||||||||||||
-DWITH_ASAN=[ON|OFF] Enable/Disable address sanitizer checks (Linux / macOS only) (default: OFF) | ||||||||||||||||
-DWITH_COVERAGE=[ON|OFF] Enable/Disable coverage tests (GCC only) (default: OFF) | ||||||||||||||||
-DWITH_APP_BUNDLE=[ON|OFF] Enable Application Bundle for macOS (default: ON) | ||||||||||||||||
-DWITH_CCACHE=[ON|OFF] Use ccache for build speed optimization (default: OFF) | ||||||||||||||||
-DWITH_X11=[ON|OFF] Enable building with X11 dependencies (default: ON) | ||||||||||||||||
|
||||||||||||||||
-DKEEPASSXC_BUILD_TYPE=[Snapshot|PreRelease|Release] Set the build type to show/hide stability warnings (default: "Snapshot") | ||||||||||||||||
-DKEEPASSXC_DIST_TYPE=[Snap|AppImage|Other] Specify the distribution method (default: "Other") | ||||||||||||||||
-DKEEPASSXC_BUILD_TYPE=[Snapshot|Release] Set the build type to show/hide stability warnings (default: "Snapshot") | ||||||||||||||||
-DKEEPASSXC_DIST_TYPE=[Snap|AppImage|Flatpak|Native] Specify the distribution method (default: "Native") | ||||||||||||||||
-DOVERRIDE_VERSION=[X.X.X] Specify a version number when building. Used with snapshot builds (default: "") | ||||||||||||||||
-DGIT_HEAD_OVERRIDE=[XXXXXXX] Specify the 7 digit git commit ref for this build. Used with distribution builds (default: "") | ||||||||||||||||
``` | ||||||||||||||||
|
||||||||||||||||
Installation | ||||||||||||||||
============ | ||||||||||||||||
Note: Even though you can build the application with all TCP/IP networking code disabled, we still require and link against | ||||||||||||||||
Qt5's network library to use local named pipes on all operating systems. | ||||||||||||||||
|
||||||||||||||||
## Installation | ||||||||||||||||
|
||||||||||||||||
After you have successfully built KeePassXC, install the binary by executing the following: | ||||||||||||||||
|
||||||||||||||||
``` | ||||||||||||||||
sudo make install | ||||||||||||||||
``` | ||||||||||||||||
|
||||||||||||||||
Packaging | ||||||||||||||||
========= | ||||||||||||||||
## Packaging | ||||||||||||||||
|
||||||||||||||||
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. | ||||||||||||||||
|
||||||||||||||||
|
@@ -138,21 +125,23 @@ To package using CMake, run the following command using whichever [generators](h | |||||||||||||||
cpack -G "ZIP;WIX" | ||||||||||||||||
``` | ||||||||||||||||
|
||||||||||||||||
Testing | ||||||||||||||||
======= | ||||||||||||||||
## Testing | ||||||||||||||||
|
||||||||||||||||
You can perform tests on the built executables with: | ||||||||||||||||
|
||||||||||||||||
``` | ||||||||||||||||
make test ARGS+="--output-on-failure" | ||||||||||||||||
``` | ||||||||||||||||
|
||||||||||||||||
On Linux, if you are not currently running on an X Server or Wayland, run the tests as follows: | ||||||||||||||||
|
||||||||||||||||
``` | ||||||||||||||||
make test ARGS+="-E test\(cli\|gui\) --output-on-failure" | ||||||||||||||||
xvfb-run -e errors -a --server-args="-screen 0 1024x768x24" make test ARGS+="-R test\(cli\|gui\) --output-on-failure" | ||||||||||||||||
``` | ||||||||||||||||
|
||||||||||||||||
Common parameters: | ||||||||||||||||
|
||||||||||||||||
``` | ||||||||||||||||
CTEST_OUTPUT_ON_FAILURE=1 | ||||||||||||||||
ARGS+=-jX | ||||||||||||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Copyright (C) 2024 KeePassXC Team <[email protected]> | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 2 or (at your option) | ||
# version 3 of the License. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
macro(add_gcc_compiler_cxxflags FLAGS) | ||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}") | ||
endif() | ||
endmacro() | ||
|
||
macro(add_gcc_compiler_cflags FLAGS) | ||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS}") | ||
endif() | ||
endmacro() | ||
|
||
macro(add_gcc_compiler_flags FLAGS) | ||
add_gcc_compiler_cxxflags("${FLAGS}") | ||
add_gcc_compiler_cflags("${FLAGS}") | ||
endmacro() | ||
|
||
# Copies of above macros that first ensure the compiler understands a given flag | ||
# Because check_*_compiler_flag() sets -D with name, need to provide "safe" FLAGNAME | ||
macro(check_add_gcc_compiler_cxxflag FLAG FLAGNAME) | ||
check_cxx_compiler_flag("${FLAG}" CXX_HAS${FLAGNAME}) | ||
if(CXX_HAS${FLAGNAME}) | ||
add_gcc_compiler_cxxflags("${FLAG}") | ||
endif() | ||
endmacro() | ||
|
||
macro(check_add_gcc_compiler_cflag FLAG FLAGNAME) | ||
check_c_compiler_flag("${FLAG}" CC_HAS${FLAGNAME}) | ||
if(CC_HAS${FLAGNAME}) | ||
add_gcc_compiler_cflags("${FLAG}") | ||
endif() | ||
endmacro() | ||
|
||
# This is the "front-end" for the above macros | ||
# Optionally takes additional parameter(s) with language to check (currently "C" or "CXX") | ||
macro(check_add_gcc_compiler_flag FLAG) | ||
string(REGEX REPLACE "[-=]" "_" FLAGNAME "${FLAG}") | ||
set(check_lang_spec ${ARGN}) | ||
list(LENGTH check_lang_spec num_extra_args) | ||
set(langs C CXX) | ||
if(num_extra_args GREATER 0) | ||
set(langs "${check_lang_spec}") | ||
endif() | ||
if("C" IN_LIST langs) | ||
check_add_gcc_compiler_cflag("${FLAG}" "${FLAGNAME}") | ||
endif() | ||
if("CXX" IN_LIST langs) | ||
check_add_gcc_compiler_cxxflag("${FLAG}" "${FLAGNAME}") | ||
endif() | ||
endmacro() |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include <sys/ptrace.h> | ||
#include <sys/types.h> | ||
|
||
int main() | ||
{ | ||
ptrace(PT_DENY_ATTACH, 0, 0, 0); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we also mention the minimum versions of required libraries (e.g. Qt, Botan) in here?