-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Add Cargo buildsystem #564
base: main
Are you sure you want to change the base?
Conversation
I'm also a bit stuck on how to add the new test cases to the script / entry point that runs the test suite - could someone advise where this is done, so that they can be run in the build? |
The entry point is https://github.com/flatpak/flatpak-builder/blob/main/tests/test-builder.sh They are just simple shell scripts. |
So we need to make this have value beyond what |
@TingPing agreed - that was always the intention. I just wanted to get the test harness set up around it first to TDD my changes. Would you still recommend |
I have no opinion at all of TOML libraries. On Fedora these are packaged:
|
I think I'd lean towards tomlc99 as a Meson subproject. |
Another thought about parsing the Cargo / Cargo.lock files.... If we take the Toml parser route with I am therefore thinking that either of the following strategies would be better than reimplementing the Cargo dependency fetch logic ourselves:
Thoughts? |
@@ -1585,6 +1587,8 @@ builder_module_build_helper (BuilderModule *self, | |||
simple = TRUE; | |||
else if (!strcmp (self->buildsystem, "qmake")) | |||
qmake = TRUE; | |||
else if (!strcmp (self->buildsystem, "cargo")) | |||
cargo = TRUE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will need to be documented. See data/flatpak-manifest.schema.json
and doc/flatpak-manifest.xml
@@ -1741,6 +1761,10 @@ builder_module_build_helper (BuilderModule *self, | |||
configure_cmd = "meson"; | |||
configure_final_arg = g_strdup (".."); | |||
} | |||
else if (cargo) | |||
{ | |||
// nothing to do - Cargo does not have a configure step |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so how do you select features?
or building a specific binary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Just to be more specific about this, do you mean switches like:
- Profile:
cargo build --release / --debug
- Target:
cargo build --target <architecture>
- Cargo features:
cargo build --features <feature>,<feature>,...
Also one key thing here is that |
@hfiguiere yes, also a good point. I suppose this prompts the question of how |
One possibility is that the buildsystem API could provide a feature where you can declare the There would then be a couple of options for how to resolve those sdk-extensions when needed. A 'soft' resolution option would be to use the extension if it's installed, but if it's not, "The buildsystem depends on the following sdk-extensions [ foo, bar, baz ], but these were not present. Please declare them in your Flatpak manifest." Meanwhile a more automated option would be for |
The problem I see with this is that you can choose multiple different rust SDK extensions (stable, nightly etc.): https://github.com/flathub/org.freedesktop.Sdk.Extension.rust-stable To add insult to injury, those SDK extensions put cargo in different paths, and they have to be appended to PATH manually in the manifest. |
Adds a Flatpak buildsystem for Cargo.
Implements #15
Note: I am opening this PR at an early stage to gather initial feedback and requirements for what needs to be done. I'm not familiar with the internals of Flatpak, so will gratefully accept any help.