On Fri, Apr 25, 2025 at 8:51 AM Nikolaos Chatzikonstantinou
<nchatz...@gmail.com> wrote:
>
> On Fri, Apr 25, 2025 at 6:33 AM Bruno Haible <br...@clisp.org> wrote:
> >
> > Nikolaos Chatzikonstantinou wrote:
> > > > One problem I see with Rust is that currently it does not integrate well
> > > > with the GNU Build system, in particular with VPATH builds (see [3] for
> > > > an example integration). Any improvements on that front would be 
> > > > welcome.
> > > >
> > > > [3] 
> > > > https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=tree;f=gettext-tools/examples/hello-rust;hb=HEAD
> > >
> > > What is the issue with VPATH builds?
> >
> > The issue is that 'cargo' mandates a certain directory layout of the
> > package, that is incompatible with VPATH builds.
>
> In the comments of configure.ac hello-rust claims to solve this issue
> though, is that not enough? I noticed that you're the author of it, so
> you must have something in mind.

Ah, here's a cheating solution:

mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR"
ln -s "$SOURCE_DIR" $(basename "$SOURCE_DIR")
printf "[workspace]\nmembers = [ \"$SOURCE_DIR\" ]\n" > "Cargo.toml"
cargo build

In the above, SOURCE_DIR is set to the root of the source directory
and BUILD_DIR should be the VPATH directory.

Works like a charm!

Regards,
Nikolaos Chatzikonstantinou

Reply via email to