mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-04-06 05:57:37 +03:00
Enhance release-tool handling of app signing
* Introduce .gitrev file to tarball generation * Correct labeling of builds based on supplied parameters to CMake * Convert supplied key file path to absolute when building under MSYS * Support OVERRIDE_VERSION to build properly version numbered snapshots * Do not build tests for any build
This commit is contained in:
parent
29c79c935a
commit
8bc94874a1
2 changed files with 32 additions and 21 deletions
|
@ -80,6 +80,7 @@ set(KEEPASSXC_VERSION_MAJOR "2")
|
||||||
set(KEEPASSXC_VERSION_MINOR "4")
|
set(KEEPASSXC_VERSION_MINOR "4")
|
||||||
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(OVERRIDE_VERSION "" CACHE STRING "Override the KeePassXC Version for Snapshot builds")
|
||||||
|
|
||||||
set(KEEPASSXC_BUILD_TYPE "Snapshot" CACHE STRING "Set KeePassXC build type to distinguish between stable releases and snapshots")
|
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)
|
set_property(CACHE KEEPASSXC_BUILD_TYPE PROPERTY STRINGS Snapshot Release PreRelease)
|
||||||
|
@ -91,8 +92,10 @@ execute_process(COMMAND git rev-parse --short=7 HEAD
|
||||||
OUTPUT_VARIABLE GIT_HEAD
|
OUTPUT_VARIABLE GIT_HEAD
|
||||||
ERROR_QUIET)
|
ERROR_QUIET)
|
||||||
string(STRIP "${GIT_HEAD}" GIT_HEAD)
|
string(STRIP "${GIT_HEAD}" GIT_HEAD)
|
||||||
if(GIT_HEAD STREQUAL "")
|
if(GIT_HEAD STREQUAL "" AND NOT GIT_HEAD_OVERRIDE STREQUAL "")
|
||||||
string(SUBSTRING "${GIT_HEAD_OVERRIDE}" 0 7 GIT_HEAD)
|
string(SUBSTRING "${GIT_HEAD_OVERRIDE}" 0 7 GIT_HEAD)
|
||||||
|
elseif(EXISTS ${CMAKE_SOURCE_DIR}/.gitrev)
|
||||||
|
file(READ ${CMAKE_SOURCE_DIR}/.gitrev GIT_HEAD)
|
||||||
endif()
|
endif()
|
||||||
message(STATUS "Found Git HEAD Revision: ${GIT_HEAD}\n")
|
message(STATUS "Found Git HEAD Revision: ${GIT_HEAD}\n")
|
||||||
|
|
||||||
|
@ -116,14 +119,17 @@ if(OVERRIDE_VERSION)
|
||||||
elseif(OVERRIDE_VERSION MATCHES "^[\\.0-9]+$")
|
elseif(OVERRIDE_VERSION MATCHES "^[\\.0-9]+$")
|
||||||
set(KEEPASSXC_BUILD_TYPE Release)
|
set(KEEPASSXC_BUILD_TYPE Release)
|
||||||
set(KEEPASSXC_VERSION ${OVERRIDE_VERSION})
|
set(KEEPASSXC_VERSION ${OVERRIDE_VERSION})
|
||||||
|
else()
|
||||||
|
set(KEEPASSXC_BUILD_TYPE Snapshot)
|
||||||
|
set(KEEPASSXC_VERSION ${OVERRIDE_VERSION})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
else()
|
||||||
|
if(KEEPASSXC_BUILD_TYPE STREQUAL "PreRelease")
|
||||||
if(KEEPASSXC_BUILD_TYPE STREQUAL "PreRelease" AND NOT OVERRIDE_VERSION)
|
|
||||||
set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION}-preview")
|
set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION}-preview")
|
||||||
elseif(KEEPASSXC_BUILD_TYPE STREQUAL "Snapshot")
|
elseif(KEEPASSXC_BUILD_TYPE STREQUAL "Snapshot")
|
||||||
set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION}-snapshot")
|
set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION}-snapshot")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(KEEPASSXC_BUILD_TYPE STREQUAL "Release")
|
if(KEEPASSXC_BUILD_TYPE STREQUAL "Release")
|
||||||
set(KEEPASSXC_BUILD_TYPE_RELEASE ON)
|
set(KEEPASSXC_BUILD_TYPE_RELEASE ON)
|
||||||
|
|
27
release-tool
27
release-tool
|
@ -813,13 +813,17 @@ build() {
|
||||||
init
|
init
|
||||||
|
|
||||||
OUTPUT_DIR="$(realpath "$OUTPUT_DIR")"
|
OUTPUT_DIR="$(realpath "$OUTPUT_DIR")"
|
||||||
|
# Resolve appsign key to absolute path if under Windows
|
||||||
|
if [[ "${build_key}" && "$(uname -o)" == "Msys" ]]; then
|
||||||
|
build_key="$(realpath "${build_key}")"
|
||||||
|
fi
|
||||||
|
|
||||||
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"
|
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DKEEPASSXC_BUILD_TYPE=Snapshot -DOVERRIDE_VERSION=${RELEASE_NAME}"
|
||||||
else
|
else
|
||||||
checkWorkingTreeClean
|
checkWorkingTreeClean
|
||||||
|
|
||||||
|
@ -848,14 +852,13 @@ build() {
|
||||||
|
|
||||||
git archive --format=tar "$TAG_NAME" --prefix="${prefix}/" --output="${OUTPUT_DIR}/${tarball_name}"
|
git archive --format=tar "$TAG_NAME" --prefix="${prefix}/" --output="${OUTPUT_DIR}/${tarball_name}"
|
||||||
|
|
||||||
if ! ${build_snapshot}; then
|
# add .version and .gitrev files to tarball
|
||||||
# add .version file to tar
|
|
||||||
mkdir "${prefix}"
|
mkdir "${prefix}"
|
||||||
echo -n ${RELEASE_NAME} > "${prefix}/.version"
|
echo -n ${RELEASE_NAME} > "${prefix}/.version"
|
||||||
tar --append --file="${OUTPUT_DIR}/${tarball_name}" "${prefix}/.version"
|
echo -n `git rev-parse --short=7 HEAD` > "${prefix}/.gitrev"
|
||||||
rm "${prefix}/.version"
|
tar --append --file="${OUTPUT_DIR}/${tarball_name}" "${prefix}/.version" "${prefix}/.gitrev"
|
||||||
|
rm "${prefix}/.version" "${prefix}/.gitrev"
|
||||||
rmdir "${prefix}" 2> /dev/null
|
rmdir "${prefix}" 2> /dev/null
|
||||||
fi
|
|
||||||
|
|
||||||
xz -6 "${OUTPUT_DIR}/${tarball_name}"
|
xz -6 "${OUTPUT_DIR}/${tarball_name}"
|
||||||
fi
|
fi
|
||||||
|
@ -881,6 +884,8 @@ build() {
|
||||||
# linuxdeploy requires /usr as install prefix
|
# linuxdeploy requires /usr as install prefix
|
||||||
INSTALL_PREFIX="/usr"
|
INSTALL_PREFIX="/usr"
|
||||||
fi
|
fi
|
||||||
|
# Do not build tests cases
|
||||||
|
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DWITH_TESTS=OFF"
|
||||||
|
|
||||||
if [ "$COMPILER" == "g++" ]; then
|
if [ "$COMPILER" == "g++" ]; then
|
||||||
export CC=gcc
|
export CC=gcc
|
||||||
|
@ -913,14 +918,14 @@ build() {
|
||||||
elif [ "$(uname -o)" == "Msys" ]; then
|
elif [ "$(uname -o)" == "Msys" ]; then
|
||||||
# Building on Windows with Msys2
|
# Building on Windows with Msys2
|
||||||
logInfo "Configuring build..."
|
logInfo "Configuring build..."
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DWITH_TESTS=Off -G"MSYS Makefiles" \
|
cmake -DCMAKE_BUILD_TYPE=Release -G"MSYS Makefiles" \
|
||||||
-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..."
|
||||||
mingw32-make ${MAKE_OPTIONS} preinstall
|
mingw32-make ${MAKE_OPTIONS} preinstall
|
||||||
|
|
||||||
# Appsign the executables if desired
|
# Appsign the executables if desired
|
||||||
if ${build_appsign} && [ -f ${build_key} ]; then
|
if ${build_appsign} && [ -f "${build_key}" ]; then
|
||||||
logInfo "Signing executable files"
|
logInfo "Signing executable files"
|
||||||
appsign "-f" $(find src | grep -P '\.exe$|\.dll$') "-k" "${build_key}"
|
appsign "-f" $(find src | grep -P '\.exe$|\.dll$') "-k" "${build_key}"
|
||||||
fi
|
fi
|
||||||
|
@ -945,7 +950,7 @@ build() {
|
||||||
|
|
||||||
# Building on Linux without Docker container
|
# Building on Linux without Docker container
|
||||||
logInfo "Configuring build..."
|
logInfo "Configuring build..."
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DWITH_TESTS=Off ${CMAKE_OPTIONS} \
|
cmake -DCMAKE_BUILD_TYPE=Release ${CMAKE_OPTIONS} \
|
||||||
-DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}" "$SRC_DIR"
|
-DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}" "$SRC_DIR"
|
||||||
|
|
||||||
logInfo "Compiling sources..."
|
logInfo "Compiling sources..."
|
||||||
|
@ -977,7 +982,7 @@ build() {
|
||||||
-v "$(realpath "$OUTPUT_DIR"):/keepassxc/out:rw" \
|
-v "$(realpath "$OUTPUT_DIR"):/keepassxc/out:rw" \
|
||||||
"$DOCKER_IMAGE" \
|
"$DOCKER_IMAGE" \
|
||||||
bash -c "cd /keepassxc/out/build-release && \
|
bash -c "cd /keepassxc/out/build-release && \
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DWITH_TESTS=Off ${CMAKE_OPTIONS} \
|
cmake -DCMAKE_BUILD_TYPE=Release ${CMAKE_OPTIONS} \
|
||||||
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} /keepassxc/src && \
|
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} /keepassxc/src && \
|
||||||
make ${MAKE_OPTIONS} && make DESTDIR=/keepassxc/out/KeePassXC.AppDir install/strip"
|
make ${MAKE_OPTIONS} && make DESTDIR=/keepassxc/out/KeePassXC.AppDir install/strip"
|
||||||
fi
|
fi
|
||||||
|
@ -1139,7 +1144,7 @@ appsign() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
logInfo "Signing app using codesign..."
|
logInfo "Signing app using codesign..."
|
||||||
codesign --sign "${key}" --verbose --deep --entitlements ${orig_dir}/share/macosx/keepassxc.entitlements ./app/KeePassXC.app
|
codesign --sign "${key}" --verbose --deep --entitlements "${SRC_DIR}/share/macosx/keepassxc.entitlements" ./app/KeePassXC.app
|
||||||
|
|
||||||
if [ 0 -ne $? ]; then
|
if [ 0 -ne $? ]; then
|
||||||
cd "${orig_dir}"
|
cd "${orig_dir}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue