From 2adf7e2c90b22d89308f36355f8a6de395e24c36 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 15 Jan 2016 04:34:02 +0000 Subject: [PATCH 1/7] Bugfix: The var is LIBUNIVALUE,not LIBBITCOIN_UNIVALUE --- src/Makefile.bench.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.bench.include b/src/Makefile.bench.include index d660a3a74..00a80ae81 100644 --- a/src/Makefile.bench.include +++ b/src/Makefile.bench.include @@ -14,7 +14,7 @@ bench_bench_bitcoin_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) bench_bench_bitcoin_LDADD = \ $(LIBBITCOIN_SERVER) \ $(LIBBITCOIN_COMMON) \ - $(LIBBITCOIN_UNIVALUE) \ + $(LIBUNIVALUE) \ $(LIBBITCOIN_UTIL) \ $(LIBBITCOIN_CRYPTO) \ $(LIBLEVELDB) \ From ab22705a7b7796362ad7c6ec8f7465d3a450977f Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 14 Jan 2016 00:26:23 +0000 Subject: [PATCH 2/7] Build against system UniValue when available --- configure.ac | 50 ++++++++++++++++++++++++++++++++++++++- src/Makefile.am | 19 ++++++++++----- src/Makefile.test.include | 2 ++ 3 files changed, 64 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 63a745393..9819c2493 100644 --- a/configure.ac +++ b/configure.ac @@ -148,6 +148,12 @@ AC_ARG_ENABLE([glibc-back-compat], [use_glibc_compat=$enableval], [use_glibc_compat=no]) +AC_ARG_WITH([system-univalue], + [AS_HELP_STRING([--without-system-univalue], + [Build with system UniValue (default is auto)])], + [system_univalue=$withval], + [system_univalue=auto] +) AC_ARG_ENABLE([zmq], [AS_HELP_STRING([--disable-zmq], [disable ZMQ notifications])], @@ -742,6 +748,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" @@ -958,8 +1002,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 diff --git a/src/Makefile.am b/src/Makefile.am index bb627a544..97593bfe8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,9 +1,20 @@ -DIST_SUBDIRS = secp256k1 univalue +DIST_SUBDIRS = secp256k1 AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS) $(HARDENED_LDFLAGS) AM_CXXFLAGS = $(HARDENED_CXXFLAGS) AM_CPPFLAGS = $(HARDENED_CPPFLAGS) +if EMBEDDED_UNIVALUE +DIST_SUBDIRS += 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 + if EMBEDDED_LEVELDB LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/include LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/helpers/memenv @@ -23,7 +34,7 @@ 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 @@ -33,13 +44,9 @@ 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: diff --git a/src/Makefile.test.include b/src/Makefile.test.include index 4d0894b71..6cf0205dd 100644 --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -130,7 +130,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) From 5d3b29bc00b85c99b07e1ca78ae8cc565f01edcc Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 15 Jan 2016 02:19:28 +0000 Subject: [PATCH 3/7] doc: Add UniValue to build instructions --- doc/build-unix.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/build-unix.md b/doc/build-unix.md index 159a14060..0f7b5a5f7 100644 --- a/doc/build-unix.md +++ b/doc/build-unix.md @@ -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 (if missing, bundled version will be used) 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*. From 23565157bade9a3dce128c9bb3be9a5508f3421d Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 28 Jan 2016 05:31:41 +0000 Subject: [PATCH 4/7] Change default configure option --with-system-univalue to "no" --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 9819c2493..24f9f090f 100644 --- a/configure.ac +++ b/configure.ac @@ -149,10 +149,10 @@ AC_ARG_ENABLE([glibc-back-compat], [use_glibc_compat=no]) AC_ARG_WITH([system-univalue], - [AS_HELP_STRING([--without-system-univalue], - [Build with system UniValue (default is auto)])], + [AS_HELP_STRING([--with-system-univalue], + [Build with system UniValue (default is no)])], [system_univalue=$withval], - [system_univalue=auto] + [system_univalue=no] ) AC_ARG_ENABLE([zmq], [AS_HELP_STRING([--disable-zmq], From 62f7f2ee219416a6abbf35e830d7cbc7057f02c9 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sun, 31 Jan 2016 02:32:00 +0000 Subject: [PATCH 5/7] Bugfix: Always include univalue in DIST_SUBDIRS --- src/Makefile.am | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 97593bfe8..8d95b0d23 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,12 +1,10 @@ -DIST_SUBDIRS = secp256k1 +DIST_SUBDIRS = secp256k1 univalue AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS) $(HARDENED_LDFLAGS) AM_CXXFLAGS = $(HARDENED_CXXFLAGS) AM_CPPFLAGS = $(HARDENED_CPPFLAGS) if EMBEDDED_UNIVALUE -DIST_SUBDIRS += univalue - LIBUNIVALUE = univalue/libunivalue.la $(LIBUNIVALUE): $(wildcard univalue/lib/*) $(wildcard univalue/include/*) From cdcad9fc5f64a4c1d06fa62e6541cc0bb7646f06 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sun, 31 Jan 2016 02:32:55 +0000 Subject: [PATCH 6/7] LDADD dependency order shuffling --- src/Makefile.bench.include | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Makefile.bench.include b/src/Makefile.bench.include index 00a80ae81..7062dd62e 100644 --- a/src/Makefile.bench.include +++ b/src/Makefile.bench.include @@ -14,12 +14,12 @@ bench_bench_bitcoin_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) bench_bench_bitcoin_LDADD = \ $(LIBBITCOIN_SERVER) \ $(LIBBITCOIN_COMMON) \ - $(LIBUNIVALUE) \ $(LIBBITCOIN_UTIL) \ $(LIBBITCOIN_CRYPTO) \ $(LIBLEVELDB) \ $(LIBMEMENV) \ - $(LIBSECP256K1) + $(LIBSECP256K1) \ + $(LIBUNIVALUE) if ENABLE_ZMQ bench_bench_bitcoin_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS) From 42407ed43ad24ac1016eb457a7b0e720e63188cd Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 1 Feb 2016 18:49:24 +0000 Subject: [PATCH 7/7] build-unix: Update UniValue build conditions --- doc/build-unix.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/build-unix.md b/doc/build-unix.md index 0f7b5a5f7..50c12ebef 100644 --- a/doc/build-unix.md +++ b/doc/build-unix.md @@ -46,7 +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 (if missing, bundled version will be used) + 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*.