From: Viresh Kumar <viresh.kumar@linaro.org>
To: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Kent Gibson <warthog618@gmail.com>
Cc: "Viresh Kumar" <viresh.kumar@linaro.org>,
"Vincent Guittot" <vincent.guittot@linaro.org>,
linux-gpio@vger.kernel.org,
"Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>,
"Wedson Almeida Filho" <wedsonaf@gmail.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
stratos-dev@op-lists.linaro.org,
"Gerard Ryan" <g.m0n3y.2503@gmail.com>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
y86-dev <y86-dev@protonmail.com>
Subject: [libgpiod][PATCH V9 8/8] bindings: rust: Integrate building of bindings with make
Date: Mon, 7 Nov 2022 15:27:34 +0530 [thread overview]
Message-ID: <d914ccd91e1abb856779ace7a43d15bc510545ad.1667815011.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <cover.1667815011.git.viresh.kumar@linaro.org>
Lets make build rust bindings as well.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
README | 8 +++++---
TODO | 8 --------
bindings/Makefile.am | 6 ++++++
bindings/rust/Makefile.am | 18 ++++++++++++++++++
configure.ac | 16 ++++++++++++++++
5 files changed, 45 insertions(+), 11 deletions(-)
create mode 100644 bindings/rust/Makefile.am
diff --git a/README b/README
index 814a0f161fd2..68b5d69f9b66 100644
--- a/README
+++ b/README
@@ -119,9 +119,9 @@ TOOLS
BINDINGS
--------
-High-level, object-oriented bindings for C++ and python3 are provided. They
-can be enabled by passing --enable-bindings-cxx and --enable-bindings-python
-arguments respectively to configure.
+High-level, object-oriented bindings for C++, python3 and Rust are provided.
+They can be enabled by passing --enable-bindings-cxx, --enable-bindings-python
+and --enable-bindings-rust arguments respectively to configure.
C++ bindings require C++11 support and autoconf-archive collection if building
from git.
@@ -132,6 +132,8 @@ the PYTHON_CPPFLAGS and PYTHON_LIBS variables in order to point the build
system to the correct locations. During native builds, the configure script
can auto-detect the location of the development files.
+Rust bindings require cargo support.
+
TESTING
-------
diff --git a/TODO b/TODO
index 8bb4d8f3ad56..cf4fd7b4a962 100644
--- a/TODO
+++ b/TODO
@@ -28,14 +28,6 @@ and is partially functional.
----------
-* implement rust bindings
-
-With Rust gaining popularity as a low-level system's language and the
-possibility of it making its way into the linux kernel, it's probably time to
-provide Rust bindings to libgpiod as part of the project.
-
-----------
-
* implement a simple daemon for controlling GPIOs in C together with a client
program
diff --git a/bindings/Makefile.am b/bindings/Makefile.am
index 8f8c762f254f..004ae23dbc58 100644
--- a/bindings/Makefile.am
+++ b/bindings/Makefile.am
@@ -14,3 +14,9 @@ if WITH_BINDINGS_PYTHON
SUBDIRS += python
endif
+
+if WITH_BINDINGS_RUST
+
+SUBDIRS += rust
+
+endif
diff --git a/bindings/rust/Makefile.am b/bindings/rust/Makefile.am
new file mode 100644
index 000000000000..79a52bc691ae
--- /dev/null
+++ b/bindings/rust/Makefile.am
@@ -0,0 +1,18 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# SPDX-FileCopyrightText: 2022 Viresh Kumar <viresh.kumar@linaro.org>
+
+command = cargo build --release --lib
+
+if WITH_TESTS
+command += --tests
+endif
+
+if WITH_EXAMPLES
+command += --examples
+endif
+
+all:
+ $(command)
+
+clean:
+ cargo clean
diff --git a/configure.ac b/configure.ac
index 048b2ac7af8f..4a2cdb68b8b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -212,6 +212,21 @@ then
[AC_SUBST(PYTHON_LIBS, [`$PYTHON-config --libs`])])
fi
+AC_ARG_ENABLE([bindings-rust],
+ [AS_HELP_STRING([--enable-bindings-rust],[enable rust bindings [default=no]])],
+ [if test "x$enableval" = xyes; then with_bindings_rust=true; fi],
+ [with_bindings_rust=false])
+AM_CONDITIONAL([WITH_BINDINGS_RUST], [test "x$with_bindings_rust" = xtrue])
+
+if test "x$with_bindings_rust" = xtrue
+then
+ AC_CHECK_PROG([has_cargo], [cargo], [true], [false])
+ if test "x$has_cargo" = xfalse
+ then
+ AC_MSG_ERROR([cargo not found - needed for rust bindings])
+ fi
+fi
+
AC_CHECK_PROG([has_doxygen], [doxygen], [true], [false])
AM_CONDITIONAL([HAS_DOXYGEN], [test "x$has_doxygen" = xtrue])
if test "x$has_doxygen" = xfalse
@@ -249,6 +264,7 @@ AC_CONFIG_FILES([Makefile
bindings/python/examples/Makefile
bindings/python/tests/Makefile
bindings/python/tests/gpiosim/Makefile
+ bindings/rust/Makefile
man/Makefile])
AC_OUTPUT
--
2.31.1.272.g89b43f80a514
next prev parent reply other threads:[~2022-11-07 9:58 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-07 9:57 [libgpiod][PATCH V9 0/8] libgpiod: Add Rust bindings Viresh Kumar
2022-11-07 9:57 ` [libgpiod][PATCH V9 1/8] bindings: rust: Add libgpiod-sys rust crate Viresh Kumar
2022-11-09 9:07 ` Bartosz Golaszewski
2022-11-14 10:04 ` Viresh Kumar
2022-11-14 10:30 ` Bartosz Golaszewski
2022-11-07 9:57 ` [libgpiod][PATCH V9 2/8] bindings: rust: Add pre generated bindings for libgpiod-sys Viresh Kumar
2022-11-07 9:57 ` [libgpiod][PATCH V9 3/8] bindings: rust: Add gpiosim crate Viresh Kumar
2022-11-07 9:57 ` [libgpiod][PATCH V9 4/8] bindings: rust: Add pre generated bindings for gpiosim Viresh Kumar
2022-11-07 9:57 ` [libgpiod][PATCH V9 5/8] bindings: rust: Add libgpiod crate Viresh Kumar
2022-11-07 9:57 ` [libgpiod][PATCH V9 6/8] bindings: rust: Add examples to " Viresh Kumar
2022-11-10 18:26 ` Bartosz Golaszewski
2022-11-14 10:03 ` Viresh Kumar
2022-11-14 10:29 ` Bartosz Golaszewski
2022-11-14 10:42 ` Viresh Kumar
2022-11-07 9:57 ` [libgpiod][PATCH V9 7/8] bindings: rust: Add tests for " Viresh Kumar
2022-11-09 9:30 ` Bartosz Golaszewski
2022-11-09 9:50 ` Kent Gibson
2022-11-09 10:36 ` Kent Gibson
2022-11-09 9:54 ` Linus Walleij
2022-11-09 10:12 ` Björn Roy Baron
2022-11-07 9:57 ` Viresh Kumar [this message]
2022-11-14 21:49 ` [libgpiod][PATCH V9 0/8] libgpiod: Add Rust bindings Bartosz Golaszewski
2022-11-16 1:12 ` Kent Gibson
2022-11-18 16:44 ` Gary Guo
2022-11-18 17:24 ` Kent Gibson
2022-11-16 10:29 ` Bartosz Golaszewski
2022-11-17 7:31 ` Viresh Kumar
2022-11-17 9:06 ` Bartosz Golaszewski
2022-11-17 9:56 ` Viresh Kumar
2022-11-17 10:18 ` Bartosz Golaszewski
2022-11-17 10:40 ` Viresh Kumar
2022-11-17 10:48 ` Bartosz Golaszewski
2022-11-17 10:55 ` Viresh Kumar
2022-11-17 11:05 ` Bartosz Golaszewski
2022-11-17 11:15 ` Viresh Kumar
2022-11-17 12:32 ` Bartosz Golaszewski
2022-11-17 10:51 ` Miguel Ojeda
2022-11-17 11:04 ` Viresh Kumar
2022-11-17 11:07 ` Miguel Ojeda
2022-11-17 11:15 ` Bartosz Golaszewski
2022-11-17 11:25 ` Viresh Kumar
2022-11-17 12:18 ` Bartosz Golaszewski
2022-11-18 9:35 ` Viresh Kumar
2022-11-18 9:38 ` Bartosz Golaszewski
2022-11-18 9:41 ` Viresh Kumar
2022-11-18 9:42 ` Bartosz Golaszewski
2022-11-17 13:05 ` Kent Gibson
2022-11-17 8:12 ` Linus Walleij
2022-11-17 8:37 ` Bartosz Golaszewski
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=d914ccd91e1abb856779ace7a43d15bc510545ad.1667815011.git.viresh.kumar@linaro.org \
--to=viresh.kumar@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=alex.gaynor@gmail.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=brgl@bgdev.pl \
--cc=g.m0n3y.2503@gmail.com \
--cc=gary@garyguo.net \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=stratos-dev@op-lists.linaro.org \
--cc=vincent.guittot@linaro.org \
--cc=warthog618@gmail.com \
--cc=wedsonaf@gmail.com \
--cc=y86-dev@protonmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).