[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH 01/12] Rust bindings: Add Rust bindings



On Tue, Jul 02, 2019 at 10:14:19PM +0900, Hiroyuki Katsura wrote:
From: Hiroyuki_Katsura <hiroyuki katsura 0513 gmail com>

---
Makefile.am             |  4 ++++
configure.ac            |  3 +++
generator/Makefile.am   |  3 +++
generator/bindtests.ml  |  3 +++
generator/bindtests.mli |  1 +
generator/main.ml       |  5 +++++
generator/rust.ml       | 34 ++++++++++++++++++++++++++++++++++
generator/rust.mli      | 19 +++++++++++++++++++
m4/guestfs-rust.m4      | 30 ++++++++++++++++++++++++++++++
rust/Cargo.toml         |  6 ++++++
rust/Makefile.am        | 29 +++++++++++++++++++++++++++++
rust/src/.gitkeep       |  0
rust/tests/.gitkeep     |  0
13 files changed, 137 insertions(+)
create mode 100644 generator/rust.ml
create mode 100644 generator/rust.mli
create mode 100644 m4/guestfs-rust.m4
create mode 100644 rust/Cargo.toml
create mode 100644 rust/Makefile.am
create mode 100644 rust/src/.gitkeep
create mode 100644 rust/tests/.gitkeep


[...]

diff --git a/generator/rust.mli b/generator/rust.mli
new file mode 100644
index 000000000..4fef55d4e
--- /dev/null
+++ b/generator/rust.mli
@@ -0,0 +1,19 @@
+(* libguestfs
+ * Copyright (C) 2009-2019 Red Hat Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*)
+
+val generate_rust: unit -> unit
\ No newline at end of file

I'm not sure what editor you use, but either setting it up so that there is a
'\n'‚ÄČin the end of the file (at least by default unless you remove it or
something) would probably be favourable.

diff --git a/m4/guestfs-rust.m4 b/m4/guestfs-rust.m4
new file mode 100644
index 000000000..f46ce960b
--- /dev/null
+++ b/m4/guestfs-rust.m4
@@ -0,0 +1,30 @@
+# libguestfs
+# Copyright (C) 2009-2019 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+dnl Rust
+AC_ARG_ENABLE([rust],
+    AS_HELP_STRING([--disable-rust], [disable Rust language bindings]),
+        [],
+        [enable_rust=yes])
+AS_IF([test "x$enable_rust" != "xno"],[
+    AC_CHECK_PROG([RUSTC],[rustc],[rustc],[no])
+    AC_CHECK_PROG([CARGO],[cargo],[cargo],[no])
+],[
+    RUSTC=no
+    CARGO=no
+    ])
+AM_CONDITIONAL([HAVE_RUST],[test "x$RUSTC" != "xno" && test "x$CARGO" != "xno"])

So even if someone explicitly specifies --enable-rust without having the tools,
they will not get the bindings built, but they will also not get an error nor
confirmation in the configure output, so it is really hard to figure out what is
happening.  I, personally, prefer the usual `--enable-rust=yes|check|no`
semantics.  Of course this can be fixed later, do not let this rust
bindings-unrelated review stop others from reviewing the important parts ;)

[...]

diff --git a/rust/Makefile.am b/rust/Makefile.am
new file mode 100644
index 000000000..e8bf27894
--- /dev/null
+++ b/rust/Makefile.am
@@ -0,0 +1,29 @@
+# libguestfs golang bindings
+# Copyright (C) 2019 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+include $(top_srcdir)/subdir-rules.mk
+
+generator_built = \
+	src/lib.rs
+
+EXTRA_DIST = \
+	$(generator_built)
+
+if HAVE_RUST
+
+endif


Maybe something is missing here?

Martin

Attachment: signature.asc
Description: PGP signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]