Merge pull request #123 from miodragpop/master-aarch64
Updates and tweaks which enable cross-building of 64bit arm binaries
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -156,7 +156,9 @@ src/Makefile.in
|
||||
doc/man/Makefile.in
|
||||
Makefile.in
|
||||
src/libcc.so
|
||||
src/libcc.dll
|
||||
src/cc/customcc.so
|
||||
src/cc/customcc.dll
|
||||
src/HUSH3_7776
|
||||
REGTEST_7776
|
||||
src/cc/librogue.so
|
||||
|
||||
56
configure.ac
56
configure.ac
@@ -96,12 +96,6 @@ AC_ARG_ENABLE([mining],
|
||||
[enable_mining=$enableval],
|
||||
[enable_mining=yes])
|
||||
|
||||
AC_ARG_ENABLE([proton],
|
||||
[AS_HELP_STRING([--disable-proton],
|
||||
[disable Proton (AMQP messaging)])],
|
||||
[use_proton=$enableval],
|
||||
[use_proton=yes])
|
||||
|
||||
AC_ARG_ENABLE(tests,
|
||||
AS_HELP_STRING([--enable-tests],[compile tests (default is yes)]),
|
||||
[use_tests=$enableval],
|
||||
@@ -507,15 +501,24 @@ if test x$use_hardening != xno; then
|
||||
HARDENED_CPPFLAGS="$HARDENED_CPPFLAGS -D_FORTIFY_SOURCE=2"
|
||||
],[AC_MSG_ERROR(Cannot enable -D_FORTIFY_SOURCE=2)])
|
||||
|
||||
#AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"],[AC_MSG_ERROR(Cannot enable RELRO)])
|
||||
#AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"],[AC_MSG_ERROR(Cannot enable BIND_NOW)])
|
||||
if test x$BUILD_OS = xdarwin || test x$TARGET_OS = xwindows; then
|
||||
# Xcode's ld (at least ld64-302.3) doesn't support -z
|
||||
# mingw-w64's ld (at least mingw-w64 4.0.4-2) also appears to not support -z
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"],[AC_MSG_WARN(Cannot enable RELRO)])
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"],[AC_MSG_WARN(Cannot enable BIND_NOW)])
|
||||
else
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"],[AC_MSG_ERROR(Cannot enable RELRO)])
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"],[AC_MSG_ERROR(Cannot enable BIND_NOW)])
|
||||
fi
|
||||
|
||||
if test x$TARGET_OS != xwindows; then
|
||||
# All windows code is PIC, forcing it on just adds useless compile warnings
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"],[AC_MSG_ERROR(Cannot enable RELRO)])
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"],[AC_MSG_ERROR(Cannot enable BIND_NOW)])
|
||||
AX_CHECK_COMPILE_FLAG([-fPIE],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fPIE"],[AC_MSG_ERROR(Cannot enable -fPIE)])
|
||||
AX_CHECK_LINK_FLAG([[-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"],[AC_MSG_ERROR(Cannot enable -pie)])
|
||||
AX_CHECK_COMPILE_FLAG([-fPIE],[PIE_FLAGS="-fPIE"],[AC_MSG_ERROR(Cannot enable -fPIE)])
|
||||
if test x$BUILD_OS = xdarwin; then
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-pie"],[AC_MSG_ERROR(Cannot enable -Wl,-pie)])
|
||||
else
|
||||
AX_CHECK_LINK_FLAG([[-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"],[AC_MSG_ERROR(Cannot enable -pie)])
|
||||
fi
|
||||
else
|
||||
# These are only available on Windows.
|
||||
AX_CHECK_LINK_FLAG([[-Wl,--dynamicbase]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--dynamicbase"],[AC_MSG_ERROR(Cannot enable --dynamicbase)])
|
||||
@@ -596,23 +599,6 @@ if test x$enable_wallet != xno; then
|
||||
BITCOIN_FIND_BDB62
|
||||
fi
|
||||
|
||||
dnl Check Qpid Proton headers and library exist
|
||||
if test x$use_proton = xyes; then
|
||||
AC_CHECK_HEADERS([proton/connection.hpp],
|
||||
[],
|
||||
[AC_MSG_WARN([Proton headers not found, disabling Proton support])
|
||||
use_proton=no])
|
||||
AC_CHECK_LIB([qpid-proton-cpp], [main],
|
||||
[PROTON_LIBS="-lqpid-proton-cpp -lqpid-proton"],
|
||||
[AC_MSG_WARN([Proton libraries not found, disabling Proton support])
|
||||
use_proton=no])
|
||||
fi
|
||||
if test x$use_proton = xyes; then
|
||||
AC_DEFINE(ENABLE_PROTON, 1, [Define to 1 to enable Proton functions])
|
||||
else
|
||||
AC_DEFINE(ENABLE_PROTON, 0, [Define to 1 to enable Proton functions])
|
||||
fi
|
||||
|
||||
if test x$build_bitcoin_utils$build_bitcoind$use_tests = xnonono; then
|
||||
use_boost=no
|
||||
else
|
||||
@@ -756,6 +742,14 @@ fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# These packages don't provide pkgconfig config files across all
|
||||
# platforms, so we use older autoconf detection mechanisms:
|
||||
AC_CHECK_HEADER([gmp.h],,AC_MSG_ERROR(libgmp headers missing))
|
||||
AC_CHECK_LIB([gmp],[[__gmpn_sub_n]],GMP_LIBS=-lgmp, [AC_MSG_ERROR(libgmp missing)])
|
||||
|
||||
AC_CHECK_HEADER([gmpxx.h],,AC_MSG_ERROR(libgmpxx headers missing))
|
||||
AC_CHECK_LIB([gmpxx],[main],GMPXX_LIBS=-lgmpxx, [AC_MSG_ERROR(libgmpxx missing)])
|
||||
|
||||
RUST_LIBS="-lrustzcash"
|
||||
case $host in
|
||||
*mingw*)
|
||||
@@ -832,8 +826,6 @@ fi
|
||||
|
||||
AM_CONDITIONAL([ENABLE_ZMQ], [test "x$use_zmq" = "xyes"])
|
||||
|
||||
AM_CONDITIONAL([ENABLE_PROTON], [test "x$use_proton" = "xyes"])
|
||||
|
||||
AC_MSG_CHECKING([whether to build test_bitcoin])
|
||||
if test x$use_tests = xyes; then
|
||||
AC_MSG_RESULT([yes])
|
||||
@@ -906,7 +898,6 @@ AC_SUBST(ZMQ_LIBS)
|
||||
AC_SUBST(GMP_LIBS)
|
||||
AC_SUBST(GMPXX_LIBS)
|
||||
AC_SUBST(LIBZCASH_LIBS)
|
||||
AC_SUBST(PROTON_LIBS)
|
||||
AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile src/test/buildenv.py])
|
||||
AC_CONFIG_FILES([qa/pull-tester/run-bitcoind-for-test.sh],[chmod +x qa/pull-tester/run-bitcoind-for-test.sh])
|
||||
AC_CONFIG_FILES([qa/pull-tester/tests-config.sh],[chmod +x qa/pull-tester/tests-config.sh])
|
||||
@@ -953,7 +944,6 @@ esac
|
||||
echo
|
||||
echo "Options used to compile and link:"
|
||||
echo " with wallet = $enable_wallet"
|
||||
echo " with proton = $use_proton"
|
||||
echo " with zmq = $use_zmq"
|
||||
echo " with test = $use_tests"
|
||||
echo " debug enabled = $enable_debug"
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2017 The Zcash developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
# Requirements:
|
||||
# pip install python-qpid-proton
|
||||
|
||||
import binascii
|
||||
from proton.handlers import MessagingHandler
|
||||
from proton.reactor import Container
|
||||
|
||||
port = 5672
|
||||
|
||||
class Server(MessagingHandler):
|
||||
def __init__(self, url):
|
||||
super(Server, self).__init__()
|
||||
self.url = url
|
||||
self.senders = {}
|
||||
|
||||
def on_start(self, event):
|
||||
print "Listening on:", self.url
|
||||
self.container = event.container
|
||||
self.acceptor = event.container.listen(self.url)
|
||||
|
||||
def on_message(self, event):
|
||||
m = event.message
|
||||
topic = m.subject
|
||||
body = m.body
|
||||
sequence = str( m.properties['x-opt-sequence-number'] )
|
||||
if topic == "hashablock":
|
||||
print '- HASH BLOCK ('+sequence+') -'
|
||||
print binascii.hexlify(body)
|
||||
elif topic == "hashtx":
|
||||
print '- HASH TX ('+sequence+') -'
|
||||
print binascii.hexlify(body)
|
||||
elif topic == "rawblock":
|
||||
print '- RAW BLOCK HEADER ('+sequence+') -'
|
||||
print binascii.hexlify(body[:80])
|
||||
elif topic == "rawtx":
|
||||
print '- RAW TX ('+sequence+') -'
|
||||
print binascii.hexlify(body)
|
||||
|
||||
try:
|
||||
Container(Server("127.0.0.1:%i" % port)).run()
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
@@ -52,10 +52,6 @@ Files: depends/sources/google*.tar.gz
|
||||
Copyright: 2008 Google Inc.
|
||||
License: BSD-3clause-Google
|
||||
|
||||
Files: depends/sources/qpid-proton-*.tar.gz
|
||||
Copyright: 2012-2017 The Apache Software Foundation
|
||||
License: Apache-Qpid-Proton-with-BSD-Subcomponents
|
||||
|
||||
Files: src/secp256k1/build-aux/m4/ax_jni_include_dir.m4
|
||||
Copyright: 2008 Don Anderson <dda@sleepycat.com>
|
||||
License: GNU-All-permissive-License
|
||||
@@ -1101,222 +1097,6 @@ Comment:
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
License: Apache-Qpid-Proton-with-BSD-Subcomponents
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
.
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
.
|
||||
1. Definitions.
|
||||
.
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
.
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
.
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
.
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
.
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
.
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
.
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
.
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
.
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
.
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
.
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
.
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
.
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
.
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
.
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
.
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
.
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
.
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
.
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
.
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
.
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
.
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
.
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
.
|
||||
END OF TERMS AND CONDITIONS
|
||||
.
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
.
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
.
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
.
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
.
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
.
|
||||
.
|
||||
PROTON SUBCOMPONENTS:
|
||||
.
|
||||
Proton includes freegetopt with a separate BSD license. Your use
|
||||
of the source code for freegetopt is subject to the terms and
|
||||
conditions of its license in examples/include/pncompat/internal/LICENSE.
|
||||
.
|
||||
The setup scripts for the python bindings include files derived by
|
||||
PyZMQ and are licensed with a separate Modified BSD license. Use of
|
||||
the source code in these setup files are subject to the terms and
|
||||
conditions in the license:
|
||||
proton-c/bindings/python/setuputils/PYZMQ_LICENSE.BSD.
|
||||
|
||||
License: GNU-All-permissive-License
|
||||
Copying and distribution of this file, with or without modification, are
|
||||
permitted in any medium without royalty provided the copyright notice
|
||||
|
||||
@@ -85,7 +85,7 @@ script: |
|
||||
BASEPREFIX=`pwd`/depends
|
||||
# Build dependencies for each host
|
||||
for i in $HOSTS; do
|
||||
NO_PROTON="x" make ${MAKEOPTS} -C ${BASEPREFIX} HOST="${i}"
|
||||
make ${MAKEOPTS} -C ${BASEPREFIX} HOST="${i}"
|
||||
done
|
||||
|
||||
# Faketime for binaries
|
||||
|
||||
1
depends/.gitignore
vendored
1
depends/.gitignore
vendored
@@ -7,3 +7,4 @@ x86_64*
|
||||
i686*
|
||||
mips*
|
||||
arm*
|
||||
aarch64*
|
||||
|
||||
@@ -74,9 +74,8 @@ include builders/default.mk
|
||||
include packages/packages.mk
|
||||
|
||||
wallet_packages_$(NO_WALLET) = $(wallet_packages)
|
||||
proton_packages_$(NO_PROTON) = $(proton_packages)
|
||||
|
||||
packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(rust_packages) $(proton_packages_) $(wallet_packages_)
|
||||
packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(rust_packages) $(wallet_packages_)
|
||||
native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages)
|
||||
all_packages = $(packages) $(native_packages)
|
||||
|
||||
@@ -112,6 +111,7 @@ $(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_
|
||||
-e 's|@CXXFLAGS@|$(strip $(host_CXXFLAGS) $(host_$(release_type)_CXXFLAGS))|' \
|
||||
-e 's|@CPPFLAGS@|$(strip $(host_CPPFLAGS) $(host_$(release_type)_CPPFLAGS))|' \
|
||||
-e 's|@LDFLAGS@|$(strip $(host_LDFLAGS) $(host_$(release_type)_LDFLAGS))|' \
|
||||
-e 's|@rust_target@|$(call rust_target,rust,$(canonical_host),$(host_os))|' \
|
||||
-e 's|@no_wallet@|$(NO_WALLET)|' \
|
||||
-e 's|@debug@|$(DEBUG)|' \
|
||||
$< > $@
|
||||
|
||||
@@ -13,6 +13,9 @@ if test -z $enable_wallet && test -n "@no_wallet@"; then
|
||||
enable_wallet=no
|
||||
fi
|
||||
|
||||
RUST_TARGET="@rust_target@"
|
||||
RUST_VENDORED_SOURCES="$depends_prefix/vendored-sources"
|
||||
|
||||
if test x@host_os@ = xdarwin; then
|
||||
BREW=no
|
||||
PORT=no
|
||||
|
||||
@@ -40,7 +40,7 @@ endef
|
||||
|
||||
define vendor_crate_source
|
||||
mkdir -p $($(1)_staging_prefix_dir)/$(CRATE_REGISTRY) && \
|
||||
cp -r $($(1)_extract_dir) $($(1)_staging_prefix_dir)/$(CRATE_REGISTRY)/$($(1)_crate_name) && \
|
||||
cp -r $($(1)_extract_dir) $($(1)_staging_prefix_dir)/$(CRATE_REGISTRY)/$($(1)_crate_versioned_name) && \
|
||||
cd $($(1)_staging_prefix_dir)/$(CRATE_REGISTRY)/$($(1)_crate_versioned_name) && \
|
||||
rm -r `basename $($(1)_patch_dir)` .stamp_* .$($(1)_file_name).hash
|
||||
endef
|
||||
@@ -59,8 +59,8 @@ $(eval $(1)_build_id:=$(shell echo -n "$($(1)_build_id_long)" | $(build_SHA256SU
|
||||
final_build_id_long+=$($(package)_build_id_long)
|
||||
|
||||
#override platform specific files and hashes
|
||||
$(eval $(1)_file_name=$(if $($(1)_file_name_$(host_os)),$($(1)_file_name_$(host_os)),$($(1)_file_name)))
|
||||
$(eval $(1)_sha256_hash=$(if $($(1)_sha256_hash_$(host_os)),$($(1)_sha256_hash_$(host_os)),$($(1)_sha256_hash)))
|
||||
$(eval $(1)_file_name=$(if $($(1)_exact_file_name),$($(1)_exact_file_name),$(if $($(1)_file_name_$(host_os)),$($(1)_file_name_$(host_os)),$($(1)_file_name))))
|
||||
$(eval $(1)_sha256_hash=$(if $($(1)_exact_sha256_hash),$($(1)_exact_sha256_hash),$(if $($(1)_sha256_hash_$(host_os)),$($(1)_sha256_hash_$(host_os)),$($(1)_sha256_hash))))
|
||||
|
||||
#compute package-specific paths
|
||||
$(1)_build_subdir?=.
|
||||
@@ -91,6 +91,7 @@ $(1)_download_path_fixed=$(subst :,\:,$$($(1)_download_path))
|
||||
|
||||
|
||||
#default commands
|
||||
# The default behavior for tar will try to set ownership when running as uid 0 and may not succeed, --no-same-owner disables this behavior
|
||||
$(1)_fetch_cmds ?= $(call fetch_file,$(1),$(subst \:,:,$$($(1)_download_path_fixed)),$$($(1)_download_file),$($(1)_file_name),$($(1)_sha256_hash))
|
||||
$(1)_extract_cmds ?= mkdir -p $$($(1)_extract_dir) && echo "$$($(1)_sha256_hash) $$($(1)_source)" > $$($(1)_extract_dir)/.$$($(1)_file_name).hash && $(build_SHA256SUM) -c $$($(1)_extract_dir)/.$$($(1)_file_name).hash && tar --no-same-owner --strip-components=1 -xf $$($(1)_source)
|
||||
$(1)_preprocess_cmds ?=
|
||||
@@ -193,7 +194,7 @@ $($(1)_preprocessed): | $($(1)_dependencies) $($(1)_extracted)
|
||||
$(AT)touch $$@
|
||||
$($(1)_configured): | $($(1)_preprocessed)
|
||||
$(AT)echo Configuring $(1)...
|
||||
$(AT)rm -rf $(host_prefix); mkdir -p $(host_prefix)/lib; cd $(host_prefix); $(foreach package,$($(1)_all_dependencies), tar xf $($(package)_cached); )
|
||||
$(AT)rm -rf $(host_prefix); mkdir -p $(host_prefix)/lib; cd $(host_prefix); $(foreach package,$($(1)_all_dependencies), tar --no-same-owner -xf $($(package)_cached); )
|
||||
$(AT)mkdir -p $$(@D)
|
||||
$(AT)+cd $$(@D); $($(1)_config_env) $(call $(1)_config_cmds, $(1))
|
||||
$(AT)touch $$@
|
||||
|
||||
@@ -9,6 +9,11 @@ define $(package)_set_vars
|
||||
$(package)_config_opts=--disable-shared --enable-cxx --disable-replication
|
||||
$(package)_config_opts_mingw32=--enable-mingw
|
||||
$(package)_config_opts_linux=--with-pic
|
||||
$(package)_config_opts_freebsd=--with-pic
|
||||
ifneq ($(build_os),darwin)
|
||||
$(package)_config_opts_darwin=--disable-atomicsupport
|
||||
endif
|
||||
$(package)_config_opts_aarch64=--disable-atomicsupport
|
||||
$(package)_cxxflags=-std=c++11
|
||||
endef
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ $(package)_dependencies=openssl
|
||||
$(package)_download_path=https://curl.haxx.se/download
|
||||
$(package)_file_name=curl-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=52af3361cf806330b88b4fe6f483b6844209d47ae196ac46da4de59bb361ab02
|
||||
$(package)_config_opts_linux=--disable-shared --enable-static --prefix=$(host_prefix) --host=x86_64-unknown-linux-gnu
|
||||
$(package)_config_opts_linux=--disable-shared --enable-static --prefix=$(host_prefix) --host=$(host)
|
||||
$(package)_config_opts_mingw32=--enable-mingw --disable-shared --enable-static --prefix=$(host_prefix) --host=x86_64-w64-mingw32
|
||||
$(package)_config_opts_darwin=--disable-shared --enable-static --prefix=$(host_prefix)
|
||||
$(package)_cflags_darwin=-mmacosx-version-min=10.9
|
||||
|
||||
@@ -8,15 +8,29 @@ $(package)_git_commit=06da3b9ac8f278e5d4ae13088cf0a4c03d2c13f5
|
||||
$(package)_dependencies=rust $(rust_crates)
|
||||
$(package)_patches=cargo.config 0001-Start-using-cargo-clippy-for-CI.patch remove-dev-dependencies.diff no-groth16.patch
|
||||
|
||||
$(package)_rust_target=$(if $(rust_rust_target_$(canonical_host)),$(rust_rust_target_$(canonical_host)),$(canonical_host))
|
||||
|
||||
ifeq ($(host_os),mingw32)
|
||||
$(package)_library_file=target/x86_64-pc-windows-gnu/release/rustzcash.lib
|
||||
else ifneq ($(canonical_host),$(build))
|
||||
ifeq ($(host_os),darwin)
|
||||
$(package)_library_file=target/x86_64-apple-darwin/release/librustzcash.a
|
||||
else
|
||||
$(package)_library_file=target/$($(package)_rust_target)/release/librustzcash.a
|
||||
endif
|
||||
else
|
||||
$(package)_library_file=target/release/librustzcash.a
|
||||
endif
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_build_opts=--frozen --release
|
||||
$(package)_build_opts_mingw32=--target=x86_64-pc-windows-gnu
|
||||
ifneq ($(canonical_host),$(build))
|
||||
ifeq ($(host_os),darwin)
|
||||
$(package)_build_opts+=--target=x86_64-apple-darwin
|
||||
else
|
||||
$(package)_build_opts+=--target=$($(package)_rust_target)
|
||||
endif
|
||||
endif
|
||||
endef
|
||||
|
||||
define $(package)_preprocess_cmds
|
||||
@@ -27,7 +41,7 @@ define $(package)_preprocess_cmds
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
cargo build --package librustzcash $($(package)_build_opts)
|
||||
$(host_prefix)/native/bin/cargo build --package librustzcash $($(package)_build_opts)
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
rust_packages := rust librustzcash
|
||||
|
||||
ifeq ($(build_os),darwin)
|
||||
zcash_packages := libgmp libsodium utfcpp
|
||||
else
|
||||
proton_packages := proton
|
||||
zcash_packages := libgmp libsodium utfcpp
|
||||
endif
|
||||
|
||||
zcash_packages := libgmp libsodium utfcpp
|
||||
rust_crates := \
|
||||
crate_aes \
|
||||
crate_aesni \
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
package=proton
|
||||
$(package)_version=0.26.0
|
||||
$(package)_download_path=https://archive.apache.org/dist/qpid/proton/$($(package)_version)
|
||||
$(package)_file_name=qpid-proton-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=0eddac870f0085b9aeb0c9da333bd3f53fedb7c872164171a7cc06761ddbbd75
|
||||
$(package)_patches=minimal-build.patch
|
||||
|
||||
define $(package)_preprocess_cmds
|
||||
patch -p1 < $($(package)_patch_dir)/minimal-build.patch && \
|
||||
mkdir -p build/proton-c/src
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
cd build; cmake .. -DCMAKE_CXX_STANDARD=11 -DCMAKE_INSTALL_PREFIX=/ -DSYSINSTALL_BINDINGS=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_PYTHON=OFF -DBUILD_PHP=OFF -DBUILD_JAVA=OFF -DBUILD_PERL=OFF -DBUILD_RUBY=OFF -DBUILD_JAVASCRIPT=OFF -DBUILD_GO=OFF -DBUILD_STATIC_LIBS=ON
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
cd build; $(MAKE) VERBOSE=1
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
cd build; $(MAKE) VERBOSE=1 DESTDIR=$($(package)_staging_prefix_dir) install
|
||||
endef
|
||||
@@ -1,7 +1,6 @@
|
||||
package=rust
|
||||
$(package)_version=1.32.0
|
||||
$(package)_download_path=https://static.rust-lang.org/dist
|
||||
|
||||
$(package)_file_name_linux=rust-$($(package)_version)-x86_64-unknown-linux-gnu.tar.gz
|
||||
$(package)_sha256_hash_linux=e024698320d76b74daf0e6e71be3681a1e7923122e3ebd03673fcac3ecc23810
|
||||
$(package)_file_name_darwin=rust-$($(package)_version)-x86_64-apple-darwin.tar.gz
|
||||
@@ -9,20 +8,26 @@ $(package)_sha256_hash_darwin=f0dfba507192f9b5c330b5984ba71d57d434475f3d62bd44a3
|
||||
$(package)_file_name_mingw32=rust-$($(package)_version)-x86_64-pc-windows-gnu.tar.gz
|
||||
$(package)_sha256_hash_mingw32=358e1435347c67dbf33aa9cad6fe501a833d6633ed5d5aa1863d5dffa0349be9
|
||||
|
||||
ifeq ($(build_os),darwin)
|
||||
$(package)_file_name=$($(package)_file_name_darwin)
|
||||
$(package)_sha256_hash=$($(package)_sha256_hash_darwin)
|
||||
else ifeq ($(host_os),mingw32)
|
||||
$(package)_file_name=$($(package)_file_name_mingw32)
|
||||
$(package)_sha256_hash=$($(package)_sha256_hash_mingw32)
|
||||
else
|
||||
$(package)_file_name=$($(package)_file_name_linux)
|
||||
$(package)_sha256_hash=$($(package)_sha256_hash_linux)
|
||||
endif
|
||||
# Mapping from GCC canonical hosts to Rust targets
|
||||
# If a mapping is not present, we assume they are identical, unless $host_os is
|
||||
# "darwin", in which case we assume x86_64-apple-darwin.
|
||||
$(package)_rust_target_x86_64-w64-mingw32=x86_64-pc-windows-gnu
|
||||
|
||||
ifeq ($(host_os),mingw32)
|
||||
# Mapping from Rust targets to SHA-256 hashes
|
||||
$(package)_rust_std_sha256_hash_aarch64-unknown-linux-gnu=346efe3aef2aff7b71a611bf7661bcec5f9bc4025a599c2866ec5fd330247cb9
|
||||
$(package)_rust_std_sha256_hash_x86_64-apple-darwin=b736d035a97f830585360e54e3f8877b68c942211cf0a75e805f34bfb36103a6
|
||||
$(package)_rust_std_sha256_hash_x86_64-pc-windows-gnu=cad5f1454d591c13eeb3657f1c9dbfeb30e648f59680bd0765b94c63e7afc49e
|
||||
|
||||
define rust_target
|
||||
$(if $($(1)_rust_target_$(2)),$($(1)_rust_target_$(2)),$(if $(findstring darwin,$(3)),x86_64-apple-darwin,$(2)))
|
||||
endef
|
||||
|
||||
ifneq ($(canonical_host),$(build))
|
||||
$(package)_rust_target=$(call rust_target,$(package),$(canonical_host),$(host_os))
|
||||
$(package)_exact_file_name=rust-std-$($(package)_version)-$($(package)_rust_target).tar.gz
|
||||
$(package)_exact_sha256_hash=$($(package)_rust_std_sha256_hash_$($(package)_rust_target))
|
||||
$(package)_build_subdir=buildos
|
||||
$(package)_extra_sources = $($(package)_file_name_$(build_os))
|
||||
$(package)_extra_sources=$($(package)_file_name_$(build_os))
|
||||
|
||||
define $(package)_fetch_cmds
|
||||
$(call fetch_file,$(package),$($(package)_download_path),$($(package)_download_file),$($(package)_file_name),$($(package)_sha256_hash)) && \
|
||||
@@ -34,19 +39,19 @@ define $(package)_extract_cmds
|
||||
echo "$($(package)_sha256_hash) $($(package)_source)" > $($(package)_extract_dir)/.$($(package)_file_name).hash && \
|
||||
echo "$($(package)_sha256_hash_$(build_os)) $($(package)_source_dir)/$($(package)_file_name_$(build_os))" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
|
||||
$(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \
|
||||
mkdir mingw32 && \
|
||||
tar --strip-components=1 -xf $($(package)_source) -C mingw32 && \
|
||||
mkdir $(canonical_host) && \
|
||||
tar --strip-components=1 -xf $($(package)_source) -C $(canonical_host) && \
|
||||
mkdir buildos && \
|
||||
tar --strip-components=1 -xf $($(package)_source_dir)/$($(package)_file_name_$(build_os)) -C buildos
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
./install.sh --destdir=$($(package)_staging_dir) --prefix=$(host_prefix)/native --disable-ldconfig && \
|
||||
cp -r ../mingw32/rust-std-x86_64-pc-windows-gnu/lib/rustlib/x86_64-pc-windows-gnu $($(package)_staging_dir)$(host_prefix)/native/lib/rustlib
|
||||
bash ./install.sh --destdir=$($(package)_staging_dir) --prefix=$(host_prefix)/native --disable-ldconfig && \
|
||||
../$(canonical_host)/install.sh --destdir=$($(package)_staging_dir) --prefix=$(host_prefix)/native --disable-ldconfig
|
||||
endef
|
||||
else
|
||||
|
||||
define $(package)_stage_cmds
|
||||
./install.sh --destdir=$($(package)_staging_dir) --prefix=$(host_prefix)/native --disable-ldconfig
|
||||
bash ./install.sh --destdir=$($(package)_staging_dir) --prefix=$(host_prefix)/native --disable-ldconfig
|
||||
endef
|
||||
endif
|
||||
|
||||
@@ -1,288 +0,0 @@
|
||||
From 03f5fc0826115edbfca468261b70c0daf627f488 Mon Sep 17 00:00:00 2001
|
||||
From: Simon <simon@bitcartel.com>
|
||||
Date: Thu, 27 Apr 2017 17:15:59 -0700
|
||||
Subject: [PATCH] Enable C++11, build static library and cpp bindings with minimal dependencies.
|
||||
|
||||
---
|
||||
CMakeLists.txt | 13 +++++++------
|
||||
examples/cpp/CMakeLists.txt | 1 +
|
||||
proton-c/CMakeLists.txt | 32 +++++++++++++++----------------
|
||||
proton-c/bindings/CMakeLists.txt | 6 +++---
|
||||
proton-c/bindings/cpp/CMakeLists.txt | 24 +++++++++++------------
|
||||
proton-c/bindings/cpp/docs/CMakeLists.txt | 2 +-
|
||||
proton-c/docs/api/CMakeLists.txt | 2 +-
|
||||
7 files changed, 41 insertions(+), 39 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index b538ffd..4a5e787 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -18,14 +18,15 @@
|
||||
#
|
||||
cmake_minimum_required (VERSION 2.8.7)
|
||||
|
||||
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
project (Proton C)
|
||||
|
||||
# Enable C++ now for examples and bindings subdirectories, but make it optional.
|
||||
enable_language(CXX OPTIONAL)
|
||||
|
||||
# Enable testing
|
||||
-enable_testing()
|
||||
-include (CTest)
|
||||
+#enable_testing()
|
||||
+#include (CTest)
|
||||
|
||||
# Pull in local cmake modules
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/tools/cmake/Modules/")
|
||||
@@ -141,7 +142,7 @@ set (BINDINGS_DIR ${LIB_INSTALL_DIR}/proton/bindings)
|
||||
|
||||
set (SYSINSTALL_BINDINGS OFF CACHE BOOL "If SYSINSTALL_BINDINGS is OFF then proton bindings will be installed underneath ${BINDINGS_DIR} and each user will need to modify their interpreter configuration to load the appropriate binding. If SYSINSTALL_BINDINGS is ON, then each language interpreter will be queried for the appropriate directory and proton bindings will be installed and available system wide with no additional per user configuration.")
|
||||
|
||||
-set (BINDING_LANGS PERL PHP PYTHON RUBY)
|
||||
+#set (BINDING_LANGS PERL PHP PYTHON RUBY)
|
||||
|
||||
foreach (LANG ${BINDING_LANGS})
|
||||
set (SYSINSTALL_${LANG} OFF CACHE BOOL "Install ${LANG} bindings into interpreter specified location.")
|
||||
@@ -156,10 +157,10 @@ set (PROTON_SHARE ${SHARE_INSTALL_DIR}/proton-${PN_VERSION})
|
||||
# End of variables used during install
|
||||
|
||||
# Check for valgrind here so tests under proton-c/ and examples/ can use it.
|
||||
-find_program(VALGRIND_EXE valgrind DOC "Location of the valgrind program")
|
||||
+#find_program(VALGRIND_EXE valgrind DOC "Location of the valgrind program")
|
||||
mark_as_advanced (VALGRIND_EXE)
|
||||
|
||||
-option(ENABLE_VALGRIND "Use valgrind to detect run-time problems" ON)
|
||||
+#option(ENABLE_VALGRIND "Use valgrind to detect run-time problems" ON)
|
||||
if (ENABLE_VALGRIND)
|
||||
if (NOT VALGRIND_EXE)
|
||||
message(STATUS "Can't locate the valgrind command; no run-time error detection")
|
||||
@@ -171,7 +172,7 @@ if (ENABLE_VALGRIND)
|
||||
endif (ENABLE_VALGRIND)
|
||||
|
||||
add_subdirectory(proton-c)
|
||||
-add_subdirectory(examples)
|
||||
+#add_subdirectory(examples)
|
||||
|
||||
install (FILES LICENSE README.md
|
||||
DESTINATION ${PROTON_SHARE})
|
||||
diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt
|
||||
index 304d899..f4877b4 100644
|
||||
--- a/examples/cpp/CMakeLists.txt
|
||||
+++ b/examples/cpp/CMakeLists.txt
|
||||
@@ -17,6 +17,7 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
find_package(ProtonCpp REQUIRED)
|
||||
|
||||
include_directories(${ProtonCpp_INCLUDE_DIRS})
|
||||
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
|
||||
index 8edb661..dc7b99c 100644
|
||||
--- a/proton-c/CMakeLists.txt
|
||||
+++ b/proton-c/CMakeLists.txt
|
||||
@@ -22,24 +22,24 @@ include(CheckSymbolExists)
|
||||
|
||||
include(soversion.cmake)
|
||||
|
||||
-add_custom_target(docs)
|
||||
-add_custom_target(doc DEPENDS docs)
|
||||
+#add_custom_target(docs)
|
||||
+#add_custom_target(doc DEPENDS docs)
|
||||
|
||||
# Set the default SSL/TLS implementation
|
||||
-find_package(OpenSSL)
|
||||
+#find_package(OpenSSL)
|
||||
find_package(PythonInterp REQUIRED)
|
||||
-find_package(SWIG)
|
||||
+#find_package(SWIG)
|
||||
# FindSwig.cmake "forgets" make its outputs advanced like a good citizen
|
||||
mark_as_advanced(SWIG_DIR SWIG_EXECUTABLE SWIG_VERSION)
|
||||
|
||||
# See if Cyrus SASL is available
|
||||
-find_library(CYRUS_SASL_LIBRARY sasl2)
|
||||
-find_path(CYRUS_SASL_INCLUDE_DIR sasl/sasl.h PATH_SUFFIXES include)
|
||||
-find_package_handle_standard_args(CyrusSASL DEFAULT_MSG CYRUS_SASL_LIBRARY CYRUS_SASL_INCLUDE_DIR)
|
||||
+#find_library(CYRUS_SASL_LIBRARY sasl2)
|
||||
+#find_path(CYRUS_SASL_INCLUDE_DIR sasl/sasl.h PATH_SUFFIXES include)
|
||||
+#find_package_handle_standard_args(CyrusSASL DEFAULT_MSG CYRUS_SASL_LIBRARY CYRUS_SASL_INCLUDE_DIR)
|
||||
mark_as_advanced(CYRUS_SASL_LIBRARY CYRUS_SASL_INCLUDE_DIR)
|
||||
|
||||
# Find saslpasswd2 executable to generate test config
|
||||
-find_program(SASLPASSWD_EXE saslpasswd2 DOC "Program used to make SASL user db for testing")
|
||||
+#find_program(SASLPASSWD_EXE saslpasswd2 DOC "Program used to make SASL user db for testing")
|
||||
mark_as_advanced(SASLPASSWD_EXE)
|
||||
|
||||
if(WIN32 AND NOT CYGWIN)
|
||||
@@ -315,8 +315,8 @@ pn_absolute_install_dir(EXEC_PREFIX "." ${CMAKE_INSTALL_PREFIX})
|
||||
pn_absolute_install_dir(LIBDIR ${LIB_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX})
|
||||
pn_absolute_install_dir(INCLUDEDIR ${INCLUDE_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
-add_subdirectory(docs/api)
|
||||
-add_subdirectory(../tests/tools/apps/c ../tests/tools/apps/c)
|
||||
+#add_subdirectory(docs/api)
|
||||
+#add_subdirectory(../tests/tools/apps/c ../tests/tools/apps/c)
|
||||
|
||||
# for full source distribution:
|
||||
set (qpid-proton-platform-all
|
||||
@@ -507,7 +507,7 @@ if (BUILD_WITH_CXX)
|
||||
endif (BUILD_WITH_CXX)
|
||||
|
||||
add_library (
|
||||
- qpid-proton-core SHARED
|
||||
+ qpid-proton-core STATIC
|
||||
${qpid-proton-core}
|
||||
${qpid-proton-layers}
|
||||
${qpid-proton-platform}
|
||||
@@ -527,7 +527,7 @@ set_target_properties (
|
||||
)
|
||||
|
||||
add_library(
|
||||
- qpid-proton SHARED
|
||||
+ qpid-proton STATIC
|
||||
# Proton Core
|
||||
${qpid-proton-core}
|
||||
${qpid-proton-layers}
|
||||
@@ -629,7 +629,7 @@ install (FILES
|
||||
|
||||
# c tests:
|
||||
|
||||
-add_subdirectory(src/tests)
|
||||
+#add_subdirectory(src/tests)
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
|
||||
# No change needed for windows already use correct separator
|
||||
@@ -712,7 +712,7 @@ if (BUILD_PYTHON)
|
||||
|
||||
endif (BUILD_PYTHON)
|
||||
|
||||
-find_program(RUBY_EXE "ruby")
|
||||
+#find_program(RUBY_EXE "ruby")
|
||||
if (RUBY_EXE AND BUILD_RUBY)
|
||||
set (rb_root "${pn_test_root}/ruby")
|
||||
set (rb_src "${CMAKE_CURRENT_SOURCE_DIR}/bindings/ruby")
|
||||
@@ -751,8 +751,8 @@ if (RUBY_EXE AND BUILD_RUBY)
|
||||
else (DEFAULT_RUBY_TESTING)
|
||||
message(STATUS "Skipping Ruby tests: missing dependencies")
|
||||
endif (DEFAULT_RUBY_TESTING)
|
||||
-else (RUBY_EXE)
|
||||
- message (STATUS "Cannot find ruby, skipping ruby tests")
|
||||
+#else (RUBY_EXE)
|
||||
+# message (STATUS "Cannot find ruby, skipping ruby tests")
|
||||
endif()
|
||||
|
||||
mark_as_advanced (RUBY_EXE RSPEC_EXE)
|
||||
diff --git a/proton-c/bindings/CMakeLists.txt b/proton-c/bindings/CMakeLists.txt
|
||||
index 6b88384..d1a50a5 100644
|
||||
--- a/proton-c/bindings/CMakeLists.txt
|
||||
+++ b/proton-c/bindings/CMakeLists.txt
|
||||
@@ -19,14 +19,14 @@
|
||||
|
||||
# Add bindings that do not require swig here - the directory name must be the same as the binding name
|
||||
# See below for swig bindings
|
||||
-set(BINDINGS javascript cpp go)
|
||||
+set(BINDINGS cpp)
|
||||
|
||||
# Prerequisites for javascript.
|
||||
#
|
||||
# It uses a C/C++ to JavaScript cross-compiler called emscripten (https://github.com/kripken/emscripten). Emscripten takes C/C++
|
||||
# and compiles it into a highly optimisable subset of JavaScript called asm.js (http://asmjs.org/) that can be
|
||||
# aggressively optimised and run at near-native speed (usually between 1.5 to 10 times slower than native C/C++).
|
||||
-find_package(Emscripten)
|
||||
+#find_package(Emscripten)
|
||||
if (EMSCRIPTEN_FOUND)
|
||||
set (DEFAULT_JAVASCRIPT ON)
|
||||
endif (EMSCRIPTEN_FOUND)
|
||||
@@ -37,7 +37,7 @@ if (CMAKE_CXX_COMPILER)
|
||||
endif (CMAKE_CXX_COMPILER)
|
||||
|
||||
# Prerequisites for Go
|
||||
-find_program(GO_EXE go)
|
||||
+#find_program(GO_EXE go)
|
||||
mark_as_advanced(GO_EXE)
|
||||
if (GO_EXE)
|
||||
if(WIN32)
|
||||
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
|
||||
index 0cc4024..796fe29 100644
|
||||
--- a/proton-c/bindings/cpp/CMakeLists.txt
|
||||
+++ b/proton-c/bindings/cpp/CMakeLists.txt
|
||||
@@ -16,7 +16,7 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
-
|
||||
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
include(cpp.cmake) # Compiler checks
|
||||
|
||||
include_directories(
|
||||
@@ -89,7 +89,7 @@ set_source_files_properties (
|
||||
COMPILE_FLAGS "${LTO}"
|
||||
)
|
||||
|
||||
-add_library(qpid-proton-cpp SHARED ${qpid-proton-cpp-source})
|
||||
+add_library(qpid-proton-cpp STATIC ${qpid-proton-cpp-source})
|
||||
|
||||
target_link_libraries (qpid-proton-cpp ${PLATFORM_LIBS} qpid-proton)
|
||||
|
||||
@@ -120,8 +120,8 @@ endif (MSVC)
|
||||
|
||||
install (DIRECTORY "include/proton" DESTINATION ${INCLUDE_INSTALL_DIR} FILES_MATCHING PATTERN "*.hpp")
|
||||
|
||||
-add_subdirectory(docs)
|
||||
-add_subdirectory(${CMAKE_SOURCE_DIR}/tests/tools/apps/cpp ${CMAKE_BINARY_DIR}/tests/tools/apps/cpp)
|
||||
+#add_subdirectory(docs)
|
||||
+#add_subdirectory(${CMAKE_SOURCE_DIR}/tests/tools/apps/cpp ${CMAKE_BINARY_DIR}/tests/tools/apps/cpp)
|
||||
|
||||
# Pkg config file
|
||||
configure_file(
|
||||
@@ -171,12 +171,12 @@ macro(add_cpp_test test)
|
||||
endif ()
|
||||
endmacro(add_cpp_test)
|
||||
|
||||
-add_cpp_test(codec_test)
|
||||
+#add_cpp_test(codec_test)
|
||||
#add_cpp_test(engine_test)
|
||||
-add_cpp_test(thread_safe_test)
|
||||
-add_cpp_test(interop_test ${CMAKE_SOURCE_DIR}/tests)
|
||||
-add_cpp_test(message_test)
|
||||
-add_cpp_test(scalar_test)
|
||||
-add_cpp_test(value_test)
|
||||
-add_cpp_test(container_test)
|
||||
-add_cpp_test(url_test)
|
||||
+#add_cpp_test(thread_safe_test)
|
||||
+#add_cpp_test(interop_test ${CMAKE_SOURCE_DIR}/tests)
|
||||
+#add_cpp_test(message_test)
|
||||
+#add_cpp_test(scalar_test)
|
||||
+#add_cpp_test(value_test)
|
||||
+#add_cpp_test(container_test)
|
||||
+#add_cpp_test(url_test)
|
||||
diff --git a/proton-c/bindings/cpp/docs/CMakeLists.txt b/proton-c/bindings/cpp/docs/CMakeLists.txt
|
||||
index d512d15..8576867 100644
|
||||
--- a/proton-c/bindings/cpp/docs/CMakeLists.txt
|
||||
+++ b/proton-c/bindings/cpp/docs/CMakeLists.txt
|
||||
@@ -17,7 +17,7 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
-find_package(Doxygen)
|
||||
+#find_package(Doxygen)
|
||||
|
||||
if (DOXYGEN_FOUND)
|
||||
configure_file (
|
||||
diff --git a/proton-c/docs/api/CMakeLists.txt b/proton-c/docs/api/CMakeLists.txt
|
||||
index 7756e48..71ebb93 100644
|
||||
--- a/proton-c/docs/api/CMakeLists.txt
|
||||
+++ b/proton-c/docs/api/CMakeLists.txt
|
||||
@@ -17,7 +17,7 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
-find_package(Doxygen)
|
||||
+#find_package(Doxygen)
|
||||
if (DOXYGEN_FOUND)
|
||||
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/user.doxygen.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/user.doxygen)
|
||||
--
|
||||
2.7.4
|
||||
|
||||
123
doc/amqp.md
123
doc/amqp.md
@@ -1,123 +0,0 @@
|
||||
# Block and Transaction Broadcasting With AMQP 1.0 (Experimental Feature)
|
||||
|
||||
[AMQP](https://www.amqp.org/) is an enterprise-level message queuing
|
||||
protocol for the reliable passing of real-time data and business
|
||||
transactions between applications. AMQP supports both broker and
|
||||
brokerless messaging. AMQP 1.0 is an open standard and has been
|
||||
ratified as ISO/IEC 19464.
|
||||
|
||||
The Hush daemon can be configured to act as a trusted "border
|
||||
router", implementing the Hush P2P protocol and relay, making
|
||||
consensus decisions, maintaining the local blockchain database,
|
||||
broadcasting locally generated transactions into the network, and
|
||||
providing a queryable RPC interface to interact on a polled basis for
|
||||
requesting blockchain related data. However, there exists only a
|
||||
limited service to notify external software of events like the arrival
|
||||
of new blocks or transactions.
|
||||
|
||||
The AMQP facility implements a notification interface through a set
|
||||
of specific notifiers. Currently there are notifiers that publish
|
||||
blocks and transactions. This read-only facility requires only the
|
||||
connection of a corresponding AMQP subscriber port in receiving
|
||||
software.
|
||||
|
||||
Currently the facility is not authenticated nor is there any two-way
|
||||
protocol involvement. Therefore, subscribers should validate the
|
||||
received data since it may be out of date, incomplete or even invalid.
|
||||
|
||||
Because AMQP is message oriented, subscribers receive transactions
|
||||
and blocks all-at-once and do not need to implement any sort of
|
||||
buffering or reassembly.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
The AMQP feature in Hush requires [Qpid Proton](https://qpid.apache.org/proton/)
|
||||
version 0.17 or newer, which you will need to install if you are not
|
||||
using the depends system. Typically, it is packaged by distributions as
|
||||
something like *libqpid-proton*. The C++ wrapper for AMQP *is* required.
|
||||
|
||||
In order to run the example Python client scripts in contrib/ one must
|
||||
also install *python-qpid-proton*, though this is not necessary for
|
||||
daemon operation.
|
||||
|
||||
## Enabling
|
||||
|
||||
By default, the AMQP feature is automatically compiled in if the
|
||||
necessary prerequisites are found. To disable, use --disable-proton
|
||||
during the *configure* step of building zcashd:
|
||||
|
||||
$ ./configure --disable-proton (other options)
|
||||
|
||||
To actually enable operation, one must set the appropriate options on
|
||||
the commandline or in the configuration file.
|
||||
|
||||
## Usage
|
||||
|
||||
AMQP support is currently an experimental feature, so you must pass
|
||||
the option:
|
||||
|
||||
-experimentalfeatures
|
||||
|
||||
Currently, the following notifications are supported:
|
||||
|
||||
-amqppubhashtx=address
|
||||
-amqppubhashblock=address
|
||||
-amqppubrawblock=address
|
||||
-amqppubrawtx=address
|
||||
|
||||
The address must be a valid AMQP address, where the same address can be
|
||||
used in more than notification. Note that SSL and SASL addresses are
|
||||
not currently supported.
|
||||
|
||||
Launch zcashd like this:
|
||||
|
||||
$ zcashd -amqppubhashtx=amqp://127.0.0.1:5672
|
||||
|
||||
Or this:
|
||||
|
||||
$ zcashd -amqppubhashtx=amqp://127.0.0.1:5672 \
|
||||
-amqppubrawtx=amqp://127.0.0.1:5672 \
|
||||
-amqppubrawblock=amqp://127.0.0.1:5672 \
|
||||
-amqppubhashblock=amqp://127.0.0.1:5672 \
|
||||
-debug=amqp
|
||||
|
||||
The debug category `amqp` enables AMQP-related logging.
|
||||
|
||||
Each notification has a topic and body, where the header corresponds
|
||||
to the notification type. For instance, for the notification `-amqpubhashtx`
|
||||
the topic is `hashtx` (no null terminator) and the body is the hexadecimal
|
||||
transaction hash (32 bytes). This transaction hash and the block hash
|
||||
found in `hashblock` are in RPC byte order.
|
||||
|
||||
These options can also be provided in zcash.conf.
|
||||
|
||||
Please see `contrib/amqp/amqp_sub.py` for a working example of an
|
||||
AMQP server listening for messages.
|
||||
|
||||
## Remarks
|
||||
|
||||
From the perspective of zcashd, the local end of an AMQP link is write-only.
|
||||
|
||||
No information is broadcast that wasn't already received from the public
|
||||
P2P network.
|
||||
|
||||
No authentication or authorization is done on peers that zcashd connects
|
||||
to; it is assumed that the AMQP link is exposed only to trusted entities,
|
||||
using other means such as firewalling.
|
||||
|
||||
TLS support may be added once OpenSSL has been removed from the Hush
|
||||
project and alternative TLS implementations have been evaluated.
|
||||
|
||||
SASL support may be added in a future update for secure communication.
|
||||
|
||||
Note that when the block chain tip changes, a reorganisation may occur
|
||||
and just the tip will be notified. It is up to the subscriber to
|
||||
retrieve the chain from the last known block to the new tip.
|
||||
|
||||
At present, zcashd does not try to resend a notification if there was
|
||||
a problem confirming receipt. Support for delivery guarantees such as
|
||||
*at-least-once* and *exactly-once* will be added in in a future update.
|
||||
|
||||
Currently, zcashd appends an up-counting sequence number to each notification
|
||||
which allows listeners to detect lost notifications.
|
||||
|
||||
@@ -96,10 +96,6 @@ if [ "x$ENABLE_ZMQ" = "x1" ]; then
|
||||
testScripts+=('zmq_test.py')
|
||||
fi
|
||||
|
||||
if [ "x$ENABLE_PROTON" = "x1" ]; then
|
||||
testScripts+=('proton_test.py')
|
||||
fi
|
||||
|
||||
extArg="-extended"
|
||||
passOn=${@#$extArg}
|
||||
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2017 The Zcash developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#
|
||||
# Test Proton interface (provides AMQP 1.0 messaging support).
|
||||
#
|
||||
# Requirements:
|
||||
# Python library for Qpid Proton:
|
||||
# https://pypi.python.org/pypi/python-qpid-proton
|
||||
# To install:
|
||||
# pip install python-qpid-proton
|
||||
#
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import assert_equal, bytes_to_hex_str, \
|
||||
start_nodes
|
||||
|
||||
from proton.handlers import MessagingHandler
|
||||
from proton.reactor import Container
|
||||
|
||||
import threading
|
||||
|
||||
|
||||
class Server(MessagingHandler):
|
||||
|
||||
def __init__(self, url, limit):
|
||||
super(Server, self).__init__()
|
||||
self.url = url
|
||||
self.counter = limit
|
||||
self.blockhashes = []
|
||||
self.txids = []
|
||||
self.blockseq = -1
|
||||
self.txidseq = -1
|
||||
|
||||
def on_start(self, event):
|
||||
print "Proton listening on:", self.url
|
||||
self.container = event.container
|
||||
self.acceptor = event.container.listen(self.url)
|
||||
|
||||
def on_message(self, event):
|
||||
m = event.message
|
||||
hash = bytes_to_hex_str(m.body)
|
||||
sequence = m.properties['x-opt-sequence-number']
|
||||
if m.subject == "hashtx":
|
||||
self.txids.append(hash)
|
||||
|
||||
# Test that sequence id is incrementing
|
||||
assert(sequence == 1 + self.txidseq)
|
||||
self.txidseq = sequence
|
||||
elif m.subject == "hashblock":
|
||||
self.blockhashes.append(hash)
|
||||
|
||||
# Test that sequence id is incrementing
|
||||
assert(sequence == 1 + self.blockseq)
|
||||
self.blockseq = sequence
|
||||
|
||||
self.counter = self.counter - 1
|
||||
if self.counter == 0:
|
||||
self.container.stop()
|
||||
|
||||
|
||||
class ProtonTest (BitcoinTestFramework):
|
||||
|
||||
port = 25672
|
||||
numblocks = 10 # must be even, as two nodes generate equal number
|
||||
assert(numblocks % 2 == 0)
|
||||
|
||||
def setup_nodes(self):
|
||||
|
||||
# Launch proton server in background thread
|
||||
# It terminates after receiving numblocks * 2 messages (one for coinbase, one for block)
|
||||
self.server = Server("127.0.0.1:%i" % self.port, self.numblocks * 2)
|
||||
self.container = Container(self.server)
|
||||
self.t1 = threading.Thread(target=self.container.run)
|
||||
self.t1.start()
|
||||
|
||||
return start_nodes(4, self.options.tmpdir, extra_args=[
|
||||
['-experimentalfeatures', '-debug=amqp', '-amqppubhashtx=amqp://127.0.0.1:'+str(self.port),
|
||||
'-amqppubhashblock=amqp://127.0.0.1:'+str(self.port)],
|
||||
[],
|
||||
[],
|
||||
[]
|
||||
])
|
||||
|
||||
def run_test(self):
|
||||
self.sync_all()
|
||||
baseheight = self.nodes[0].getblockcount() # 200 blocks already mined
|
||||
|
||||
# generate some blocks
|
||||
self.nodes[0].generate(self.numblocks/2)
|
||||
self.sync_all()
|
||||
self.nodes[1].generate(self.numblocks/2)
|
||||
self.sync_all()
|
||||
|
||||
# wait for server to finish
|
||||
self.t1.join()
|
||||
|
||||
# sequence numbers have already been checked in the server's message handler
|
||||
|
||||
# sanity check that we have the right number of block hashes and coinbase txids
|
||||
assert_equal(len(self.server.blockhashes), self.numblocks)
|
||||
assert_equal(len(self.server.txids), self.numblocks)
|
||||
|
||||
# verify that each block has the correct coinbase txid
|
||||
for i in xrange(0, self.numblocks):
|
||||
height = baseheight + i + 1
|
||||
blockhash = self.nodes[0].getblockhash(height)
|
||||
assert_equal(blockhash, self.server.blockhashes[i])
|
||||
resp = self.nodes[0].getblock(blockhash)
|
||||
coinbase = resp["tx"][0]
|
||||
assert_equal(coinbase, self.server.txids[i])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
ProtonTest().main()
|
||||
@@ -54,9 +54,6 @@ LIBZCASH=libzcash.a
|
||||
if ENABLE_ZMQ
|
||||
LIBBITCOIN_ZMQ=libbitcoin_zmq.a
|
||||
endif
|
||||
if ENABLE_PROTON
|
||||
LIBBITCOIN_PROTON=libbitcoin_proton.a
|
||||
endif
|
||||
if BUILD_BITCOIN_LIBS
|
||||
LIBZCASH_CONSENSUS=libzcashconsensus.la
|
||||
endif
|
||||
@@ -65,13 +62,13 @@ LIBBITCOIN_WALLET=libbitcoin_wallet.a
|
||||
endif
|
||||
|
||||
$(LIBSECP256K1): $(wildcard secp256k1/src/*) $(wildcard secp256k1/include/*)
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -march=x86-64 -g "
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -g "
|
||||
|
||||
$(LIBUNIVALUE): $(wildcard univalue/lib/*)
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -march=x86-64 -g "
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -g "
|
||||
|
||||
$(LIBCRYPTOCONDITIONS): $(wildcard cryptoconditions/src/*) $(wildcard cryptoconditions/include/*)
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -march=x86-64 -g "
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -g "
|
||||
|
||||
# Make is not made aware of per-object dependencies to avoid limiting building parallelization
|
||||
# But to build the less dependent modules first, we manually select their order here:
|
||||
@@ -89,9 +86,6 @@ endif
|
||||
if ENABLE_ZMQ
|
||||
EXTRA_LIBRARIES += $(LIBBITCOIN_ZMQ)
|
||||
endif
|
||||
if ENABLE_PROTON
|
||||
EXTRA_LIBRARIES += $(LIBBITCOIN_PROTON)
|
||||
endif
|
||||
|
||||
lib_LTLIBRARIES = $(LIBZCASH_CONSENSUS)
|
||||
|
||||
@@ -331,15 +325,6 @@ libbitcoin_zmq_a_SOURCES = \
|
||||
zmq/zmqpublishnotifier.cpp
|
||||
endif
|
||||
|
||||
if ENABLE_PROTON
|
||||
libbitcoin_proton_a_CPPFLAGS = $(BITCOIN_INCLUDES)
|
||||
libbitcoin_proton_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
libbitcoin_proton_a_SOURCES = \
|
||||
amqp/amqpabstractnotifier.cpp \
|
||||
amqp/amqpnotificationinterface.cpp \
|
||||
amqp/amqppublishnotifier.cpp
|
||||
endif
|
||||
|
||||
# wallet: komodod, but only linked when wallet enabled
|
||||
libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
||||
libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
@@ -504,7 +489,6 @@ komodod_LDADD = \
|
||||
$(LIBUNIVALUE) \
|
||||
$(LIBBITCOIN_UTIL) \
|
||||
$(LIBBITCOIN_ZMQ) \
|
||||
$(LIBBITCOIN_PROTON) \
|
||||
$(LIBBITCOIN_CRYPTO) \
|
||||
$(LIBZCASH) \
|
||||
$(LIBLEVELDB) \
|
||||
@@ -524,7 +508,6 @@ komodod_LDADD += \
|
||||
$(EVENT_PTHREADS_LIBS) \
|
||||
$(EVENT_LIBS) \
|
||||
$(ZMQ_LIBS) \
|
||||
$(PROTON_LIBS) \
|
||||
$(LIBBITCOIN_CRYPTO) \
|
||||
$(LIBZCASH_LIBS)
|
||||
|
||||
@@ -538,10 +521,6 @@ if TARGET_LINUX
|
||||
komodod_LDADD += libcc.so $(LIBSECP256K1)
|
||||
endif
|
||||
|
||||
if ENABLE_PROTON
|
||||
komodod_LDADD += $(LIBBITCOIN_PROTON) $(PROTON_LIBS)
|
||||
endif
|
||||
|
||||
# [+] Decker: use static linking for libstdc++.6.dylib, libgomp.1.dylib, libgcc_s.1.dylib
|
||||
if TARGET_DARWIN
|
||||
komodod_LDFLAGS += -static-libgcc
|
||||
|
||||
@@ -65,11 +65,6 @@ endif
|
||||
|
||||
komodo_gtest_LDADD += $(LIBZCASH_CONSENSUS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(LIBZCASH) $(LIBZCASH_LIBS)
|
||||
|
||||
if ENABLE_PROTON
|
||||
komodo_gtest_LDADD += $(LIBBITCOIN_PROTON) $(PROTON_LIBS)
|
||||
endif
|
||||
|
||||
|
||||
komodo_gtest_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -static
|
||||
|
||||
komodo_gtest_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -static
|
||||
|
||||
@@ -130,10 +130,6 @@ if ENABLE_ZMQ
|
||||
test_test_bitcoin_LDADD += $(ZMQ_LIBS)
|
||||
endif
|
||||
|
||||
if ENABLE_PROTON
|
||||
test_test_bitcoin_LDADD += $(PROTON_LIBS)
|
||||
endif
|
||||
|
||||
nodist_test_test_bitcoin_SOURCES = $(GENERATED_TEST_FILES)
|
||||
|
||||
$(BITCOIN_TESTS): $(GENERATED_TEST_FILES)
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// Copyright (c) 2017 The Zcash developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "amqpabstractnotifier.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
AMQPAbstractNotifier::~AMQPAbstractNotifier()
|
||||
{
|
||||
}
|
||||
|
||||
bool AMQPAbstractNotifier::NotifyBlock(const CBlockIndex * /*CBlockIndex*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AMQPAbstractNotifier::NotifyTransaction(const CTransaction &/*transaction*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
// Copyright (c) 2017 The Zcash developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef ZCASH_AMQP_AMQPABSTRACTNOTIFIER_H
|
||||
#define ZCASH_AMQP_AMQPABSTRACTNOTIFIER_H
|
||||
|
||||
#include "amqpconfig.h"
|
||||
|
||||
class CBlockIndex;
|
||||
class AMQPAbstractNotifier;
|
||||
|
||||
typedef AMQPAbstractNotifier* (*AMQPNotifierFactory)();
|
||||
|
||||
class AMQPAbstractNotifier
|
||||
{
|
||||
public:
|
||||
AMQPAbstractNotifier() { }
|
||||
virtual ~AMQPAbstractNotifier();
|
||||
|
||||
template <typename T>
|
||||
static AMQPAbstractNotifier* Create()
|
||||
{
|
||||
return new T();
|
||||
}
|
||||
|
||||
std::string GetType() const { return type; }
|
||||
void SetType(const std::string &t) { type = t; }
|
||||
std::string GetAddress() const { return address; }
|
||||
void SetAddress(const std::string &a) { address = a; }
|
||||
|
||||
virtual bool Initialize() = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
|
||||
virtual bool NotifyBlock(const CBlockIndex *pindex);
|
||||
virtual bool NotifyTransaction(const CTransaction &transaction);
|
||||
|
||||
protected:
|
||||
std::string type;
|
||||
std::string address;
|
||||
};
|
||||
|
||||
#endif // ZCASH_AMQP_AMQPABSTRACTNOTIFIER_H
|
||||
@@ -1,33 +0,0 @@
|
||||
// Copyright (c) 2017 The Zcash developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef ZCASH_AMQP_AMQPCONFIG_H
|
||||
#define ZCASH_AMQP_AMQPCONFIG_H
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config/bitcoin-config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <string>
|
||||
|
||||
#if ENABLE_PROTON
|
||||
#include <proton/connection.hpp>
|
||||
#include <proton/connection_options.hpp>
|
||||
#include <proton/container.hpp>
|
||||
#include <proton/default_container.hpp>
|
||||
#include <proton/message.hpp>
|
||||
#include <proton/message_id.hpp>
|
||||
#include <proton/messaging_handler.hpp>
|
||||
#include <proton/thread_safe.hpp>
|
||||
#include <proton/tracker.hpp>
|
||||
#include <proton/transport.hpp>
|
||||
#include <proton/types.hpp>
|
||||
#include <proton/url.hpp>
|
||||
#endif
|
||||
|
||||
#include "primitives/block.h"
|
||||
#include "primitives/transaction.h"
|
||||
|
||||
#endif // ZCASH_AMQP_AMQPCONFIG_H
|
||||
@@ -1,136 +0,0 @@
|
||||
// Copyright (c) 2017 The Zcash developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "amqpnotificationinterface.h"
|
||||
#include "amqppublishnotifier.h"
|
||||
|
||||
#include "version.h"
|
||||
#include "main.h"
|
||||
#include "streams.h"
|
||||
#include "util.h"
|
||||
|
||||
// AMQP 1.0 Support
|
||||
//
|
||||
// The boost::signals2 signals and slot system is thread safe, so CValidationInterface listeners
|
||||
// can be invoked from any thread.
|
||||
//
|
||||
// Currently signals are fired from main.cpp so the callbacks should be invoked on the same thread.
|
||||
// It should be safe to share objects responsible for sending, as they should not be run concurrently
|
||||
// across different threads.
|
||||
//
|
||||
// Developers should be mindful of where notifications are fired to avoid potential race conditions.
|
||||
// For example, different signals targeting the same address could be fired from different threads
|
||||
// in different parts of the system around the same time.
|
||||
//
|
||||
// Like the ZMQ notification interface, if a notifier fails to send a message, the notifier is shut down.
|
||||
//
|
||||
|
||||
AMQPNotificationInterface::AMQPNotificationInterface()
|
||||
{
|
||||
}
|
||||
|
||||
AMQPNotificationInterface::~AMQPNotificationInterface()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
for (std::list<AMQPAbstractNotifier*>::iterator i = notifiers.begin(); i != notifiers.end(); ++i) {
|
||||
delete *i;
|
||||
}
|
||||
}
|
||||
|
||||
AMQPNotificationInterface* AMQPNotificationInterface::CreateWithArguments(const std::map<std::string, std::string> &args)
|
||||
{
|
||||
AMQPNotificationInterface* notificationInterface = nullptr;
|
||||
std::map<std::string, AMQPNotifierFactory> factories;
|
||||
std::list<AMQPAbstractNotifier*> notifiers;
|
||||
|
||||
factories["pubhashblock"] = AMQPAbstractNotifier::Create<AMQPPublishHashBlockNotifier>;
|
||||
factories["pubhashtx"] = AMQPAbstractNotifier::Create<AMQPPublishHashTransactionNotifier>;
|
||||
factories["pubrawblock"] = AMQPAbstractNotifier::Create<AMQPPublishRawBlockNotifier>;
|
||||
factories["pubrawtx"] = AMQPAbstractNotifier::Create<AMQPPublishRawTransactionNotifier>;
|
||||
|
||||
for (std::map<std::string, AMQPNotifierFactory>::const_iterator i=factories.begin(); i!=factories.end(); ++i) {
|
||||
std::map<std::string, std::string>::const_iterator j = args.find("-amqp" + i->first);
|
||||
if (j!=args.end()) {
|
||||
AMQPNotifierFactory factory = i->second;
|
||||
std::string address = j->second;
|
||||
AMQPAbstractNotifier *notifier = factory();
|
||||
notifier->SetType(i->first);
|
||||
notifier->SetAddress(address);
|
||||
notifiers.push_back(notifier);
|
||||
}
|
||||
}
|
||||
|
||||
if (!notifiers.empty()) {
|
||||
notificationInterface = new AMQPNotificationInterface();
|
||||
notificationInterface->notifiers = notifiers;
|
||||
|
||||
if (!notificationInterface->Initialize()) {
|
||||
delete notificationInterface;
|
||||
notificationInterface = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
return notificationInterface;
|
||||
}
|
||||
|
||||
// Called at startup to conditionally set up
|
||||
bool AMQPNotificationInterface::Initialize()
|
||||
{
|
||||
LogPrint("amqp", "amqp: Initialize notification interface\n");
|
||||
|
||||
std::list<AMQPAbstractNotifier*>::iterator i = notifiers.begin();
|
||||
for (; i != notifiers.end(); ++i) {
|
||||
AMQPAbstractNotifier *notifier = *i;
|
||||
if (notifier->Initialize()) {
|
||||
LogPrint("amqp", "amqp: Notifier %s ready (address = %s)\n", notifier->GetType(), notifier->GetAddress());
|
||||
} else {
|
||||
LogPrint("amqp", "amqp: Notifier %s failed (address = %s)\n", notifier->GetType(), notifier->GetAddress());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i != notifiers.end()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Called during shutdown sequence
|
||||
void AMQPNotificationInterface::Shutdown()
|
||||
{
|
||||
LogPrint("amqp", "amqp: Shutdown notification interface\n");
|
||||
|
||||
for (std::list<AMQPAbstractNotifier*>::iterator i = notifiers.begin(); i != notifiers.end(); ++i) {
|
||||
AMQPAbstractNotifier *notifier = *i;
|
||||
notifier->Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
void AMQPNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindex)
|
||||
{
|
||||
for (std::list<AMQPAbstractNotifier*>::iterator i = notifiers.begin(); i != notifiers.end(); ) {
|
||||
AMQPAbstractNotifier *notifier = *i;
|
||||
if (notifier->NotifyBlock(pindex)) {
|
||||
i++;
|
||||
} else {
|
||||
notifier->Shutdown();
|
||||
i = notifiers.erase(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AMQPNotificationInterface::SyncTransaction(const CTransaction &tx, const CBlock *pblock)
|
||||
{
|
||||
for (std::list<AMQPAbstractNotifier*>::iterator i = notifiers.begin(); i != notifiers.end(); ) {
|
||||
AMQPAbstractNotifier *notifier = *i;
|
||||
if (notifier->NotifyTransaction(tx)) {
|
||||
i++;
|
||||
} else {
|
||||
notifier->Shutdown();
|
||||
i = notifiers.erase(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
// Copyright (c) 2017 The Zcash developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef ZCASH_AMQP_AMQPNOTIFICATIONINTERFACE_H
|
||||
#define ZCASH_AMQP_AMQPNOTIFICATIONINTERFACE_H
|
||||
|
||||
#include "validationinterface.h"
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
class CBlockIndex;
|
||||
class AMQPAbstractNotifier;
|
||||
|
||||
class AMQPNotificationInterface : public CValidationInterface
|
||||
{
|
||||
public:
|
||||
virtual ~AMQPNotificationInterface();
|
||||
|
||||
static AMQPNotificationInterface* CreateWithArguments(const std::map<std::string, std::string> &args);
|
||||
|
||||
protected:
|
||||
bool Initialize();
|
||||
void Shutdown();
|
||||
|
||||
// CValidationInterface
|
||||
void SyncTransaction(const CTransaction &tx, const CBlock *pblock);
|
||||
void UpdatedBlockTip(const CBlockIndex *pindex);
|
||||
|
||||
private:
|
||||
AMQPNotificationInterface();
|
||||
|
||||
std::list<AMQPAbstractNotifier*> notifiers;
|
||||
};
|
||||
|
||||
#endif // ZCASH_AMQP_AMQPNOTIFICATIONINTERFACE_H
|
||||
@@ -1,177 +0,0 @@
|
||||
// Copyright (c) 2017 The Zcash developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "amqppublishnotifier.h"
|
||||
#include "main.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "amqpsender.h"
|
||||
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
|
||||
static std::multimap<std::string, AMQPAbstractPublishNotifier*> mapPublishNotifiers;
|
||||
|
||||
static const char *MSG_HASHBLOCK = "hashblock";
|
||||
static const char *MSG_HASHTX = "hashtx";
|
||||
static const char *MSG_RAWBLOCK = "rawblock";
|
||||
static const char *MSG_RAWTX = "rawtx";
|
||||
|
||||
// Invoke this method from a new thread to run the proton container event loop.
|
||||
void AMQPAbstractPublishNotifier::SpawnProtonContainer()
|
||||
{
|
||||
try {
|
||||
proton::default_container(*handler_).run();
|
||||
}
|
||||
catch (const proton::error_condition &e) {
|
||||
LogPrint("amqp", "amqp: container error: %s\n", e.what());
|
||||
}
|
||||
catch (const std::runtime_error &e) {
|
||||
LogPrint("amqp", "amqp: runtime error: %s\n", e.what());
|
||||
}
|
||||
catch (const std::exception &e) {
|
||||
LogPrint("amqp", "amqp: exception: %s\n", e.what());
|
||||
}
|
||||
catch (...) {
|
||||
LogPrint("amqp", "amqp: unknown error\n");
|
||||
}
|
||||
handler_->terminate();
|
||||
}
|
||||
|
||||
bool AMQPAbstractPublishNotifier::Initialize()
|
||||
{
|
||||
std::multimap<std::string, AMQPAbstractPublishNotifier*>::iterator i = mapPublishNotifiers.find(address);
|
||||
|
||||
if (i == mapPublishNotifiers.end()) {
|
||||
try {
|
||||
handler_ = std::make_shared<AMQPSender>(address);
|
||||
thread_ = std::make_shared<std::thread>(&AMQPAbstractPublishNotifier::SpawnProtonContainer, this);
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
LogPrint("amqp", "amqp: initialization error: %s\n", e.what());
|
||||
return false;
|
||||
}
|
||||
mapPublishNotifiers.insert(std::make_pair(address, this));
|
||||
} else {
|
||||
// copy the shared ptrs to the message handler and the thread where the proton container is running
|
||||
handler_ = i->second->handler_;
|
||||
thread_ = i->second->thread_;
|
||||
mapPublishNotifiers.insert(std::make_pair(address, this));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void AMQPAbstractPublishNotifier::Shutdown()
|
||||
{
|
||||
LogPrint("amqp", "amqp: Shutdown notifier %s at %s\n", GetType(), GetAddress());
|
||||
|
||||
int count = mapPublishNotifiers.count(address);
|
||||
|
||||
// remove this notifier from the list of publishers using this address
|
||||
typedef std::multimap<std::string, AMQPAbstractPublishNotifier*>::iterator iterator;
|
||||
std::pair<iterator, iterator> iterpair = mapPublishNotifiers.equal_range(address);
|
||||
|
||||
for (iterator it = iterpair.first; it != iterpair.second; ++it) {
|
||||
if (it->second == this) {
|
||||
mapPublishNotifiers.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// terminate the connection if this is the last publisher using this address
|
||||
if (count == 1) {
|
||||
handler_->terminate();
|
||||
if (thread_.get() != nullptr) {
|
||||
if (thread_->joinable()) {
|
||||
thread_->join();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool AMQPAbstractPublishNotifier::SendMessage(const char *command, const void* data, size_t size)
|
||||
{
|
||||
try {
|
||||
proton::binary content;
|
||||
const char *p = (const char *)data;
|
||||
content.assign(p, p + size);
|
||||
|
||||
proton::message message(content);
|
||||
message.subject(std::string(command));
|
||||
proton::message::property_map & props = message.properties();
|
||||
props.put("x-opt-sequence-number", sequence_);
|
||||
handler_->publish(message);
|
||||
|
||||
} catch (proton::error_condition &e) {
|
||||
LogPrint("amqp", "amqp: error : %s\n", e.what());
|
||||
return false;
|
||||
}
|
||||
catch (const std::runtime_error &e) {
|
||||
LogPrint("amqp", "amqp: runtime error: %s\n", e.what());
|
||||
return false;
|
||||
}
|
||||
catch (const std::exception &e) {
|
||||
LogPrint("amqp", "amqp: exception: %s\n", e.what());
|
||||
return false;
|
||||
}
|
||||
catch (...) {
|
||||
LogPrint("amqp", "amqp: unknown error\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
sequence_++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AMQPPublishHashBlockNotifier::NotifyBlock(const CBlockIndex *pindex)
|
||||
{
|
||||
uint256 hash = pindex->GetBlockHash();
|
||||
LogPrint("amqp", "amqp: Publish hashblock %s\n", hash.GetHex());
|
||||
char data[32];
|
||||
for (unsigned int i = 0; i < 32; i++)
|
||||
data[31 - i] = hash.begin()[i];
|
||||
return SendMessage(MSG_HASHBLOCK, data, 32);
|
||||
}
|
||||
|
||||
bool AMQPPublishHashTransactionNotifier::NotifyTransaction(const CTransaction &transaction)
|
||||
{
|
||||
uint256 hash = transaction.GetHash();
|
||||
LogPrint("amqp", "amqp: Publish hashtx %s\n", hash.GetHex());
|
||||
char data[32];
|
||||
for (unsigned int i = 0; i < 32; i++)
|
||||
data[31 - i] = hash.begin()[i];
|
||||
return SendMessage(MSG_HASHTX, data, 32);
|
||||
}
|
||||
|
||||
bool AMQPPublishRawBlockNotifier::NotifyBlock(const CBlockIndex *pindex)
|
||||
{
|
||||
LogPrint("amqp", "amqp: Publish rawblock %s\n", pindex->GetBlockHash().GetHex());
|
||||
|
||||
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
||||
{
|
||||
LOCK(cs_main);
|
||||
CBlock block;
|
||||
if(!ReadBlockFromDisk(block, pindex)) {
|
||||
LogPrint("amqp", "amqp: Can't read block from disk");
|
||||
return false;
|
||||
}
|
||||
|
||||
ss << block;
|
||||
}
|
||||
|
||||
return SendMessage(MSG_RAWBLOCK, &(*ss.begin()), ss.size());
|
||||
}
|
||||
|
||||
bool AMQPPublishRawTransactionNotifier::NotifyTransaction(const CTransaction &transaction)
|
||||
{
|
||||
uint256 hash = transaction.GetHash();
|
||||
LogPrint("amqp", "amqp: Publish rawtx %s\n", hash.GetHex());
|
||||
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
||||
ss << transaction;
|
||||
return SendMessage(MSG_RAWTX, &(*ss.begin()), ss.size());
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
// Copyright (c) 2017 The Zcash developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef ZCASH_AMQP_AMQPPUBLISHNOTIFIER_H
|
||||
#define ZCASH_AMQP_AMQPPUBLISHNOTIFIER_H
|
||||
|
||||
#include "amqpabstractnotifier.h"
|
||||
#include "amqpconfig.h"
|
||||
#include "amqpsender.h"
|
||||
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
|
||||
class CBlockIndex;
|
||||
|
||||
class AMQPAbstractPublishNotifier : public AMQPAbstractNotifier
|
||||
{
|
||||
private:
|
||||
uint64_t sequence_; // memory only, per notifier instance: upcounting message sequence number
|
||||
|
||||
std::shared_ptr<std::thread> thread_; // proton container thread, may be shared between notifiers
|
||||
std::shared_ptr<AMQPSender> handler_; // proton container message handler, may be shared between notifiers
|
||||
|
||||
public:
|
||||
bool SendMessage(const char *command, const void* data, size_t size);
|
||||
bool Initialize();
|
||||
void Shutdown();
|
||||
void SpawnProtonContainer();
|
||||
};
|
||||
|
||||
class AMQPPublishHashBlockNotifier : public AMQPAbstractPublishNotifier
|
||||
{
|
||||
public:
|
||||
bool NotifyBlock(const CBlockIndex *pindex);
|
||||
};
|
||||
|
||||
class AMQPPublishHashTransactionNotifier : public AMQPAbstractPublishNotifier
|
||||
{
|
||||
public:
|
||||
bool NotifyTransaction(const CTransaction &transaction);
|
||||
};
|
||||
|
||||
class AMQPPublishRawBlockNotifier : public AMQPAbstractPublishNotifier
|
||||
{
|
||||
public:
|
||||
bool NotifyBlock(const CBlockIndex *pindex);
|
||||
};
|
||||
|
||||
class AMQPPublishRawTransactionNotifier : public AMQPAbstractPublishNotifier
|
||||
{
|
||||
public:
|
||||
bool NotifyTransaction(const CTransaction &transaction);
|
||||
};
|
||||
|
||||
#endif // ZCASH_AMQP_AMQPPUBLISHNOTIFIER_H
|
||||
@@ -1,115 +0,0 @@
|
||||
// Copyright (c) 2017 The Zcash developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef ZCASH_AMQP_AMQPSENDER_H
|
||||
#define ZCASH_AMQP_AMQPSENDER_H
|
||||
|
||||
#include "amqpconfig.h"
|
||||
|
||||
#include <deque>
|
||||
#include <memory>
|
||||
#include <future>
|
||||
#include <iostream>
|
||||
|
||||
class AMQPSender : public proton::messaging_handler {
|
||||
private:
|
||||
std::deque<proton::message> messages_;
|
||||
proton::url url_;
|
||||
proton::connection conn_;
|
||||
proton::sender sender_;
|
||||
std::mutex lock_;
|
||||
std::atomic<bool> terminated_ = {false};
|
||||
|
||||
public:
|
||||
|
||||
AMQPSender(const std::string& url) : url_(url) {}
|
||||
|
||||
// Callback to initialize the container when run() is invoked
|
||||
void on_container_start(proton::container& c) override {
|
||||
proton::duration t(10000); // milliseconds
|
||||
proton::connection_options opts = proton::connection_options().idle_timeout(t);
|
||||
conn_ = c.connect(url_, opts);
|
||||
sender_ = conn_.open_sender(url_.path());
|
||||
}
|
||||
|
||||
// Remote end signals when the local end can send (i.e. has credit)
|
||||
void on_sendable(proton::sender &s) override {
|
||||
dispatch();
|
||||
}
|
||||
|
||||
// Publish message by adding to queue and trying to dispatch it
|
||||
void publish(const proton::message &m) {
|
||||
add_message(m);
|
||||
dispatch();
|
||||
}
|
||||
|
||||
// Add message to queue
|
||||
void add_message(const proton::message &m) {
|
||||
std::lock_guard<std::mutex> guard(lock_);
|
||||
messages_.push_back(m);
|
||||
}
|
||||
|
||||
// Send messages in queue
|
||||
void dispatch() {
|
||||
std::lock_guard<std::mutex> guard(lock_);
|
||||
|
||||
if (isTerminated()) {
|
||||
throw std::runtime_error("amqp connection was terminated");
|
||||
}
|
||||
|
||||
if (!conn_.active()) {
|
||||
throw std::runtime_error("amqp connection is not active");
|
||||
}
|
||||
|
||||
while (messages_.size() > 0) {
|
||||
if (sender_.credit()) {
|
||||
const proton::message& m = messages_.front();
|
||||
sender_.send(m);
|
||||
messages_.pop_front();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Close connection to remote end. Container event-loop, by default, will auto-stop.
|
||||
void terminate() {
|
||||
std::lock_guard<std::mutex> guard(lock_);
|
||||
conn_.close();
|
||||
terminated_.store(true);
|
||||
}
|
||||
|
||||
bool isTerminated() const {
|
||||
return terminated_.load();
|
||||
}
|
||||
|
||||
void on_transport_error(proton::transport &t) override {
|
||||
t.connection().close();
|
||||
throw t.error();
|
||||
}
|
||||
|
||||
void on_connection_error(proton::connection &c) override {
|
||||
c.close();
|
||||
throw c.error();
|
||||
}
|
||||
|
||||
void on_session_error(proton::session &s) override {
|
||||
s.connection().close();
|
||||
throw s.error();
|
||||
}
|
||||
|
||||
void on_receiver_error(proton::receiver &r) override {
|
||||
r.connection().close();
|
||||
throw r.error();
|
||||
}
|
||||
|
||||
void on_sender_error(proton::sender &s) override {
|
||||
s.connection().close();
|
||||
throw s.error();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif //ZCASH_AMQP_AMQPSENDER_H
|
||||
5
src/cc/Makefile_custom
Executable file → Normal file
5
src/cc/Makefile_custom
Executable file → Normal file
@@ -2,6 +2,7 @@ SHELL = /bin/sh
|
||||
CC = gcc
|
||||
CC_DARWIN = g++-8
|
||||
CC_WIN = x86_64-w64-mingw32-gcc-posix
|
||||
CC_AARCH64 = aarch64-linux-gnu-g++
|
||||
CFLAGS_DARWIN = -DBUILD_CUSTOMCC -std=c++11 -arch x86_64 -I../secp256k1/include -I../../depends/$(shell echo `../..//depends/config.guess`/include) -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -Wl,-undefined -Wl,dynamic_lookup -Wno-write-strings -shared -dynamiclib
|
||||
CFLAGS = -Wno-write-strings -DBUILD_CUSTOMCC -std=c++11 -I../secp256k1/include -I../../depends/$(shell echo `../..//depends/config.guess`/include) -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -shared
|
||||
CFLAGS_WIN = -Wno-write-strings -DBUILD_CUSTOMCC -std=c++11 -I../secp256k1/include -I../../depends/x86_64-w64-mingw32/include -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -shared
|
||||
@@ -28,6 +29,10 @@ else ifeq ($(HOST),x86_64-w64-mingw32)
|
||||
$(CC_WIN) $(CFLAGS_WIN) $(DEBUGFLAGS) -o $(TARGET_WIN) -c $(SOURCES)
|
||||
cp $(TARGET_WIN) ../libcc.dll
|
||||
#else ifeq ($(WIN_HOST),True) - todo: pass ENV var from build.sh if WIN host
|
||||
else ifeq ($(HOST),aarch64-linux-gnu)
|
||||
$(info LINUX ARM 64bit )
|
||||
$(CC_AARCH64) $(CFLAGS) $(DEBUGFLAGS) -o $(TARGET) -c $(SOURCES)
|
||||
cp $(TARGET) ../libcc.so
|
||||
else
|
||||
$(info LINUX)
|
||||
$(CC) $(CFLAGS) $(DEBUGFLAGS) -o $(TARGET) -c $(SOURCES)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
if make -f Makefile_custom "$@"; then
|
||||
if HOST="$HOST" make -B -f Makefile_custom "$@"; then
|
||||
echo CUSTOMCC BUILD SUCCESSFUL
|
||||
else
|
||||
echo CUSTOMCC BUILD FAILED
|
||||
|
||||
@@ -15,7 +15,7 @@ AM_CFLAGS = -I$(top_srcdir)/src/asn -I$(top_srcdir)/include -I$(top_srcdir)/src/
|
||||
LIBSECP256K1=src/include/secp256k1/libsecp256k1.la
|
||||
|
||||
$(LIBSECP256K1): $(wildcard src/secp256k1/*)
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) -march:x86-64 -g
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) -g
|
||||
|
||||
CRYPTOCONDITIONS_CORE=libcryptoconditions_core.la
|
||||
|
||||
|
||||
@@ -1714,7 +1714,9 @@ OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) {
|
||||
OCTET_STRING_t *st = (OCTET_STRING_t *)sptr;
|
||||
asn_OCTET_STRING_specifics_t *specs;
|
||||
asn_struct_ctx_t *ctx;
|
||||
#if !defined(__aarch64__)
|
||||
struct _stack *stck;
|
||||
#endif
|
||||
|
||||
if(!td || !st)
|
||||
return;
|
||||
@@ -1731,6 +1733,15 @@ OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) {
|
||||
st->buf = 0;
|
||||
}
|
||||
|
||||
/* Attention !!!
|
||||
* this is quick & dirty workaround for memory corruption bug on aarch64-linux-gnu
|
||||
* - downside: allows memory leakage
|
||||
* - issue description: On Raspberry Pi 4 @ 64bit linux, daemon crashes with "free(): invalid pointer" error
|
||||
* - probable cause: misaligned memory access to nested structs containing pointers
|
||||
* - TODO: use the latest asn1c compiler on CryptoConditions.asn, maybe generate cpp instead of c code... investigation in progress
|
||||
*/
|
||||
|
||||
#if !defined(__aarch64__)
|
||||
/*
|
||||
* Remove decode-time stack.
|
||||
*/
|
||||
@@ -1747,6 +1758,7 @@ OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) {
|
||||
if(!contents_only) {
|
||||
FREEMEM(st);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -71,7 +71,7 @@ endif
|
||||
endif
|
||||
|
||||
libsecp256k1_la_SOURCES = src/secp256k1.c
|
||||
libsecp256k1_la_CPPFLAGS = -DSECP256K1_BUILD -I$(top_srcdir)/include -I$(top_srcdir)/src $(SECP_INCLUDES) -march=x86-64 -g
|
||||
libsecp256k1_la_CPPFLAGS = -DSECP256K1_BUILD -I$(top_srcdir)/include -I$(top_srcdir)/src $(SECP_INCLUDES) -g
|
||||
libsecp256k1_la_LIBADD = $(JNI_LIB) $(SECP_LIBS) $(COMMON_LIB)
|
||||
|
||||
libsecp256k1_jni_la_SOURCES = src/java/org_bitcoin_NativeSecp256k1.c src/java/org_bitcoin_Secp256k1Context.c
|
||||
|
||||
39
src/init.cpp
39
src/init.cpp
@@ -84,10 +84,6 @@
|
||||
#include "zmq/zmqnotificationinterface.h"
|
||||
#endif
|
||||
|
||||
#if ENABLE_PROTON
|
||||
#include "amqp/amqpnotificationinterface.h"
|
||||
#endif
|
||||
|
||||
#include "librustzcash.h"
|
||||
|
||||
using namespace std;
|
||||
@@ -112,10 +108,6 @@ bool fFeeEstimatesInitialized = false;
|
||||
static CZMQNotificationInterface* pzmqNotificationInterface = NULL;
|
||||
#endif
|
||||
|
||||
#if ENABLE_PROTON
|
||||
static AMQPNotificationInterface* pAMQPNotificationInterface = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
// Win32 LevelDB doesn't use file descriptors, and the ones used for
|
||||
// accessing block files don't count towards the fd_set size limit
|
||||
@@ -285,14 +277,6 @@ void Shutdown()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLE_PROTON
|
||||
if (pAMQPNotificationInterface) {
|
||||
UnregisterValidationInterface(pAMQPNotificationInterface);
|
||||
delete pAMQPNotificationInterface;
|
||||
pAMQPNotificationInterface = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
try {
|
||||
boost::filesystem::remove(GetPidFile());
|
||||
@@ -486,14 +470,6 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
strUsage += HelpMessageOpt("-zmqpubrawtx=<address>", _("Enable publish raw transaction in <address>"));
|
||||
#endif
|
||||
|
||||
#if ENABLE_PROTON
|
||||
strUsage += HelpMessageGroup(_("AMQP 1.0 notification options:"));
|
||||
strUsage += HelpMessageOpt("-amqppubhashblock=<address>", _("Enable publish hash block in <address>"));
|
||||
strUsage += HelpMessageOpt("-amqppubhashtx=<address>", _("Enable publish hash transaction in <address>"));
|
||||
strUsage += HelpMessageOpt("-amqppubrawblock=<address>", _("Enable publish raw block in <address>"));
|
||||
strUsage += HelpMessageOpt("-amqppubrawtx=<address>", _("Enable publish raw transaction in <address>"));
|
||||
#endif
|
||||
|
||||
strUsage += HelpMessageGroup(_("Debugging/Testing options:"));
|
||||
if (showDebug)
|
||||
{
|
||||
@@ -1624,21 +1600,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLE_PROTON
|
||||
pAMQPNotificationInterface = AMQPNotificationInterface::CreateWithArguments(mapArgs);
|
||||
|
||||
if (pAMQPNotificationInterface) {
|
||||
|
||||
// AMQP support is currently an experimental feature, so fail if user configured AMQP notifications
|
||||
// without enabling experimental features.
|
||||
if (!fExperimentalMode) {
|
||||
return InitError(_("AMQP support requires -experimentalfeatures."));
|
||||
}
|
||||
|
||||
RegisterValidationInterface(pAMQPNotificationInterface);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( KOMODO_NSPV_SUPERLITE )
|
||||
{
|
||||
std::vector<boost::filesystem::path> vImportFiles;
|
||||
|
||||
@@ -2439,11 +2439,10 @@ void CWallet::DeleteTransactions(std::vector<uint256> &removeTxs) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
#if defined(__unix__) || defined(_WIN64)
|
||||
// Miodrag: release memory back to the OS
|
||||
#if defined(__GLIBC__)
|
||||
malloc_trim(0);
|
||||
#else
|
||||
//TODO: This doesn't work on Mac
|
||||
// On Mac and Win memory isn't kept back upon vector or list member erase, different garbage collector strategy. No need to force trimming.
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ PREFIX="$(pwd)/depends/aarch64-unknown-linux-gnu/"
|
||||
|
||||
HOST=aarch64-unknown-linux-gnu BUILD=aarch64-unknown-linux-gnu make "$@" -C ./depends/ V=1 NO_QT=1
|
||||
./autogen.sh
|
||||
CONFIG_SITE="$(pwd)/depends/aarch64-unknown-linux-gnu/share/config.site" ./configure --prefix="${PREFIX}" --host=aarch64-unknown-linux-gnu --build=aarch64-unknown-linux-gnu --with-gui=no --enable-rust=no --disable-proton "$HARDENING_ARG" "$LCOV_ARG" CXXFLAGS='-fwrapv -fno-strict-aliasing -g'
|
||||
CONFIG_SITE="$(pwd)/depends/aarch64-unknown-linux-gnu/share/config.site" ./configure --prefix="${PREFIX}" --host=aarch64-unknown-linux-gnu --build=aarch64-unknown-linux-gnu --with-gui=no --enable-rust=no "$HARDENING_ARG" "$LCOV_ARG" CXXFLAGS='-fwrapv -fno-strict-aliasing -g'
|
||||
|
||||
#BUILD CCLIB
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ fi
|
||||
TRIPLET=`./depends/config.guess`
|
||||
PREFIX="$(pwd)/depends/$TRIPLET"
|
||||
|
||||
make "$@" -C ./depends/ V=1 NO_QT=1 NO_PROTON=1
|
||||
make "$@" -C ./depends/ V=1 NO_QT=1
|
||||
|
||||
#BUILD CCLIB
|
||||
|
||||
|
||||
@@ -58,12 +58,11 @@ Welcome To The Hush Build System, Here Be Dragons!
|
||||
Usage:
|
||||
$0 --help
|
||||
Show this help message and exit.
|
||||
$0 [ --enable-lcov || --disable-tests ] [ --disable-mining ] [ --enable-proton ] [ --disable-libs ] [ MAKEARGS... ]
|
||||
$0 [ --enable-lcov || --disable-tests ] [ --disable-mining ] [ --disable-libs ] [ MAKEARGS... ]
|
||||
Build Hush and most of its transitive dependencies from source. MAKEARGS are applied to both dependencies and Hush itself.
|
||||
If --enable-lcov is passed, Hush is configured to add coverage instrumentation, thus enabling "make cov" to work.
|
||||
If --disable-tests is passed instead, the Hush tests are not built.
|
||||
If --disable-mining is passed, Hush is configured to not build any mining code. It must be passed after the test arguments, if present.
|
||||
If --enable-proton is passed, Hush is configured to build the Apache Qpid Proton library required for AMQP support. This library is not built by default.
|
||||
It must be passed after the test/mining arguments, if present.
|
||||
EOF
|
||||
exit 0
|
||||
@@ -94,25 +93,17 @@ then
|
||||
shift
|
||||
fi
|
||||
|
||||
# If --enable-proton is the next argument, enable building Proton code:
|
||||
PROTON_ARG='--enable-proton=no'
|
||||
if [ "x${1:-}" = 'x--enable-proton' ]
|
||||
then
|
||||
PROTON_ARG=''
|
||||
shift
|
||||
fi
|
||||
|
||||
# Just show the useful info
|
||||
eval "$MAKE" --version | head -n2
|
||||
as --version | head -n1
|
||||
as --version | tail -n1
|
||||
ld -v
|
||||
|
||||
HOST="$HOST" BUILD="$BUILD" NO_PROTON="$PROTON_ARG" "$MAKE" "$@" -C ./depends/ V=1
|
||||
HOST="$HOST" BUILD="$BUILD" "$MAKE" "$@" -C ./depends/ V=1
|
||||
|
||||
./autogen.sh
|
||||
|
||||
CONFIG_SITE="$PWD/depends/$HOST/share/config.site" ./configure "$HARDENING_ARG" "$LCOV_ARG" "$TEST_ARG" "$MINING_ARG" "$PROTON_ARG" $CONFIGURE_FLAGS CXXFLAGS='-g'
|
||||
CONFIG_SITE="$PWD/depends/$HOST/share/config.site" ./configure "$HARDENING_ARG" "$LCOV_ARG" "$TEST_ARG" "$MINING_ARG" $CONFIGURE_FLAGS CXXFLAGS='-g'
|
||||
|
||||
#BUILD CCLIB
|
||||
|
||||
|
||||
Reference in New Issue
Block a user