Skip to content

Commit

Permalink
configure: use system libbase58 if available.
Browse files Browse the repository at this point in the history
Also one less headache for reproducible builds.  But unlike
libsodium, this only seems common in Ubuntu.

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Feb 8, 2019
1 parent 21fd8f7 commit d413fc7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 14 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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 <libbase58.h>
#include <stdio.h>
int main(void)
{
printf("%p\n", b58check);
exit(0);
}
/*END*/
EOF
mv $CONFIG_VAR_FILE.$$ $CONFIG_VAR_FILE

Expand Down
3 changes: 2 additions & 1 deletion doc/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 8 additions & 2 deletions external/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit d413fc7

Please sign in to comment.