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

pkg/nanopb: simplify setup procedure #53

Merged
merged 2 commits into from
Sep 10, 2019
Merged
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
3 changes: 2 additions & 1 deletion pkg/nanopb/nanopb.inc.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PROTOC ?= protoc
PROTOC_GEN_NANOPB ?= protoc-gen-nanopb
PROTOC_GEN_NANOPB ?= $(PKGDIRBASE)/nanopb/generator/protoc-gen-nanopb

PROTOBUF_FILES ?= $(wildcard *.proto)
GENSRC += $(PROTOBUF_FILES:%.proto=$(BINDIR)/$(MODULE)/%.pb.c)
Expand All @@ -15,6 +15,7 @@ $(GENSRC): $(PROTOBUF_FILES)
$(Q)D=$(BINDIR)/$(MODULE) && \
mkdir -p "$$D" && \
cd $(CURDIR) && \
make -C $(PKGDIRBASE)/nanopb/generator/proto && \
Copy link
Owner

@kaspar030 kaspar030 Sep 9, 2019

Choose a reason for hiding this comment

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

can you we guard this with something like if $PROTOC_GEN_NANOPB == $(PKGDIRBASE)/nanopb/generator/protoc-gen-nanopb, so that make will only be called if the user doesn't supply an external version?

Or is that overkill...?

Copy link
Author

Choose a reason for hiding this comment

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

The question is why would the user ever want to provide an external version?

I can add such check, but I don't quite see the use case for it yet.

Copy link
Owner

Choose a reason for hiding this comment

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

ok, fine with me!

for protofile in $(PROTOBUF_FILES); do \
protoc --plugin=protoc-gen-nanopb=$(PROTOC_GEN_NANOPB) \
--nanopb_out="$$D" \
Expand Down
19 changes: 0 additions & 19 deletions tests/pkg_nanopb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,3 @@ The library provides a Google Protocol Buffers encoder / decoder.
Install the protobuf compiler and the protobuf python bindings.
On Debian/ubuntu, the corresponding packages are `protobuf-compiler` and
`python-protobuf`. On Arch, it is `protobuf` and `python-protobuf`.

You'll also need the nanopb protoc generator plugin.

Checkout the matching nanopb repository:

$ git clone https://github.com/nanopb/nanopb nanopb-0.3.9.3
$ cd nanopb/generator/proto

Take note of the path to `nanopb/generator`.

The build system needs to know the location of the generator plugin.
Assuming nanopb has been checked out into `~/src/nanopb`, you'll need to prefix
all make invocations with
```PROTOC_GEN_NANOPB=~/src/nanopb/generator/protoc-gen-nanopb```.

E.g., to compile this test:

PROTOC_GEN_NANOPB=~/src/nanopb/generator/protoc-gen-nanopb make \
clean all -j4