Skip to content

Commit

Permalink
support static link
Browse files Browse the repository at this point in the history
  • Loading branch information
arowser authored and rustyrussell committed Dec 18, 2018
1 parent 2c53572 commit 64677dc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ CFLAGS = $(CPPFLAGS) $(CWARNFLAGS) $(CDEBUGFLAGS) -I $(CCANDIR) $(EXTERNAL_INCLU
CONFIGURATOR_CC := $(CC)

LDFLAGS = $(PIE_LDFLAGS)
ifeq ($(STATIC),1)
LDLIBS = -static -L/usr/local/lib -lgmp -lsqlite3 -lm -lz -lpthread -ldl $(COVFLAGS)
else
LDLIBS = -L/usr/local/lib -lm -lgmp -lsqlite3 -lz $(COVFLAGS)
endif

default: all-programs all-test-programs

Expand Down
6 changes: 6 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ CDEBUGFLAGS=${CDEBUGFLAGS:--std=gnu11 -g -fstack-protector}
DEVELOPER=${DEVELOPER:-0}
EXPERIMENTAL_FEATURES=${EXPERIMENTAL_FEATURES:-0}
COMPAT=${COMPAT:-1}
STATIC=${STATIC:-0}
CONFIGURATOR_CC=${CONFIGURATOR_CC:-$CC}

CONFIGURATOR=ccan/tools/configurator/configurator
Expand Down Expand Up @@ -54,6 +55,8 @@ usage()
echo " Compatibility mode, good to disable to see if your software breaks"
usage_with_default "--enable/disable-valgrind" "(autodetect)"
echo " Valgrind binary to use for tests"
usage_with_default "--enable/disable-static" "$STATIC" "enable" "disable"
echo " Static link binary"
exit 1
}

Expand Down Expand Up @@ -110,6 +113,8 @@ for opt in "$@"; do
--disable-compat) COMPAT=0;;
--enable-valgrind) VALGRIND=1;;
--disable-valgrind) VALGRIND=0;;
--enable-static) STATIC=1;;
--disable-static) STATIC=0;;
--help|-h) usage;;
*)
echo "Unknown option '$opt'" >&2
Expand Down Expand Up @@ -144,6 +149,7 @@ add_var DEVELOPER "$DEVELOPER" $CONFIG_HEADER
add_var EXPERIMENTAL_FEATURES "$EXPERIMENTAL_FEATURES" $CONFIG_HEADER
add_var COMPAT "$COMPAT" $CONFIG_HEADER
add_var PYTEST "$PYTEST"
add_var STATIC "$STATIC"

# Hack to avoid sha256 name clash with libwally: will be fixed when that
# becomes a standalone shared lib.
Expand Down

0 comments on commit 64677dc

Please sign in to comment.