Skip to content
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

Add support for variants targets #61

Merged
merged 6 commits into from
Sep 18, 2023
Merged

Add support for variants targets #61

merged 6 commits into from
Sep 18, 2023

Conversation

philss
Copy link
Owner

@philss philss commented Sep 15, 2023

This feature introduces variants, which are alternative versions that can be configured in compile time to
load a specific precompiled NIF depending on the result of callback functions.

This enables developers to set different versions for the same target, depending on which versions of dependencies the target machine has.
Remember that the callback will always run at compile time, in the machine that is doing the compilation.

This may be enough to fix #59 and elixir-explorer/explorer#590

TODOs

This is needed in order to load the correct variants and building the
list of artifacts for download.
This makes the mix task know that needs to download the variants as
well.
philss added a commit to philss/rustler-precompiled-action that referenced this pull request Sep 15, 2023
@philss philss marked this pull request as ready for review September 18, 2023 18:39
@philss
Copy link
Owner Author

philss commented Sep 18, 2023

@josevalim would you mind to take a look? :)

Comment on lines 315 to 323
variants =
maybe_variants_tar_gz_urls(
metadata[:variants],
base_url,
target_triple,
metadata[:lib_name]
)

[tar_gz_file_url(base_url, file_name) | variants]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth encapsulating inside a tar_gz_urls function since it is defined both here and above.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I moved to a private function :)

Copy link
Contributor

@josevalim josevalim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two minor nits and ship it!

@philss philss merged commit 3044594 into main Sep 18, 2023
2 checks passed
philss added a commit to philss/rustler-precompiled-action that referenced this pull request Sep 22, 2023
* Support building with a variant name

This is part of philss/rustler_precompiled#61

* Add the "features" option and improve logging

* Change the `features` input to `cargo-args`

The idea is to have more flexibility, enabling more arguments to be
passed.

* Add a flag to enable debug mode compilation

* Fix term and docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unknown linux gets a failed to load NIF library error due to GLIBC version
2 participants