Skip to content

Commit

Permalink
Add support for cross-compilation
Browse files Browse the repository at this point in the history
This adds proper support for cross-compiling Inko programs from one
target to another.

The Rust runtime is compiled ahead of time as part of the release
process. These runtimes are managed using the `inko runtime` command.
For musl we also include libunwind.a as this is needed to resolve linker
symbol errors. The library is taken from the rustup musl toolchain to
ensure it's the same version as Rust expects. This also saves us having
to compile it in the first place.

By default the compiler tries to detect what compiler/linker driver to
use based on the target you're compiling for. For example, when
targeting musl, the linker tries to use musl-gcc or musl-clang if it's
installed. A custom linker can be specified using the --linker option.
We also support linking using Zig, which makes it _much_ easier to
target macOS and potentially other targets, provided you have Zig
installed of course.

This commit also contains some dependency version updates and the
necessary changes, in an effort to reduce the dependency tree size a bit
after the addition of the "ureq" crate.

Finally, this commit replaces the use of blake2 with blake3. The blake3
crate has a simple API and is supposed to perform much better than
blake2. Also, the blake2 crate relies on a pile of generics and
dependencies such that rust-analyzer isn't able to provide meaningful
help (i.e showing types on hover doesn't work), while this works fine
with blake3.

This fixes #524.

Changelog: added
  • Loading branch information
yorickpeterse committed Jan 13, 2024
1 parent a69b423 commit ee4d767
Show file tree
Hide file tree
Showing 38 changed files with 1,529 additions and 498 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,26 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

runtimes:
runs-on: ubuntu-latest
needs:
- lints
- linux
- mac
- freebsd
env:
AWS_REGION: eu-west-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- uses: actions/checkout@v4
- name: Installing dependencies
run: sudo ./scripts/deps.sh ubuntu:latest
- name: Installing Rust
run: ./scripts/rust.sh 1.70
- name: Generating runtimes
run: make runtimes

docs:
runs-on: ubuntu-latest
needs:
Expand Down
Loading

0 comments on commit ee4d767

Please sign in to comment.