Skip to content

Commit

Permalink
merge bitcoin#22646: tighter Univalue integration, remove `--with-sys…
Browse files Browse the repository at this point in the history
…tem-univalue` (#4823)

* merge bitcoin#22646: tighter Univalue integration, remove `--with-system-univalue`

* masternode: add missing header in meta.cpp
  • Loading branch information
kwvg authored May 2, 2022
1 parent c4fe4e3 commit b47d484
Show file tree
Hide file tree
Showing 21 changed files with 1,402 additions and 450 deletions.
58 changes: 0 additions & 58 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,6 @@ if test "x$use_asm" = xyes; then
AC_DEFINE(USE_ASM, 1, [Define this symbol to build in assembly routines])
fi

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])],
Expand Down Expand Up @@ -1506,61 +1500,13 @@ else
fi
fi

dnl univalue check

need_bundled_univalue=yes

dnl check if libgmp is present
AC_CHECK_HEADER([gmp.h],, AC_MSG_ERROR(libgmp headers missing))
AC_CHECK_LIB([gmp], [__gmpz_init],GMP_LIBS=-lgmp, AC_MSG_ERROR(libgmp missing))

dnl check if immer headers-only library is present
AC_CHECK_HEADER([immer/map.hpp],, AC_MSG_ERROR(immer map headers missing))

if test x$build_bitcoin_wallet$build_bitcoin_cli$build_bitcoin_tx$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench = xnonononononono; then
need_bundled_univalue=no
else

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 >= 1.0.4],[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
need_bundled_univalue=no
elif test x$system_univalue = xyes ; then
AC_MSG_ERROR([univalue not found])
else
system_univalue=no
fi
fi

if test x$need_bundled_univalue = xyes ; then
UNIVALUE_CFLAGS='-I$(srcdir)/univalue/include'
UNIVALUE_LIBS='univalue/libunivalue.la'
fi

fi

AM_CONDITIONAL([EMBEDDED_UNIVALUE],[test x$need_bundled_univalue = xyes])
AC_SUBST(UNIVALUE_CFLAGS)
AC_SUBST(UNIVALUE_LIBS)

AC_MSG_CHECKING([whether to build dashd])
AM_CONDITIONAL([BUILD_BITCOIND], [test x$build_bitcoind = xyes])
AC_MSG_RESULT($build_bitcoind)
Expand Down Expand Up @@ -1866,10 +1812,6 @@ PKGCONFIG_LIBDIR_TEMP="$PKG_CONFIG_LIBDIR"
unset PKG_CONFIG_LIBDIR
PKG_CONFIG_LIBDIR="$PKGCONFIG_LIBDIR_TEMP"

if test x$need_bundled_univalue = xyes; then
AC_CONFIG_SUBDIRS([src/univalue])
fi

ac_configure_args="${ac_configure_args} --disable-shared --with-pic --enable-benchmark=no --enable-module-recovery"
AC_CONFIG_SUBDIRS([src/secp256k1])

Expand Down
19 changes: 5 additions & 14 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

DIST_SUBDIRS = secp256k1 univalue
DIST_SUBDIRS = secp256k1

AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS) $(HARDENED_LDFLAGS) $(GPROF_LDFLAGS) $(SANITIZER_LDFLAGS)
AM_CXXFLAGS = $(DEBUG_CXXFLAGS) $(HARDENED_CXXFLAGS) $(WARN_CXXFLAGS) $(NOWARN_CXXFLAGS) $(ERROR_CXXFLAGS) $(GPROF_CXXFLAGS) $(SANITIZER_CXXFLAGS)
Expand Down Expand Up @@ -31,18 +31,7 @@ BACKTRACE_LIB = -lbacktrace
endif
endif #ENABLE_STACKTRACES

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_INCLUDES=-I$(builddir) -I$(srcdir)/secp256k1/include $(BDB_CPPFLAGS) $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS)

BITCOIN_INCLUDES += $(UNIVALUE_CFLAGS)
BITCOIN_INCLUDES=-I$(builddir) -I$(srcdir)/secp256k1/include -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT) $(BDB_CPPFLAGS) $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS)

BLS_LIBS=-lbls-dash -lrelic_s

Expand Down Expand Up @@ -101,6 +90,7 @@ EXTRA_LIBRARIES += \
$(LIBBITCOIN_ZMQ)

lib_LTLIBRARIES = $(LIBBITCOINCONSENSUS)
noinst_LTLIBRARIES =

bin_PROGRAMS =
noinst_PROGRAMS =
Expand Down Expand Up @@ -896,7 +886,6 @@ $(top_srcdir)/$(subdir)/config/dash-config.h.in: $(am__configure_deps)

clean-local:
-$(MAKE) -C secp256k1 clean
-$(MAKE) -C univalue clean
-rm -f leveldb/*/*.gcda leveldb/*/*.gcno leveldb/helpers/memenv/*.gcda leveldb/helpers/memenv/*.gcno
-rm -f config.h
-rm -rf test/__pycache__
Expand Down Expand Up @@ -942,3 +931,5 @@ endif
if ENABLE_QT_TESTS
include Makefile.qttest.include
endif

include Makefile.univalue.include
22 changes: 20 additions & 2 deletions src/Makefile.test.include
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,26 @@ endif
@echo "Running test/util/rpcauth-test.py..."
$(PYTHON) $(top_builddir)/test/util/rpcauth-test.py
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C secp256k1 check
if EMBEDDED_UNIVALUE
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C univalue check

if !ENABLE_FUZZ
UNIVALUE_TESTS = univalue/test/object univalue/test/unitester univalue/test/no_nul
noinst_PROGRAMS += $(UNIVALUE_TESTS)
TESTS += $(UNIVALUE_TESTS)

univalue_test_unitester_SOURCES = $(UNIVALUE_TEST_UNITESTER_INT)
univalue_test_unitester_LDADD = $(LIBUNIVALUE)
univalue_test_unitester_CPPFLAGS = -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT) -DJSON_TEST_SRC=\"$(srcdir)/$(UNIVALUE_TEST_DATA_DIR_INT)\"
univalue_test_unitester_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)

univalue_test_no_nul_SOURCES = $(UNIVALUE_TEST_NO_NUL_INT)
univalue_test_no_nul_LDADD = $(LIBUNIVALUE)
univalue_test_no_nul_CPPFLAGS = -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT)
univalue_test_no_nul_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)

univalue_test_object_SOURCES = $(UNIVALUE_TEST_OBJECT_INT)
univalue_test_object_LDADD = $(LIBUNIVALUE)
univalue_test_object_CPPFLAGS = -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT)
univalue_test_object_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)
endif

%.cpp.test: %.cpp
Expand Down
6 changes: 6 additions & 0 deletions src/Makefile.univalue.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include univalue/sources.mk

LIBUNIVALUE = libunivalue.la
noinst_LTLIBRARIES += $(LIBUNIVALUE)
libunivalue_la_SOURCES = $(UNIVALUE_LIB_SOURCES_INT) $(UNIVALUE_DIST_HEADERS_INT) $(UNIVALUE_LIB_HEADERS_INT) $(UNIVALUE_TEST_FILES_INT)
libunivalue_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT)
2 changes: 2 additions & 0 deletions src/masternode/meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include <timedata.h>

#include <sstream>

CMasternodeMetaMan mmetaman;

const std::string CMasternodeMetaMan::SERIALIZATION_VERSION_STRING = "CMasternodeMetaMan-Version-2";
Expand Down
44 changes: 44 additions & 0 deletions src/univalue/.cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
env:
MAKEJOBS: "-j4"
RUN_TESTS: "true"
BASE_OUTDIR: "$CIRRUS_WORKING_DIR/out_dir_base"
DEBIAN_FRONTEND: "noninteractive"

task:
container:
image: ubuntu:focal
cpu: 1
memory: 1G
greedy: true # https://medium.com/cirruslabs/introducing-greedy-container-instances-29aad06dc2b4

matrix:
- name: "gcc"
env:
CC: "gcc"
CXX: "g++"
APT_PKGS: "gcc"
- name: "clang"
env:
CC: "clang"
CXX: "clang++"
APT_PKGS: "clang"
- name: "mingw"
env:
CC: ""
CXX: ""
UNIVALUE_CONFIG: "--host=x86_64-w64-mingw32"
APT_PKGS: "g++-mingw-w64-x86-64 gcc-mingw-w64-x86-64 binutils-mingw-w64-x86-64"
RUN_TESTS: "false"

install_script:
- apt update
- apt install -y pkg-config build-essential libtool autotools-dev automake bsdmainutils
- apt install -y $APT_PKGS
autogen_script:
- ./autogen.sh
configure_script:
- ./configure --cache-file=config.cache --bindir=$BASE_OUTDIR/bin --libdir=$BASE_OUTDIR/lib $UNIVALUE_CONFIG
make_script:
- make $MAKEJOBS V=1
test_script:
- if [ "$RUN_TESTS" = "true" ]; then make $MAKEJOBS distcheck; fi
51 changes: 0 additions & 51 deletions src/univalue/.travis.yml

This file was deleted.

Loading

0 comments on commit b47d484

Please sign in to comment.