Bug 1621785 - Build configuration for RNP. r=kaie
authorRob Lemley <rob@thunderbird.net>
Tue, 14 Apr 2020 22:29:19 +0000
changeset 38843 a6d09372afd04610039510fd19ed6620f520c14e
parent 38842 ce145705013d3a0dc777bf5413b4d643d93ba5d7
child 38844 b1139f8617d4488b3bb5693c50886c3a9925c43b
push id401
push userclokep@gmail.com
push dateMon, 01 Jun 2020 20:41:59 +0000
reviewerskaie
bugs1621785
Bug 1621785 - Build configuration for RNP. r=kaie Differential Revision: https://phabricator.services.mozilla.com/D70757
third_party/rnp/Makefile.in
third_party/rnp/module.ver
third_party/rnp/moz.build
third_party/rnp/rnp.symbols
new file mode 100644
--- /dev/null
+++ b/third_party/rnp/Makefile.in
@@ -0,0 +1,14 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+
+include $(moztopsrcdir)/config/config.mk
+include $(moztopsrcdir)/config/rules.mk
+
+$(SHARED_LIBRARY): $(OBJS) $(RESFILE) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
+	$(REPORT_BUILD)
+ifndef INCREMENTAL_LINKER
+	$(RM) $@
+endif
+	$(MKSHLIB) $($@_OBJS) $(RESFILE) $(LDFLAGS) $(STATIC_LIBS) $(SHARED_LIBS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS)
new file mode 100644
--- /dev/null
+++ b/third_party/rnp/module.ver
@@ -0,0 +1,8 @@
+WIN32_MODULE_DESCRIPTION=@MOZ_APP_DISPLAYNAME@
+WIN32_MODULE_PRODUCTNAME=@MOZ_APP_DISPLAYNAME@
+WIN32_MODULE_NAME=@MOZ_RNP_DIST_INFO@
+WIN32_MODULE_PRODUCTVERSION=@MOZ_APP_WINVERSION@
+WIN32_MODULE_PRODUCTVERSION_STRING=@MOZ_APP_VERSION@
+WIN32_MODULE_COPYRIGHT=Thunderbird and Mozilla Developers, according to the MPL 1.1/GPL 2.0/LGPL 2.1 licenses, as applicable.
+WIN32_MODULE_COMPANYNAME=MZLA Technologies
+WIN32_MODULE_COMMENT=OpenPGP support library. Includes RNP, Botan, Json-C. See license and README files.
new file mode 100644
--- /dev/null
+++ b/third_party/rnp/moz.build
@@ -0,0 +1,126 @@
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+SharedLibrary('rnp')
+
+include('../rnpdefs.mozbuild')
+
+@template
+def IQuote(*paths):
+    """Add a set of paths to the include path via -iquote"""
+    flags = []
+    for p in paths:
+        if CONFIG['CC_TYPE'] == 'clang-cl':
+            flags += ['-Xclang', '-iquote', '-Xclang']
+        else:
+            flags += ['-iquote']
+        flags += [p]
+    COMPILE_FLAGS['OS_CXXFLAGS'] = flags
+
+
+COMPILE_FLAGS['WARNINGS_CFLAGS'] += [
+    '-Wall',
+    '-Wextra',
+    '-Wunreachable-code',
+    '-Wpointer-arith',
+    '-Wmissing-declarations',
+    '-Wno-pedantic',
+    '-Wno-ignored-qualifiers',
+    '-Wno-unused-parameter',
+    '-Wno-missing-field-initializers',
+]
+
+if CONFIG['CC_TYPE'] == 'clang-cl':
+    CXXFLAGS += [
+        '-Xclang',
+        '-fcxx-exceptions',
+    ]
+else:
+    CXXFLAGS += [
+        '-fcxx-exceptions',
+    ]
+
+
+IQuote('{}/src/lib'.format(OBJDIR),
+       '{}/src/lib'.format(SRCDIR),
+       '{}/../json-c'.format(OBJDIR))
+
+
+DEFINES['_GNU_SOURCE'] = True
+
+DEFINES['HAVE_BZLIB_H'] = True
+DEFINES['HAVE_ZLIB_H'] = True
+DEFINES['MOZ_RNP_DIST_INFO'] = rnp_dist_info
+
+CONFIGURE_DEFINE_FILES += [
+    'src/lib/config.h',
+]
+
+LOCAL_INCLUDES = [
+    '!../botan/build/include',
+    '../bzip2',
+    '../json-c',
+    '../zlib',
+    'include',
+    'src',
+]
+if CONFIG['CC_TYPE'] == 'clang-cl':
+    ForceInclude('{}/../niwcompat/niw_compat.h'.format(SRCDIR))
+    LOCAL_INCLUDES += [
+        '../niwcompat',
+    ]
+
+    OS_LIBS += [
+        '-LIBPATH:{}'.format(CONFIG['COMPILER_RT_BUILTIN_PATH']),
+        CONFIG['COMPILER_RT_BUILTIN_LIB']
+    ]
+
+if CONFIG['MOZ_LIBSTDCXX_TARGET_VERSION']:
+    OS_LIBS += CONFIG['REALTIME_LIBS']
+
+SYMBOLS_FILE = 'rnp.symbols'
+
+
+SOURCES += [
+    'src/lib/crypto.cpp',
+    'src/lib/crypto/bn.cpp',
+    'src/lib/crypto/dsa.cpp',
+    'src/lib/crypto/ec.cpp',
+    'src/lib/crypto/ecdh.cpp',
+    'src/lib/crypto/ecdsa.cpp',
+    'src/lib/crypto/eddsa.cpp',
+    'src/lib/crypto/elgamal.cpp',
+    'src/lib/crypto/hash.cpp',
+    'src/lib/crypto/mpi.cpp',
+    'src/lib/crypto/rng.cpp',
+    'src/lib/crypto/rsa.cpp',
+    'src/lib/crypto/s2k.cpp',
+    'src/lib/crypto/signatures.cpp',
+    'src/lib/crypto/sm2.cpp',
+    'src/lib/crypto/symmetric.cpp',
+    'src/lib/fingerprint.cpp',
+    'src/lib/generate-key.cpp',
+    'src/lib/key-provider.cpp',
+    'src/lib/list.cpp',
+    'src/lib/misc.cpp',
+    'src/lib/pass-provider.cpp',
+    'src/lib/pgp-key.cpp',
+    'src/lib/rnp.cpp',
+    # librekey
+    'src/librekey/key_store_g10.cpp',
+    'src/librekey/key_store_kbx.cpp',
+    'src/librekey/key_store_pgp.cpp',
+    'src/librekey/rnp_key_store.cpp',
+    # librepgp
+    'src/librepgp/stream-armor.cpp',
+    'src/librepgp/stream-common.cpp',
+    'src/librepgp/stream-ctx.cpp',
+    'src/librepgp/stream-dump.cpp',
+    'src/librepgp/stream-key.cpp',
+    'src/librepgp/stream-packet.cpp',
+    'src/librepgp/stream-parse.cpp',
+    'src/librepgp/stream-sig.cpp',
+    'src/librepgp/stream-write.cpp',
+]
new file mode 100644
--- /dev/null
+++ b/third_party/rnp/rnp.symbols
@@ -0,0 +1,187 @@
+rnp_buffer_clear
+rnp_buffer_destroy
+rnp_calculate_iterations
+rnp_dearmor
+rnp_decrypt
+rnp_detect_homedir_info
+rnp_detect_key_format
+rnp_disable_debug
+rnp_dump_packets_to_json
+rnp_dump_packets_to_output
+rnp_enable_debug
+rnp_enarmor
+rnp_ffi_create
+rnp_ffi_destroy
+rnp_ffi_set_key_provider
+rnp_ffi_set_log_fd
+rnp_ffi_set_pass_provider
+rnp_generate_key_25519
+rnp_generate_key_dsa_eg
+rnp_generate_key_ec
+rnp_generate_key_ex
+rnp_generate_key_json
+rnp_generate_key_rsa
+rnp_generate_key_sm2
+rnp_get_default_homedir
+rnp_get_public_key_count
+rnp_get_public_key_data
+rnp_get_secret_key_count
+rnp_get_secret_key_data
+rnp_guess_contents
+rnp_identifier_iterator_create
+rnp_identifier_iterator_destroy
+rnp_identifier_iterator_next
+rnp_import_keys
+rnp_import_signatures
+rnp_input_destroy
+rnp_input_from_callback
+rnp_input_from_memory
+rnp_input_from_path
+rnp_key_add_uid
+rnp_key_allows_usage
+rnp_key_export
+rnp_key_export_revocation
+rnp_key_get_alg
+rnp_key_get_bits
+rnp_key_get_creation
+rnp_key_get_curve
+rnp_key_get_dsa_qbits
+rnp_key_get_expiration
+rnp_key_get_fprint
+rnp_key_get_grip
+rnp_key_get_keyid
+rnp_key_get_primary_grip
+rnp_key_get_primary_uid
+rnp_key_get_revocation_reason
+rnp_key_get_signature_at
+rnp_key_get_signature_count
+rnp_key_get_subkey_at
+rnp_key_get_subkey_count
+rnp_key_get_uid_at
+rnp_key_get_uid_count
+rnp_key_get_uid_handle_at
+rnp_key_handle_destroy
+rnp_key_have_public
+rnp_key_have_secret
+rnp_key_is_compromised
+rnp_key_is_locked
+rnp_key_is_primary
+rnp_key_is_protected
+rnp_key_is_retired
+rnp_key_is_revoked
+rnp_key_is_sub
+rnp_key_is_superseded
+rnp_key_lock
+rnp_key_packets_to_json
+rnp_key_protect
+rnp_key_remove
+rnp_key_to_json
+rnp_key_unlock
+rnp_key_unprotect
+rnp_load_keys
+rnp_locate_key
+rnp_op_encrypt_add_password
+rnp_op_encrypt_add_recipient
+rnp_op_encrypt_add_signature
+rnp_op_encrypt_create
+rnp_op_encrypt_destroy
+rnp_op_encrypt_execute
+rnp_op_encrypt_set_aead
+rnp_op_encrypt_set_aead_bits
+rnp_op_encrypt_set_armor
+rnp_op_encrypt_set_cipher
+rnp_op_encrypt_set_compression
+rnp_op_encrypt_set_creation_time
+rnp_op_encrypt_set_expiration_time
+rnp_op_encrypt_set_file_mtime
+rnp_op_encrypt_set_file_name
+rnp_op_encrypt_set_hash
+rnp_op_generate_add_pref_cipher
+rnp_op_generate_add_pref_compression
+rnp_op_generate_add_pref_hash
+rnp_op_generate_add_usage
+rnp_op_generate_clear_pref_ciphers
+rnp_op_generate_clear_pref_compression
+rnp_op_generate_clear_pref_hashes
+rnp_op_generate_clear_usage
+rnp_op_generate_create
+rnp_op_generate_destroy
+rnp_op_generate_execute
+rnp_op_generate_get_key
+rnp_op_generate_set_bits
+rnp_op_generate_set_curve
+rnp_op_generate_set_dsa_qbits
+rnp_op_generate_set_expiration
+rnp_op_generate_set_hash
+rnp_op_generate_set_pref_keyserver
+rnp_op_generate_set_protection_cipher
+rnp_op_generate_set_protection_hash
+rnp_op_generate_set_protection_iterations
+rnp_op_generate_set_protection_mode
+rnp_op_generate_set_protection_password
+rnp_op_generate_set_request_password
+rnp_op_generate_set_userid
+rnp_op_generate_subkey_create
+rnp_op_sign_add_signature
+rnp_op_sign_cleartext_create
+rnp_op_sign_create
+rnp_op_sign_destroy
+rnp_op_sign_detached_create
+rnp_op_sign_execute
+rnp_op_sign_set_armor
+rnp_op_sign_set_compression
+rnp_op_sign_set_creation_time
+rnp_op_sign_set_expiration_time
+rnp_op_sign_set_file_mtime
+rnp_op_sign_set_file_name
+rnp_op_sign_set_hash
+rnp_op_sign_signature_set_creation_time
+rnp_op_sign_signature_set_expiration_time
+rnp_op_sign_signature_set_hash
+rnp_op_verify_create
+rnp_op_verify_destroy
+rnp_op_verify_detached_create
+rnp_op_verify_execute
+rnp_op_verify_get_file_info
+rnp_op_verify_get_signature_at
+rnp_op_verify_get_signature_count
+rnp_op_verify_signature_get_handle
+rnp_op_verify_signature_get_hash
+rnp_op_verify_signature_get_key
+rnp_op_verify_signature_get_status
+rnp_op_verify_signature_get_times
+rnp_output_destroy
+rnp_output_finish
+rnp_output_memory_get_buf
+rnp_output_to_armor
+rnp_output_to_callback
+rnp_output_to_file
+rnp_output_to_memory
+rnp_output_to_null
+rnp_output_to_path
+rnp_output_write
+rnp_request_password
+rnp_result_to_string
+rnp_save_keys
+rnp_signature_get_alg
+rnp_signature_get_creation
+rnp_signature_get_hash_alg
+rnp_signature_get_keyid
+rnp_signature_get_signer
+rnp_signature_handle_destroy
+rnp_signature_packet_to_json
+rnp_supported_features
+rnp_supports_feature
+rnp_uid_get_signature_at
+rnp_uid_get_signature_count
+rnp_uid_handle_destroy
+rnp_uid_is_revoked
+rnp_unload_keys
+rnp_version
+rnp_version_commit_timestamp
+rnp_version_for
+rnp_version_major
+rnp_version_minor
+rnp_version_patch
+rnp_version_string
+rnp_version_string_full