meta-rust / cargo-bitbake

cargo extension that can generate BitBake recipes utilizing the classes from meta-rust
Apache License 2.0
83 stars 57 forks source link

Add DEPENDS to recipe? #31

Closed hpux735 closed 3 years ago

hpux735 commented 3 years ago

Hi!

Is there a way to note required DEPENDS arguments for the recipe? We have a project that requires that the system has openssl, and need to add it manually for each new version by adding:

DEPENDS += " openssl"

to the recipe.

Is there any way we can add into some file (maybe cargo.toml) that we need some extra arguments in the recipe file?

kraj commented 3 years ago

perhaps you can add it via BASE_DEFAULT_DEPS += "openssl" in local.conf

hpux735 commented 3 years ago

While that technically would work as a work-around, it's not really an idiomatic solution. Recipe files should be atomic in that they contain all the information they need to be built. I don't expect cargo to necessarily know what system packages are required to compile all the packages, so a reasonable model could be to add some kind of flag either in cargo.toml, or elsewhere, to add those.

kraj commented 3 years ago

Requiring a package to link to every recipe is not Normal except system packages like libc and tools so It is not clear to me and if there Is an advantage of having this tooled but it’s f there is another place which it is already encoded the reading and expressing it into depends is fine

hpux735 commented 3 years ago

I think I'm confused by what you're saying...

Are you saying that recipes aren't expected to list their build dependencies in the recipe? We might be talking past one another, if you're talking about rust dependencies then you don't often have to mess with it, because there are almost always native implementations. However, rarely, they depend on system libraries.

I think having those statements in the .inc file is probably the right answer, and I didn't notice that those includes are down there at the bottom of the file. That way it's consistent between version bb files.

kraj commented 3 years ago

The initial ask came out that there is a need to add one package to all or lot of generated recipes but per recipe depends are unique and they need to be set explicitly

so now question is if that information is already present in toml files somehow then it could be used to synthesize depends how if not then perhaps editing it by hand would be next best option

hpux735 commented 3 years ago

Oh, no it certainly wouldn't be all of them. I think, in this example, some dependency of reqwest depends on openssl. Unfortunately, I don't believe there is a way in cargo.toml to codify these dependencies. Swift, for example, does have a notion of this in their manifest format.

I've looked a bit in the cargo book, and I don't believe it's a tractable problem without resorting to some heroics.

srwalter commented 3 years ago

This is a good use of the foo.inc file that the generated recipe sources. You can add to DEPENDS from there, and that way your change is not lost when you regenerate the .bb file