mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
Backport Bitcoin PR#7349: Build against system UniValue when available (#1503)
* Build against system UniValue when available * doc: Add UniValue to build instructions * Bugfix: The var is LIBUNIVALUE,not LIBBITCOIN_UNIVALUE * Change default configure option --with-system-univalue to "no" * Bugfix: Always include univalue in DIST_SUBDIRS * LDADD dependency order shuffling * build-unix: Update UniValue build conditions
This commit is contained in:
parent
96f0d6ec2b
commit
f65017cfeb
50
configure.ac
50
configure.ac
@ -166,6 +166,12 @@ AC_ARG_ENABLE([glibc-back-compat],
|
||||
[use_glibc_compat=$enableval],
|
||||
[use_glibc_compat=no])
|
||||
|
||||
AC_ARG_WITH([system-univalue],
|
||||
[AS_HELP_STRING([--with-system-univalue],
|
||||
[Build with system UniValue (default is no)])],
|
||||
[system_univalue=$withval],
|
||||
[system_univalue=no]
|
||||
)
|
||||
AC_ARG_ENABLE([zmq],
|
||||
[AS_HELP_STRING([--disable-zmq],
|
||||
[disable ZMQ notifications])],
|
||||
@ -814,6 +820,44 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl univalue check
|
||||
|
||||
if test x$system_univalue != xno ; then
|
||||
found_univalue=no
|
||||
if test x$use_pkgconfig = xyes; then
|
||||
: #NOP
|
||||
m4_ifdef(
|
||||
[PKG_CHECK_MODULES],
|
||||
[
|
||||
PKG_CHECK_MODULES([UNIVALUE],[libunivalue],[found_univalue=yes],[true])
|
||||
]
|
||||
)
|
||||
else
|
||||
AC_CHECK_HEADER([univalue.h],[
|
||||
AC_CHECK_LIB([univalue], [main],[
|
||||
UNIVALUE_LIBS=-lunivalue
|
||||
found_univalue=yes
|
||||
],[true])
|
||||
],[true])
|
||||
fi
|
||||
|
||||
if test x$found_univalue = xyes ; then
|
||||
system_univalue=yes
|
||||
elif test x$system_univalue = xyes ; then
|
||||
AC_MSG_ERROR([univalue not found])
|
||||
else
|
||||
system_univalue=no
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x$system_univalue = xno ; then
|
||||
UNIVALUE_CFLAGS='-I$(srcdir)/univalue/include'
|
||||
UNIVALUE_LIBS='univalue/libunivalue.la'
|
||||
fi
|
||||
AM_CONDITIONAL([EMBEDDED_UNIVALUE],[test x$system_univalue = xno])
|
||||
AC_SUBST(UNIVALUE_CFLAGS)
|
||||
AC_SUBST(UNIVALUE_LIBS)
|
||||
|
||||
CXXFLAGS_TEMP="$CXXFLAGS"
|
||||
LIBS_TEMP="$LIBS"
|
||||
CXXFLAGS="$CXXFLAGS $SSL_CFLAGS $CRYPTO_CFLAGS"
|
||||
@ -1031,8 +1075,12 @@ PKGCONFIG_LIBDIR_TEMP="$PKG_CONFIG_LIBDIR"
|
||||
unset PKG_CONFIG_LIBDIR
|
||||
PKG_CONFIG_LIBDIR="$PKGCONFIG_LIBDIR_TEMP"
|
||||
|
||||
if test x$system_univalue = xno; then
|
||||
AC_CONFIG_SUBDIRS([src/univalue])
|
||||
fi
|
||||
|
||||
ac_configure_args="${ac_configure_args} --disable-shared --with-pic --with-bignum=no --enable-module-recovery"
|
||||
AC_CONFIG_SUBDIRS([src/secp256k1 src/univalue])
|
||||
AC_CONFIG_SUBDIRS([src/secp256k1])
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
|
@ -46,6 +46,7 @@ Optional dependencies:
|
||||
qt | GUI | GUI toolkit (only needed when GUI enabled)
|
||||
protobuf | Payments in GUI | Data interchange format used for payment protocol (only needed when GUI enabled)
|
||||
libqrencode | QR codes in GUI | Optional for generating QR codes (only needed when GUI enabled)
|
||||
univalue | Utility | JSON parsing and encoding (bundled version will be used unless --with-system-univalue passed to configure)
|
||||
libzmq3 | ZMQ notification | Optional, allows generating ZMQ notifications (requires ZMQ version >= 4.x)
|
||||
|
||||
For the versions used in the release, see [release-process.md](release-process.md) under *Fetch and build inputs*.
|
||||
|
@ -5,11 +5,20 @@ AM_CXXFLAGS = $(HARDENED_CXXFLAGS)
|
||||
AM_CPPFLAGS = $(HARDENED_CPPFLAGS)
|
||||
EXTRA_LIBRARIES =
|
||||
|
||||
if EMBEDDED_UNIVALUE
|
||||
LIBUNIVALUE = univalue/libunivalue.la
|
||||
|
||||
$(LIBUNIVALUE): $(wildcard univalue/lib/*) $(wildcard univalue/include/*)
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
|
||||
else
|
||||
LIBUNIVALUE = $(UNIVALUE_LIBS)
|
||||
endif
|
||||
|
||||
BITCOIN_CONFIG_INCLUDES=-I$(builddir)/config
|
||||
BITCOIN_INCLUDES=-I$(builddir) -I$(builddir)/obj $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS) $(CRYPTO_CFLAGS) $(SSL_CFLAGS)
|
||||
|
||||
BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include
|
||||
BITCOIN_INCLUDES += -I$(srcdir)/univalue/include
|
||||
BITCOIN_INCLUDES += $(UNIVALUE_CFLAGS)
|
||||
|
||||
LIBBITCOIN_SERVER=libbitcoin_server.a
|
||||
LIBBITCOIN_WALLET=libbitcoin_wallet.a
|
||||
@ -19,14 +28,10 @@ LIBBITCOIN_UTIL=libbitcoin_util.a
|
||||
LIBBITCOIN_CRYPTO=crypto/libbitcoin_crypto.a
|
||||
LIBBITCOINQT=qt/libbitcoinqt.a
|
||||
LIBSECP256K1=secp256k1/libsecp256k1.la
|
||||
LIBUNIVALUE=univalue/libunivalue.la
|
||||
|
||||
$(LIBSECP256K1): $(wildcard secp256k1/src/*) $(wildcard secp256k1/include/*)
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
|
||||
|
||||
$(LIBUNIVALUE): $(wildcard univalue/lib/*) $(wildcard univalue/include/*)
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
|
||||
|
||||
# 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:
|
||||
EXTRA_LIBRARIES += \
|
||||
|
@ -14,12 +14,12 @@ bench_bench_dash_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
bench_bench_dash_LDADD = \
|
||||
$(LIBBITCOIN_SERVER) \
|
||||
$(LIBBITCOIN_COMMON) \
|
||||
$(LIBBITCOIN_UNIVALUE) \
|
||||
$(LIBBITCOIN_UTIL) \
|
||||
$(LIBBITCOIN_CRYPTO) \
|
||||
$(LIBLEVELDB) \
|
||||
$(LIBMEMENV) \
|
||||
$(LIBSECP256K1)
|
||||
$(LIBSECP256K1) \
|
||||
$(LIBUNIVALUE)
|
||||
|
||||
if ENABLE_ZMQ
|
||||
bench_bench_dash_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
|
||||
|
@ -137,7 +137,9 @@ check-local:
|
||||
@echo "Running test/bitcoin-util-test.py..."
|
||||
$(AM_V_at)srcdir=$(srcdir) PYTHONPATH=$(builddir)/test $(srcdir)/test/bitcoin-util-test.py
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C secp256k1 check
|
||||
if EMBEDDED_UNIVALUE
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C univalue check
|
||||
endif
|
||||
|
||||
%.json.h: %.json
|
||||
@$(MKDIR_P) $(@D)
|
||||
|
Loading…
Reference in New Issue
Block a user