Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: disable-grpc flag #7478

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,10 @@ ifneq ($(FUZZING),0)
endif
ifneq ($(RUST),0)
include cln-rpc/Makefile
ifneq ($(GRPC),0)
include cln-grpc/Makefile
endif
endif
include cln-grpc/Makefile

ifneq ($V,1)
MSGGEN_ARGS := -s
Expand All @@ -377,6 +379,7 @@ endif
$(MSGGEN_GENALL)&: contrib/msggen/msggen/schema.json
@$(call VERBOSE, "msggen $@", PYTHONPATH=contrib/msggen $(PYTHON) contrib/msggen/msggen/__main__.py $(MSGGEN_ARGS) generate)

ifneq ($(GRPC),0)
# The compiler assumes that the proto files are in the same
# directory structure as the generated files will be. Since we
# don't do that we need to path the files up.
Expand All @@ -395,6 +398,7 @@ $(GRPC_GEN) &: cln-grpc/proto/node.proto cln-grpc/proto/primitives.proto
$(PYTHON) -m grpc_tools.protoc -I cln-grpc/proto cln-grpc/proto/primitives.proto --python_out=$(GRPC_PATH)/ --experimental_allow_proto3_optional
find $(GRPC_DIR)/ -type f -name "*.py" -print0 | xargs -0 sed -i'.bak' -e 's/^import \(.*\)_pb2 as .*__pb2/from pyln.grpc import \1_pb2 as \1__pb2/g'
find $(GRPC_DIR)/ -type f -name "*.py.bak" -print0 | xargs -0 rm -f
endif

# We make pretty much everything depend on these.
ALL_GEN_HEADERS := $(filter %gen.h,$(ALL_C_HEADERS))
Expand Down
6 changes: 6 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ set_defaults()
VALGRIND=${VALGRIND:-$(default_valgrind_setting)}
TEST_NETWORK=${TEST_NETWORK:-regtest}
RUST=${RUST:-$(default_rust_setting)}
GRPC=1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this depends on RUST, seems logical to default it to the rust setting?

}

usage()
Expand Down Expand Up @@ -220,6 +221,8 @@ usage()
echo " Compile with fuzzing"
usage_with_default "--enable/disable-rust" "$RUST" "enable" "disable"
echo " Compile with Rust support"
usage_with_default "--enable/disable-grpc" "$GRPC" "enable" "disable"
echo " Compile with cln-grpc plugin"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is enabled but RUST isn't, iiuc it won't actually compile the CLN-GRPC plugin right? Seems confusing.

exit 1
}

Expand Down Expand Up @@ -283,6 +286,8 @@ for opt in "$@"; do
--disable-fuzzing) FUZZING=0;;
--enable-rust) RUST=1;;
--disable-rust) RUST=0;;
--enable-grpc) GRPC=1;;
--disable-grpc) GRPC=0;;
--help|-h) usage;;
*)
echo "Unknown option '$opt'" >&2
Expand Down Expand Up @@ -543,6 +548,7 @@ add_var HAVE_LOWDOWN "$HAVE_LOWDOWN"
add_var SHA256SUM "$SHA256SUM"
add_var FUZZING "$FUZZING"
add_var RUST "$RUST"
add_var GRPC "$GRPC"
add_var PYTHON "$PYTHON"

# Hack to avoid sha256 name clash with libwally: will be fixed when that
Expand Down
7 changes: 6 additions & 1 deletion plugins/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,15 @@ PLUGINS := $(C_PLUGINS)
PLUGIN_ALL_OBJS := $(PLUGIN_ALL_SRC:.c=.o)

ifneq ($(RUST),0)
ifneq ($(GRPC),0)
# Builtin plugins must be in this plugins dir to work when we're executed
# *without* make install.
plugins/cln-grpc: target/${RUST_PROFILE}/cln-grpc
@cp $< $@

PLUGINS += plugins/cln-grpc
endif
endif

PLUGIN_COMMON_OBJS := \
bitcoin/base58.o \
Expand Down Expand Up @@ -264,7 +266,10 @@ target/${RUST_PROFILE}/cln-grpc: ${CLN_PLUGIN_SRC} ${CLN_GRPC_PLUGIN_SRC}
cargo build ${CARGO_OPTS} --bin cln-grpc

ifneq ($(RUST),0)
DEFAULT_TARGETS += $(CLN_PLUGIN_EXAMPLES) plugins/cln-grpc
DEFAULT_TARGETS += $(CLN_PLUGIN_EXAMPLES)
ifneq ($(GRPC),0)
DEFAULT_TARGETS += plugins/cln-grpc
endif
endif

clean: plugins-clean
Expand Down