-
Notifications
You must be signed in to change notification settings - Fork 14
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
Expand cross compilation #124
Conversation
@@ -47,7 +81,7 @@ defmodule Bundlex do | |||
@doc """ | |||
Returns family of the platform obtained with `platform/0`. | |||
""" | |||
@spec family() :: :unix | :windows | |||
@spec family() :: :unix | :windows | :custom |
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.
Since we deprecate this function anyway, maybe let's keep it unchanged for better compatibility?
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.
we deprecate platform, not family
README.md
Outdated
@@ -172,6 +174,20 @@ As in the case of NIFs, CNodes compiled with Bundlex can be used like any other | |||
Similarly to CNodes Bundlex provides `Bundlex.Port` module for a little easier interacting with Ports. | |||
Please refer to the module's documentation to see how to use it. | |||
|
|||
### Cross-compilation | |||
|
|||
With proper setup Bundlex can support cross-compilation. When using Nerves the it should work out of the box. |
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.
With proper setup Bundlex can support cross-compilation. When using Nerves the it should work out of the box. | |
With proper setup, Bundlex can support cross-compilation. When using Nerves it should work out of the box. |
README.md
Outdated
|
||
With proper setup Bundlex can support cross-compilation. When using Nerves the it should work out of the box. | ||
|
||
Not relying in Nerves and using your own toolchain is also possible, although it wasn't tested. In this scenario the following environment variables need to be set, since they're not handled by Nerves: |
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.
Not relying in Nerves and using your own toolchain is also possible, although it wasn't tested. In this scenario the following environment variables need to be set, since they're not handled by Nerves: | |
Not relying on Nerves and using your own toolchain is also possible, although it wasn't tested. In this scenario, the following environment variables need to be set: |
lib/bundlex.ex
Outdated
%{ | ||
architecture: String.t() | :unknown, | ||
vendor: String.t() | :unknown, | ||
os: String.t() | :unknown, | ||
abi: String.t() | :unknown |
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.
I'd either use nil
or "unknown"
lib/bundlex/platform.ex
Outdated
:nerves | ||
|
||
:error -> | ||
Output.warn( |
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.
Output.warn( | |
Output.info( |
Co-authored-by: Mateusz Front <[email protected]>
.circleci/config.yml
Outdated
orbs: | ||
elixir: membraneframework/elixir@1 | ||
elixir: membraneframework/elixir@dev:94bbc77eef4293223822a2f7f31b136ac0833b1f |
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.
Why?
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.
I'm experimenting with using non-membrane images where they're not required membraneframework/membrane_core#701
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.
Remember to fix it before merging
@@ -147,7 +147,7 @@ defmodule Bundlex.Toolchain.Common.Unix.OSDeps do | |||
|
|||
# TODO: pass the platform via arguments | |||
# $ORIGIN must be escaped so that it's not treated as an ENV variable | |||
rpath_root = if Bundlex.platform() == :macosx, do: "@loader_path", else: "\\$ORIGIN" | |||
rpath_root = if Platform.get_target!() == :macosx, do: "@loader_path", else: "\\$ORIGIN" |
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.
What is the difference between Platform.get_target!()
and Bundlex.get_target!()
?
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.
Now deprecated Bundlex.get_platform/0
invoked Platform.get_target!/0
, it gives a bit different information than Bundlex.get_target/0
, we probably want to get rid of it eventually and rely just on the Bundlex.get_target/0
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 why won't you use Bundlex.get_target/0
instead of Platform.get_target!/0
?
07c6eb3
to
c73d0ec
Compare
d02d01e
to
2194cb8
Compare
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.
Let me know, when it will be ready for review
3cb3c68
to
70281f4
Compare
.circleci/config.yml
Outdated
orbs: | ||
elixir: membraneframework/elixir@1 | ||
elixir: membraneframework/elixir@dev:527ac9efd5554630ed90dbe24cd35b45dedcca9a |
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.
seems like a temporary value
70281f4
to
32971f4
Compare
30c17f8
to
ac0d94a
Compare
ac0d94a
to
153e777
Compare
closes membraneframework/membrane_core#721
Up until now there were two public functions that gave information about platform, Bundlex.get_target/0 and Bundlex.platform/0. Their difference was that get_target/0 gave more specific infomation, but later on, when adding crosscompilation support, only platform/0 detected the crosscompilation.
This PR changes behavior of Bundlex.get_target/0, so that when crosscompiling the
target
map will have it's fields set by environment variables used by Nerves.This PR also allows for crosscompilation outside of Nerves. The only thing nerves does is set env variables to correct flags and paths, which can be also done by the user that wants to use their custom toolchain.