thunderbird/backport-rnp-0.16.2-to-esr102-d-bug-1790446.patch

78 lines
2.6 KiB
Diff
Raw Normal View History

# HG changeset patch
# User Rob Lemley <rob@thunderbird.net>
# Date 1662997034 0
# Mon Sep 12 15:37:14 2022 +0000
# Node ID 17dc6bb322b5d40299bba0a90d59c0593137d4f6
# Parent c9e44c0a569253884961ad2e18fae23f5ed0f6dc
Bug 1790446 - Get RNP version during configure and set in config.h. r=dandarnell
Depends on D157152
Differential Revision: https://phabricator.services.mozilla.com/D157153
diff --git a/comm/third_party/openpgp.configure b/comm/third_party/openpgp.configure
--- a/comm/third_party/openpgp.configure
+++ b/comm/third_party/openpgp.configure
@@ -86,10 +86,42 @@ with only_when("--enable-compile-environ
set_config("MZLA_LIBRNP", depends_if(in_tree_librnp)(lambda _: True))
set_define("MZLA_LIBRNP", depends_if(in_tree_librnp)(lambda _: True))
with only_when(in_tree_librnp):
+
+ @depends(build_environment, c_compiler)
+ @imports(_from="textwrap", _import="dedent")
+ @imports(_from="os.path", _import="join")
+ def rnp_version_string(build_env, compiler):
+ log.info("Determining librnp version from version.h.")
+ include_path = join(
+ build_env.topsrcdir, "comm", "third_party", "rnp", "src", "lib"
+ )
+ check = dedent(
+ """\
+ #include "version.h"
+ RNP_VERSION_STRING_FULL
+ """
+ )
+ result = try_preprocess(
+ compiler.wrapper
+ + [compiler.compiler]
+ + compiler.flags
+ + ["-I", include_path],
+ "C",
+ check,
+ )
+ if result:
+ rnp_version = result.splitlines()[-1]
+ rnp_version = rnp_version.replace('"', "")
+ else:
+ raise FatalCheckError("Unable to determine RNP version string.")
+ return rnp_version
+
+ set_config("MZLA_LIBRNP_FULL_VERSION", rnp_version_string)
+
# JSON-C --with-system-json
system_lib_option(
"--with-system-jsonc",
help="Use system JSON-C for librnp (located with pkgconfig)",
)
diff --git a/comm/third_party/rnp/moz.build b/third_party/rnp/moz.b/commuild
--- a/comm/third_party/rnp/moz.build
+++ b/comm/third_party/rnp/moz.build
@@ -41,10 +41,12 @@ rnp_defines = {
"HAVE_ZLIB_H": True,
"CRYPTO_BACKEND_BOTAN": True,
"ENABLE_AEAD": True,
"ENABLE_TWOFISH": True,
"ENABLE_BRAINPOOL": True,
+ "PACKAGE_BUGREPORT": '"https://bugzilla.mozilla.org/enter_bug.cgi?product=Thunderbird"',
+ "PACKAGE_STRING": '"rnp {}"'.format(CONFIG["MZLA_LIBRNP_FULL_VERSION"])
}
GeneratedFile(
"src/lib/config.h",
script="/comm/python/rocbuild/process_cmake_define_files.py",
inputs=["src/lib/config.h.in"],