Skip to content

Support recompilation of NIFs based on build_dot_zig#199

Open
joelpaulkoch wants to merge 3 commits into
burrito-elixir:mainfrom
joelpaulkoch:build_dot_zig
Open

Support recompilation of NIFs based on build_dot_zig#199
joelpaulkoch wants to merge 3 commits into
burrito-elixir:mainfrom
joelpaulkoch:build_dot_zig

Conversation

@joelpaulkoch

Copy link
Copy Markdown

Hey, first of all: thank you for burrito, it's fun to write cli applications in Elixir.

It's probably very niche but I've been working on a NIF that's compiled with build_dot_zig.
I believe zigler is more popular but it's also more complex and in my case I just want to write the NIF as a zig package.

This PR integrates build_dot_zig into the recompilation of burrito.

Here is a small demo app using burrito with a demo dependency which is based on build_dot_zig.

@joelpaulkoch joelpaulkoch left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'm generally wondering whether there is a way to recompile the dependencies using mix instead of calling make or zig build, then we could reuse a lot of the logic of the compiler libraries.
I didn't get a chance to look at how nerves handles cross compilation.

Comment on lines 45 to 48
# - Check if they contain :elixir_make in their `:compilers`
#
# We'll probably need to expand how we detect NIFs, but :elixir_make is a popular way to compile NIFs
# so it's a good place to start...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This comment should be updated.


erts_env = erts_make_env(erts_path)

build_mode = "ReleaseSafe"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I think it would be great to at least check whether it's a debug build and then go for Debug mode. Or otherwise allow overriding the build mode somehow.

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.

1 participant