mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Add support for pre-releases
This commit is contained in:
parent
d36e9875c5
commit
924d472de5
@ -73,27 +73,49 @@ set(KEEPASSXC_VERSION_MINOR "3")
|
|||||||
set(KEEPASSXC_VERSION_PATCH "0")
|
set(KEEPASSXC_VERSION_PATCH "0")
|
||||||
set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION_MAJOR}.${KEEPASSXC_VERSION_MINOR}.${KEEPASSXC_VERSION_PATCH}")
|
set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION_MAJOR}.${KEEPASSXC_VERSION_MINOR}.${KEEPASSXC_VERSION_PATCH}")
|
||||||
|
|
||||||
set(KEEPASSXC_RELEASE_BUILD OFF CACHE BOOLEAN "Remove stability warnings")
|
set(KEEPASSXC_BUILD_TYPE "Snapshot" CACHE STRING "Set KeePassXC build type to distinguish between stable releases and snapshots")
|
||||||
|
set_property(CACHE KEEPASSXC_BUILD_TYPE PROPERTY STRINGS Snapshot Release PreRelease)
|
||||||
|
|
||||||
# Check if on a tag, if so build as a release
|
# Check if on a tag, if so build as a release
|
||||||
execute_process(COMMAND git tag --points-at HEAD
|
execute_process(COMMAND git tag --points-at HEAD
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE GIT_TAG)
|
OUTPUT_VARIABLE GIT_TAG)
|
||||||
if(GIT_TAG)
|
if(GIT_TAG)
|
||||||
set(KEEPASSXC_RELEASE_BUILD ON)
|
string(REGEX REPLACE "\r?\n$" "" GIT_TAG "${GIT_TAG}")
|
||||||
elseif(NOT KEEPASSXC_RELEASE_BUILD)
|
|
||||||
|
if(GIT_TAG MATCHES "^[\\.0-9]+-(alpha|beta)[0-9]+$")
|
||||||
|
set(KEEPASSXC_BUILD_TYPE PreRelease)
|
||||||
|
set(KEEPASSXC_VERSION ${GIT_TAG})
|
||||||
|
elseif(GIT_TAG MATCHES "^[\\.0-9]+$")
|
||||||
|
set(KEEPASSXC_BUILD_TYPE Release)
|
||||||
|
set(KEEPASSXC_VERSION ${GIT_TAG})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(KEEPASSXC_BUILD_TYPE STREQUAL "PreRelease" AND NOT GIT_TAG)
|
||||||
|
set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION}-preview")
|
||||||
|
elseif(KEEPASSXC_BUILD_TYPE STREQUAL "Snapshot")
|
||||||
set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION}-snapshot")
|
set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION}-snapshot")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(KEEPASSXC_BUILD_TYPE STREQUAL "Release")
|
||||||
|
set(KEEPASSXC_BUILD_TYPE_RELEASE ON)
|
||||||
|
elseif(KEEPASSXC_BUILD_TYPE STREQUAL "PreRelease")
|
||||||
|
set(KEEPASSXC_BUILD_TYPE_PRE_RELEASE ON)
|
||||||
|
else()
|
||||||
|
set(KEEPASSXC_BUILD_TYPE_SNAPSHOT ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
message(STATUS "Setting up build for KeePassXC v${KEEPASSXC_VERSION}\n")
|
message(STATUS "Setting up build for KeePassXC v${KEEPASSXC_VERSION}\n")
|
||||||
|
|
||||||
# Distribution info
|
# Distribution info
|
||||||
set(KEEPASSXC_DIST True)
|
set(KEEPASSXC_DIST ON)
|
||||||
set(KEEPASSXC_DIST_TYPE "Other" CACHE STRING "KeePassXC Distribution type")
|
set(KEEPASSXC_DIST_TYPE "Other" CACHE STRING "KeePassXC Distribution Type")
|
||||||
set_property(CACHE KEEPASSXC_DIST_TYPE PROPERTY STRINGS Snap AppImage Other)
|
set_property(CACHE KEEPASSXC_DIST_TYPE PROPERTY STRINGS Snap AppImage Other)
|
||||||
if(KEEPASSXC_DIST_TYPE STREQUAL "Snap")
|
if(KEEPASSXC_DIST_TYPE STREQUAL "Snap")
|
||||||
set(KEEPASSXC_DIST_SNAP True)
|
set(KEEPASSXC_DIST_SNAP ON)
|
||||||
elseif(KEEPASSXC_DIST_TYPE STREQUAL "AppImage")
|
elseif(KEEPASSXC_DIST_TYPE STREQUAL "AppImage")
|
||||||
set(KEEPASSXC_DIST_APPIMAGE True)
|
set(KEEPASSXC_DIST_APPIMAGE ON)
|
||||||
elseif(KEEPASSXC_DIST_TYPE STREQUAL "Other")
|
elseif(KEEPASSXC_DIST_TYPE STREQUAL "Other")
|
||||||
unset(KEEPASSXC_DIST)
|
unset(KEEPASSXC_DIST)
|
||||||
endif()
|
endif()
|
||||||
|
39
release-tool
39
release-tool
@ -246,7 +246,7 @@ checkVersionInCMake() {
|
|||||||
local app_name_upper="$(echo "$APP_NAME" | tr '[:lower:]' '[:upper:]')"
|
local app_name_upper="$(echo "$APP_NAME" | tr '[:lower:]' '[:upper:]')"
|
||||||
local major_num="$(echo ${RELEASE_NAME} | cut -f1 -d.)"
|
local major_num="$(echo ${RELEASE_NAME} | cut -f1 -d.)"
|
||||||
local minor_num="$(echo ${RELEASE_NAME} | cut -f2 -d.)"
|
local minor_num="$(echo ${RELEASE_NAME} | cut -f2 -d.)"
|
||||||
local patch_num="$(echo ${RELEASE_NAME} | cut -f3 -d.)"
|
local patch_num="$(echo ${RELEASE_NAME} | cut -f3 -d. | cut -f1 -d-)"
|
||||||
|
|
||||||
grep -q "${app_name_upper}_VERSION_MAJOR \"${major_num}\"" CMakeLists.txt
|
grep -q "${app_name_upper}_VERSION_MAJOR \"${major_num}\"" CMakeLists.txt
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
@ -582,19 +582,26 @@ build() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
init
|
init
|
||||||
checkWorkingTreeClean
|
|
||||||
|
|
||||||
OUTPUT_DIR="$(realpath "$OUTPUT_DIR")"
|
OUTPUT_DIR="$(realpath "$OUTPUT_DIR")"
|
||||||
|
|
||||||
if $BUILD_SNAPSHOT; then
|
if ${BUILD_SNAPSHOT}; then
|
||||||
TAG_NAME="HEAD"
|
TAG_NAME="HEAD"
|
||||||
local branch=`git rev-parse --abbrev-ref HEAD`
|
local branch=`git rev-parse --abbrev-ref HEAD`
|
||||||
logInfo "Using current branch ${branch} to build..."
|
logInfo "Using current branch ${branch} to build..."
|
||||||
RELEASE_NAME="${RELEASE_NAME}-snapshot"
|
RELEASE_NAME="${RELEASE_NAME}-snapshot"
|
||||||
|
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DKEEPASSXC_BUILD_TYPE=Snapshot"
|
||||||
else
|
else
|
||||||
logInfo "Checking out release tag '${TAG_NAME}'..."
|
checkWorkingTreeClean
|
||||||
|
|
||||||
|
if $(echo "$TAG_NAME" | grep -qP "\-(alpha|beta)\\d+\$"); then
|
||||||
|
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DKEEPASSXC_BUILD_TYPE=PreRelease"
|
||||||
|
logInfo "Checking out pre-release tag '${TAG_NAME}'..."
|
||||||
|
else
|
||||||
|
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DKEEPASSXC_BUILD_TYPE=Release"
|
||||||
|
logInfo "Checking out release tag '${TAG_NAME}'..."
|
||||||
|
fi
|
||||||
git checkout "$TAG_NAME"
|
git checkout "$TAG_NAME"
|
||||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DKEEPASSXC_RELEASE_BUILD=ON"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
logInfo "Creating output directory..."
|
logInfo "Creating output directory..."
|
||||||
@ -604,20 +611,28 @@ build() {
|
|||||||
exitError "Failed to create output directory!"
|
exitError "Failed to create output directory!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if $BUILD_SOURCE_TARBALL; then
|
if ${BUILD_SOURCE_TARBALL}; then
|
||||||
logInfo "Creating source tarball..."
|
logInfo "Creating source tarball..."
|
||||||
local app_name_lower="$(echo "$APP_NAME" | tr '[:upper:]' '[:lower:]')"
|
local app_name_lower="$(echo "$APP_NAME" | tr '[:upper:]' '[:lower:]')"
|
||||||
TARBALL_NAME="${app_name_lower}-${RELEASE_NAME}-src.tar.xz"
|
TARBALL_NAME="${app_name_lower}-${RELEASE_NAME}-src.tar.xz"
|
||||||
git archive --format=tar "$TAG_NAME" --prefix="${app_name_lower}-${RELEASE_NAME}/" \
|
git archive --format=tar "$TAG_NAME" --prefix="${app_name_lower}-${RELEASE_NAME}/" \
|
||||||
| xz -6 > "${OUTPUT_DIR}/${TARBALL_NAME}"
|
| xz -6 > "${OUTPUT_DIR}/${TARBALL_NAME}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -e "${OUTPUT_DIR}/build-release" ]; then
|
||||||
|
logInfo "Cleaning existing build directory..."
|
||||||
|
rm -r "${OUTPUT_DIR}/build-release" 2> /dev/null
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
exitError "Failed to clean existing build directory, please do it manually."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
logInfo "Creating build directory..."
|
logInfo "Creating build directory..."
|
||||||
mkdir -p "${OUTPUT_DIR}/build-release"
|
mkdir -p "${OUTPUT_DIR}/build-release"
|
||||||
cd "${OUTPUT_DIR}/build-release"
|
cd "${OUTPUT_DIR}/build-release"
|
||||||
|
|
||||||
logInfo "Configuring sources..."
|
logInfo "Configuring sources..."
|
||||||
for p in $BUILD_PLUGINS; do
|
for p in ${BUILD_PLUGINS}; do
|
||||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DWITH_XC_$(echo $p | tr '[:lower:]' '[:upper:]')=On"
|
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DWITH_XC_$(echo $p | tr '[:lower:]' '[:upper:]')=On"
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -654,13 +669,13 @@ build() {
|
|||||||
-DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}" $CMAKE_OPTIONS "$SRC_DIR"
|
-DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}" $CMAKE_OPTIONS "$SRC_DIR"
|
||||||
|
|
||||||
logInfo "Compiling and packaging sources..."
|
logInfo "Compiling and packaging sources..."
|
||||||
make $MAKE_OPTIONS preinstall
|
mingw32-make $MAKE_OPTIONS preinstall
|
||||||
# Call cpack directly instead of calling make package.
|
# Call cpack directly instead of calling make package.
|
||||||
# This is important because we want to build the MSI when making a
|
# This is important because we want to build the MSI when making a
|
||||||
# release.
|
# release.
|
||||||
cpack -G "NSIS;WIX;ZIP"
|
cpack -G "NSIS;ZIP;${CPACK_GENERATORS}"
|
||||||
|
|
||||||
mv "./${APP_NAME}-${RELEASE_NAME}-"*.{exe,msi,zip} ../
|
mv "./${APP_NAME}-${RELEASE_NAME}-"*.* ../
|
||||||
else
|
else
|
||||||
mkdir -p "${OUTPUT_DIR}/bin-release"
|
mkdir -p "${OUTPUT_DIR}/bin-release"
|
||||||
|
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
#ifndef KEEPASSX_CONFIG_KEEPASSX_H
|
#ifndef KEEPASSX_CONFIG_KEEPASSX_H
|
||||||
#define KEEPASSX_CONFIG_KEEPASSX_H
|
#define KEEPASSX_CONFIG_KEEPASSX_H
|
||||||
|
|
||||||
#define KEEPASSX_VERSION "${KEEPASSXC_VERSION}"
|
#define KEEPASSX_VERSION "@KEEPASSXC_VERSION@"
|
||||||
|
|
||||||
#define KEEPASSX_SOURCE_DIR "${CMAKE_SOURCE_DIR}"
|
#define KEEPASSX_SOURCE_DIR "@CMAKE_SOURCE_DIR@"
|
||||||
#define KEEPASSX_BINARY_DIR "${CMAKE_BINARY_DIR}"
|
#define KEEPASSX_BINARY_DIR "@CMAKE_BINARY_DIR@"
|
||||||
|
|
||||||
#define KEEPASSX_PREFIX_DIR "${CMAKE_INSTALL_PREFIX}"
|
#define KEEPASSX_PREFIX_DIR "@CMAKE_INSTALL_PREFIX@"
|
||||||
#define KEEPASSX_PLUGIN_DIR "${PLUGIN_INSTALL_DIR}"
|
#define KEEPASSX_PLUGIN_DIR "@PLUGIN_INSTALL_DIR@"
|
||||||
#define KEEPASSX_DATA_DIR "${DATA_INSTALL_DIR}"
|
#define KEEPASSX_DATA_DIR "@DATA_INSTALL_DIR@"
|
||||||
|
|
||||||
#cmakedefine WITH_XC_AUTOTYPE
|
#cmakedefine WITH_XC_AUTOTYPE
|
||||||
#cmakedefine WITH_XC_NETWORKING
|
#cmakedefine WITH_XC_NETWORKING
|
||||||
@ -19,13 +19,16 @@
|
|||||||
#cmakedefine WITH_XC_YUBIKEY
|
#cmakedefine WITH_XC_YUBIKEY
|
||||||
#cmakedefine WITH_XC_SSHAGENT
|
#cmakedefine WITH_XC_SSHAGENT
|
||||||
|
|
||||||
|
#cmakedefine KEEPASSXC_BUILD_TYPE "@KEEPASSXC_BUILD_TYPE@"
|
||||||
|
#cmakedefine KEEPASSXC_BUILD_TYPE_RELEASE
|
||||||
|
#cmakedefine KEEPASSXC_BUILD_TYPE_PRE_RELEASE
|
||||||
|
#cmakedefine KEEPASSXC_BUILD_TYPE_SNAPSHOT
|
||||||
|
|
||||||
#cmakedefine KEEPASSXC_DIST
|
#cmakedefine KEEPASSXC_DIST
|
||||||
#cmakedefine KEEPASSXC_DIST_TYPE "@KEEPASSXC_DIST_TYPE@"
|
#cmakedefine KEEPASSXC_DIST_TYPE "@KEEPASSXC_DIST_TYPE@"
|
||||||
#cmakedefine KEEPASSXC_DIST_SNAP
|
#cmakedefine KEEPASSXC_DIST_SNAP
|
||||||
#cmakedefine KEEPASSXC_DIST_APPIMAGE
|
#cmakedefine KEEPASSXC_DIST_APPIMAGE
|
||||||
|
|
||||||
#cmakedefine KEEPASSXC_RELEASE_BUILD
|
|
||||||
|
|
||||||
#cmakedefine HAVE_PR_SET_DUMPABLE 1
|
#cmakedefine HAVE_PR_SET_DUMPABLE 1
|
||||||
#cmakedefine HAVE_RLIMIT_CORE 1
|
#cmakedefine HAVE_RLIMIT_CORE 1
|
||||||
#cmakedefine HAVE_PT_DENY_ATTACH 1
|
#cmakedefine HAVE_PT_DENY_ATTACH 1
|
||||||
|
@ -54,8 +54,8 @@ AboutDialog::AboutDialog(QWidget* parent)
|
|||||||
|
|
||||||
QString debugInfo = "KeePassXC - ";
|
QString debugInfo = "KeePassXC - ";
|
||||||
debugInfo.append(tr("Version %1\n").arg(KEEPASSX_VERSION));
|
debugInfo.append(tr("Version %1\n").arg(KEEPASSX_VERSION));
|
||||||
#ifndef KEEPASSXC_RELEASE_BUILD
|
#ifndef KEEPASSXC_BUILD_TYPE_RELEASE
|
||||||
debugInfo.append(tr("Build Type: Snapshot\n"));
|
debugInfo.append(tr("Build Type: %1\n").arg(KEEPASSXC_BUILD_TYPE));
|
||||||
#endif
|
#endif
|
||||||
if (!commitHash.isEmpty()) {
|
if (!commitHash.isEmpty()) {
|
||||||
debugInfo.append(tr("Revision: %1").arg(commitHash.left(7)).append("\n"));
|
debugInfo.append(tr("Revision: %1").arg(commitHash.left(7)).append("\n"));
|
||||||
|
@ -425,7 +425,7 @@ MainWindow::MainWindow()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef KEEPASSXC_RELEASE_BUILD
|
#ifndef KEEPASSXC_BUILD_TYPE_RELEASE
|
||||||
m_ui->globalMessageWidget->showMessage(tr("WARNING: You are using an unstable build of KeePassXC!\n"
|
m_ui->globalMessageWidget->showMessage(tr("WARNING: You are using an unstable build of KeePassXC!\n"
|
||||||
"There is a high risk of corruption, maintain a backup of your databases.\n"
|
"There is a high risk of corruption, maintain a backup of your databases.\n"
|
||||||
"This version is not meant for production use."),
|
"This version is not meant for production use."),
|
||||||
|
Loading…
Reference in New Issue
Block a user