Sunday, December 31, 2023

Re: lang/rust: roadmap for using SYSTEM_VERSION

On Sun, Dec 31, 2023 at 12:26:28PM +0100, Sebastien Marie wrote:
> Theo Buehler <tb@theobuehler.org> writes:
>
> > On Sat, Dec 30, 2023 at 07:32:18PM +0100, Sebastien Marie wrote:
> >
> > The outlined procedure makes sense to me and I like the approach, but I
> > am a bit worried that it makes it harder for people to write Rust ports
> > using the devel/cargo module, which is already tricky.
> >
> > Porters will now need to be able to grasp the separation of concerns to
> > understand the distinction between the devel/cargo and lang/rust
> > modules. They must now deal with two sets of variables: MODCARGO_* and
> > MODRUST_*. The latter only has two user-visible bits for now, so maybe
> > it's not that bad.
>
> initially, I tried to hide the "lang/rust" module under "devel/cargo"
> module (and have devel/cargo to sets MODULES+=lang/rust), but
> arch-defines.mk is included before MODULES processing, which means that
> the test ${MODULES:Mlang/rust} to check if lang/rust module is here or
> not isn't trigger as the module comes too late in the variable.

Wrong assumption. You assume you need to do a test in arch-defines.mk
but variables are lazy.

Just do

_MAYADD_RUST_VERSION ?=
_PKG_ARGS_VERSION += ${_MAYADD_RUST_VERSION}

in arch-defines.mk

and then, all you need to do is make sure that
_MAYADD_RUST_VERSION actually gets defined as
_MAYADD_RUST_VERSION = -V ${MODRUST_SYSTEM_VERSION}
in either the cargo or the rust module, whatever needs inclusion.

No comments:

Post a Comment