mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 06:41:44 +01:00
configure: use system libsodium if available and modern.
Also one less headache for reproducible builds. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
2db84d6653
commit
21fd8f7eaa
3 changed files with 30 additions and 8 deletions
17
configure
vendored
17
configure
vendored
|
@ -156,7 +156,22 @@ if [ "$ASAN" = "1" ]; then
|
|||
fi
|
||||
|
||||
rm -f $CONFIG_VAR_FILE.$$
|
||||
$CONFIGURATOR --autotools-style --var-file=$CONFIG_VAR_FILE.$$ --header-file=$CONFIG_HEADER --configurator-cc="$CONFIGURATOR_CC" "$CC" $CWARNFLAGS $CDEBUGFLAGS
|
||||
$CONFIGURATOR --extra-tests --autotools-style --var-file=$CONFIG_VAR_FILE.$$ --header-file=$CONFIG_HEADER --configurator-cc="$CONFIGURATOR_CC" "$CC" $CWARNFLAGS $CDEBUGFLAGS <<EOF
|
||||
var=HAVE_GOOD_LIBSODIUM
|
||||
desc=libsodium with IETF chacha20 variants
|
||||
style=DEFINES_EVERYTHING|EXECUTE|MAY_NOT_COMPILE
|
||||
link=-lsodium
|
||||
code=
|
||||
#include <sodium.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("%p\n", crypto_aead_chacha20poly1305_ietf_encrypt);
|
||||
exit(0);
|
||||
}
|
||||
/*END*/
|
||||
EOF
|
||||
mv $CONFIG_VAR_FILE.$$ $CONFIG_VAR_FILE
|
||||
|
||||
add_var PREFIX "$PREFIX"
|
||||
|
|
|
@ -36,7 +36,7 @@ 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
|
||||
libsqlite3-dev python python3 net-tools zlib1g-dev libsodium
|
||||
|
||||
If you don't have Bitcoin installed locally you'll need to install that
|
||||
as well:
|
||||
|
@ -93,7 +93,8 @@ $ sudo dnf update -y && \
|
|||
net-tools \
|
||||
valgrind \
|
||||
wget \
|
||||
zlib-devel && \
|
||||
zlib-devel \
|
||||
libsodium-devel && \
|
||||
sudo dnf clean all
|
||||
```
|
||||
|
||||
|
@ -132,7 +133,7 @@ OS version: FreeBSD 11.1-RELEASE or above
|
|||
Get dependencies:
|
||||
|
||||
# pkg install -y \
|
||||
autoconf automake git gmp asciidoc gmake libtool python python3 sqlite3
|
||||
autoconf automake git gmp asciidoc gmake libtool python python3 sqlite3 libsodium
|
||||
|
||||
If you don't have Bitcoin installed locally you'll need to install that
|
||||
as well:
|
||||
|
@ -167,7 +168,7 @@ Use nix-shell launch a shell with a full clightning dev environment:
|
|||
|
||||
```
|
||||
$ nix-shell -Q -p gdb sqlite autoconf git clang libtool gmp sqlite autoconf \
|
||||
autogen automake 'python3.withPackages (p: [p.bitcoinlib])' \
|
||||
autogen automake libsodium 'python3.withPackages (p: [p.bitcoinlib])' \
|
||||
valgrind asciidoc --run make
|
||||
```
|
||||
|
||||
|
@ -181,7 +182,7 @@ Assuming you have Xcode and Homebrew installed. Install dependencies:
|
|||
If you don't have bitcoind installed locally you'll need to install that
|
||||
as well:
|
||||
|
||||
$ brew install berkeley-db4 boost miniupnpc openssl pkg-config libevent
|
||||
$ brew install berkeley-db4 boost miniupnpc openssl pkg-config libevent libsodium
|
||||
$ git clone https://github.com/bitcoin/bitcoin
|
||||
$ cd bitcoin
|
||||
$ ./autogen.sh
|
||||
|
|
10
external/Makefile
vendored
10
external/Makefile
vendored
|
@ -15,10 +15,9 @@ 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/libsodium.a external/libjsmn.a external/libbase58.a external/libbacktrace.a
|
||||
EXTERNAL_LIBS := external/libwallycore.a external/libsecp256k1.a external/libjsmn.a external/libbase58.a external/libbacktrace.a
|
||||
|
||||
EXTERNAL_INCLUDE_FLAGS := \
|
||||
-I external/libsodium/src/libsodium/include \
|
||||
-I external/libwally-core/include/ \
|
||||
-I external/libwally-core/src/secp256k1/include/ \
|
||||
-I external/jsmn/ \
|
||||
|
@ -26,6 +25,13 @@ EXTERNAL_INCLUDE_FLAGS := \
|
|||
-I external/libbacktrace/ \
|
||||
-I external/libbacktrace-build
|
||||
|
||||
ifneq ($(HAVE_GOOD_LIBSODIUM),1)
|
||||
EXTERNAL_INCLUDE_FLAGS += -I external/libsodium/src/libsodium/include
|
||||
EXTERNAL_LIBS += external/libsodium.a
|
||||
else
|
||||
LDLIBS += -lsodium
|
||||
endif
|
||||
|
||||
EXTERNAL_LDLIBS := -Lexternal $(patsubst lib%.a,-l%,$(notdir $(EXTERNAL_LIBS)))
|
||||
|
||||
submodcheck: FORCE
|
||||
|
|
Loading…
Add table
Reference in a new issue