From: "Erik Schilling" <erik.schilling@linaro.org>
To: "Viresh Kumar" <viresh.kumar@linaro.org>
Cc: Linux-GPIO <linux-gpio@vger.kernel.org>,
"Bartosz Golaszewski" <bartosz.golaszewski@linaro.org>,
"Manos Pitsidianakis" <manos.pitsidianakis@linaro.org>,
"Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: [PATCH libgpiod RFC 0/3] bindings: rust: allow packaging of libgpiod-sys
Date: Wed, 24 May 2023 10:09:55 +0200 [thread overview]
Message-ID: <CSUCSUR6CSH3.NHT0430XGAIO@fedora> (raw)
In-Reply-To: <20230524060341.khmsd2lw32u3jxsc@vireshk-i7>
On Wed May 24, 2023 at 8:03 AM CEST, Viresh Kumar wrote:
> On 23-05-23, 13:25, Erik Schilling wrote:
> > As of now, the Rust bindings are only consumable as git dependencies
> > (and even then come with some restrictions when wanting to control
> > the build and linkage behaviour).
> >
> > This series does some (hopefully) cleanup and then proposes a change
> > in how the Rust bindings are built and linked.
> >
> > Since the changes may require people hacking on the bindings to set some
> > additional environment variables (at least if they want to avoid running
> > make install), I am sending this as an RFC in order
> > to hear opinions.
> >
> > For gpiosim-sys the situation is slightly more complex. Right now,
> > libgpiosim installs without a pkg-config. If it is desireable to add
> > one, that could be done and the same mechanism could be used. Otherwise,
> > if packaging that lib is desirable (it looks like it?), we could either
> > still query for libgpiod (and hope that the linker and include paths are
> > matching) or need some other way to acquire the linker and include paths
> > (and flags).
> >
> > So... The open questions:
> > - Is this OK at all? Are people depending on this building against
> > relative paths?
>
> Not sure if the build of the libgpiod git repo depends on that relative path,
> did you try to do `make` in the libgpiod directory ? Like:
>
> $ ./autogen.sh --enable-tools=yes --enable-bindings-rust --enable-examples --enable-tests; make
Ah! I did not catch that libgpiod is built via `make` too. I only
checked the Makefile under libgpiod-sys.
But we can do something like this (I would probably redo the
documentation part in the README then though...):
diff --git a/bindings/rust/libgpiod/Makefile.am b/bindings/rust/libgpiod/Makefile.am
index 38f2ebf..8bbf530 100644
--- a/bindings/rust/libgpiod/Makefile.am
+++ b/bindings/rust/libgpiod/Makefile.am
@@ -2,7 +2,13 @@
# SPDX-FileCopyrightText: 2022 Linaro Ltd.
# SPDX-FileCopyrightTest: 2022 Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
-command = cargo build --release --lib
+# We do not want to build against the system libs here. So we specify the paths
+# to the build directory of the C lib.
+command = SYSTEM_DEPS_LIBGPIOD_NO_PKG_CONFIG=1 \
+ SYSTEM_DEPS_LIBGPIOD_SEARCH_NATIVE="${PWD}/../../../lib/.libs/" \
+ SYSTEM_DEPS_LIBGPIOD_LIB=gpiod \
+ SYSTEM_DEPS_LIBGPIOD_INCLUDE="${PWD}/../../../include/" \
+ cargo build --release --lib
if WITH_TESTS
command += --tests
>
> > - What to do with gpiosim-sys (see above)?
>
> The only user for the cargo tests for libgpiod stuff is for the vhost-device
> crate with the help of rust-vmm containers. I am installing libgpiod there
> currently and so it works, not sure of how it may be required to be used later
> on though.
I am not exactly sure if I understood the above comment correctly. But
if we want to eventually be able to consume gpiosim-sys via crates.io
(or any packaging mechanism that relies on cargo package), then we will
need to decouple the header and .so file referencing in a similar way.
The easiest solution for me seems to be to just add a pkg-config file
for gpiosim and use the same mechanism that I sketched for libgpiod-sys
here.
next prev parent reply other threads:[~2023-05-24 8:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-23 11:25 [PATCH libgpiod RFC 0/3] bindings: rust: allow packaging of libgpiod-sys Erik Schilling
2023-05-23 11:25 ` [PATCH libgpiod RFC 1/3] bindings: rust: drop legacy extern crate syntax Erik Schilling
2023-05-24 4:36 ` Viresh Kumar
2023-05-23 11:25 ` [PATCH libgpiod RFC 2/3] bindings: rust: remove unneeded cc dependency Erik Schilling
2023-05-24 4:36 ` Viresh Kumar
2023-05-23 11:25 ` [PATCH libgpiod RFC 3/3] bindings: rust: build against pkg-config info Erik Schilling
2023-05-24 5:01 ` Erik Schilling
2023-05-24 6:03 ` [PATCH libgpiod RFC 0/3] bindings: rust: allow packaging of libgpiod-sys Viresh Kumar
2023-05-24 8:09 ` Erik Schilling [this message]
2023-05-24 8:14 ` Viresh Kumar
2023-05-24 10:53 ` Erik Schilling
2023-05-26 8:30 ` Erik Schilling
2023-05-26 8:36 ` Bartosz Golaszewski
2023-05-26 8:59 ` Erik Schilling
2023-05-26 9:31 ` Viresh Kumar
2023-05-26 9:44 ` Erik Schilling
2023-05-24 9:17 ` Bartosz Golaszewski
2023-05-26 9:45 ` Erik Schilling
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CSUCSUR6CSH3.NHT0430XGAIO@fedora \
--to=erik.schilling@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=bartosz.golaszewski@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=manos.pitsidianakis@linaro.org \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.