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

Constants for host and target triples #13156

Closed
HertzDevil opened this issue Mar 5, 2023 · 0 comments · Fixed by #13823
Closed

Constants for host and target triples #13156

HertzDevil opened this issue Mar 5, 2023 · 0 comments · Fixed by #13823

Comments

@HertzDevil
Copy link
Contributor

HertzDevil commented Mar 5, 2023

Crystal::DESCRIPTION can be mostly recreated from the other constants under Crystal:

formatted_sha = "[#{Crystal::BUILD_COMMIT}] " if Crystal::BUILD_COMMIT
<<-EOS
Crystal #{Crystal::VERSION} #{formatted_sha}(#{Crystal::BUILD_DATE})

LLVM: #{Crystal::LLVM_VERSION}
Default target: x86_64-pc-linux-gnu
EOS

This is almost a 1:1 replica of the internal Crystal::Config.description, except that the default LLVM target triple must still be hardcoded. It probably doesn't hurt to expose it:

Crystal::HOST_TRIPLE   # => "x86_64-pc-linux-gnu"
Crystal::TARGET_TRIPLE # => "x86_64-pc-linux-gnu"

Then Crystal::HOST_TRIPLE can be used in the above interpolation. TARGET_TRIPLE would be equal to whatever is passed to the --target command-line option, possibly normalized, and defaults to HOST_TRIPLE if not given.

Slightly related: #11694

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant