Page MenuHome GnuPG

No OneTemporary

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9d97cede..ed6d9c97 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,104 +1,111 @@
# CMakeLists.txt for GpgME++
# Copyright 2025 g10 Code GmbH
# Software engineering by Carl Schwan <carl.schwan@gnupg.com>
# Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
#
# This file is part of GPGME++.
#
# GPGME++ is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of the
# License, or (at your option) any later version.
#
# GPGME++ 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 Lesser General
# Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, see <https://gnu.org/licenses/>.
# SPDX-License-Identifier: LGPL-2.1-or-later
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
set(FULL_VERSION "2.0.0")
string(REGEX MATCH "^[0-9]+.[0-9]+.[0-9]+" cmake_compat_version ${FULL_VERSION})
project(gpgmepp VERSION ${cmake_compat_version})
set(VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(VERSION_MICRO ${PROJECT_VERSION_PATCH})
# LT Version numbers, remember to change them just *before* a release.
# (Code changed: REVISION++)
# (Interfaces added/removed/changed: CURRENT++, REVISION=0)
# (Interfaces added: AGE++)
# (Interfaces removed: AGE=0)
set(LIBGPGMEPP_LT_CURRENT "28")
set(LIBGPGMEPP_LT_AGE "22")
set(LIBGPGMEPP_LT_REVISION "0")
math(EXPR LIBGPGMEPP_SOVERSION "${LIBGPGMEPP_LT_CURRENT} - ${LIBGPGMEPP_LT_AGE}")
set(GPG_ERROR_REQUIRED_VERSION "1.47")
set(GPGME_REQUIRED_VERSION "1.24.2")
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
include(G10CMakeSettings)
include(G10AddDistTargets)
include(G10AddGenChangeLogTarget)
+include(G10AddReleaseTargets)
include(G10CompilerSettings)
include(G10GetFullVersion)
include(ECMUninstallTarget)
include(FeatureSummary)
include(GNUInstallDirs)
find_package(LibGpgError ${GPG_ERROR_REQUIRED_VERSION})
set_package_properties(LibGpgError PROPERTIES TYPE REQUIRED)
find_package(Gpgme ${GPGME_REQUIRED_VERSION})
set_package_properties(Gpgme PROPERTIES TYPE REQUIRED)
g10_get_full_version()
# create the VERSION file
find_package(Git QUIET)
if (GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
# get the current commit ID
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --verify HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE commit_id
)
string(STRIP "${commit_id}" commit_id) # strip trailing whitespace
file(WRITE "${CMAKE_BINARY_DIR}/VERSION" "${G10_FULL_VERSION}\n${commit_id}\n")
elseif(EXISTS "${CMAKE_SOURCE_DIR}/VERSION")
configure_file("${CMAKE_SOURCE_DIR}/VERSION" "VERSION" COPYONLY)
else()
file(WRITE "${CMAKE_BINARY_DIR}/VERSION" "${G10_FULL_VERSION}\nunknown\n")
endif()
# start ChangeLog at import from KDE in gpgme repo
g10_add_gen_changelog_target(
SINCE "2016-03-08T00:00:00"
FOOTER "${CMAKE_SOURCE_DIR}/build-aux/git-log-footer"
)
set(EXTRA_DIST
"${CMAKE_BINARY_DIR}/ChangeLog"
"${CMAKE_BINARY_DIR}/VERSION"
)
g10_add_dist_targets(
VERSION "${G10_FULL_VERSION}"
ARCHIVE_FORMAT "tar.xz"
EXTRA_FILES ${EXTRA_DIST}
)
add_dependencies(dist gen-ChangeLog)
+g10_add_release_targets(
+ VERSION "${G10_FULL_VERSION}"
+ ARCHIVE_FORMAT "tar.xz"
+ RELEASE_ARCHIVE_SUFFIX "gpgme"
+)
+
add_subdirectory(src)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
diff --git a/cmake/modules/G10AddReleaseTargets.cmake b/cmake/modules/G10AddReleaseTargets.cmake
new file mode 100644
index 00000000..a408419d
--- /dev/null
+++ b/cmake/modules/G10AddReleaseTargets.cmake
@@ -0,0 +1,133 @@
+# Copyright 2025 g10 Code GmbH
+# Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# SPDX-License-Identifier: BSD-2-Clause
+
+#[=======================================================================[.rst:
+G10AddReleaseTargets
+--------------------
+
+Add custom targets ``gen-swdb``, ``release``, and ``sign-release``.
+
+::
+
+ g10_add_release_targets(
+ [VERSION <version>]
+ [SWDB_PREFIX <prefix>]
+ [ARCHIVE_FORMAT <format>]
+ [RELEASE_ARCHIVE_SUFFIX archive_suffix]
+ )
+
+
+This function adds the custom targets ``gen-swdb``, ``release``, and
+``sign-release`` to the project. These targets are used when releasing a new
+version of a project.
+
+The ``gen-swdb`` target generates the swdb entries for the release archive.
+The entries are prefixed with ``prefix``. They are written to a file named
+``<PROJECT_NAME>-<version>.swdb``.
+
+The ``release`` target creates a tarball by running the distcheck target
+in a subfolder ``dist`` of the build folder.
+
+The ``sign-release`` target signs the tarball and uploads everything to the
+location of the released tarball archives. This location is defined by the
+variable ``RELEASE_ARCHIVE`` in ``~/.gnupg-autogen.rc`` which is suffixed by
+``archive_suffix``.
+
+If ``VERSION`` is not given then ``PROJECT_VERSION`` is used.
+
+If ``PREFIX`` is not given then the lower-cased ``PROJECT_NAME`` is used.
+
+If ``ARCHIVE_FORMAT`` is not given then ``tar.gz`` is used. It must match
+the format specified for the dist targets.
+
+If ``RELEASE_ARCHIVE_SUFFIX`` is not given then ``PROJECT_NAME`` is used.
+#]=======================================================================]
+
+function(G10_ADD_RELEASE_TARGETS)
+ set(options)
+ set(one_value_keywords VERSION SWDB_PREFIX ARCHIVE_FORMAT RELEASE_ARCHIVE_SUFFIX)
+ set(multi_value_keywords)
+
+ cmake_parse_arguments(PARSE_ARGV 0 arg "${options}" "${one_value_keywords}" "${multi_value_keywords}")
+
+ if(arg_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Unknown keywords given to G10_ADD_RELEASE_TARGETS(): \"${arg_UNPARSED_ARGUMENTS}\"")
+ endif()
+
+ if(arg_VERSION)
+ set(version ${arg_VERSION})
+ else()
+ set(version ${PROJECT_VERSION})
+ endif()
+ if(arg_SWDB_PREFIX)
+ set(swdb_prefix ${arg_SWDB_PREFIX})
+ else()
+ string(TOLOWER ${PROJECT_NAME} swdb_prefix)
+ endif()
+ if(arg_ARCHIVE_FORMAT)
+ set(archive_format ${arg_ARCHIVE_FORMAT})
+ else()
+ set(archive_format "tar.gz")
+ endif()
+ if(arg_RELEASE_ARCHIVE_SUFFIX)
+ set(release_archive_suffix ${arg_RELEASE_ARCHIVE_SUFFIX})
+ else()
+ set(release_archive_suffix ${PROJECT_NAME})
+ endif()
+
+ set(release_name "${PROJECT_NAME}-${version}")
+
+ if(NOT TARGET gen-swdb)
+ configure_file("${CMAKE_SOURCE_DIR}/cmake/modules/g10_generate_swdb.sh.in" "g10_generate_swdb.sh" @ONLY)
+ file(CHMOD "g10_generate_swdb.sh"
+ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+ add_custom_target(gen-swdb
+ COMMENT "Generating SWDB entries as ${release_name}.swdb..."
+ COMMAND "${CMAKE_BINARY_DIR}/g10_generate_swdb.sh"
+ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
+ )
+ endif()
+
+ if(NOT TARGET release)
+ configure_file("${CMAKE_SOURCE_DIR}/cmake/modules/g10_release.sh.in" "g10_release.sh" @ONLY)
+ file(CHMOD "g10_release.sh"
+ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+ add_custom_target(release
+ COMMAND "${CMAKE_BINARY_DIR}/g10_release.sh"
+ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
+ )
+ endif()
+
+ if(NOT TARGET sign-release)
+ configure_file("${CMAKE_SOURCE_DIR}/cmake/modules/g10_sign-release.sh.in" "g10_sign-release.sh" @ONLY)
+ file(CHMOD "g10_sign-release.sh"
+ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+ add_custom_target(sign-release
+ COMMAND "${CMAKE_BINARY_DIR}/g10_sign-release.sh"
+ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
+ )
+ endif()
+endfunction()
diff --git a/cmake/modules/g10_generate_swdb.sh.in b/cmake/modules/g10_generate_swdb.sh.in
new file mode 100644
index 00000000..af0b1fb8
--- /dev/null
+++ b/cmake/modules/g10_generate_swdb.sh.in
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# Copyright 2025 g10 Code GmbH
+# Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+#
+# This file 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 3 of the License, or
+# (at your option) any later version.
+#
+# This file 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 <https://www.gnu.org/licenses/>.
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+set -e
+
+archive_filename="@release_name@.@archive_format@"
+
+if [ ! -e "${archive_filename}" ]; then
+ echo "Error: '${archive_filename}' does not exist." >&2
+ exit 1
+fi
+
+(
+ pref="#+macro: @swdb_prefix@_"
+ reldate="$(date -u +%Y-%m-%d)"
+ echo "${pref}ver @version@"
+ echo "${pref}date ${reldate}"
+ echo "${pref}size $(wc -c <"${archive_filename}" | awk '{print int($1/1024)}')k"
+ echo "${pref}sha1 $(sha1sum <"${archive_filename}" | cut -d' ' -f1)"
+ echo "${pref}sha2 $(sha256sum <"${archive_filename}" | cut -d' ' -f1)"
+) | tee @release_name@.swdb
diff --git a/cmake/modules/g10_release.sh.in b/cmake/modules/g10_release.sh.in
new file mode 100644
index 00000000..78d2a31c
--- /dev/null
+++ b/cmake/modules/g10_release.sh.in
@@ -0,0 +1,48 @@
+#!/bin/sh
+#
+# Copyright 2025 g10 Code GmbH
+# Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+#
+# This file 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 3 of the License, or
+# (at your option) any later version.
+#
+# This file 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 <https://www.gnu.org/licenses/>.
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+(
+ set -e
+
+ if [ "@CMAKE_BINARY_DIR@" = "@CMAKE_SOURCE_DIR@" ]; then
+ echo "error: build directory must not be the source directory" >&2
+ exit 2
+ fi
+
+ echo "/* Build started at $(date -uIseconds) */"
+
+ cd @CMAKE_BINARY_DIR@
+ if [ -d "dist/@release_name@" ]; then
+ find "dist/@release_name@" -type d ! -perm -700 -exec chmod u+rwx {} ';'
+ fi
+ rm -rf dist
+ mkdir dist
+ cd dist
+ @CMAKE_COMMAND@ @CMAKE_SOURCE_DIR@/CMakeLists.txt
+
+ @CMAKE_COMMAND@ --build . --verbose -t distcheck
+ @CMAKE_COMMAND@ --build . -t gen-swdb
+
+ echo "/* Build finished at $(date -uIseconds) */"
+ echo "/*"
+ echo " * Please run the final step interactively:"
+ echo " * make sign-release"
+ echo " */"
+) 2>&1 | tee "@release_name@.buildlog"
diff --git a/cmake/modules/g10_sign-release.sh.in b/cmake/modules/g10_sign-release.sh.in
new file mode 100644
index 00000000..7363d73c
--- /dev/null
+++ b/cmake/modules/g10_sign-release.sh.in
@@ -0,0 +1,51 @@
+#!/bin/sh
+#
+# Copyright 2025 g10 Code GmbH
+# Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+#
+# This file 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 3 of the License, or
+# (at your option) any later version.
+#
+# This file 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 <https://www.gnu.org/licenses/>.
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+set -e
+
+test $(pwd | sed 's,.*/,,') = dist || cd dist
+x=$(grep '^RELEASE_ARCHIVE=' $HOME/.gnupg-autogen.rc|cut -d= -f2)
+if [ -z "$x" ]; then
+ echo "error: RELEASE_ARCHIVE missing in ~/.gnupg-autogen.rc">&2
+ exit 2
+fi
+myarchive="$x/@release_archive_suffix@"
+x=$(grep '^RELEASE_SIGNKEY=' $HOME/.gnupg-autogen.rc|cut -d= -f2)
+if [ -z "$x" ]; then
+ echo "error: RELEASE_SIGNKEY missing in ~/.gnupg-autogen.rc">&2
+ exit 2
+fi
+mysignkey="$x"
+files1="@release_name@.tar.bz2"
+files2="@release_name@.tar.bz2.sig
+ @release_name@.swdb
+ @release_name@.buildlog"
+echo "/* Signing the source tarball ..."
+gpg -sbu $mysignkey @release_name@.tar.bz2
+cat @release_name@.swdb >swdb.snippet
+echo >>swdb.snippet
+sha1sum ${files1} >>swdb.snippet
+cat "../@release_name@.buildlog" swdb.snippet \
+ | gzip >@release_name@.buildlog
+echo "Copying to local archive ..."
+scp -p ${files1} ${files2} $myarchive/ || true
+echo '/*'
+echo ' * All done; for checksums see dist/swdb.snippet'
+echo ' */'

File Metadata

Mime Type
text/x-diff
Expires
Thu, Feb 26, 6:43 PM (15 h, 59 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ca/2c/48fc56fd5383e3c5b3ddb7a93d34

Event Timeline