From d413fc7e9b13f315be431346a82ae804451c5c11 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 8 Feb 2019 09:41:59 +1030 Subject: [PATCH] configure: use system libbase58 if available. Also one less headache for reproducible builds. But unlike libsodium, this only seems common in Ubuntu. Signed-off-by: Rusty Russell --- CHANGELOG.md | 1 + configure | 14 ++++++++++++++ doc/INSTALL.md | 3 ++- external/Makefile | 10 ++++++++-- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7219e625e067..624853ab07dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - JSON API: `listpeers` now includes `funding_allocation_msat`, which returns a map of the amounts initially funded to the channel by each peer, indexed by channel id. - `option_data_loss_protect` is now enabled by default. - JSON API: `help` with a `command` argument gives a JSON array, like other commands. +- build: we'll use the system libbase58 and libsodium if found suitable. ### Deprecated diff --git a/configure b/configure index 38541385566f..c30c3dc703fb 100755 --- a/configure +++ b/configure @@ -171,6 +171,20 @@ int main(void) exit(0); } /*END*/ +var=HAVE_SYSTEM_LIBBASE58 +desc=libbase58 +style=DEFINES_EVERYTHING|EXECUTE|MAY_NOT_COMPILE +link=-lbase58 +code= +#include +#include + +int main(void) +{ + printf("%p\n", b58check); + exit(0); +} +/*END*/ EOF mv $CONFIG_VAR_FILE.$$ $CONFIG_VAR_FILE diff --git a/doc/INSTALL.md b/doc/INSTALL.md index 29014ff89d65..2457182f6029 100644 --- a/doc/INSTALL.md +++ b/doc/INSTALL.md @@ -36,7 +36,8 @@ Get dependencies: sudo apt-get update sudo apt-get install -y \ autoconf automake build-essential git libtool libgmp-dev \ - libsqlite3-dev python python3 net-tools zlib1g-dev libsodium + libsqlite3-dev python python3 net-tools zlib1g-dev libsodium \ + libbase58-dev If you don't have Bitcoin installed locally you'll need to install that as well: diff --git a/external/Makefile b/external/Makefile index ccaf7d3fb46c..816b95fb1065 100644 --- a/external/Makefile +++ b/external/Makefile @@ -15,13 +15,12 @@ JSMN_HEADERS := external/jsmn/jsmn.h LIBBASE58_HEADERS := external/libbase58/libbase58.h EXTERNAL_HEADERS := $(LIBSODIUM_HEADERS) $(LIBWALLY_HEADERS) $(LIBSECP_HEADERS) $(JSMN_HEADERS) $(LIBBASE58_HEADERS) -EXTERNAL_LIBS := external/libwallycore.a external/libsecp256k1.a external/libjsmn.a external/libbase58.a external/libbacktrace.a +EXTERNAL_LIBS := external/libwallycore.a external/libsecp256k1.a external/libjsmn.a external/libbacktrace.a EXTERNAL_INCLUDE_FLAGS := \ -I external/libwally-core/include/ \ -I external/libwally-core/src/secp256k1/include/ \ -I external/jsmn/ \ - -I external/libbase58/ \ -I external/libbacktrace/ \ -I external/libbacktrace-build @@ -32,6 +31,13 @@ else LDLIBS += -lsodium endif +ifneq ($(HAVE_SYSTEM_LIBBASE58),1) +EXTERNAL_INCLUDE_FLAGS += -I external/libbase58/ +EXTERNAL_LIBS += external/libbase58.a +else +LDLIBS += -lbase58 +endif + EXTERNAL_LDLIBS := -Lexternal $(patsubst lib%.a,-l%,$(notdir $(EXTERNAL_LIBS))) submodcheck: FORCE