Re: Broken build with rust bindings (without --enable-tests)

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

 



On 19-04-23, 11:58, Miguel Ojeda wrote:
> On Wed, Apr 19, 2023 at 9:28 AM Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
> >
> > I earlier thought that if I am doing "cargo build" without "--tests"
> > or "--examples", then dev-dependencies are not built. I was wrong.
> 
> No, it will not get built. If you do `cargo build` on `libgpiod`, then it works.
> 
> The problem is in the `Makefile.am`s instead -- `make` is told to go
> into all of the crates and run `cargo build` for each:
> 
>     SUBDIRS = gpiosim-sys libgpiod libgpiod-sys

Ah, so this is what we need ? It works.

diff --git a/bindings/rust/Makefile.am b/bindings/rust/Makefile.am
index 1e01024b04ea..7903f828d87d 100644
--- a/bindings/rust/Makefile.am
+++ b/bindings/rust/Makefile.am
@@ -2,22 +2,5 @@
 # SPDX-FileCopyrightText: 2022 Linaro Ltd.
 # SPDX-FileCopyrightTest: 2022 Viresh Kumar <viresh.kumar@xxxxxxxxxx>

-command = cargo build --release --lib
-
-if WITH_TESTS
-command += --tests
-endif
-
-if WITH_EXAMPLES
-command += --examples
-endif
-
-all:
-       $(command)
-
-clean:
-       cargo clean
-
 EXTRA_DIST = Cargo.toml
-
 SUBDIRS = gpiosim-sys libgpiod libgpiod-sys
diff --git a/bindings/rust/libgpiod/Makefile.am b/bindings/rust/libgpiod/Makefile.am
index 6b55d0d509d1..38f2ebf37aff 100644
--- a/bindings/rust/libgpiod/Makefile.am
+++ b/bindings/rust/libgpiod/Makefile.am
@@ -2,5 +2,21 @@
 # SPDX-FileCopyrightText: 2022 Linaro Ltd.
 # SPDX-FileCopyrightTest: 2022 Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>

+command = cargo build --release --lib
+
+if WITH_TESTS
+command += --tests
+endif
+
+if WITH_EXAMPLES
+command += --examples
+endif
+
+all:
+       $(command)
+
+clean:
+       cargo clean
+
 EXTRA_DIST = Cargo.toml
 SUBDIRS = examples src tests

-------------------------8<-------------------------

I am also not sure if there is any significance of adding SUBDIRS for
gpiosim-sys and libgpiod, and adding Makefile.am in those directories.

-- 
viresh



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux