Skip to content

Commit

Permalink
external/libbacktrace: new external library for backtrace support.
Browse files Browse the repository at this point in the history
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell authored and cdecker committed Sep 12, 2017
1 parent 584b160 commit dba2718
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Expand Up @@ -7,3 +7,6 @@
[submodule "libsodium"]
path = external/libsodium
url = https://github.com/jedisct1/libsodium.git
[submodule "external/libbacktrace"]
path = external/libbacktrace
url = https://github.com/ianlancetaylor/libbacktrace.git
17 changes: 14 additions & 3 deletions external/Makefile
Expand Up @@ -8,14 +8,15 @@ 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_LIBS := external/libwallycore.a external/libsecp256k1.a external/libsodium.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/ \
-I external/libbase58/
-I external/libbase58/ \
-I external/libbacktrace

EXTERNAL_LDLIBS := -Lexternal $(patsubst lib%.a,-l%,$(notdir $(EXTERNAL_LIBS)))

Expand Down Expand Up @@ -69,6 +70,16 @@ external/base58.o: $(LIBBASE58_SRC)
external/libbase58.a: external/base58.o
$(AR) rc $@ $<

external/libbacktrace/backtrace.h:
git submodule update external/libbacktrace/
[ -f $@ ] || git submodule update --init external/libbacktrace/

# Need separate build dir: changes inside submodule make git think it's dirty.
external/libbacktrace.a: external/libbacktrace/backtrace.h
@mkdir external/libbacktrace-build 2>/dev/null || true
cd external/libbacktrace-build && ../libbacktrace/configure CC="$(CC)" --enable-static=yes --enable-shared=no --libdir=`pwd`/.. && $(MAKE)
$(MAKE) -C external/libbacktrace-build install-exec

distclean: external-distclean
clean: external-clean

Expand All @@ -77,7 +88,7 @@ external-clean:

external-distclean:
make -C external/libsodium distclean || true
make -C external/libbase64 distclean || true
$(RM) -rf external/libbacktrace-build
$(RM) external/libsodium.la external/libsodium/src/libsodium/libsodium.la
$(RM) external/libwally-core/src/secp256k1/libsecp256k1.la external/libwally-core/src/libwallycore.la
cd external/libwally-core && tools/cleanup.sh
1 change: 1 addition & 0 deletions external/libbacktrace
Submodule libbacktrace added at 14d377

0 comments on commit dba2718

Please sign in to comment.